diff --git a/CMakeLists.txt b/CMakeLists.txt index 8728bec2..0829d853 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -645,6 +645,7 @@ set(WOWEE_SOURCES src/pipeline/wowee_spell_mechanics.cpp src/pipeline/wowee_keybindings.cpp src/pipeline/wowee_spell_schools.cpp + src/pipeline/wowee_lfg.cpp src/pipeline/custom_zone_discovery.cpp src/pipeline/dbc_layout.cpp @@ -1443,6 +1444,7 @@ add_executable(wowee_editor tools/editor/cli_keybindings_catalog.cpp tools/editor/cli_tree_summary_md.cpp tools/editor/cli_spell_schools_catalog.cpp + tools/editor/cli_lfg_catalog.cpp tools/editor/cli_quest_objective.cpp tools/editor/cli_quest_reward.cpp tools/editor/cli_clone.cpp @@ -1566,6 +1568,7 @@ add_executable(wowee_editor src/pipeline/wowee_spell_mechanics.cpp src/pipeline/wowee_keybindings.cpp src/pipeline/wowee_spell_schools.cpp + src/pipeline/wowee_lfg.cpp src/pipeline/custom_zone_discovery.cpp src/pipeline/terrain_mesh.cpp diff --git a/include/pipeline/wowee_lfg.hpp b/include/pipeline/wowee_lfg.hpp new file mode 100644 index 00000000..3b9eb307 --- /dev/null +++ b/include/pipeline/wowee_lfg.hpp @@ -0,0 +1,118 @@ +#pragma once + +#include +#include +#include + +namespace wowee { +namespace pipeline { + +// Wowee Open Looking-For-Group Dungeon catalog (.wlfg) — +// novel replacement for Blizzard's LFGDungeons.dbc plus +// the AzerothCore-style dungeon-finder reward tables. +// Defines the dungeons / raids that the LFG / Dungeon +// Finder / Raid Browser presents to players, with their +// level brackets, group-size requirements, role +// requirements (tank / heal / DPS), and queue-completion +// rewards. +// +// Cross-references with previously-added formats: +// WLFG.entry.mapId → WMS.map.mapId +// WLFG.entry.queueRewardItemId → WIT.itemId +// WLFG.entry.firstClearAchievement → WACH.achievementId +// +// Binary layout (little-endian): +// magic[4] = "WLFG" +// version (uint32) = current 1 +// nameLen + name (catalog label) +// entryCount (uint32) +// entries (each): +// dungeonId (uint32) +// nameLen + name +// descLen + description +// mapId (uint32) +// minLevel (uint16) / maxLevel (uint16) / +// recommendedLevel (uint16) / minGearLevel (uint16) +// difficulty (uint8) / groupSize (uint8) / +// requiredRolesMask (uint8) / expansionRequired (uint8) +// queueRewardItemId (uint32) +// queueRewardEmblemCount (uint16) / pad[2] +// firstClearAchievement (uint32) +struct WoweeLFGDungeon { + enum Difficulty : uint8_t { + Normal = 0, + Heroic = 1, // dungeon heroic + 10-man heroic raid + Mythic = 2, // 25-man heroic raid + Hardmode = 3, // Ulduar-style toggleable + }; + + enum ExpansionRequired : uint8_t { + Classic = 0, + TBC = 1, + WotLK = 2, + TurtleWoW = 3, + }; + + // requiredRolesMask bits — combine to require multiple + // role types in the queue-formed group. + static constexpr uint8_t kRoleTank = 0x01; + static constexpr uint8_t kRoleHeal = 0x02; + static constexpr uint8_t kRoleDPS = 0x04; + static constexpr uint8_t kRoleAll = kRoleTank | kRoleHeal | kRoleDPS; + + struct Entry { + uint32_t dungeonId = 0; + std::string name; + std::string description; + uint32_t mapId = 0; // WMS cross-ref + uint16_t minLevel = 1; + uint16_t maxLevel = 80; + uint16_t recommendedLevel = 0; + uint16_t minGearLevel = 0; // ilvl floor for queue + uint8_t difficulty = Normal; + uint8_t groupSize = 5; // 5 / 10 / 25 / 40 + uint8_t requiredRolesMask = kRoleAll; + uint8_t expansionRequired = Classic; + uint32_t queueRewardItemId = 0; // WIT cross-ref + uint16_t queueRewardEmblemCount = 0; + uint32_t firstClearAchievement = 0; // WACH cross-ref + }; + + std::string name; + std::vector entries; + + bool isValid() const { return !entries.empty(); } + + const Entry* findById(uint32_t dungeonId) const; + + static const char* difficultyName(uint8_t d); + static const char* expansionRequiredName(uint8_t e); +}; + +class WoweeLFGDungeonLoader { +public: + static bool save(const WoweeLFGDungeon& cat, + const std::string& basePath); + static WoweeLFGDungeon load(const std::string& basePath); + static bool exists(const std::string& basePath); + + // Preset emitters used by --gen-lfg* variants. + // + // makeStarter — 3 classic-era dungeons (Ragefire + // Chasm 13-18, Wailing Caverns + // 17-24, Deadmines 18-23). + // makeHeroic — 5 WotLK 80-level heroics with + // emblem rewards (Halls of Lightning + // Heroic, Halls of Stone, Utgarde + // Pinnacle, Violet Hold, Old Kingdom). + // makeRaid — 3 raid catalog entries (Naxxramas-25, + // Ulduar-25 with Hardmode, ToC-25) + // with achievement cross-refs and + // larger groupSize. + static WoweeLFGDungeon makeStarter(const std::string& catalogName); + static WoweeLFGDungeon makeHeroic(const std::string& catalogName); + static WoweeLFGDungeon makeRaid(const std::string& catalogName); +}; + +} // namespace pipeline +} // namespace wowee diff --git a/src/pipeline/wowee_lfg.cpp b/src/pipeline/wowee_lfg.cpp new file mode 100644 index 00000000..6a4e813e --- /dev/null +++ b/src/pipeline/wowee_lfg.cpp @@ -0,0 +1,257 @@ +#include "pipeline/wowee_lfg.hpp" + +#include +#include +#include + +namespace wowee { +namespace pipeline { + +namespace { + +constexpr char kMagic[4] = {'W', 'L', 'F', 'G'}; +constexpr uint32_t kVersion = 1; + +template +void writePOD(std::ofstream& os, const T& v) { + os.write(reinterpret_cast(&v), sizeof(T)); +} + +template +bool readPOD(std::ifstream& is, T& v) { + is.read(reinterpret_cast(&v), sizeof(T)); + return is.gcount() == static_cast(sizeof(T)); +} + +void writeStr(std::ofstream& os, const std::string& s) { + uint32_t n = static_cast(s.size()); + writePOD(os, n); + if (n > 0) os.write(s.data(), n); +} + +bool readStr(std::ifstream& is, std::string& s) { + uint32_t n = 0; + if (!readPOD(is, n)) return false; + if (n > (1u << 20)) return false; + s.resize(n); + if (n > 0) { + is.read(s.data(), n); + if (is.gcount() != static_cast(n)) { + s.clear(); + return false; + } + } + return true; +} + +std::string normalizePath(std::string base) { + if (base.size() < 5 || base.substr(base.size() - 5) != ".wlfg") { + base += ".wlfg"; + } + return base; +} + +} // namespace + +const WoweeLFGDungeon::Entry* +WoweeLFGDungeon::findById(uint32_t dungeonId) const { + for (const auto& e : entries) + if (e.dungeonId == dungeonId) return &e; + return nullptr; +} + +const char* WoweeLFGDungeon::difficultyName(uint8_t d) { + switch (d) { + case Normal: return "normal"; + case Heroic: return "heroic"; + case Mythic: return "mythic"; + case Hardmode: return "hardmode"; + default: return "unknown"; + } +} + +const char* WoweeLFGDungeon::expansionRequiredName(uint8_t e) { + switch (e) { + case Classic: return "classic"; + case TBC: return "tbc"; + case WotLK: return "wotlk"; + case TurtleWoW: return "turtle"; + default: return "unknown"; + } +} + +bool WoweeLFGDungeonLoader::save(const WoweeLFGDungeon& cat, + const std::string& basePath) { + std::ofstream os(normalizePath(basePath), std::ios::binary); + if (!os) return false; + os.write(kMagic, 4); + writePOD(os, kVersion); + writeStr(os, cat.name); + uint32_t entryCount = static_cast(cat.entries.size()); + writePOD(os, entryCount); + for (const auto& e : cat.entries) { + writePOD(os, e.dungeonId); + writeStr(os, e.name); + writeStr(os, e.description); + writePOD(os, e.mapId); + writePOD(os, e.minLevel); + writePOD(os, e.maxLevel); + writePOD(os, e.recommendedLevel); + writePOD(os, e.minGearLevel); + writePOD(os, e.difficulty); + writePOD(os, e.groupSize); + writePOD(os, e.requiredRolesMask); + writePOD(os, e.expansionRequired); + writePOD(os, e.queueRewardItemId); + writePOD(os, e.queueRewardEmblemCount); + uint8_t pad2[2] = {0, 0}; + os.write(reinterpret_cast(pad2), 2); + writePOD(os, e.firstClearAchievement); + } + return os.good(); +} + +WoweeLFGDungeon WoweeLFGDungeonLoader::load( + const std::string& basePath) { + WoweeLFGDungeon out; + std::ifstream is(normalizePath(basePath), std::ios::binary); + if (!is) return out; + char magic[4]; + is.read(magic, 4); + if (std::memcmp(magic, kMagic, 4) != 0) return out; + uint32_t version = 0; + if (!readPOD(is, version) || version != kVersion) return out; + if (!readStr(is, out.name)) return out; + uint32_t entryCount = 0; + if (!readPOD(is, entryCount)) return out; + if (entryCount > (1u << 20)) return out; + out.entries.resize(entryCount); + for (auto& e : out.entries) { + if (!readPOD(is, e.dungeonId)) { + out.entries.clear(); return out; + } + if (!readStr(is, e.name) || !readStr(is, e.description)) { + out.entries.clear(); return out; + } + if (!readPOD(is, e.mapId) || + !readPOD(is, e.minLevel) || + !readPOD(is, e.maxLevel) || + !readPOD(is, e.recommendedLevel) || + !readPOD(is, e.minGearLevel) || + !readPOD(is, e.difficulty) || + !readPOD(is, e.groupSize) || + !readPOD(is, e.requiredRolesMask) || + !readPOD(is, e.expansionRequired) || + !readPOD(is, e.queueRewardItemId) || + !readPOD(is, e.queueRewardEmblemCount)) { + out.entries.clear(); return out; + } + uint8_t pad2[2]; + is.read(reinterpret_cast(pad2), 2); + if (is.gcount() != 2) { out.entries.clear(); return out; } + if (!readPOD(is, e.firstClearAchievement)) { + out.entries.clear(); return out; + } + } + return out; +} + +bool WoweeLFGDungeonLoader::exists(const std::string& basePath) { + std::ifstream is(normalizePath(basePath), std::ios::binary); + return is.good(); +} + +WoweeLFGDungeon WoweeLFGDungeonLoader::makeStarter( + const std::string& catalogName) { + WoweeLFGDungeon c; + c.name = catalogName; + auto add = [&](uint32_t id, const char* name, uint32_t mapId, + uint16_t minL, uint16_t maxL, uint16_t recL, + const char* desc) { + WoweeLFGDungeon::Entry e; + e.dungeonId = id; e.name = name; e.description = desc; + e.mapId = mapId; + e.minLevel = minL; e.maxLevel = maxL; + e.recommendedLevel = recL; + e.difficulty = WoweeLFGDungeon::Normal; + e.groupSize = 5; + e.expansionRequired = WoweeLFGDungeon::Classic; + c.entries.push_back(e); + }; + add(1, "Ragefire Chasm", 389, 13, 18, 15, + "Volcanic 5-man dungeon under Orgrimmar."); + add(2, "Wailing Caverns", 43, 17, 24, 20, + "Druidic 5-man dungeon in the Barrens."); + add(3, "The Deadmines", 36, 18, 23, 20, + "Defias hideout 5-man dungeon in Westfall."); + return c; +} + +WoweeLFGDungeon WoweeLFGDungeonLoader::makeHeroic( + const std::string& catalogName) { + WoweeLFGDungeon c; + c.name = catalogName; + auto add = [&](uint32_t id, const char* name, uint32_t mapId, + uint16_t minIlvl, uint16_t emblemCount, + uint32_t ach, const char* desc) { + WoweeLFGDungeon::Entry e; + e.dungeonId = id; e.name = name; e.description = desc; + e.mapId = mapId; + e.minLevel = 80; e.maxLevel = 80; + e.recommendedLevel = 80; + e.minGearLevel = minIlvl; + e.difficulty = WoweeLFGDungeon::Heroic; + e.groupSize = 5; + e.expansionRequired = WoweeLFGDungeon::WotLK; + e.queueRewardEmblemCount = emblemCount; + e.firstClearAchievement = ach; + c.entries.push_back(e); + }; + add(100, "Halls of Lightning Heroic", 602, 180, 2, 1862, + "Storm titan-keeper 5-man — Loken finale."); + add(101, "Halls of Stone Heroic", 599, 180, 2, 1865, + "Iron dwarf 5-man — Tribunal of Ages event."); + add(102, "Utgarde Pinnacle Heroic", 575, 180, 2, 1487, + "Vrykul 5-man — King Ymiron finale."); + add(103, "The Violet Hold Heroic", 608, 180, 2, 1816, + "Dalaran prison breakout 5-man."); + add(104, "Old Kingdom Heroic", 595, 180, 2, 1860, + "Faceless ones 5-man — Herald Volazj."); + return c; +} + +WoweeLFGDungeon WoweeLFGDungeonLoader::makeRaid( + const std::string& catalogName) { + WoweeLFGDungeon c; + c.name = catalogName; + auto add = [&](uint32_t id, const char* name, uint32_t mapId, + uint8_t difficulty, uint8_t groupSize, + uint16_t minIlvl, uint16_t emblemCount, + uint32_t ach, const char* desc) { + WoweeLFGDungeon::Entry e; + e.dungeonId = id; e.name = name; e.description = desc; + e.mapId = mapId; + e.minLevel = 80; e.maxLevel = 80; + e.recommendedLevel = 80; + e.minGearLevel = minIlvl; + e.difficulty = difficulty; + e.groupSize = groupSize; + e.expansionRequired = WoweeLFGDungeon::WotLK; + e.queueRewardEmblemCount = emblemCount; + e.firstClearAchievement = ach; + c.entries.push_back(e); + }; + add(200, "Naxxramas-25", 533, + WoweeLFGDungeon::Normal, 25, 200, 5, 1996, + "25-man recycled tier-3 raid in Northrend."); + add(201, "Ulduar-25 Hardmode", 603, + WoweeLFGDungeon::Hardmode, 25, 220, 5, 2200, + "25-man with toggleable hardmode boss difficulty."); + add(202, "Trial of the Crusader-25", 649, + WoweeLFGDungeon::Mythic, 25, 232, 10, 4047, + "25-man Argent Crusade raid, mythic difficulty."); + return c; +} + +} // namespace pipeline +} // namespace wowee diff --git a/tools/editor/cli_arg_required.cpp b/tools/editor/cli_arg_required.cpp index 4e36845b..cd8ad947 100644 --- a/tools/editor/cli_arg_required.cpp +++ b/tools/editor/cli_arg_required.cpp @@ -172,6 +172,8 @@ const char* const kArgRequired[] = { "--gen-sch", "--gen-sch-magical", "--gen-sch-combined", "--info-wsch", "--validate-wsch", "--export-wsch-json", "--import-wsch-json", + "--gen-lfg", "--gen-lfg-heroic", "--gen-lfg-raid", + "--info-wlfg", "--validate-wlfg", "--gen-weather-temperate", "--gen-weather-arctic", "--gen-weather-desert", "--gen-weather-stormy", "--gen-zone-atmosphere", diff --git a/tools/editor/cli_dispatch.cpp b/tools/editor/cli_dispatch.cpp index 934d6e72..ec38ca3e 100644 --- a/tools/editor/cli_dispatch.cpp +++ b/tools/editor/cli_dispatch.cpp @@ -91,6 +91,7 @@ #include "cli_keybindings_catalog.hpp" #include "cli_tree_summary_md.hpp" #include "cli_spell_schools_catalog.hpp" +#include "cli_lfg_catalog.hpp" #include "cli_quest_objective.hpp" #include "cli_quest_reward.hpp" #include "cli_clone.hpp" @@ -223,6 +224,7 @@ constexpr DispatchFn kDispatchTable[] = { handleKeybindingsCatalog, handleTreeSummaryMd, handleSpellSchoolsCatalog, + handleLFGCatalog, handleQuestObjective, handleQuestReward, handleClone, diff --git a/tools/editor/cli_format_table.cpp b/tools/editor/cli_format_table.cpp index cf9b1ef9..d372f63b 100644 --- a/tools/editor/cli_format_table.cpp +++ b/tools/editor/cli_format_table.cpp @@ -59,6 +59,7 @@ constexpr FormatMagicEntry kFormats[] = { {{'W','S','M','C'}, ".wsmc", "spells", "--info-wsmc", "Spell mechanic catalog"}, {{'W','K','B','D'}, ".wkbd", "input", "--info-wkbd", "Keybinding catalog"}, {{'W','S','C','H'}, ".wsch", "spells", "--info-wsch", "Spell school / damage type catalog"}, + {{'W','L','F','G'}, ".wlfg", "social", "--info-wlfg", "LFG / Dungeon Finder catalog"}, {{'W','F','A','C'}, ".wfac", "factions", nullptr, "Faction catalog"}, {{'W','L','C','K'}, ".wlck", "locks", nullptr, "Lock catalog"}, {{'W','S','K','L'}, ".wskl", "skills", nullptr, "Skill catalog"}, diff --git a/tools/editor/cli_help.cpp b/tools/editor/cli_help.cpp index a0a67d53..83edc0e9 100644 --- a/tools/editor/cli_help.cpp +++ b/tools/editor/cli_help.cpp @@ -1529,6 +1529,16 @@ void printUsage(const char* argv0) { std::printf(" Export binary .wsch to a human-editable JSON sidecar (defaults to .wsch.json)\n"); std::printf(" --import-wsch-json [out-base]\n"); std::printf(" Import a .wsch.json sidecar back into binary .wsch (canBeImmune/Absorbed/Crit default to 1, canBeReflected to 0)\n"); + std::printf(" --gen-lfg [name]\n"); + std::printf(" Emit .wlfg starter: 3 classic 5-man dungeons (Ragefire Chasm / Wailing Caverns / Deadmines) with level brackets\n"); + std::printf(" --gen-lfg-heroic [name]\n"); + std::printf(" Emit .wlfg 5 WotLK 80-level heroic 5-mans with emblem rewards + first-clear achievement IDs\n"); + std::printf(" --gen-lfg-raid [name]\n"); + std::printf(" Emit .wlfg 3 raid entries (Naxxramas-25 / Ulduar-25 Hardmode / ToC-25 Mythic) with larger groupSize\n"); + std::printf(" --info-wlfg [--json]\n"); + std::printf(" Print WLFG entries (id / map / level range / minIlvl / difficulty / groupSize / role mask / expansion / rewards / name)\n"); + std::printf(" --validate-wlfg [--json]\n"); + std::printf(" Static checks: id+name+mapId required, difficulty 0..3 / expansion 0..3, minLevel<=maxLevel, recommended within range, role mask>0\n"); std::printf(" --gen-weather-temperate [zoneName]\n"); std::printf(" Emit .wow weather schedule: clear-dominant + occasional rain + fog (forest / grassland)\n"); std::printf(" --gen-weather-arctic [zoneName]\n"); diff --git a/tools/editor/cli_lfg_catalog.cpp b/tools/editor/cli_lfg_catalog.cpp new file mode 100644 index 00000000..d88da36a --- /dev/null +++ b/tools/editor/cli_lfg_catalog.cpp @@ -0,0 +1,259 @@ +#include "cli_lfg_catalog.hpp" +#include "cli_arg_parse.hpp" +#include "cli_box_emitter.hpp" + +#include "pipeline/wowee_lfg.hpp" +#include + +#include +#include +#include +#include +#include +#include + +namespace wowee { +namespace editor { +namespace cli { + +namespace { + +std::string stripWlfgExt(std::string base) { + stripExt(base, ".wlfg"); + return base; +} + +bool saveOrError(const wowee::pipeline::WoweeLFGDungeon& c, + const std::string& base, const char* cmd) { + if (!wowee::pipeline::WoweeLFGDungeonLoader::save(c, base)) { + std::fprintf(stderr, "%s: failed to save %s.wlfg\n", + cmd, base.c_str()); + return false; + } + return true; +} + +void printGenSummary(const wowee::pipeline::WoweeLFGDungeon& c, + const std::string& base) { + std::printf("Wrote %s.wlfg\n", base.c_str()); + std::printf(" catalog : %s\n", c.name.c_str()); + std::printf(" dungeons : %zu\n", c.entries.size()); +} + +int handleGenStarter(int& i, int argc, char** argv) { + std::string base = argv[++i]; + std::string name = "StarterLFG"; + if (parseOptArg(i, argc, argv)) name = argv[++i]; + base = stripWlfgExt(base); + auto c = wowee::pipeline::WoweeLFGDungeonLoader::makeStarter(name); + if (!saveOrError(c, base, "gen-lfg")) return 1; + printGenSummary(c, base); + return 0; +} + +int handleGenHeroic(int& i, int argc, char** argv) { + std::string base = argv[++i]; + std::string name = "HeroicLFG"; + if (parseOptArg(i, argc, argv)) name = argv[++i]; + base = stripWlfgExt(base); + auto c = wowee::pipeline::WoweeLFGDungeonLoader::makeHeroic(name); + if (!saveOrError(c, base, "gen-lfg-heroic")) return 1; + printGenSummary(c, base); + return 0; +} + +int handleGenRaid(int& i, int argc, char** argv) { + std::string base = argv[++i]; + std::string name = "RaidLFG"; + if (parseOptArg(i, argc, argv)) name = argv[++i]; + base = stripWlfgExt(base); + auto c = wowee::pipeline::WoweeLFGDungeonLoader::makeRaid(name); + if (!saveOrError(c, base, "gen-lfg-raid")) return 1; + printGenSummary(c, base); + return 0; +} + +int handleInfo(int& i, int argc, char** argv) { + std::string base = argv[++i]; + bool jsonOut = consumeJsonFlag(i, argc, argv); + base = stripWlfgExt(base); + if (!wowee::pipeline::WoweeLFGDungeonLoader::exists(base)) { + std::fprintf(stderr, "WLFG not found: %s.wlfg\n", base.c_str()); + return 1; + } + auto c = wowee::pipeline::WoweeLFGDungeonLoader::load(base); + if (jsonOut) { + nlohmann::json j; + j["wlfg"] = base + ".wlfg"; + j["name"] = c.name; + j["count"] = c.entries.size(); + nlohmann::json arr = nlohmann::json::array(); + for (const auto& e : c.entries) { + arr.push_back({ + {"dungeonId", e.dungeonId}, + {"name", e.name}, + {"description", e.description}, + {"mapId", e.mapId}, + {"minLevel", e.minLevel}, + {"maxLevel", e.maxLevel}, + {"recommendedLevel", e.recommendedLevel}, + {"minGearLevel", e.minGearLevel}, + {"difficulty", e.difficulty}, + {"difficultyName", wowee::pipeline::WoweeLFGDungeon::difficultyName(e.difficulty)}, + {"groupSize", e.groupSize}, + {"requiredRolesMask", e.requiredRolesMask}, + {"expansionRequired", e.expansionRequired}, + {"expansionRequiredName", wowee::pipeline::WoweeLFGDungeon::expansionRequiredName(e.expansionRequired)}, + {"queueRewardItemId", e.queueRewardItemId}, + {"queueRewardEmblemCount", e.queueRewardEmblemCount}, + {"firstClearAchievement", e.firstClearAchievement}, + }); + } + j["entries"] = arr; + std::printf("%s\n", j.dump(2).c_str()); + return 0; + } + std::printf("WLFG: %s.wlfg\n", base.c_str()); + std::printf(" catalog : %s\n", c.name.c_str()); + std::printf(" dungeons : %zu\n", c.entries.size()); + if (c.entries.empty()) return 0; + std::printf(" id map levels ilvl diff group roles exp emblem ach name\n"); + for (const auto& e : c.entries) { + std::printf(" %4u %4u %3u-%3u %3u %-9s %3u 0x%02x %-7s %3u %5u %s\n", + e.dungeonId, e.mapId, + e.minLevel, e.maxLevel, e.minGearLevel, + wowee::pipeline::WoweeLFGDungeon::difficultyName(e.difficulty), + e.groupSize, e.requiredRolesMask, + wowee::pipeline::WoweeLFGDungeon::expansionRequiredName(e.expansionRequired), + e.queueRewardEmblemCount, + e.firstClearAchievement, + e.name.c_str()); + } + return 0; +} + +int handleValidate(int& i, int argc, char** argv) { + std::string base = argv[++i]; + bool jsonOut = consumeJsonFlag(i, argc, argv); + base = stripWlfgExt(base); + if (!wowee::pipeline::WoweeLFGDungeonLoader::exists(base)) { + std::fprintf(stderr, + "validate-wlfg: WLFG not found: %s.wlfg\n", base.c_str()); + return 1; + } + auto c = wowee::pipeline::WoweeLFGDungeonLoader::load(base); + std::vector errors; + std::vector warnings; + if (c.entries.empty()) { + warnings.push_back("catalog has zero entries"); + } + std::vector idsSeen; + for (size_t k = 0; k < c.entries.size(); ++k) { + const auto& e = c.entries[k]; + std::string ctx = "entry " + std::to_string(k) + + " (id=" + std::to_string(e.dungeonId); + if (!e.name.empty()) ctx += " " + e.name; + ctx += ")"; + if (e.dungeonId == 0) + errors.push_back(ctx + ": dungeonId is 0"); + if (e.name.empty()) + errors.push_back(ctx + ": name is empty"); + if (e.mapId == 0) + errors.push_back(ctx + + ": mapId is 0 (dungeon has no instance map)"); + if (e.difficulty > wowee::pipeline::WoweeLFGDungeon::Hardmode) { + errors.push_back(ctx + ": difficulty " + + std::to_string(e.difficulty) + " not in 0..3"); + } + if (e.expansionRequired > wowee::pipeline::WoweeLFGDungeon::TurtleWoW) { + errors.push_back(ctx + ": expansionRequired " + + std::to_string(e.expansionRequired) + " not in 0..3"); + } + if (e.minLevel > e.maxLevel) { + errors.push_back(ctx + ": minLevel " + + std::to_string(e.minLevel) + " > maxLevel " + + std::to_string(e.maxLevel)); + } + if (e.recommendedLevel != 0 && + (e.recommendedLevel < e.minLevel || + e.recommendedLevel > e.maxLevel)) { + warnings.push_back(ctx + ": recommendedLevel " + + std::to_string(e.recommendedLevel) + + " outside [" + std::to_string(e.minLevel) + + ", " + std::to_string(e.maxLevel) + "]"); + } + // Common group sizes: 5 (dungeon), 10/25 (raid), + // 40 (vanilla raid). Other values are unusual but + // not technically wrong. + if (e.groupSize != 5 && e.groupSize != 10 && + e.groupSize != 25 && e.groupSize != 40) { + warnings.push_back(ctx + ": groupSize " + + std::to_string(e.groupSize) + + " is unusual (5 / 10 / 25 / 40 are canonical)"); + } + if (e.requiredRolesMask == 0) { + errors.push_back(ctx + + ": requiredRolesMask=0 (no role requirement — " + "queue won't form a balanced group)"); + } + for (uint32_t prev : idsSeen) { + if (prev == e.dungeonId) { + errors.push_back(ctx + ": duplicate dungeonId"); + break; + } + } + idsSeen.push_back(e.dungeonId); + } + bool ok = errors.empty(); + if (jsonOut) { + nlohmann::json j; + j["wlfg"] = base + ".wlfg"; + j["ok"] = ok; + j["errors"] = errors; + j["warnings"] = warnings; + std::printf("%s\n", j.dump(2).c_str()); + return ok ? 0 : 1; + } + std::printf("validate-wlfg: %s.wlfg\n", base.c_str()); + if (ok && warnings.empty()) { + std::printf(" OK — %zu dungeons, all dungeonIds unique, all level ranges valid\n", + c.entries.size()); + return 0; + } + if (!warnings.empty()) { + std::printf(" warnings (%zu):\n", warnings.size()); + for (const auto& w : warnings) + std::printf(" - %s\n", w.c_str()); + } + if (!errors.empty()) { + std::printf(" ERRORS (%zu):\n", errors.size()); + for (const auto& e : errors) + std::printf(" - %s\n", e.c_str()); + } + return ok ? 0 : 1; +} + +} // namespace + +bool handleLFGCatalog(int& i, int argc, char** argv, int& outRc) { + if (std::strcmp(argv[i], "--gen-lfg") == 0 && i + 1 < argc) { + outRc = handleGenStarter(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--gen-lfg-heroic") == 0 && i + 1 < argc) { + outRc = handleGenHeroic(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--gen-lfg-raid") == 0 && i + 1 < argc) { + outRc = handleGenRaid(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--info-wlfg") == 0 && i + 1 < argc) { + outRc = handleInfo(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--validate-wlfg") == 0 && i + 1 < argc) { + outRc = handleValidate(i, argc, argv); return true; + } + return false; +} + +} // namespace cli +} // namespace editor +} // namespace wowee diff --git a/tools/editor/cli_lfg_catalog.hpp b/tools/editor/cli_lfg_catalog.hpp new file mode 100644 index 00000000..94c93208 --- /dev/null +++ b/tools/editor/cli_lfg_catalog.hpp @@ -0,0 +1,11 @@ +#pragma once + +namespace wowee { +namespace editor { +namespace cli { + +bool handleLFGCatalog(int& i, int argc, char** argv, int& outRc); + +} // namespace cli +} // namespace editor +} // namespace wowee diff --git a/tools/editor/cli_list_formats.cpp b/tools/editor/cli_list_formats.cpp index 10fd0a48..36da2aa3 100644 --- a/tools/editor/cli_list_formats.cpp +++ b/tools/editor/cli_list_formats.cpp @@ -81,6 +81,7 @@ constexpr FormatRow kFormats[] = { {"WSMC", ".wsmc", "spells", "SpellMechanic.dbc + DR tables", "Spell mechanic / CC category catalog"}, {"WKBD", ".wkbd", "input", "KeyBinding.dbc + default binds", "Default keybinding catalog"}, {"WSCH", ".wsch", "spells", "SpellSchools.dbc + Resistances", "Spell school / damage type catalog"}, + {"WLFG", ".wlfg", "social", "LFGDungeons.dbc + LFG rewards", "LFG / Dungeon Finder catalog"}, // Additional pipeline catalogs without the alternating // gen/info/validate CLI surface (loaded by the engine