Repository navigation
Sync: opt-in store_bundles stream for the refining and alliance games stores - #401
Open
blevouschurverantunt wants to merge 2 commits into
Open
blevouschurverantunt wants to merge 2 commits into
blevouschurverantunt wants to merge 2 commits into
Conversation
Several declared field types did not match what the game sends, so the values decoded wrongly or as 0. Corrected, field by field: - OfferDetails.validCount: int32 -> sint32 (zigzag) - OfferDetails.sameRemainingCount: int32 -> sint32 (zigzag) - Bundle.priority: uint32 -> fixed32 - Bundle.sortOrder: uint32 -> fixed32 - Cost.quantity: uint32 -> fixed32 - OrderItem.bundleId: uint32 -> fixed32 - OrderItem.bundleVersion: uint32 -> fixed32 - Resource.amountUlong: uint64 -> fixed64 - UserProfile.level: int32 -> fixed32 - UserProfile.levelLastAwarded: int32 -> fixed32 Visible effect: the store_offer event's valid_count and same_remaining_count were read doubled (5 available arrived as 10) and "unlimited" (-1) arrived as 1. They now carry the true values; the keys are unchanged. The fixed32/fixed64 fields previously read 0. Store offer prices fall back to Resource.amountUlong when Resource.amount is 0, so an amount carried only in amountUlong now decodes instead of reading 0. In the real store snapshots checked, every resource with amountUlong set also had an equal amount, so prices there are unchanged; faction offers were not among them. The own-profile comment in records.cc and sync.h is updated: the record's level is a fixed32 field and read 0 only because of the wrong type. The in-memory level is still what the profile stream uses. Tests decode hand-encoded wire bytes for each corrected field except OrderItem.bundleId and bundleVersion, which no generated code reads yet, and check the store_offer counts, including -1. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
New sync option `store_bundles` (default false) and event type
`store_bundle`, read from the same platform Bundles response as
`store_offers`, which is unchanged.
One event per category in a fixed list (refining_materials,
refining_ship_parts, alliance_games), carrying the whole snapshot of that
category's bundles sorted by bundle id. Each bundle has: bid, sort,
cost[{qty, res[{rid, amount}]}], req[{type, id, amount}],
dynamic[[{id, kind, qty}]], static[{id, kind, qty}], uses_left,
same_left, valid_from, valid_until and cooldown. Every key is always
present, cost and dynamic keep wire order, uses_left and same_left are
the decoded counts (-1 is unlimited), and valid_from/valid_until are
epoch seconds or null when the game sends no time or 0. No player,
account or alliance identifier is included.
The platform response is read when either store_offers or store_bundles
is enabled by any target; each processor runs only for its own option and
each target receives only the streams it enables. Unchanged snapshots are
not resent, and a response without a category keeps that category's last
record.
Docs: FEATURES.md row and the English example settings.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Builds on #400 (protobuf wire-type fixes), which this needs for
Cost.quantity,Bundle.sortOrderand the offer counts. Until that merges, the diff shows both commits; only the second one, 5cd3873, belongs to this PR.Adds an opt-in sync option,
store_bundles, that sends onestore_bundlerecord per store category: the whole current list of bundles in that category. It is off by default, and only targets that enable it receive the records.The categories are a fixed list:
refining_materials,refining_ship_partsandalliance_games. Bundles in any other category are ignored. The data comes from the same platform bundles response thatstore_offersalready reads.store_offersis unchanged.Record shape, with invented values:
{"type":"store_bundle","category":"refining_materials","bundles":[ {"bid":30,"sort":7, "cost":[{"qty":1,"res":[{"rid":4000000000,"amount":1000}]}, {"qty":2,"res":[{"rid":4000000000,"amount":2000}]}], "req":[], "dynamic":[[{"id":21,"kind":"resource","qty":3},{"id":23,"kind":"resource","qty":9}]], "static":[{"id":22,"kind":"resource","qty":5}], "uses_left":-1,"same_left":-1, "valid_from":1700000000,"valid_until":null,"cooldown":false}]}category: one of the three names above.bundles: every bundle in the category, sorted by bundle id.bid,sort: bundle id and sort order.cost: price options in the order the game sends them. Each hasqty(how many items that price buys) andres, a list of{rid, amount}.req: requirements, each{type, id, amount}.dynamic: lists of{id, kind, qty}, in wire order.static: one list of{id, kind, qty}.uses_left,same_left: the decoded remaining counts. -1 is unlimited.valid_from,valid_until: epoch seconds, ornullwhen the game sends no time or 0.cooldown: whether a cooldown is configured.[]. Numeric ids are sent as numbers and other ids as strings. No player, account or alliance identifier is included.How it behaves:
store_offersorstore_bundleson, and a target receives only the streams it enables.Files:
src/mod/config.h,src/mod/sync/{records.cc,state.cc,sync.cc,sync.h},tests/sync_logic.cc, a row indocs/FEATURES.mdand the English settings example.Validation
zig build mods build-tests -Dtarget=x86_64-windows-msvc,zig build test-sync test-mod test-codegen, the fullReleaseFastDLL build, andzig build fmt.tests/sync_logic.cc,store bundles, checks:null;alliance_gamesbundle;store_offeroutput is unchanged;store_bundlesreceives nothing from the stream.ReleaseFast), against a private sync endpoint,store_bundlerecords arrived for all three categories. The two refining categories arrive at login.alliance_gamesarrives when the player opens that store in game. Static item quantities can be -1 (a game sentinel seen on converter bundles); the mod passes it through unchanged.Settings and platforms
store_bundles, off by default, under[sync]and per target. Nothing is sent unless a target opts in.alliance_gamesrecord when the store is opened.store_offers.qtyof -1 on a static item is the game's own value, passed through unchanged.🤖 Generated with Claude Code