feat(editor): WAUH JSON round-trip closure

Adds --export-wauh-json / --import-wauh-json with the established
readEnumField template factoring int+name dual encoding for
factionAccess ("both"/"alliance"/"horde"/"neutral"). All 3
presets (stormwind/orgrimmar/bootybay) byte-identical binary
roundtrip OK including the Booty Bay neutral 15%/15% rate
configuration.

Live-tested economic-trap validator: hand-mutated Booty Bay
deposit to 60% + cut to 50% (sum 110%). Validator correctly
errored: "depositRatePct=6000 + cutPct=5000 = 11000 basis
points — seller would lose money on every sale (combined rates
>= 100%)". Catches misconfigured AH rates that would silently
trap players into negative expected returns on every listing.

CLI flag count 1452 -> 1454.
This commit is contained in:
Kelsi 2026-05-10 05:18:42 -07:00
parent 4b63025e4a
commit 8f72664f6c
3 changed files with 176 additions and 0 deletions

View file

@ -2709,6 +2709,10 @@ void printUsage(const char* argv0) {
std::printf(" Print WAUH entries (id / faction / depositPct / cutPct / hour range / fee / npcAuctioneerId / name)\n");
std::printf(" --validate-wauh <wauh-base> [--json]\n");
std::printf(" Static checks: id+name required, factionAccess 0..3, depositRatePct + cutPct each in 0..10000 (basis points), no duplicate ahIds, no duplicate (faction,name) pairs, no duplicate npcAuctioneerId (gossip dispatch tie), maxListingDuration > 0 and minListing <= maxListing; CRITICAL: combined depositRatePct + cutPct < 10000 (else seller loses money on every sale). Warns on combined > 50%% (sellers may abandon AH; verify intentional like neutral AH penalty)\n");
std::printf(" --export-wauh-json <wauh-base> [out.json]\n");
std::printf(" Export binary .wauh to a human-editable JSON sidecar (defaults to <base>.wauh.json; emits factionAccess as int + name string)\n");
std::printf(" --import-wauh-json <json-path> [out-base]\n");
std::printf(" Import a .wauh.json sidecar back into binary .wauh (factionAccess int OR \"both\"/\"alliance\"/\"horde\"/\"neutral\" — round-trips per-AH config byte-identical)\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");