feat(editor): WCST JSON round-trip closure

Adds --export-wcst-json / --import-wcst-json. Eight uint stat
fields per entry serialize as JSON ints; className field on
export is informational (classId is the authoritative key).
All 3 presets (warrior/mage/starting) byte-identical binary
roundtrip OK including the 9-entry starting-stats preset that
spans 9 different vanilla classes.

Live-tested monotonicity validator: hand-mutated Mage L20
baseStrength to 21 (below L10=22), validator correctly emitted:
"monotonicity: Mage baseStrength regresses from 22 (L10) to 21
(L20) — likely typo". The level-sorting + adjacent-pair walk
correctly identified the violation across the sparse 6-level
sample.

CLI flag count 1371 -> 1373.
This commit is contained in:
Kelsi 2026-05-10 04:10:57 -07:00
parent b66e41df87
commit fab32a1cff
3 changed files with 127 additions and 0 deletions

View file

@ -2583,6 +2583,10 @@ void printUsage(const char* argv0) {
std::printf(" Print WCST entries (statId / class / level / hp / mana / Str/Agi/Sta/Int/Spi / armor)\n");
std::printf(" --validate-wcst <wcst-base> [--json]\n");
std::printf(" Static checks: statId+classId+level required, classId 1..11, level 1..60, no zero baseHealth (player would die instantly), no duplicate statIds, no duplicate (classId,level) pairs (runtime stat-lookup tie); warns on classId 6/10 (DK/Monk gap unused in vanilla), Warrior/Rogue baseMana > 0 (these classes use Rage/Energy not mana — likely typo), and per-class monotonicity violations across all 8 stats (any stat regressing as level increases)\n");
std::printf(" --export-wcst-json <wcst-base> [out.json]\n");
std::printf(" Export binary .wcst to a human-editable JSON sidecar (defaults to <base>.wcst.json; emits classId as int + className string for readability)\n");
std::printf(" --import-wcst-json <json-path> [out-base]\n");
std::printf(" Import a .wcst.json sidecar back into binary .wcst (className field is informational; classId int is authoritative — round-trips per-class per-level stat tables byte-identical)\n");
std::printf(" --catalog-pluck <wXXX-file> <id> [--json]\n");
std::printf(" Extract one entry by id from any registered catalog format. Auto-detects magic, dispatches to the per-format --info-* handler internally, then prints just the matching entry. Primary-key field is auto-detected (first *Id field, or first numeric)\n");
std::printf(" --catalog-find <directory> <id> [--magic <WXXX>] [--json]\n");