feat(pipeline): add WRUN (Wowee DK Rune Cost) catalog

62nd open format — replaces RuneCost.dbc plus the DK-specific
portions of ChrPowerType. Defines per-spell rune costs (Blood
/ Frost / Unholy) and runic-power generation / consumption
for the Death Knight class.

4 spell tree branches (BloodTree / FrostTree / UnholyTree /
Generic) classify which spec uses each rune cost. Each entry
binds a spell to its rune cost (how many of each rune kind
the spell consumes), an optional anyDeathConvertCost (extra
Death-rune-acceptable cost for procced abilities), and a
runicPowerCost (negative = generator, positive = spender).

Cross-references with prior formats — spellId points at
WSPL.spellId (the spell that uses this rune cost).

CLI: --gen-rune (3 baseline DK abilities — Death Strike
1F+1U + 20RP gen, Frost Strike pure 40 RP spender, Heart
Strike 1B + 10RP gen), --gen-rune-blood (4 blood-tree DK
abilities — Heart Strike, Death and Decay AoE, Vampiric
Blood tank cooldown, Rune Tap self-heal), --gen-rune-frost
(4 frost-tree — Frost Strike, Howling Blast AoE, Obliterate
finisher, Icy Touch ranged opener applying Frost Fever),
--info-wrun, --validate-wrun with --json variants. Validator
catches id+name+spellId required, branch 0..3, no rune cost
> 2 (DK only has 2 of each rune type so a higher cost can
never be paid), runicPowerCost > 100 (DK RP cap), no-cost
warning (spell consumes nothing — verify it's a
passive/stance/form), and high-RP-generator warning (> 25
RP per cast is unusual).

Format graph: 61 → 62 binary formats. CLI flag count: 840
→ 847.
This commit is contained in:
Kelsi 2026-05-09 20:52:19 -07:00
parent 2a31eeb2fe
commit ad603c0c44
10 changed files with 635 additions and 0 deletions

View file

@ -650,6 +650,7 @@ set(WOWEE_SOURCES
src/pipeline/wowee_char_features.cpp
src/pipeline/wowee_pvp.cpp
src/pipeline/wowee_bags.cpp
src/pipeline/wowee_runes.cpp
src/pipeline/custom_zone_discovery.cpp
src/pipeline/dbc_layout.cpp
@ -1454,6 +1455,7 @@ add_executable(wowee_editor
tools/editor/cli_char_features_catalog.cpp
tools/editor/cli_pvp_catalog.cpp
tools/editor/cli_bags_catalog.cpp
tools/editor/cli_runes_catalog.cpp
tools/editor/cli_quest_objective.cpp
tools/editor/cli_quest_reward.cpp
tools/editor/cli_clone.cpp
@ -1582,6 +1584,7 @@ add_executable(wowee_editor
src/pipeline/wowee_char_features.cpp
src/pipeline/wowee_pvp.cpp
src/pipeline/wowee_bags.cpp
src/pipeline/wowee_runes.cpp
src/pipeline/custom_zone_discovery.cpp
src/pipeline/terrain_mesh.cpp

View file

@ -0,0 +1,96 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace wowee {
namespace pipeline {
// Wowee Open Death Knight Rune Cost catalog (.wrun) — novel
// replacement for Blizzard's RuneCost.dbc plus the DK-specific
// portions of ChrPowerType. Defines per-spell rune costs
// (Blood / Frost / Unholy) and runic-power generation /
// consumption for the Death Knight class.
//
// Each entry binds a spell to its rune cost: how many of each
// rune kind the spell consumes, and how much runic power it
// generates (positive) or spends (negative). Death runes —
// the wildcard rune that fills any slot — are tracked
// implicitly: a spell with anyDeathConvertCost > 0 will
// consume Death runes preferentially over its specified type.
//
// Cross-references with previously-added formats:
// WRUN.entry.spellId → WSPL.spellId (the spell that uses
// this rune cost)
//
// Binary layout (little-endian):
// magic[4] = "WRUN"
// version (uint32) = current 1
// nameLen + name (catalog label)
// entryCount (uint32)
// entries (each):
// runeCostId (uint32)
// spellId (uint32)
// nameLen + name
// descLen + description
// bloodCost (uint8) / frostCost (uint8) /
// unholyCost (uint8) / anyDeathConvertCost (uint8)
// runicPowerCost (int16) / pad[2]
// spellTreeBranch (uint8) / pad[3]
struct WoweeRuneCost {
enum SpellTreeBranch : uint8_t {
BloodTree = 0, // tank-spec blood tree
FrostTree = 1, // 2H DPS frost tree
UnholyTree = 2, // pet-spec unholy tree
Generic = 3, // baseline non-tree-specific
};
struct Entry {
uint32_t runeCostId = 0;
uint32_t spellId = 0; // WSPL cross-ref
std::string name;
std::string description;
uint8_t bloodCost = 0; // # blood runes consumed
uint8_t frostCost = 0; // # frost runes consumed
uint8_t unholyCost = 0; // # unholy runes consumed
uint8_t anyDeathConvertCost = 0; // # additional Death-rune-OK runes
int16_t runicPowerCost = 0; // < 0 = generator, > 0 = spender
uint8_t spellTreeBranch = Generic;
};
std::string name;
std::vector<Entry> entries;
bool isValid() const { return !entries.empty(); }
const Entry* findById(uint32_t runeCostId) const;
static const char* spellTreeBranchName(uint8_t b);
};
class WoweeRuneCostLoader {
public:
static bool save(const WoweeRuneCost& cat,
const std::string& basePath);
static WoweeRuneCost load(const std::string& basePath);
static bool exists(const std::string& basePath);
// Preset emitters used by --gen-rune* variants.
//
// makeStarter — 3 baseline DK abilities (Death Strike
// 1B+1F, Frost Strike +20 RP spender,
// Heart Strike 1B generator).
// makeBlood — 4 blood-tree abilities (Heart Strike,
// Death and Decay, Vampiric Blood, Rune
// Tap) — tanking + self-heal kit.
// makeFrost — 4 frost-tree abilities (Frost Strike,
// Howling Blast, Obliterate, Icy Touch)
// — DPS rotation kit.
static WoweeRuneCost makeStarter(const std::string& catalogName);
static WoweeRuneCost makeBlood(const std::string& catalogName);
static WoweeRuneCost makeFrost(const std::string& catalogName);
};
} // namespace pipeline
} // namespace wowee

View file

@ -0,0 +1,245 @@
#include "pipeline/wowee_runes.hpp"
#include <cstdio>
#include <cstring>
#include <fstream>
namespace wowee {
namespace pipeline {
namespace {
constexpr char kMagic[4] = {'W', 'R', 'U', 'N'};
constexpr uint32_t kVersion = 1;
template <typename T>
void writePOD(std::ofstream& os, const T& v) {
os.write(reinterpret_cast<const char*>(&v), sizeof(T));
}
template <typename T>
bool readPOD(std::ifstream& is, T& v) {
is.read(reinterpret_cast<char*>(&v), sizeof(T));
return is.gcount() == static_cast<std::streamsize>(sizeof(T));
}
void writeStr(std::ofstream& os, const std::string& s) {
uint32_t n = static_cast<uint32_t>(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<std::streamsize>(n)) {
s.clear();
return false;
}
}
return true;
}
std::string normalizePath(std::string base) {
if (base.size() < 5 || base.substr(base.size() - 5) != ".wrun") {
base += ".wrun";
}
return base;
}
} // namespace
const WoweeRuneCost::Entry*
WoweeRuneCost::findById(uint32_t runeCostId) const {
for (const auto& e : entries)
if (e.runeCostId == runeCostId) return &e;
return nullptr;
}
const char* WoweeRuneCost::spellTreeBranchName(uint8_t b) {
switch (b) {
case BloodTree: return "blood";
case FrostTree: return "frost";
case UnholyTree: return "unholy";
case Generic: return "generic";
default: return "unknown";
}
}
bool WoweeRuneCostLoader::save(const WoweeRuneCost& 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<uint32_t>(cat.entries.size());
writePOD(os, entryCount);
for (const auto& e : cat.entries) {
writePOD(os, e.runeCostId);
writePOD(os, e.spellId);
writeStr(os, e.name);
writeStr(os, e.description);
writePOD(os, e.bloodCost);
writePOD(os, e.frostCost);
writePOD(os, e.unholyCost);
writePOD(os, e.anyDeathConvertCost);
writePOD(os, e.runicPowerCost);
uint8_t pad2[2] = {0, 0};
os.write(reinterpret_cast<const char*>(pad2), 2);
writePOD(os, e.spellTreeBranch);
uint8_t pad3[3] = {0, 0, 0};
os.write(reinterpret_cast<const char*>(pad3), 3);
}
return os.good();
}
WoweeRuneCost WoweeRuneCostLoader::load(const std::string& basePath) {
WoweeRuneCost 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.runeCostId) ||
!readPOD(is, e.spellId)) {
out.entries.clear(); return out;
}
if (!readStr(is, e.name) || !readStr(is, e.description)) {
out.entries.clear(); return out;
}
if (!readPOD(is, e.bloodCost) ||
!readPOD(is, e.frostCost) ||
!readPOD(is, e.unholyCost) ||
!readPOD(is, e.anyDeathConvertCost) ||
!readPOD(is, e.runicPowerCost)) {
out.entries.clear(); return out;
}
uint8_t pad2[2];
is.read(reinterpret_cast<char*>(pad2), 2);
if (is.gcount() != 2) { out.entries.clear(); return out; }
if (!readPOD(is, e.spellTreeBranch)) {
out.entries.clear(); return out;
}
uint8_t pad3[3];
is.read(reinterpret_cast<char*>(pad3), 3);
if (is.gcount() != 3) { out.entries.clear(); return out; }
}
return out;
}
bool WoweeRuneCostLoader::exists(const std::string& basePath) {
std::ifstream is(normalizePath(basePath), std::ios::binary);
return is.good();
}
WoweeRuneCost WoweeRuneCostLoader::makeStarter(
const std::string& catalogName) {
WoweeRuneCost c;
c.name = catalogName;
{
WoweeRuneCost::Entry e;
e.runeCostId = 1; e.name = "DeathStrikeRuneCost";
e.description = "Death Strike — costs 1 Frost + 1 Unholy, "
"generates 20 RP, heals based on damage taken.";
e.spellId = 49998; // canonical Death Strike spellId
e.frostCost = 1; e.unholyCost = 1;
e.runicPowerCost = -20; // generator
e.spellTreeBranch = WoweeRuneCost::Generic;
c.entries.push_back(e);
}
{
WoweeRuneCost::Entry e;
e.runeCostId = 2; e.name = "FrostStrikeRuneCost";
e.description = "Frost Strike — pure runic power spender, "
"no rune cost.";
e.spellId = 49143; // canonical Frost Strike
e.runicPowerCost = 40; // spender
e.spellTreeBranch = WoweeRuneCost::FrostTree;
c.entries.push_back(e);
}
{
WoweeRuneCost::Entry e;
e.runeCostId = 3; e.name = "HeartStrikeRuneCost";
e.description = "Heart Strike — costs 1 Blood, generates "
"10 RP, blood-tree filler.";
e.spellId = 55050; // canonical Heart Strike
e.bloodCost = 1;
e.runicPowerCost = -10; // generator
e.spellTreeBranch = WoweeRuneCost::BloodTree;
c.entries.push_back(e);
}
return c;
}
WoweeRuneCost WoweeRuneCostLoader::makeBlood(
const std::string& catalogName) {
WoweeRuneCost c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* name, uint32_t spellId,
uint8_t blood, uint8_t frost, uint8_t unholy,
int16_t rp, const char* desc) {
WoweeRuneCost::Entry e;
e.runeCostId = id; e.name = name; e.description = desc;
e.spellId = spellId;
e.bloodCost = blood;
e.frostCost = frost;
e.unholyCost = unholy;
e.runicPowerCost = rp;
e.spellTreeBranch = WoweeRuneCost::BloodTree;
c.entries.push_back(e);
};
add(100, "HeartStrike", 55050, 1, 0, 0, -10,
"Blood-tree filler — 1 Blood, generates 10 RP.");
add(101, "DeathAndDecay", 43265, 1, 1, 1, -15,
"AoE blood ability — 1 of each + 15 RP gain.");
add(102, "VampiricBlood", 55233, 0, 0, 0, 20,
"Tanking cooldown — pure 20 RP spender.");
add(103, "RuneTap", 48982, 1, 0, 0, 0,
"Self-heal — 1 Blood, no RP gain or cost.");
return c;
}
WoweeRuneCost WoweeRuneCostLoader::makeFrost(
const std::string& catalogName) {
WoweeRuneCost c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* name, uint32_t spellId,
uint8_t blood, uint8_t frost, uint8_t unholy,
int16_t rp, const char* desc) {
WoweeRuneCost::Entry e;
e.runeCostId = id; e.name = name; e.description = desc;
e.spellId = spellId;
e.bloodCost = blood;
e.frostCost = frost;
e.unholyCost = unholy;
e.runicPowerCost = rp;
e.spellTreeBranch = WoweeRuneCost::FrostTree;
c.entries.push_back(e);
};
add(200, "FrostStrike", 49143, 0, 0, 0, 40,
"Pure RP spender — 40 RP for big single-target hit.");
add(201, "HowlingBlast", 49184, 0, 1, 0, -10,
"AoE frost — 1 Frost, generates 10 RP.");
add(202, "Obliterate", 49020, 0, 1, 1, -15,
"Frost finisher — 1 Frost + 1 Unholy, generates 15 RP.");
add(203, "IcyTouch", 45477, 0, 1, 0, -10,
"Frost ranged opener — 1 Frost, generates 10 RP, "
"applies Frost Fever DoT.");
return c;
}
} // namespace pipeline
} // namespace wowee

View file

@ -188,6 +188,8 @@ const char* const kArgRequired[] = {
"--gen-bnk", "--gen-bnk-bank", "--gen-bnk-special",
"--info-wbnk", "--validate-wbnk",
"--export-wbnk-json", "--import-wbnk-json",
"--gen-rune", "--gen-rune-blood", "--gen-rune-frost",
"--info-wrun", "--validate-wrun",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",

View file

@ -97,6 +97,7 @@
#include "cli_char_features_catalog.hpp"
#include "cli_pvp_catalog.hpp"
#include "cli_bags_catalog.hpp"
#include "cli_runes_catalog.hpp"
#include "cli_quest_objective.hpp"
#include "cli_quest_reward.hpp"
#include "cli_clone.hpp"
@ -235,6 +236,7 @@ constexpr DispatchFn kDispatchTable[] = {
handleCharFeaturesCatalog,
handlePVPCatalog,
handleBagsCatalog,
handleRunesCatalog,
handleQuestObjective,
handleQuestReward,
handleClone,

View file

@ -64,6 +64,7 @@ constexpr FormatMagicEntry kFormats[] = {
{{'W','C','H','F'}, ".wchf", "chars", "--info-wchf", "Character hair / face customization catalog"},
{{'W','P','V','P'}, ".wpvp", "pvp", "--info-wpvp", "PvP honor rank + arena tier catalog"},
{{'W','B','N','K'}, ".wbnk", "items", "--info-wbnk", "Bag / bank slot catalog"},
{{'W','R','U','N'}, ".wrun", "spells", "--info-wrun", "Death Knight rune cost 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"},

View file

@ -1601,6 +1601,16 @@ void printUsage(const char* argv0) {
std::printf(" Export binary .wbnk to a human-editable JSON sidecar (defaults to <base>.wbnk.json)\n");
std::printf(" --import-wbnk-json <json-path> [out-base]\n");
std::printf(" Import a .wbnk.json sidecar back into binary .wbnk (accepts bagKind int OR name string; isUnlocked defaults to 1, mask to AnyContainer)\n");
std::printf(" --gen-rune <wrun-base> [name]\n");
std::printf(" Emit .wrun starter: 3 baseline DK rune costs (Death Strike 1F+1U, Frost Strike 40RP spender, Heart Strike 1B)\n");
std::printf(" --gen-rune-blood <wrun-base> [name]\n");
std::printf(" Emit .wrun 4 blood-tree DK rune costs (Heart Strike, Death and Decay AoE, Vampiric Blood, Rune Tap self-heal)\n");
std::printf(" --gen-rune-frost <wrun-base> [name]\n");
std::printf(" Emit .wrun 4 frost-tree DK rune costs (Frost Strike, Howling Blast AoE, Obliterate finisher, Icy Touch opener)\n");
std::printf(" --info-wrun <wrun-base> [--json]\n");
std::printf(" Print WRUN entries (id / spell / B/F/U costs / death-convertible / RP cost+arrow / branch / name)\n");
std::printf(" --validate-wrun <wrun-base> [--json]\n");
std::printf(" Static checks: id+name+spellId required, branch 0..3, no rune cost > 2 (DK has only 2 of each), runicPower > 100 cap, no-cost warning\n");
std::printf(" --gen-weather-temperate <wow-base> [zoneName]\n");
std::printf(" Emit .wow weather schedule: clear-dominant + occasional rain + fog (forest / grassland)\n");
std::printf(" --gen-weather-arctic <wow-base> [zoneName]\n");

View file

@ -86,6 +86,7 @@ constexpr FormatRow kFormats[] = {
{"WCHF", ".wchf", "chars", "CharHairGeosets + CharFacialHair", "Character hair / face customization catalog"},
{"WPVP", ".wpvp", "pvp", "honor / arena rank tables", "PvP honor rank + arena tier catalog"},
{"WBNK", ".wbnk", "items", "ItemBag.dbc + bank slots", "Bag / bank / special slot catalog"},
{"WRUN", ".wrun", "spells", "RuneCost.dbc + ChrPowerType DK", "Death Knight rune cost catalog"},
// Additional pipeline catalogs without the alternating
// gen/info/validate CLI surface (loaded by the engine

View file

@ -0,0 +1,264 @@
#include "cli_runes_catalog.hpp"
#include "cli_arg_parse.hpp"
#include "cli_box_emitter.hpp"
#include "pipeline/wowee_runes.hpp"
#include <nlohmann/json.hpp>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <string>
#include <vector>
namespace wowee {
namespace editor {
namespace cli {
namespace {
std::string stripWrunExt(std::string base) {
stripExt(base, ".wrun");
return base;
}
bool saveOrError(const wowee::pipeline::WoweeRuneCost& c,
const std::string& base, const char* cmd) {
if (!wowee::pipeline::WoweeRuneCostLoader::save(c, base)) {
std::fprintf(stderr, "%s: failed to save %s.wrun\n",
cmd, base.c_str());
return false;
}
return true;
}
void printGenSummary(const wowee::pipeline::WoweeRuneCost& c,
const std::string& base) {
std::printf("Wrote %s.wrun\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" costs : %zu\n", c.entries.size());
}
int handleGenStarter(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "StarterRuneCosts";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWrunExt(base);
auto c = wowee::pipeline::WoweeRuneCostLoader::makeStarter(name);
if (!saveOrError(c, base, "gen-rune")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenBlood(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "BloodTreeRuneCosts";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWrunExt(base);
auto c = wowee::pipeline::WoweeRuneCostLoader::makeBlood(name);
if (!saveOrError(c, base, "gen-rune-blood")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenFrost(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "FrostTreeRuneCosts";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWrunExt(base);
auto c = wowee::pipeline::WoweeRuneCostLoader::makeFrost(name);
if (!saveOrError(c, base, "gen-rune-frost")) 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 = stripWrunExt(base);
if (!wowee::pipeline::WoweeRuneCostLoader::exists(base)) {
std::fprintf(stderr, "WRUN not found: %s.wrun\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeRuneCostLoader::load(base);
if (jsonOut) {
nlohmann::json j;
j["wrun"] = base + ".wrun";
j["name"] = c.name;
j["count"] = c.entries.size();
nlohmann::json arr = nlohmann::json::array();
for (const auto& e : c.entries) {
arr.push_back({
{"runeCostId", e.runeCostId},
{"spellId", e.spellId},
{"name", e.name},
{"description", e.description},
{"bloodCost", e.bloodCost},
{"frostCost", e.frostCost},
{"unholyCost", e.unholyCost},
{"anyDeathConvertCost", e.anyDeathConvertCost},
{"runicPowerCost", e.runicPowerCost},
{"spellTreeBranch", e.spellTreeBranch},
{"spellTreeBranchName", wowee::pipeline::WoweeRuneCost::spellTreeBranchName(e.spellTreeBranch)},
});
}
j["entries"] = arr;
std::printf("%s\n", j.dump(2).c_str());
return 0;
}
std::printf("WRUN: %s.wrun\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" costs : %zu\n", c.entries.size());
if (c.entries.empty()) return 0;
std::printf(" id spell B F U Any RP branch name\n");
for (const auto& e : c.entries) {
const char* rpKind = e.runicPowerCost == 0
? " "
: (e.runicPowerCost > 0 ? "" : "");
std::printf(" %4u %5u %u %u %u %u %s%4d %-8s %s\n",
e.runeCostId, e.spellId,
e.bloodCost, e.frostCost, e.unholyCost,
e.anyDeathConvertCost,
rpKind, e.runicPowerCost,
wowee::pipeline::WoweeRuneCost::spellTreeBranchName(e.spellTreeBranch),
e.name.c_str());
}
std::printf(" legend: B/F/U/Any = blood/frost/unholy/death-convertible costs; "
"RP arrow shows generator (←) vs spender (→)\n");
return 0;
}
int handleValidate(int& i, int argc, char** argv) {
std::string base = argv[++i];
bool jsonOut = consumeJsonFlag(i, argc, argv);
base = stripWrunExt(base);
if (!wowee::pipeline::WoweeRuneCostLoader::exists(base)) {
std::fprintf(stderr,
"validate-wrun: WRUN not found: %s.wrun\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeRuneCostLoader::load(base);
std::vector<std::string> errors;
std::vector<std::string> warnings;
if (c.entries.empty()) {
warnings.push_back("catalog has zero entries");
}
std::vector<uint32_t> 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.runeCostId);
if (!e.name.empty()) ctx += " " + e.name;
ctx += ")";
if (e.runeCostId == 0)
errors.push_back(ctx + ": runeCostId is 0");
if (e.name.empty())
errors.push_back(ctx + ": name is empty");
if (e.spellId == 0)
errors.push_back(ctx +
": spellId is 0 (rune cost not bound to a WSPL spell)");
if (e.spellTreeBranch > wowee::pipeline::WoweeRuneCost::Generic) {
errors.push_back(ctx + ": spellTreeBranch " +
std::to_string(e.spellTreeBranch) + " not in 0..3");
}
// A DK has 6 runes total (2 of each kind) — a single
// ability cost shouldn't exceed 2 of any one type
// because the system can't satisfy it.
if (e.bloodCost > 2)
errors.push_back(ctx + ": bloodCost " +
std::to_string(e.bloodCost) + " exceeds 2 (DK only "
"has 2 blood runes)");
if (e.frostCost > 2)
errors.push_back(ctx + ": frostCost " +
std::to_string(e.frostCost) + " exceeds 2");
if (e.unholyCost > 2)
errors.push_back(ctx + ": unholyCost " +
std::to_string(e.unholyCost) + " exceeds 2");
// A spell with no rune cost AND no runic-power cost
// is weird — every DK ability either consumes
// resources, generates them, or applies a stance.
// We don't have stance info here, so warn.
bool noResourceCost = e.bloodCost == 0 && e.frostCost == 0 &&
e.unholyCost == 0 &&
e.anyDeathConvertCost == 0 &&
e.runicPowerCost == 0;
if (noResourceCost) {
warnings.push_back(ctx +
": no rune or runic-power cost — verify this is "
"intentional (passive / stance / forms only)");
}
// RP cost > 100 isn't possible — max RP cap is 100.
if (e.runicPowerCost > 100) {
errors.push_back(ctx +
": runicPowerCost " +
std::to_string(e.runicPowerCost) +
" exceeds 100 (DK runic power max)");
}
if (e.runicPowerCost < -25) {
warnings.push_back(ctx +
": runicPowerCost " +
std::to_string(e.runicPowerCost) +
" generates more than 25 RP per cast — unusual");
}
for (uint32_t prev : idsSeen) {
if (prev == e.runeCostId) {
errors.push_back(ctx + ": duplicate runeCostId");
break;
}
}
idsSeen.push_back(e.runeCostId);
}
bool ok = errors.empty();
if (jsonOut) {
nlohmann::json j;
j["wrun"] = base + ".wrun";
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-wrun: %s.wrun\n", base.c_str());
if (ok && warnings.empty()) {
std::printf(" OK — %zu rune costs, all runeCostIds unique, all costs within DK budget\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 handleRunesCatalog(int& i, int argc, char** argv, int& outRc) {
if (std::strcmp(argv[i], "--gen-rune") == 0 && i + 1 < argc) {
outRc = handleGenStarter(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-rune-blood") == 0 && i + 1 < argc) {
outRc = handleGenBlood(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-rune-frost") == 0 && i + 1 < argc) {
outRc = handleGenFrost(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--info-wrun") == 0 && i + 1 < argc) {
outRc = handleInfo(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--validate-wrun") == 0 && i + 1 < argc) {
outRc = handleValidate(i, argc, argv); return true;
}
return false;
}
} // namespace cli
} // namespace editor
} // namespace wowee

View file

@ -0,0 +1,11 @@
#pragma once
namespace wowee {
namespace editor {
namespace cli {
bool handleRunesCatalog(int& i, int argc, char** argv, int& outRc);
} // namespace cli
} // namespace editor
} // namespace wowee