feat(editor): WIRC JSON round-trip closure

Adds --export-wirc-json / --import-wirc-json. allowedSlotsMask
emitted as both int + readable string (e.g. "Helm|Chest|Leg|
Boot") for tooling readability. Variable-length enchants
serialize as JSON object array of {enchantId, weight}.

All 3 presets (bear/eagle/tiger) byte-identical binary roundtrip
OK including the bear pool's totalWeight=100 (30+50+15+5 enchant
weight distribution).

Live-tested totalWeight mismatch validator: hand-mutated bear
pool enchant[1].weight from 50 to 60 (sum=110) while leaving
totalWeight=100 in JSON. Validator correctly errored:
"totalWeight=100 does not match sum of enchant weights=110 —
loot generator would mis-pick". Catches the class of denormal-
ized-cache-staleness bugs where the loot generator's hot-path
roll uses a precomputed total that no longer matches the
enchant table — players would see wrong rates of each enchant
tier without any obvious symptom.

CLI flag count 1434 -> 1436.
This commit is contained in:
Kelsi 2026-05-10 05:03:30 -07:00
parent b6a88ff964
commit c60e779e67
3 changed files with 134 additions and 0 deletions

View file

@ -421,6 +421,7 @@ const char* const kArgRequired[] = {
"--export-wbhv-json", "--import-wbhv-json",
"--gen-irc-bear", "--gen-irc-eagle", "--gen-irc-tiger",
"--info-wirc", "--validate-wirc",
"--export-wirc-json", "--import-wirc-json",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",