Skip to content

Parse mod entity classes into the data-mod catalog#495

Closed
ptrlrd wants to merge 1 commit into
feat/mod-asset-directoryfrom
feat/mod-parser
Closed

Parse mod entity classes into the data-mod catalog#495
ptrlrd wants to merge 1 commit into
feat/mod-asset-directoryfrom
feat/mod-parser

Conversation

@ptrlrd

@ptrlrd ptrlrd commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Part of full rendered modded cards. This produces the catalog the site renders for modded entities, after falling back main then beta then mod.

What it does

tools/parse_mod.py turns a mod's C# entity classes plus its localization JSON into the same per-language catalog shape the site already serves for base entities, written to data-mod/<key>/<lang>/{cards,relics,potions}.json.

It reuses the base-game parser machinery so modded cards render identically to base cards:

  • description_resolver bakes the SmartFormat tokens ({Damage:diff()}, {IfUpgraded:show:...}, [gold] markup) into final text exactly as for base cards.
  • The 33-field card schema and the type/rarity/target enums come from card_parser.

The mod-specific part is reading mechanics from the fluent builder calls (WithDamage, WithBlock, WithVar, WithKeyword, WithCostUpgradeBy, WithCalculatedDamage, HasEnergyCostX) rather than the decompiled game's DynamicVar declarations, and namespacing ids with the mod prefix (Eruption -> WATCHER-ERUPTION) so they never collide with base ids.

The mod's repo layout, id prefix, color, and languages all come from its data/mods.json entry, so adding another mod is config plus a checkout, no new code.

Verified against WatcherMod

90 cards, 8 relics, 4 potions across 7 languages (eng, deu, ita, jpn, kor, rus, zhs). Spot-checks all correct:

Card Parsed
Eruption cost 2, Attack/Basic, 9 dmg, cost->1 on upgrade
Vigilance 8 block, +4 on upgrade ("Gain 12 Block")
Perseverance 5 block, custom var Increase 2 (+1), both bump on upgrade
Halt 3 block + WrathBlock 9, both upgrade correctly
Collect X-cost detected
Brilliance calculated damage shown as base 12
Tranquility Retain + Exhaust, cost->0 on upgrade

Quality scan across all 90 cards: zero leftover {} tokens, zero stray placeholders. Descriptions, names, types, and keywords localize per language.

Notes

  • data-mod/ is committed like data-beta/ (served catalog data, regenerable from the mod repo).
  • One potion (Bottled Miracle) shows its count as the runtime "X" because that number lives in an effect method rather than a builder call; everything else bakes its numbers in.
  • Stacked on Add a curated mod-asset directory and /api/mods #493. Next: bake these to full card images on the CDN, serve the catalog from the backend, and wire the frontend fallback.

The run and live pages render an entity from its catalog entry after
falling back main -> beta -> mod. This adds tools/parse_mod.py, which
turns a mod's C# card/relic/potion classes plus its localization JSON
into the same per-language catalog shape the site already renders for
base entities, written to data-mod/<key>/<lang>/.

It reuses the base-game parser machinery: description_resolver bakes the
SmartFormat tokens ({Damage:diff()}, {IfUpgraded:show:...}, [gold] tags)
into final text exactly as for base cards, and the 33-field card schema
and enums come from card_parser. The mod-specific part is reading
mechanics from the fluent builder calls (WithDamage, WithBlock, WithVar,
WithKeyword, WithCostUpgradeBy, WithCalculatedDamage, HasEnergyCostX)
rather than the decompiled game's DynamicVar declarations, and namespacing
ids with the mod prefix (Eruption -> WATCHER-ERUPTION) so they never
collide with base ids.

The mod's repo layout, id prefix, color, and languages come from its
data/mods.json entry. Verified against WatcherMod: 90 cards, 8 relics,
4 potions across 7 languages, with cost, type, rarity, damage/block,
custom vars, keywords, X-cost, and upgrade descriptions all resolving
correctly. One potion (Bottled Miracle) shows its count as the runtime
"X" because that number lives in an effect method rather than a builder
call; everything else bakes its numbers in.
@ptrlrd

ptrlrd commented Jun 16, 2026

Copy link
Copy Markdown
Owner Author

Folded into #496, which delivers the whole modded-card feature (directory, ingest, parse, bake, backend serving, and frontend resolution) in one MR.

@ptrlrd ptrlrd closed this Jun 16, 2026
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