refactor(editor): move --info-quests and --info-objects into cli_content_info.cpp

Picks up two stragglers that should have been part of the
content-info family extraction in c519ee3 — they were earlier
in main.cpp (lines 1079, 1139) than the contiguous block I
extracted, so the prior pass missed them. Moving them now
puts the entire creature/object/quest inspection family in
one translation unit (18 handlers total).

main.cpp drops 14,732 → 14,628 lines (-104). Behavior
verified by re-running --info-quests on a non-zone path
(same error message).
This commit is contained in:
Kelsi 2026-05-09 04:50:26 -07:00
parent 3e3ba5012b
commit a23eb420ef
2 changed files with 114 additions and 104 deletions

View file

@ -1076,110 +1076,6 @@ int main(int argc, char* argv[]) {
std::printf(" total tris : %zu\n", totalIdx / 3);
std::printf(" total mats : %zu (across all groups)\n", totalMats);
return 0;
} else if (std::strcmp(argv[i], "--info-quests") == 0 && i + 1 < argc) {
std::string path = argv[++i];
bool jsonOut = (i + 1 < argc &&
std::strcmp(argv[i + 1], "--json") == 0);
if (jsonOut) i++;
wowee::editor::QuestEditor qe;
if (!qe.loadFromFile(path)) {
std::fprintf(stderr, "Failed to load quests.json: %s\n", path.c_str());
return 1;
}
const auto& quests = qe.getQuests();
int chained = 0, withReward = 0, withItems = 0;
int objKill = 0, objCollect = 0, objTalk = 0;
uint32_t totalXp = 0;
for (const auto& q : quests) {
if (q.nextQuestId != 0) chained++;
if (q.reward.xp > 0 || q.reward.gold > 0 ||
q.reward.silver > 0 || q.reward.copper > 0) withReward++;
if (!q.reward.itemRewards.empty()) withItems++;
totalXp += q.reward.xp;
using OT = wowee::editor::QuestObjectiveType;
for (const auto& obj : q.objectives) {
if (obj.type == OT::KillCreature) objKill++;
else if (obj.type == OT::CollectItem) objCollect++;
else if (obj.type == OT::TalkToNPC) objTalk++;
}
}
std::vector<std::string> errors;
qe.validateChains(errors);
if (jsonOut) {
nlohmann::json j;
j["file"] = path;
j["total"] = quests.size();
j["chained"] = chained;
j["withReward"] = withReward;
j["withItems"] = withItems;
j["totalXp"] = totalXp;
j["avgXpPerQuest"] = quests.empty() ? 0.0
: double(totalXp) / quests.size();
j["objectives"] = {{"kill", objKill},
{"collect", objCollect},
{"talk", objTalk}};
j["chainErrors"] = errors;
std::printf("%s\n", j.dump(2).c_str());
return 0;
}
std::printf("quests.json: %s\n", path.c_str());
std::printf(" total : %zu\n", quests.size());
std::printf(" chained : %d (have nextQuestId)\n", chained);
std::printf(" with reward : %d\n", withReward);
std::printf(" with items : %d\n", withItems);
std::printf(" total XP : %u (avg %.0f per quest)\n", totalXp,
quests.empty() ? 0.0 : double(totalXp) / quests.size());
std::printf(" objectives : %d kill, %d collect, %d talk\n",
objKill, objCollect, objTalk);
if (!errors.empty()) {
std::printf(" chain errors: %zu\n", errors.size());
for (const auto& e : errors) std::printf(" - %s\n", e.c_str());
}
return 0;
} else if (std::strcmp(argv[i], "--info-objects") == 0 && i + 1 < argc) {
std::string path = argv[++i];
bool jsonOut = (i + 1 < argc &&
std::strcmp(argv[i + 1], "--json") == 0);
if (jsonOut) i++;
wowee::editor::ObjectPlacer placer;
if (!placer.loadFromFile(path)) {
std::fprintf(stderr, "Failed to load objects.json: %s\n", path.c_str());
return 1;
}
const auto& objs = placer.getObjects();
int m2Count = 0, wmoCount = 0;
std::unordered_map<std::string, int> pathHist;
float minScale = 1e30f, maxScale = -1e30f;
for (const auto& o : objs) {
if (o.type == wowee::editor::PlaceableType::M2) m2Count++;
else if (o.type == wowee::editor::PlaceableType::WMO) wmoCount++;
pathHist[o.path]++;
if (o.scale < minScale) minScale = o.scale;
if (o.scale > maxScale) maxScale = o.scale;
}
if (jsonOut) {
nlohmann::json j;
j["file"] = path;
j["total"] = objs.size();
j["m2"] = m2Count;
j["wmo"] = wmoCount;
j["uniquePaths"] = pathHist.size();
if (!objs.empty()) {
j["scaleMin"] = minScale;
j["scaleMax"] = maxScale;
}
std::printf("%s\n", j.dump(2).c_str());
return 0;
}
std::printf("objects.json: %s\n", path.c_str());
std::printf(" total : %zu\n", objs.size());
std::printf(" M2 doodads : %d\n", m2Count);
std::printf(" WMO buildings: %d\n", wmoCount);
std::printf(" unique paths: %zu\n", pathHist.size());
if (!objs.empty()) {
std::printf(" scale range : [%.2f, %.2f]\n", minScale, maxScale);
}
return 0;
} else if (std::strcmp(argv[i], "--info-extract") == 0 && i + 1 < argc) {
// Walk an extracted-asset directory and report counts by
// extension + open-format coverage. Useful for seeing whether