feat(editor): add WTRN JSON round-trip authoring workflow

Closes the WTRN open-format loop with --export-wtrn-json /
--import-wtrn-json, mirroring the JSON pairs added for
every other novel binary format. All 16 binary formats
added since WOL now have full JSON round-trip authoring.

Each NPC round-trips:
  • npcId, kindMask (dual int + kindList string array),
    greeting
  • spells[]: spellId / cost / requiredSkill+rank / minLevel
  • items[]:  itemId / stockCount / restockSec /
              extendedCost / moneyCostCopper

The stockCount field has special handling — the sentinel
0xFFFFFFFF value emits as the string "unlimited" instead of
the raw integer, since 4294967295 reads as a magic-number
typo in hand-edit JSON. The importer accepts either form.

Verified byte-identical round-trip on the starter preset
(innkeeper 4001 with 1 spell + 3 items, exercising both
unlimited-stock and finite-stock-with-restock cases).

Adds 2 flags (553 documented total now).
This commit is contained in:
Kelsi 2026-05-09 16:14:50 -07:00
parent d2ca3ea22b
commit c3f7286d4a
3 changed files with 188 additions and 0 deletions

View file

@ -64,6 +64,7 @@ const char* const kArgRequired[] = {
"--export-wach-json", "--import-wach-json",
"--gen-trainers", "--gen-trainers-mage", "--gen-trainers-weapons",
"--info-wtrn", "--validate-wtrn",
"--export-wtrn-json", "--import-wtrn-json",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",