feat(editor): add WMAT JSON round-trip (--export/--import-wmat-json)

Closes the editing loop on the item-material catalog: dump a
.wmat to JSON, hand-edit materialKind / weightCategory / foley /
impact sound bindings / material flags (e.g. swap a Hide entry
from Light to Medium weight, add IsBreakable to a wooden bow,
re-bind Plate's foley to a different WSND entry, mark a new
HolyForged variant), re-import to a byte-identical binary.

Three different field types each take dual int+name forms:
  - materialKind: int 0..11 OR "cloth"/"leather"/"mail"/"plate"/
    "wood"/"stone"/"metal"/"liquid"/"organic"/"crystal"/
    "ethereal"/"hide"
  - weightCategory: int 0..2 OR "light"/"medium"/"heavy"
  - materialFlags: int bitfield OR pipe-separated label string
    ("IsMagical|IsBreakable|IsHolyCharged"). Importer prefers
    int form when both present so unknown bits round-trip
    losslessly.

Verified byte-identical round-trip on all three presets
(armor / weapon / magical). CLI flag count 948 -> 950.
This commit is contained in:
Kelsi 2026-05-09 22:16:13 -07:00
parent b220eeba61
commit 9318b6c006
3 changed files with 212 additions and 0 deletions

View file

@ -1813,6 +1813,10 @@ void printUsage(const char* argv0) {
std::printf(" Print WMAT entries (id / kind / weight / foley/impact sound ids / material flags / name) — flags decoded as label list\n");
std::printf(" --validate-wmat <wmat-base> [--json]\n");
std::printf(" Static checks: id+name required, materialKind 0..11, weightCategory 0..2, no duplicate ids; warns on Holy+Cursed combo, Plate non-heavy, Cloth non-light\n");
std::printf(" --export-wmat-json <wmat-base> [out.json]\n");
std::printf(" Export binary .wmat to a human-editable JSON sidecar (defaults to <base>.wmat.json)\n");
std::printf(" --import-wmat-json <json-path> [out-base]\n");
std::printf(" Import a .wmat.json sidecar back into binary .wmat (accepts materialKind/weightCategory int OR name; materialFlags int OR pipe-separated label string)\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");