Skip to content

Sync game data constants with client 0.41 (Overcharge bit, SEGMENT4, new enum members) #216

Closed

Description

@MarTrepodi

Component

Helpers

Problem or Use Case

Game client 0.41.2115745 changed the game data constants that the helpers mirror. Once a Comlink release is built on that schema, the library will be out of step with it:

  • New game data bit. GameDataItemsEnum gains Overcharge = 4503599627370496 (252). It selects three new collections: overchargeDefinition, overchargeStatGroup and overchargePointMissionLookup. DataItems has no member for it, so these collections can only be requested with DataItems.ALL or a raw integer.
  • SEGMENT4 moves. The game folds the new bit into segment 4: Segment4 goes from 3377424842620928 to 7881024469991424. DataItems.SEGMENT4 and Constants.Segment4 would then return less than request_segment=4 does.
  • New enum members missing from the snapshot tables:
    • UnitStat 62 UNITSTATCRITICALDAMAGENEGATE, shown in game as "Critical Defense" (UNIT_STAT_CRITICAL_DAMAGE_NEGATE in the localization bundle). Not in STATS or UNIT_STAT_ENUMS_MAP.
    • ItemType 36 OVERCHARGE_POINT. Not in ITEM_TYPES.
    • CurrencyType 51 ARENA_CURRENCY, "Arena Tokens" (SHARED_CURRENCY_ARENA). Not in CURRENCY_TYPES or CURRENCY_NAMES, so ItemNames can't name it without the live get_enums() table.

Why this has to wait. The current public Comlink release (spec 0.40.5) is still on the 0.40 schema. It validates items as an integer string from 1 to 4503599627370495 (252 − 1), or -1. Checked against it on 2026-11-04:

Request Result on Comlink 0.40.5
items=4503599627370496 (Overcharge) HTTP 400
items=7881024469991424 (new SEGMENT4) HTTP 400
items=3377424842620928 (current SEGMENT4) 200, same collections as request_segment=4
items=-1 (DataItems.ALL) 200

Shipping the new SEGMENT4 now would turn every DataItems.SEGMENT4 request into an HTTP 400 for users on that release.

Proposed Solution

When a Comlink release built on the 0.41 schema is published:

Library changes (all in src/swgoh_comlink/helpers/)

  • _data_items.py: add OVERCHARGE = 4503599627370496, plus the aliases OVERCHARGE_DEFINITION, OVERCHARGE_STAT_GROUP and OVERCHARGE_POINT_MISSION_LOOKUP (same bit). Set SEGMENT4 = 7881024469991424. Raise the documented items range to 253 − 1. On Python 3.15+, int(DataItems.ALL) becomes 253 − 1; the wire value stays -1.
  • _constants.py: Segment4 = 7881024469991424, and map the legacy name "Overcharge" to OVERCHARGE so Constants.get("Overcharge") resolves.
  • _stat_data.py: add stat "62" (nameKey UNIT_STAT_CRITICAL_DAMAGE_NEGATE, descKey UNIT_STAT_DESCRIPTION_CRITICAL_DAMAGE_NEGATE, enum UNITSTATCRITICALDAMAGENEGATE, tableKey CRITICAL_DAMAGE_NEGATE). Add 36: "OVERCHARGE_POINT" to ITEM_TYPES, 51: "ARENA_CURRENCY" to CURRENCY_TYPES, and "ARENA_CURRENCY": "Arena Tokens" to CURRENCY_NAMES. Update the snapshot docstrings to name the new schema version.

Tests and docs

  • Refresh tests/resources/enums-item-currency.json from the new release's get_enums(), so test_snapshots_match_recorded_get_enums checks the new members.
  • Update the Constants tests: segment values, the Overcharge legacy name, the overcharge aliases sharing one bit, and the stat 62 entry.
  • docs/migration.md: the new SEGMENT4 value, the 253 − 1 range, and a note on the Overcharge bit.

Verify against the new public release before merging

  1. /openapi.json reports a version newer than 0.40.5, and get_enums()["GameDataItemsEnum"] lists Overcharge and Segment4 = 7881024469991424.
  2. get_game_data(items=DataItems.OVERCHARGE) returns 200 with the three overcharge* keys.
  3. get_game_data(items=DataItems.SEGMENT4) returns the same populated collections as request_segment=4.
  4. Read the new items bound from the 400 message for items=9007199254740992 (253). If the release still rejects out-of-range values, put the HTTP 400 sentence back in the DataItems docstring with the new bound.
  5. get_enums() lists UnitStat 62, ItemType 36 and CurrencyType 51 under the names above.
  6. Run examples/Sync/get_game_data.py and examples/Async/get_game_data.py against it.
  7. uv run pytest, uv run ruff check src tests and uv run ty check all pass.

Out of scope here: helpers over the new Era Arena and Overcharge data (eraDefinition.eraArena, eraDefinition.overchargeConfig, the overcharge* collections). On game data 0.40.6 these are null or empty, so there is nothing to build or test against yet.

Alternatives Considered

  • Ship the enum table additions now and hold only the DataItems change. The stat, item type and currency entries are harmless on 0.40.5. But the snapshot tables are meant to match one recorded get_enums() response, and no public release returns these members yet. Shipping everything together keeps the snapshots, the fixture and DataItems on the same schema version.
  • Add OVERCHARGE now as an opt-in member, keeping the old SEGMENT4. This avoids breaking SEGMENT4, but it exposes a member that every current public release rejects with HTTP 400.
  • Compute SEGMENT4 from the live get_enums() at runtime. This would follow the server automatically, but it costs a request and makes DataItems depend on a client. The enum is a static IntFlag on purpose.

Activity

  1. added
    enhancement
    on Nov 4, 2026
  2. self-assigned this
    on Nov 4, 2026
  3. added theissue type on Nov 4, 2026
  4. github-actions commented on Nov 23, 2026

    @github-actions
    Contributor

    Addressed by #273, which is now merged into develop. This issue will close automatically when that change is released to main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions