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

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

Each faction round-trips:
  • 13 scalar fields (id, parent, name, description, flags,
    7 ascending threshold values, baseReputation)
  • enemies[] and friends[] as JSON int arrays for trivial
    hand-edit
  • reputationFlags as dual int + string-array form
    (e.g. ["visible", "header"])

The 7 reputation thresholds round-trip exactly even though
they have non-default values in some presets — the
importer uses the canonical Hostile/Friendly/etc enum
values as defaults so a hand-author can omit the standard
thresholds and only specify custom ones.

Verified byte-identical round-trip on the alliance preset
(5 factions: Alliance header + 3 cities with reciprocal
friend lists + Defias enemy). Adds 2 flags (523 documented
total now).
This commit is contained in:
Kelsi 2026-05-09 15:45:58 -07:00
parent 81b1897a24
commit dda7933df9
3 changed files with 166 additions and 0 deletions

View file

@ -947,6 +947,10 @@ void printUsage(const char* argv0) {
std::printf(" Print WFAC entries (id / parent / flags / enemy + friend counts / name)\n");
std::printf(" --validate-wfac <wfac-base> [--json]\n");
std::printf(" Static checks: factionId>0+unique, name not empty, threshold ordering, no self-enemy, no enemy/friend overlap\n");
std::printf(" --export-wfac-json <wfac-base> [out.json]\n");
std::printf(" Export binary .wfac to a human-editable JSON sidecar (defaults to <base>.wfac.json)\n");
std::printf(" --import-wfac-json <json-path> [out-base]\n");
std::printf(" Import a .wfac.json sidecar back into binary .wfac (accepts flag int OR flagsList strings)\n");
std::printf(" --gen-locks <wlck-base> [name]\n");
std::printf(" Emit .wlck starter: 2 locks (Iron Door key+force, Wooden Chest force-only) — lockId=1 matches WGOT\n");
std::printf(" --gen-locks-dungeon <wlck-base> [name]\n");