Skip to content

Sync: opt-in alliance stream with the own alliance's league and level - #402

Open
blevouschurverantunt wants to merge 1 commit into
STFC-Mod:devfrom
blevouschurverantunt:feature/sync-alliance-league
Open

blevouschurverantunt wants to merge 1 commit into
STFC-Mod:devfrom
blevouschurverantunt:feature/sync-alliance-league

Conversation

@blevouschurverantunt

Copy link
Copy Markdown
Contributor

What changed and why

Adds an opt-in sync option, alliance, that sends one alliance_league record with the league and level of the player's own alliance. It is off by default, and only targets that enable it receive the record.

[sync.targets.example]
alliance = true

Record shape, with invented values:

{"type":"alliance_league","league":2,"level":30}
  • league: the alliance's league number.
  • level: the alliance's level.
  • Nothing else is sent: no alliance id, name, tag, slogan, announcement or member count.

Source and checks:

  • The data is the game server's AllianceDetails group (225), decoded as an AllianceProfile. Only league and level are read from it.
  • That group can describe an alliance other than the player's own. It is used only when its alliance id equals the alliance id listed in the player's own profile record, which is read from the UserProfiles response and remembered for the session.
  • Until the own profile record has been read in the session, nothing is sent.
  • When the own profile lists no alliance, nothing is sent. The mod has no verified signal for "no alliance" and does not guess.
  • The record has one fixed key, so the framework sends it again only when league or level changes.
  • Nothing resets the record, so after the player leaves an alliance the last league and level stay for the rest of the session.
  • Reading the own profile does not depend on the profile option.

Files: src/mod/config.h, src/mod/sync/{records.cc,state.cc,sync.h}, tests/sync_logic.cc, a row in docs/FEATURES.md and the English settings example.

Validation

  • Run locally on Windows with Zig 0.16: zig build mods build-tests -Dtarget=x86_64-windows-msvc, zig build test-sync test-mod test-codegen, the full ReleaseFast DLL build, and zig build fmt.
  • New test in tests/sync_logic.cc, alliance league, checks:
    • nothing is sent before the own alliance is known;
    • a group for another alliance sends nothing;
    • the own alliance sends exactly type, league and level, with name, tag and slogan in the input left out;
    • unchanged values are sent once, and a changed league is sent again;
    • another alliance does not overwrite the own record;
    • a new session forgets the alliance the previous one learned;
    • an own profile with no alliance sends nothing.
  • In game (Windows, ReleaseFast), against a private sync endpoint, one alliance_league record arrived at login with the player's own alliance's league and level. Records for other alliances are not sent.
  • Limits of that test:

Settings and platforms

  • New option alliance, off by default, under [sync] and per target. Nothing is sent unless a target opts in.
  • Volume: one record at login once the own profile has been read, then one more only when league or level changes.
  • The data is read-only and the client already receives it. There is no new hook, server call or game-side action.

🤖 Generated with Claude Code

New sync option `alliance` (default false) and event type
`alliance_league`: {"type":"alliance_league","league":<n>,"level":<n>},
the league and level of the player's own alliance and nothing else (no
alliance id, name, tag, slogan, announcement or member count).

Source: the game server's AllianceDetails group (225), which decodes as
an AllianceProfile and arrives about every 30 seconds. It is one record
with a fixed key, so the framework sends it only when league or level
changes.

The group may describe an alliance other than the player's own, so it
is used only when its alliance id equals the alliance id listed in the
player's own profile record, read from the UserProfiles response. Until
that record has been read in the session nothing is sent. When the own
profile lists no alliance, nothing is sent either; the mod has no
verified signal for "no alliance" and does not guess.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant