Parse mod entity classes into the data-mod catalog#495
Closed
ptrlrd wants to merge 1 commit into
Closed
Conversation
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.
Owner
Author
|
Folded into #496, which delivers the whole modded-card feature (directory, ingest, parse, bake, backend serving, and frontend resolution) in one MR. |
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.
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.pyturns 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 todata-mod/<key>/<lang>/{cards,relics,potions}.json.It reuses the base-game parser machinery so modded cards render identically to base cards:
description_resolverbakes the SmartFormat tokens ({Damage:diff()},{IfUpgraded:show:...},[gold]markup) into final text exactly as for base cards.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'sDynamicVardeclarations, 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.jsonentry, 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:
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 likedata-beta/(served catalog data, regenerable from the mod repo).