feat(editor): WPRT JSON round-trip closure

Adds --export-wprt-json / --import-wprt-json with the established
readEnumField template factoring int+name dual encoding for both
factionAccess ("both"/"alliance"/"horde"/"neutral") and portalKind
("teleport"/"portal"). Float fields (destX/Y/Z, destOrientation)
preserved bit-for-bit through JSON.

All 3 presets (alliance/horde/teleports) byte-identical binary
roundtrip OK including the Teleport: Orgrimmar Horde-faction
entry that crosses the otherwise-Alliance teleports preset.

Live-tested reagent-mismatch warning: hand-mutated Stormwind
Portal entry (Portal kind) to use Rune of Teleportation (17031
— Teleport reagent), validator correctly emitted: "Portal kind
with reagentItemId=17031 — vanilla group portals require Rune
of Portals (itemId 17032). Verify intentional".

CLI flag count 1362 -> 1364.
This commit is contained in:
Kelsi 2026-05-10 04:03:57 -07:00
parent be3a253dcc
commit f41f913a2a
3 changed files with 193 additions and 0 deletions

View file

@ -2569,6 +2569,10 @@ void printUsage(const char* argv0) {
std::printf(" Print WPRT entries (id / spellId / portalKind / factionAccess / levelRequirement / reagentItemId / destination)\n");
std::printf(" --validate-wprt <wprt-base> [--json]\n");
std::printf(" Static checks: id+spellId+destination required, factionAccess 0..3, portalKind 0..1, no duplicate portalIds, no duplicate spellIds (would conflict on cast); warns on levelRequirement < 20 (vanilla mage cannot unlock), Portal kind without Rune of Portals (17032), Teleport kind without Rune of Teleportation (17031), and duplicate destination names (likely Teleport+Portal pair OR copy-paste bug)\n");
std::printf(" --export-wprt-json <wprt-base> [out.json]\n");
std::printf(" Export binary .wprt to a human-editable JSON sidecar (defaults to <base>.wprt.json; emits factionAccess and portalKind as int + name string; floats preserved bit-for-bit)\n");
std::printf(" --import-wprt-json <json-path> [out-base]\n");
std::printf(" Import a .wprt.json sidecar back into binary .wprt (factionAccess int OR \"both\"/\"alliance\"/\"horde\"/\"neutral\"; portalKind int OR \"teleport\"/\"portal\")\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");