feat(editor): add WHRD JSON round-trip (--export/--import-whrd-json)

Novel pct/basis-points dual encoding for
bonusQualityChance: stored on disk as raw uint16 basis
points (0..10000) for compactness and integer-precision
math, but exported with both forms — bonusQualityChance
(int basis points, authoritative) and bonusQualityPct
(float, derived = bp / 100). Import accepts either form;
when only bonusQualityPct is present, converts pct *
100 to basis points with rounding.

This pattern is novel for the catalog set: most
percentage-style fields stored either as int (precise,
unfriendly) or as float (friendly, lossy round-trip).
The dual form gets both: byte-identical round-trip from
binary, AND human-friendly editing in JSON.

itemLevelDelta serializes as signed int16 (Heroic
modes can technically downgrade ilvl, though the
validator warns on negative). dropChanceMultiplier as
plain float.

All 3 presets (5man/raid25/challenge-mode) byte-
identical roundtrip OK. Pct-form import smoke-tested
with 7.5%% -> 750 basis points conversion. CLI flag
count 1182 -> 1184.
This commit is contained in:
Kelsi 2026-05-10 01:55:23 -07:00
parent 81b8572b50
commit f7ea99948a
3 changed files with 139 additions and 0 deletions

View file

@ -333,6 +333,7 @@ const char* const kArgRequired[] = {
"--export-wptt-json", "--import-wptt-json",
"--gen-hrd", "--gen-hrd-raid25", "--gen-hrd-cm",
"--info-whrd", "--validate-whrd",
"--export-whrd-json", "--import-whrd-json",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",