mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-10 19:13:52 +00:00
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:
parent
81b8572b50
commit
f7ea99948a
3 changed files with 139 additions and 0 deletions
|
|
@ -2275,6 +2275,10 @@ void printUsage(const char* argv0) {
|
|||
std::printf(" Print WHRD entries (id / map / difficulty / +ilvl / bonus quality %% / drop multiplier / token id / extra emblems / name)\n");
|
||||
std::printf(" --validate-whrd <whrd-base> [--json]\n");
|
||||
std::printf(" Static checks: id+name required, difficultyId>0 (Normal=0 by convention), bonusQualityChance<=10000 basis points, dropChanceMultiplier>0, no duplicate scalingIds, no two scalings binding the same (mapId,difficultyId) tuple unless mapId=0 wildcard; warns on negative ilvlDelta (Heroic worse than Normal?), ilvl>50 (beyond canonical range), drop multiplier>10x\n");
|
||||
std::printf(" --export-whrd-json <whrd-base> [out.json]\n");
|
||||
std::printf(" Export binary .whrd to a human-editable JSON sidecar (defaults to <base>.whrd.json; emits bonusQualityChance as both raw basis points AND derived bonusQualityPct float convenience field)\n");
|
||||
std::printf(" --import-whrd-json <json-path> [out-base]\n");
|
||||
std::printf(" Import a .whrd.json sidecar back into binary .whrd (bonusQualityChance accepts raw basis points int OR bonusQualityPct float — converts pct *100 -> basis points; itemLevelDelta is signed int16; dropChanceMultiplier is float)\n");
|
||||
std::printf(" --catalog-pluck <wXXX-file> <id> [--json]\n");
|
||||
std::printf(" Extract one entry by id from any registered catalog format. Auto-detects magic, dispatches to the per-format --info-* handler internally, then prints just the matching entry. Primary-key field is auto-detected (first *Id field, or first numeric)\n");
|
||||
std::printf(" --catalog-find <directory> <id> [--magic <WXXX>] [--json]\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue