diff --git a/CMakeLists.txt b/CMakeLists.txt index b42175dc..17a42407 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -653,6 +653,7 @@ set(WOWEE_SOURCES src/pipeline/wowee_runes.cpp src/pipeline/wowee_loading_screens.cpp src/pipeline/wowee_item_suffixes.cpp + src/pipeline/wowee_combat_ratings.cpp src/pipeline/custom_zone_discovery.cpp src/pipeline/dbc_layout.cpp @@ -1460,6 +1461,7 @@ add_executable(wowee_editor tools/editor/cli_runes_catalog.cpp tools/editor/cli_loading_screens_catalog.cpp tools/editor/cli_item_suffixes_catalog.cpp + tools/editor/cli_combat_ratings_catalog.cpp tools/editor/cli_quest_objective.cpp tools/editor/cli_quest_reward.cpp tools/editor/cli_clone.cpp @@ -1591,6 +1593,7 @@ add_executable(wowee_editor src/pipeline/wowee_runes.cpp src/pipeline/wowee_loading_screens.cpp src/pipeline/wowee_item_suffixes.cpp + src/pipeline/wowee_combat_ratings.cpp src/pipeline/custom_zone_discovery.cpp src/pipeline/terrain_mesh.cpp diff --git a/include/pipeline/wowee_combat_ratings.hpp b/include/pipeline/wowee_combat_ratings.hpp new file mode 100644 index 00000000..13239de7 --- /dev/null +++ b/include/pipeline/wowee_combat_ratings.hpp @@ -0,0 +1,103 @@ +#pragma once + +#include +#include +#include + +namespace wowee { +namespace pipeline { + +// Wowee Open Combat Rating Conversion catalog (.wcrr) — +// novel replacement for Blizzard's gtCombatRatings.dbc plus +// the per-level rating-to-percentage tables in +// gtRegenHPPerSpt.dbc and related stat-curve DBCs. Defines +// per-rating-type conversion factors at canonical level +// breakpoints (1 / 60 / 70 / 80) — the runtime linearly +// interpolates between breakpoints for intermediate levels. +// +// pointsAtLevelN is "how many rating points equal 1% of +// the benefit at that level." Higher level = more rating +// needed for the same %. So at level 60 you might need 14 +// crit rating per 1%, but at level 80 you need 45 — the +// curve gradually requires more rating to reach the same +// percentage benefit. +// +// Cross-references with previously-added formats: +// None — this catalog is consumed directly by the combat +// engine's stat resolver. WSPL spell scaling and WIT item +// stat conversion read this catalog at runtime. +// +// Binary layout (little-endian): +// magic[4] = "WCRR" +// version (uint32) = current 1 +// nameLen + name (catalog label) +// entryCount (uint32) +// entries (each): +// ratingType (uint32) +// nameLen + name +// descLen + description +// iconLen + iconPath +// ratingKind (uint8) / pad[3] +// pointsAtL1 (float) +// pointsAtL60 (float) +// pointsAtL70 (float) +// pointsAtL80 (float) +// maxBenefitPercent (float) +struct WoweeCombatRating { + enum RatingKind : uint8_t { + Combat = 0, // Hit / Crit / Haste / ExpertiseRating + Defense = 1, // Defense / Dodge / Parry / Block / ArmorPen + Spell = 2, // SpellPower / SpellPenetration / MP5 + Resilience = 3, // PvP damage reduction + Other = 4, // misc (mining, fishing skill caps) + }; + + struct Entry { + uint32_t ratingType = 0; + std::string name; + std::string description; + std::string iconPath; + uint8_t ratingKind = Combat; + float pointsAtL1 = 1.0f; + float pointsAtL60 = 14.0f; // canonical L60 base + float pointsAtL70 = 22.0f; // canonical L70 base + float pointsAtL80 = 45.0f; // canonical L80 base + float maxBenefitPercent = 100.0f; + }; + + std::string name; + std::vector entries; + + bool isValid() const { return !entries.empty(); } + + const Entry* findById(uint32_t ratingType) const; + + static const char* ratingKindName(uint8_t k); +}; + +class WoweeCombatRatingLoader { +public: + static bool save(const WoweeCombatRating& cat, + const std::string& basePath); + static WoweeCombatRating load(const std::string& basePath); + static bool exists(const std::string& basePath); + + // Preset emitters used by --gen-crr* variants. + // + // makeStarter — 3 essential combat ratings (Hit / + // Crit / Haste) at canonical WoW + // L80 conversion values. + // makeDefensive — 4 defensive ratings (Defense / Dodge + // / Parry / Block) for tank stat + // scaling. + // makeSpell — 3 spell-related ratings (SpellPower + // direct conversion, SpellPenetration, + // MP5 mana regeneration) for caster + // stat scaling. + static WoweeCombatRating makeStarter(const std::string& catalogName); + static WoweeCombatRating makeDefensive(const std::string& catalogName); + static WoweeCombatRating makeSpell(const std::string& catalogName); +}; + +} // namespace pipeline +} // namespace wowee diff --git a/src/pipeline/wowee_combat_ratings.cpp b/src/pipeline/wowee_combat_ratings.cpp new file mode 100644 index 00000000..d0a58910 --- /dev/null +++ b/src/pipeline/wowee_combat_ratings.cpp @@ -0,0 +1,244 @@ +#include "pipeline/wowee_combat_ratings.hpp" + +#include +#include +#include + +namespace wowee { +namespace pipeline { + +namespace { + +constexpr char kMagic[4] = {'W', 'C', 'R', 'R'}; +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) != ".wcrr") { + base += ".wcrr"; + } + return base; +} + +} // namespace + +const WoweeCombatRating::Entry* +WoweeCombatRating::findById(uint32_t ratingType) const { + for (const auto& e : entries) + if (e.ratingType == ratingType) return &e; + return nullptr; +} + +const char* WoweeCombatRating::ratingKindName(uint8_t k) { + switch (k) { + case Combat: return "combat"; + case Defense: return "defense"; + case Spell: return "spell"; + case Resilience: return "resilience"; + case Other: return "other"; + default: return "unknown"; + } +} + +bool WoweeCombatRatingLoader::save(const WoweeCombatRating& 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.ratingType); + writeStr(os, e.name); + writeStr(os, e.description); + writeStr(os, e.iconPath); + writePOD(os, e.ratingKind); + uint8_t pad3[3] = {0, 0, 0}; + os.write(reinterpret_cast(pad3), 3); + writePOD(os, e.pointsAtL1); + writePOD(os, e.pointsAtL60); + writePOD(os, e.pointsAtL70); + writePOD(os, e.pointsAtL80); + writePOD(os, e.maxBenefitPercent); + } + return os.good(); +} + +WoweeCombatRating WoweeCombatRatingLoader::load( + const std::string& basePath) { + WoweeCombatRating 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.ratingType)) { + out.entries.clear(); return out; + } + if (!readStr(is, e.name) || !readStr(is, e.description) || + !readStr(is, e.iconPath)) { + out.entries.clear(); return out; + } + if (!readPOD(is, e.ratingKind)) { + out.entries.clear(); return out; + } + uint8_t pad3[3]; + is.read(reinterpret_cast(pad3), 3); + if (is.gcount() != 3) { out.entries.clear(); return out; } + if (!readPOD(is, e.pointsAtL1) || + !readPOD(is, e.pointsAtL60) || + !readPOD(is, e.pointsAtL70) || + !readPOD(is, e.pointsAtL80) || + !readPOD(is, e.maxBenefitPercent)) { + out.entries.clear(); return out; + } + } + return out; +} + +bool WoweeCombatRatingLoader::exists(const std::string& basePath) { + std::ifstream is(normalizePath(basePath), std::ios::binary); + return is.good(); +} + +WoweeCombatRating WoweeCombatRatingLoader::makeStarter( + const std::string& catalogName) { + WoweeCombatRating c; + c.name = catalogName; + auto add = [&](uint32_t id, const char* name, float l1, float l60, + float l70, float l80, float maxPct, + const char* desc) { + WoweeCombatRating::Entry e; + e.ratingType = id; e.name = name; e.description = desc; + e.iconPath = std::string("Interface/Icons/Spell_") + + name + ".blp"; + e.ratingKind = WoweeCombatRating::Combat; + e.pointsAtL1 = l1; + e.pointsAtL60 = l60; + e.pointsAtL70 = l70; + e.pointsAtL80 = l80; + e.maxBenefitPercent = maxPct; + c.entries.push_back(e); + }; + // Canonical WoW WotLK conversion values. + add(1, "HitRating", 1.0f, 10.0f, 15.7f, 32.79f, 100.0f, + "Increases chance to hit. ~32.79 hit rating = 1% hit " + "at level 80."); + add(2, "CritRating", 1.0f, 14.0f, 22.1f, 45.91f, 100.0f, + "Increases critical strike chance. ~45.91 crit rating " + "= 1% crit at level 80."); + add(3, "HasteRating", 1.0f, 10.0f, 15.8f, 32.79f, 100.0f, + "Increases attack and casting speed. ~32.79 haste " + "rating = 1% haste at level 80."); + return c; +} + +WoweeCombatRating WoweeCombatRatingLoader::makeDefensive( + const std::string& catalogName) { + WoweeCombatRating c; + c.name = catalogName; + auto add = [&](uint32_t id, const char* name, float l1, float l60, + float l70, float l80, float maxPct, + const char* desc) { + WoweeCombatRating::Entry e; + e.ratingType = id; e.name = name; e.description = desc; + e.iconPath = std::string("Interface/Icons/Spell_Defense_") + + name + ".blp"; + e.ratingKind = WoweeCombatRating::Defense; + e.pointsAtL1 = l1; + e.pointsAtL60 = l60; + e.pointsAtL70 = l70; + e.pointsAtL80 = l80; + e.maxBenefitPercent = maxPct; + c.entries.push_back(e); + }; + add(100, "DefenseRating", 1.0f, 1.5f, 2.4f, 4.92f, 100.0f, + "Increases defense skill. ~4.92 = 1 defense at L80; " + "1 defense reduces crit chance against you by 0.04%."); + add(101, "DodgeRating", 1.0f, 12.0f, 18.9f, 39.34f, 60.0f, + "Increases dodge chance. Diminishing returns soft cap " + "around 30%."); + add(102, "ParryRating", 1.0f, 13.0f, 20.5f, 43.84f, 50.0f, + "Increases parry chance. Tank-only stat."); + add(103, "BlockRating", 1.0f, 5.0f, 7.9f, 16.39f, 60.0f, + "Increases shield block chance."); + return c; +} + +WoweeCombatRating WoweeCombatRatingLoader::makeSpell( + const std::string& catalogName) { + WoweeCombatRating c; + c.name = catalogName; + auto add = [&](uint32_t id, const char* name, float l1, float l60, + float l70, float l80, float maxPct, + uint8_t kind, const char* desc) { + WoweeCombatRating::Entry e; + e.ratingType = id; e.name = name; e.description = desc; + e.iconPath = std::string("Interface/Icons/Spell_Holy_") + + name + ".blp"; + e.ratingKind = kind; + e.pointsAtL1 = l1; + e.pointsAtL60 = l60; + e.pointsAtL70 = l70; + e.pointsAtL80 = l80; + e.maxBenefitPercent = maxPct; + c.entries.push_back(e); + }; + add(200, "SpellPower", 1.0f, 1.0f, 1.0f, 1.0f, 100.0f, + WoweeCombatRating::Spell, + "Direct 1:1 conversion — 1 spell power adds 1 to " + "spell damage / heal scaling pre-coefficient."); + add(201, "SpellPenetration", 1.0f, 1.0f, 1.0f, 1.0f, 130.0f, + WoweeCombatRating::Spell, + "Reduces target's spell resistance by 1 per point " + "(no level scaling — flat)."); + add(202, "ManaPer5Seconds", 1.0f, 1.0f, 1.0f, 1.0f, 9999.0f, + WoweeCombatRating::Spell, + "Mana regenerated every 5 seconds (combat + out-of-" + "combat). Direct value, no conversion."); + return c; +} + +} // namespace pipeline +} // namespace wowee diff --git a/tools/editor/cli_arg_required.cpp b/tools/editor/cli_arg_required.cpp index d92ad52f..0858a751 100644 --- a/tools/editor/cli_arg_required.cpp +++ b/tools/editor/cli_arg_required.cpp @@ -197,6 +197,8 @@ const char* const kArgRequired[] = { "--gen-suf", "--gen-suf-magical", "--gen-suf-pvp", "--info-wsuf", "--validate-wsuf", "--export-wsuf-json", "--import-wsuf-json", + "--gen-crr", "--gen-crr-defensive", "--gen-crr-spell", + "--info-wcrr", "--validate-wcrr", "--gen-weather-temperate", "--gen-weather-arctic", "--gen-weather-desert", "--gen-weather-stormy", "--gen-zone-atmosphere", diff --git a/tools/editor/cli_combat_ratings_catalog.cpp b/tools/editor/cli_combat_ratings_catalog.cpp new file mode 100644 index 00000000..9cd62881 --- /dev/null +++ b/tools/editor/cli_combat_ratings_catalog.cpp @@ -0,0 +1,252 @@ +#include "cli_combat_ratings_catalog.hpp" +#include "cli_arg_parse.hpp" +#include "cli_box_emitter.hpp" + +#include "pipeline/wowee_combat_ratings.hpp" +#include + +#include +#include +#include +#include +#include +#include + +namespace wowee { +namespace editor { +namespace cli { + +namespace { + +std::string stripWcrrExt(std::string base) { + stripExt(base, ".wcrr"); + return base; +} + +bool saveOrError(const wowee::pipeline::WoweeCombatRating& c, + const std::string& base, const char* cmd) { + if (!wowee::pipeline::WoweeCombatRatingLoader::save(c, base)) { + std::fprintf(stderr, "%s: failed to save %s.wcrr\n", + cmd, base.c_str()); + return false; + } + return true; +} + +void printGenSummary(const wowee::pipeline::WoweeCombatRating& c, + const std::string& base) { + std::printf("Wrote %s.wcrr\n", base.c_str()); + std::printf(" catalog : %s\n", c.name.c_str()); + std::printf(" ratings : %zu\n", c.entries.size()); +} + +int handleGenStarter(int& i, int argc, char** argv) { + std::string base = argv[++i]; + std::string name = "StarterCombatRatings"; + if (parseOptArg(i, argc, argv)) name = argv[++i]; + base = stripWcrrExt(base); + auto c = wowee::pipeline::WoweeCombatRatingLoader::makeStarter(name); + if (!saveOrError(c, base, "gen-crr")) return 1; + printGenSummary(c, base); + return 0; +} + +int handleGenDefensive(int& i, int argc, char** argv) { + std::string base = argv[++i]; + std::string name = "DefensiveCombatRatings"; + if (parseOptArg(i, argc, argv)) name = argv[++i]; + base = stripWcrrExt(base); + auto c = wowee::pipeline::WoweeCombatRatingLoader::makeDefensive(name); + if (!saveOrError(c, base, "gen-crr-defensive")) return 1; + printGenSummary(c, base); + return 0; +} + +int handleGenSpell(int& i, int argc, char** argv) { + std::string base = argv[++i]; + std::string name = "SpellCombatRatings"; + if (parseOptArg(i, argc, argv)) name = argv[++i]; + base = stripWcrrExt(base); + auto c = wowee::pipeline::WoweeCombatRatingLoader::makeSpell(name); + if (!saveOrError(c, base, "gen-crr-spell")) 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 = stripWcrrExt(base); + if (!wowee::pipeline::WoweeCombatRatingLoader::exists(base)) { + std::fprintf(stderr, "WCRR not found: %s.wcrr\n", base.c_str()); + return 1; + } + auto c = wowee::pipeline::WoweeCombatRatingLoader::load(base); + if (jsonOut) { + nlohmann::json j; + j["wcrr"] = base + ".wcrr"; + j["name"] = c.name; + j["count"] = c.entries.size(); + nlohmann::json arr = nlohmann::json::array(); + for (const auto& e : c.entries) { + arr.push_back({ + {"ratingType", e.ratingType}, + {"name", e.name}, + {"description", e.description}, + {"iconPath", e.iconPath}, + {"ratingKind", e.ratingKind}, + {"ratingKindName", wowee::pipeline::WoweeCombatRating::ratingKindName(e.ratingKind)}, + {"pointsAtL1", e.pointsAtL1}, + {"pointsAtL60", e.pointsAtL60}, + {"pointsAtL70", e.pointsAtL70}, + {"pointsAtL80", e.pointsAtL80}, + {"maxBenefitPercent", e.maxBenefitPercent}, + }); + } + j["entries"] = arr; + std::printf("%s\n", j.dump(2).c_str()); + return 0; + } + std::printf("WCRR: %s.wcrr\n", base.c_str()); + std::printf(" catalog : %s\n", c.name.c_str()); + std::printf(" ratings : %zu\n", c.entries.size()); + if (c.entries.empty()) return 0; + std::printf(" id kind L1 L60 L70 L80 maxPct name\n"); + for (const auto& e : c.entries) { + std::printf(" %4u %-9s %5.2f %5.2f %5.2f %6.2f %5.1f %s\n", + e.ratingType, + wowee::pipeline::WoweeCombatRating::ratingKindName(e.ratingKind), + e.pointsAtL1, e.pointsAtL60, e.pointsAtL70, + e.pointsAtL80, e.maxBenefitPercent, + e.name.c_str()); + } + std::printf(" legend: pointsAtLN = how many rating points = 1%% benefit at level N\n"); + return 0; +} + +int handleValidate(int& i, int argc, char** argv) { + std::string base = argv[++i]; + bool jsonOut = consumeJsonFlag(i, argc, argv); + base = stripWcrrExt(base); + if (!wowee::pipeline::WoweeCombatRatingLoader::exists(base)) { + std::fprintf(stderr, + "validate-wcrr: WCRR not found: %s.wcrr\n", base.c_str()); + return 1; + } + auto c = wowee::pipeline::WoweeCombatRatingLoader::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.ratingType); + if (!e.name.empty()) ctx += " " + e.name; + ctx += ")"; + if (e.ratingType == 0) + errors.push_back(ctx + ": ratingType is 0"); + if (e.name.empty()) + errors.push_back(ctx + ": name is empty"); + if (e.ratingKind > wowee::pipeline::WoweeCombatRating::Other) { + errors.push_back(ctx + ": ratingKind " + + std::to_string(e.ratingKind) + " not in 0..4"); + } + // Conversion floor must be > 0 — division by zero + // would crash the stat resolver. + if (e.pointsAtL1 <= 0.0f || e.pointsAtL60 <= 0.0f || + e.pointsAtL70 <= 0.0f || e.pointsAtL80 <= 0.0f) { + errors.push_back(ctx + + ": one or more pointsAtLN values <= 0 " + "(divide-by-zero risk in stat resolver)"); + } + if (e.maxBenefitPercent <= 0.0f) { + errors.push_back(ctx + + ": maxBenefitPercent " + + std::to_string(e.maxBenefitPercent) + + " <= 0 (rating would never grant any benefit)"); + } + // The conversion curve should be monotonic-ascending + // (more rating needed at higher levels). A flat or + // descending curve is plausible only for direct 1:1 + // ratings (SpellPower / SpellPenetration / MP5). + bool flat = e.pointsAtL1 == e.pointsAtL60 && + e.pointsAtL60 == e.pointsAtL70 && + e.pointsAtL70 == e.pointsAtL80; + bool ascending = e.pointsAtL1 <= e.pointsAtL60 && + e.pointsAtL60 <= e.pointsAtL70 && + e.pointsAtL70 <= e.pointsAtL80; + if (!flat && !ascending) { + warnings.push_back(ctx + + ": conversion curve non-monotonic (" + + std::to_string(e.pointsAtL1) + " / " + + std::to_string(e.pointsAtL60) + " / " + + std::to_string(e.pointsAtL70) + " / " + + std::to_string(e.pointsAtL80) + + ") — typically rating cost ascends with level"); + } + for (uint32_t prev : idsSeen) { + if (prev == e.ratingType) { + errors.push_back(ctx + ": duplicate ratingType"); + break; + } + } + idsSeen.push_back(e.ratingType); + } + bool ok = errors.empty(); + if (jsonOut) { + nlohmann::json j; + j["wcrr"] = base + ".wcrr"; + 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-wcrr: %s.wcrr\n", base.c_str()); + if (ok && warnings.empty()) { + std::printf(" OK — %zu ratings, all ratingTypes unique, all curves monotonic\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 handleCombatRatingsCatalog(int& i, int argc, char** argv, + int& outRc) { + if (std::strcmp(argv[i], "--gen-crr") == 0 && i + 1 < argc) { + outRc = handleGenStarter(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--gen-crr-defensive") == 0 && + i + 1 < argc) { + outRc = handleGenDefensive(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--gen-crr-spell") == 0 && i + 1 < argc) { + outRc = handleGenSpell(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--info-wcrr") == 0 && i + 1 < argc) { + outRc = handleInfo(i, argc, argv); return true; + } + if (std::strcmp(argv[i], "--validate-wcrr") == 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_combat_ratings_catalog.hpp b/tools/editor/cli_combat_ratings_catalog.hpp new file mode 100644 index 00000000..ad23eef3 --- /dev/null +++ b/tools/editor/cli_combat_ratings_catalog.hpp @@ -0,0 +1,12 @@ +#pragma once + +namespace wowee { +namespace editor { +namespace cli { + +bool handleCombatRatingsCatalog(int& i, int argc, char** argv, + int& outRc); + +} // namespace cli +} // namespace editor +} // namespace wowee diff --git a/tools/editor/cli_dispatch.cpp b/tools/editor/cli_dispatch.cpp index 2d1522f5..d34343dd 100644 --- a/tools/editor/cli_dispatch.cpp +++ b/tools/editor/cli_dispatch.cpp @@ -100,6 +100,7 @@ #include "cli_runes_catalog.hpp" #include "cli_loading_screens_catalog.hpp" #include "cli_item_suffixes_catalog.hpp" +#include "cli_combat_ratings_catalog.hpp" #include "cli_quest_objective.hpp" #include "cli_quest_reward.hpp" #include "cli_clone.hpp" @@ -241,6 +242,7 @@ constexpr DispatchFn kDispatchTable[] = { handleRunesCatalog, handleLoadingScreensCatalog, handleItemSuffixesCatalog, + handleCombatRatingsCatalog, handleQuestObjective, handleQuestReward, handleClone, diff --git a/tools/editor/cli_format_table.cpp b/tools/editor/cli_format_table.cpp index 2788062b..346d8f5f 100644 --- a/tools/editor/cli_format_table.cpp +++ b/tools/editor/cli_format_table.cpp @@ -67,6 +67,7 @@ constexpr FormatMagicEntry kFormats[] = { {{'W','R','U','N'}, ".wrun", "spells", "--info-wrun", "Death Knight rune cost catalog"}, {{'W','L','D','S'}, ".wlds", "ui", "--info-wlds", "Loading screen catalog"}, {{'W','S','U','F'}, ".wsuf", "items", "--info-wsuf", "Item random-suffix catalog"}, + {{'W','C','R','R'}, ".wcrr", "stats", "--info-wcrr", "Combat rating conversion 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 b7d1563e..3032856e 100644 --- a/tools/editor/cli_help.cpp +++ b/tools/editor/cli_help.cpp @@ -1643,6 +1643,16 @@ void printUsage(const char* argv0) { std::printf(" Export binary .wsuf to a human-editable JSON sidecar with nested stats[] arrays (defaults to .wsuf.json)\n"); std::printf(" --import-wsuf-json [out-base]\n"); std::printf(" Import a .wsuf.json sidecar back into binary .wsuf (accepts suffixCategory int OR name string; missing stat slots cleared)\n"); + std::printf(" --gen-crr [name]\n"); + std::printf(" Emit .wcrr starter: 3 essential combat ratings (Hit / Crit / Haste) at canonical L80 conversion values\n"); + std::printf(" --gen-crr-defensive [name]\n"); + std::printf(" Emit .wcrr 4 defensive ratings (Defense / Dodge / Parry / Block) for tank stat scaling with diminishing returns caps\n"); + std::printf(" --gen-crr-spell [name]\n"); + std::printf(" Emit .wcrr 3 spell ratings (SpellPower direct / SpellPenetration flat / MP5 mana regen) for caster stat scaling\n"); + std::printf(" --info-wcrr [--json]\n"); + std::printf(" Print WCRR entries (id / kind / pointsAtL1/L60/L70/L80 conversion floors / max benefit pct / name)\n"); + std::printf(" --validate-wcrr [--json]\n"); + std::printf(" Static checks: id+name required, kind 0..4, all pointsAtLN > 0 (div-by-zero risk), maxPct > 0, monotonic ascending curve\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_list_formats.cpp b/tools/editor/cli_list_formats.cpp index 7f48d898..32fd3fb6 100644 --- a/tools/editor/cli_list_formats.cpp +++ b/tools/editor/cli_list_formats.cpp @@ -89,6 +89,7 @@ constexpr FormatRow kFormats[] = { {"WRUN", ".wrun", "spells", "RuneCost.dbc + ChrPowerType DK", "Death Knight rune cost catalog"}, {"WLDS", ".wlds", "ui", "LoadingScreens.dbc", "Per-zone loading screen catalog"}, {"WSUF", ".wsuf", "items", "ItemRandomProperties + Suffix", "Item random-suffix bonus catalog"}, + {"WCRR", ".wcrr", "stats", "gtCombatRatings.dbc + curves", "Combat rating conversion catalog"}, // Additional pipeline catalogs without the alternating // gen/info/validate CLI surface (loaded by the engine