mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 09:33:51 +00:00
feat(editor): --list-zones --json for machine-readable zone discovery
Adds JSON mode to the zone discovery scanner. Returns an array of
zone objects, each with name/dir/mapId/author/description/tiles/
hasCreatures/hasQuests.
Lets CI scripts iterate every available zone and run a per-zone
gate, e.g.:
for zone in $(wowee_editor --list-zones --json | jq -r '.[].directory'); do
wowee_editor --validate "$zone" --json | jq -e '.score == 7'
done
Fifth and last commonly-used inspector to gain --json mode (after
--info-extract, --validate, --info-wcp, --zone-summary).
This commit is contained in:
parent
81cc146d58
commit
987dc81f13
1 changed files with 24 additions and 1 deletions
|
|
@ -30,7 +30,7 @@ static void printUsage(const char* argv0) {
|
|||
std::printf(" --adt <map> <x> <y> Load an ADT tile on startup\n");
|
||||
std::printf(" --convert-m2 <path> Convert M2 model to WOM open format (no GUI)\n");
|
||||
std::printf(" --convert-wmo <path> Convert WMO building to WOB open format (no GUI)\n");
|
||||
std::printf(" --list-zones List discovered custom zones and exit\n");
|
||||
std::printf(" --list-zones [--json] List discovered custom zones and exit\n");
|
||||
std::printf(" --scaffold-zone <name> [tx ty] Create a blank zone in custom_zones/<name>/ and exit\n");
|
||||
std::printf(" --build-woc <wot-base> Generate a WOC collision mesh from WHM/WOT and exit\n");
|
||||
std::printf(" --regen-collision <zoneDir> Rebuild every WOC under a zone dir and exit\n");
|
||||
|
|
@ -1000,7 +1000,30 @@ int main(int argc, char* argv[]) {
|
|||
std::printf("WCP unpacked to: %s\n", destDir.c_str());
|
||||
return 0;
|
||||
} else if (std::strcmp(argv[i], "--list-zones") == 0) {
|
||||
// Optional --json after the flag for machine-readable output.
|
||||
bool jsonOut = (i + 1 < argc &&
|
||||
std::strcmp(argv[i + 1], "--json") == 0);
|
||||
if (jsonOut) i++;
|
||||
auto zones = wowee::pipeline::CustomZoneDiscovery::scan({"custom_zones", "output"});
|
||||
if (jsonOut) {
|
||||
nlohmann::json j = nlohmann::json::array();
|
||||
for (const auto& z : zones) {
|
||||
nlohmann::json zoneObj;
|
||||
zoneObj["name"] = z.name;
|
||||
zoneObj["directory"] = z.directory;
|
||||
zoneObj["mapId"] = z.mapId;
|
||||
zoneObj["author"] = z.author;
|
||||
zoneObj["description"] = z.description;
|
||||
zoneObj["hasCreatures"] = z.hasCreatures;
|
||||
zoneObj["hasQuests"] = z.hasQuests;
|
||||
nlohmann::json tiles = nlohmann::json::array();
|
||||
for (const auto& t : z.tiles) tiles.push_back({t.first, t.second});
|
||||
zoneObj["tiles"] = tiles;
|
||||
j.push_back(std::move(zoneObj));
|
||||
}
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return 0;
|
||||
}
|
||||
if (zones.empty()) {
|
||||
std::printf("No custom zones found in custom_zones/ or output/\n");
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue