feat(editor): add WCMR JSON round-trip (--export/--import-wcmr-json)

Closes the editing loop on the creature-patrol catalog: dump a
.wcmr to JSON, hand-edit pathKind / moveType / waypoint coords /
delays (e.g. add a new mid-route waypoint to a city guard's
patrol, change Stormwind cathedral guards from Walk to Run kind,
extend an ICC patrol from 16 to 24 waypoints to cover a wider
area), re-import to a byte-identical binary.

First round-trip with truly variable-length payloads. The
waypoint arrays serialize as JSON arrays of {x, y, z, delayMs}
objects — adding or removing waypoints in the JSON sidecar
preserves the length-prefixed binary layout on import. The
generic --bulk-export-json / --bulk-import-json utilities work
on these too without modification, since the sidecar follows
the same magic-pattern naming convention.

Two dual-encoded fields:
  - pathKind: int 0..3 OR "loop" / "one-shot" / "reverse" /
    "random"
  - moveType: int 0..3 OR "walk" / "run" / "fly" / "swim"

Verified byte-identical round-trip on all three presets
(patrol / city / boss). The boss preset's 12-pt + 8-pt + 16-pt
patrols (36 waypoints total = 576 bytes of waypoint payload)
round-trip exactly, confirming the variable-length encoding
preserves byte-for-byte order in both directions. CLI flag count
1053 -> 1055.
This commit is contained in:
Kelsi 2026-05-09 23:41:17 -07:00
parent 7d3b80e1f7
commit 5a12f5d183
3 changed files with 186 additions and 0 deletions

View file

@ -2023,6 +2023,10 @@ void printUsage(const char* argv0) {
std::printf(" Print WCMR entries (id / creatureGuid / pathKind / moveType / waypoint count / total path length yards / name)\n");
std::printf(" --validate-wcmr <wcmr-base> [--json]\n");
std::printf(" Static checks: id+name+creatureGuid+waypoints required, pathKind 0..3, moveType 0..3, no duplicate ids; warns on 1-waypoint paths (idle), Loop with <3 waypoints (degenerate)\n");
std::printf(" --export-wcmr-json <wcmr-base> [out.json]\n");
std::printf(" Export binary .wcmr to a human-editable JSON sidecar (defaults to <base>.wcmr.json). Waypoints exported as JSON arrays for variable-length editing\n");
std::printf(" --import-wcmr-json <json-path> [out-base]\n");
std::printf(" Import a .wcmr.json sidecar back into binary .wcmr (accepts pathKind/moveType int OR name; waypoint arrays length-preserving)\n");
std::printf(" --gen-weather-temperate <wow-base> [zoneName]\n");
std::printf(" Emit .wow weather schedule: clear-dominant + occasional rain + fog (forest / grassland)\n");
std::printf(" --gen-weather-arctic <wow-base> [zoneName]\n");