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

Closes the WCRT open-format loop with --export-wcrt-json /
--import-wcrt-json, mirroring the WOL/WOW/WOMX/WSND/WSPN/
WIT/WLOT JSON pairs. All 8 binary formats added since WOL
now have full JSON round-trip authoring.

Each creature template round-trips all 22 scalar fields.
Three enum-typed fields emit dual int + name forms so a
hand-author can use either:
  • typeId    (humanoid / beast / dragon / ...)
  • familyId  (wolf / cat / bear / ... — for beasts)
  • npcFlags  (vendor / quest / trainer / innkeeper / ...)
  • aiFlags   (passive / aggressive / flee / call-help / no-leash)

Both flag bitsets emit string-array forms so a hand-author
can write ["vendor", "innkeeper", "repair"] instead of
having to remember that those bits combine to 0x91.

Verified byte-identical round-trip on the merchants preset
(3 NPCs covering innkeeper / smith / alchemist with mixed
flag combinations). Adds 2 flags (502 documented total now).
This commit is contained in:
Kelsi 2026-05-09 15:27:12 -07:00
parent 02ae17740e
commit 2df4e75c71
3 changed files with 234 additions and 0 deletions

View file

@ -905,6 +905,10 @@ void printUsage(const char* argv0) {
std::printf(" Print WCRT entries (id / level / hp / type / faction / npc-flags / name + subname)\n");
std::printf(" --validate-wcrt <wcrt-base> [--json]\n");
std::printf(" Static checks: creatureId>0+unique, level/hp>0, min<=max, attackSpeed>0, behavior flag conflicts\n");
std::printf(" --export-wcrt-json <wcrt-base> [out.json]\n");
std::printf(" Export binary .wcrt to a human-editable JSON sidecar (defaults to <base>.wcrt.json)\n");
std::printf(" --import-wcrt-json <json-path> [out-base]\n");
std::printf(" Import a .wcrt.json sidecar back into binary .wcrt (accepts type/family/flag int OR name forms)\n");
std::printf(" --gen-quests <wqt-base> [name]\n");
std::printf(" Emit .wqt starter quest: 'Kill 10 Defias Bandits' giver=4001 (matches WCRT village innkeeper)\n");
std::printf(" --gen-quests-chain <wqt-base> [name]\n");