From a54ce494be5d403c31663cb6ce9c5a62f4ac5590 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 10:38:57 -0700 Subject: [PATCH] feat(editor): zone validation for open format completeness scoring - ContentPacker::validateZone() scans a zone directory and checks for all open format files (WOT, WHM, PNG, WOM, zone.json, etc.) - openFormatScore(): returns 0-5 based on how many open formats present - summary(): human-readable list of found formats - Foundation for quality gate on WCP export: warn if zone uses Blizzard formats that could be converted to open versions --- tools/editor/content_pack.cpp | 37 +++++++++++++++++++++++++++++++++++ tools/editor/content_pack.hpp | 10 ++++++++++ 2 files changed, 47 insertions(+) diff --git a/tools/editor/content_pack.cpp b/tools/editor/content_pack.cpp index 24ad9bb8..46a43dfe 100644 --- a/tools/editor/content_pack.cpp +++ b/tools/editor/content_pack.cpp @@ -171,5 +171,42 @@ bool ContentPacker::readInfo(const std::string& wcpPath, ContentPackInfo& info) return true; } +ContentPacker::ValidationResult ContentPacker::validateZone(const std::string& zoneDir) { + namespace fs = std::filesystem; + ValidationResult r; + if (!fs::exists(zoneDir)) return r; + + for (auto& entry : fs::recursive_directory_iterator(zoneDir)) { + if (!entry.is_regular_file()) continue; + std::string ext = entry.path().extension().string(); + std::string name = entry.path().filename().string(); + if (ext == ".wot") r.hasWot = true; + if (ext == ".whm") r.hasWhm = true; + if (ext == ".wom") r.hasWom = true; + if (ext == ".png") r.hasPng = true; + if (name == "zone.json") r.hasZoneJson = true; + if (name == "creatures.json") r.hasCreatures = true; + if (name == "quests.json") r.hasQuests = true; + if (name == "objects.json") r.hasObjects = true; + } + return r; +} + +int ContentPacker::ValidationResult::openFormatScore() const { + int score = 0; + if (hasWot) score++; if (hasWhm) score++; if (hasZoneJson) score++; + if (hasPng) score++; if (hasWom) score++; + return score; // max 5 for fully open +} + +std::string ContentPacker::ValidationResult::summary() const { + std::string s; + s += hasWot ? "WOT " : ""; s += hasWhm ? "WHM " : ""; + s += hasZoneJson ? "zone.json " : ""; s += hasPng ? "PNG " : ""; + s += hasWom ? "WOM " : ""; s += hasCreatures ? "creatures " : ""; + s += hasQuests ? "quests " : ""; s += hasObjects ? "objects " : ""; + return s.empty() ? "(empty)" : s; +} + } // namespace editor } // namespace wowee diff --git a/tools/editor/content_pack.hpp b/tools/editor/content_pack.hpp index 9f7edda7..f51006e6 100644 --- a/tools/editor/content_pack.hpp +++ b/tools/editor/content_pack.hpp @@ -34,6 +34,16 @@ public: // Read pack info without extracting static bool readInfo(const std::string& wcpPath, ContentPackInfo& info); + + // Validate that a zone directory has all required open format files + struct ValidationResult { + bool hasWot = false, hasWhm = false, hasZoneJson = false; + bool hasPng = false, hasWom = false, hasCreatures = false; + bool hasQuests = false, hasObjects = false; + int openFormatScore() const; + std::string summary() const; + }; + static ValidationResult validateZone(const std::string& zoneDir); }; } // namespace editor