mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-11 03:23:51 +00:00
feat(editor): add WAUR (Spell Aura Type) — companion to WSEF, CLI flag count breaks 1000
Open replacement for the SpellEffect.EffectAuraType field
meanings used when SpellEffect.Effect=APPLY_AURA. Defines what
each aura-type integer value actually does once an aura is
attached to a unit — PERIODIC_DAMAGE ticks damage every N
seconds, MOD_STAT adds a stat bonus, MOD_INCREASE_SPEED scales
movement, MOD_DAMAGE_PERCENT_DONE scales spell power, etc.
Companion to WSEF — together they cover the full spell-effect
classification space:
WSEF: outer effect ID — what does the effect DO?
(APPLY_AURA, SCHOOL_DAMAGE, HEAL, etc)
WAUR: inner aura type — when WSEF=APPLY_AURA, what KIND
of aura is applied? (PERIODIC_DAMAGE, MOD_STAT,
STUN, ROOT, etc)
Nine auraKind values (Periodic / StatMod / DamageMod /
Movement / Visual / Trigger / Resource / Control / Misc)
classify the major behavior families. Periodic auras carry an
updateFrequencyMs (canonical 3s for DoT/HoT, 2s for energize,
1s for fast triggers). Stackable auras carry a maxStackCount.
Cross-references back to WSEF (this catalog is the secondary
classification that WSEF entry id 6 (APPLY_AURA) dispatches
into) and forward to WSPL (spell entries with effect=APPLY_AURA
reference an auraTypeId here).
Three preset emitters: --gen-aur (5 periodic auras with
canonical tick intervals), --gen-aur-stats (5 stat-modifier
auras instantly applied on attach), --gen-aur-movement (4
movement-impairing CC auras typical of crowd-control spells).
Validation enforces name presence, auraKind 0..8, targetingHint
0..3, no duplicate ids; errors on Periodic kind without
updateFrequencyMs (would never tick); warns on:
- non-Periodic/Trigger kinds with updateFrequencyMs > 0
(engine ignores tick interval)
- maxStackCount > 0 with isStackable=false (cap unreachable)
Wired through the cross-format table; WAUR appears automatically
in all 15 cross-format utilities. Format count 82 -> 83;
CLI flag count 996 -> 1001 — broke the 1000-flag mark.
This commit is contained in:
parent
9f5678f67e
commit
7d3430c8fe
10 changed files with 643 additions and 0 deletions
|
|
@ -671,6 +671,7 @@ set(WOWEE_SOURCES
|
|||
src/pipeline/wowee_spell_reagents.cpp
|
||||
src/pipeline/wowee_achievement_criteria.cpp
|
||||
src/pipeline/wowee_spell_effect_types.cpp
|
||||
src/pipeline/wowee_spell_aura_types.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/dbc_layout.cpp
|
||||
|
||||
|
|
@ -1502,6 +1503,7 @@ add_executable(wowee_editor
|
|||
tools/editor/cli_spell_reagents_catalog.cpp
|
||||
tools/editor/cli_achievement_criteria_catalog.cpp
|
||||
tools/editor/cli_spell_effect_types_catalog.cpp
|
||||
tools/editor/cli_spell_aura_types_catalog.cpp
|
||||
tools/editor/cli_quest_objective.cpp
|
||||
tools/editor/cli_quest_reward.cpp
|
||||
tools/editor/cli_clone.cpp
|
||||
|
|
@ -1651,6 +1653,7 @@ add_executable(wowee_editor
|
|||
src/pipeline/wowee_spell_reagents.cpp
|
||||
src/pipeline/wowee_achievement_criteria.cpp
|
||||
src/pipeline/wowee_spell_effect_types.cpp
|
||||
src/pipeline/wowee_spell_aura_types.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/terrain_mesh.cpp
|
||||
|
||||
|
|
|
|||
120
include/pipeline/wowee_spell_aura_types.hpp
Normal file
120
include/pipeline/wowee_spell_aura_types.hpp
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Spell Aura Type catalog (.waur) — novel
|
||||
// replacement for the SpellEffect.EffectAuraType field
|
||||
// meanings used when SpellEffect.Effect=APPLY_AURA.
|
||||
// Defines what each aura-type integer value actually does
|
||||
// once an aura is attached to a unit — PERIODIC_DAMAGE
|
||||
// ticks damage every N seconds, MOD_STAT adds a stat
|
||||
// bonus, MOD_INCREASE_SPEED scales movement speed,
|
||||
// MOD_DAMAGE_PERCENT_DONE scales spell power, etc.
|
||||
//
|
||||
// Companion to WSEF (Spell Effect Type) — together they
|
||||
// cover the full spell-effect classification space:
|
||||
// WSEF: outer effect ID (what does the effect DO?)
|
||||
// WAUR: inner aura type (when WSEF=APPLY_AURA, what
|
||||
// KIND of aura is applied?)
|
||||
//
|
||||
// WotLK's Spell.dbc has 300+ aura types, each with its
|
||||
// own resolver in the aura update loop. This catalog
|
||||
// lets the engine look up "given auraType=3, how often
|
||||
// do I tick and what behavior do I run?" via a single
|
||||
// table lookup.
|
||||
//
|
||||
// Cross-references with previously-added formats:
|
||||
// WSPL: spells with effect=APPLY_AURA reference an
|
||||
// auraTypeId here.
|
||||
// WSEF: this catalog is the secondary classification
|
||||
// that WSEF entry id 6 (APPLY_AURA) dispatches
|
||||
// into.
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WAUR"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// auraTypeId (uint32)
|
||||
// nameLen + name
|
||||
// descLen + description
|
||||
// auraKind (uint8) / targetingHint (uint8)
|
||||
// isStackable (uint8) / maxStackCount (uint8)
|
||||
// updateFrequencyMs (uint32)
|
||||
// iconColorRGBA (uint32)
|
||||
struct WoweeSpellAuraType {
|
||||
enum AuraKind : uint8_t {
|
||||
Periodic = 0, // ticks damage/heal/energize over time
|
||||
StatMod = 1, // modifies a stat (Strength, Stamina)
|
||||
DamageMod = 2, // modifies damage done/taken
|
||||
Movement = 3, // changes mobility (Stun, Root, Snare)
|
||||
Visual = 4, // pure cosmetic (glow, particle effect)
|
||||
Trigger = 5, // periodic trigger of another spell
|
||||
Resource = 6, // affects power regen / consumption
|
||||
Control = 7, // mind control / charm / fear
|
||||
Misc = 8, // catch-all
|
||||
};
|
||||
|
||||
enum TargetingHint : uint8_t {
|
||||
AnyUnit = 0, // can apply to any unit
|
||||
SelfOnly = 1, // caster-only
|
||||
HostileOnly = 2, // hostile-target only
|
||||
BeneficialOnly = 3, // friendly-target only
|
||||
};
|
||||
|
||||
struct Entry {
|
||||
uint32_t auraTypeId = 0;
|
||||
std::string name;
|
||||
std::string description;
|
||||
uint8_t auraKind = Periodic;
|
||||
uint8_t targetingHint = AnyUnit;
|
||||
uint8_t isStackable = 0; // 0/1 bool
|
||||
uint8_t maxStackCount = 0; // 0 = no cap (when stackable)
|
||||
uint32_t updateFrequencyMs = 0; // periodic tick interval; 0 for non-periodic
|
||||
uint32_t iconColorRGBA = 0xFFFFFFFFu;
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::vector<Entry> entries;
|
||||
|
||||
bool isValid() const { return !entries.empty(); }
|
||||
|
||||
const Entry* findById(uint32_t auraTypeId) const;
|
||||
|
||||
static const char* auraKindName(uint8_t k);
|
||||
static const char* targetingHintName(uint8_t t);
|
||||
};
|
||||
|
||||
class WoweeSpellAuraTypeLoader {
|
||||
public:
|
||||
static bool save(const WoweeSpellAuraType& cat,
|
||||
const std::string& basePath);
|
||||
static WoweeSpellAuraType load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-aur* variants.
|
||||
//
|
||||
// makePeriodic — 5 periodic auras (PeriodicDamage,
|
||||
// PeriodicHeal, PeriodicEnergize,
|
||||
// PeriodicLeech, PeriodicTriggerSpell)
|
||||
// all with 3000ms canonical tick.
|
||||
// makeStatMod — 5 stat modifiers (ModStat,
|
||||
// ModResistance, ModDamageDone,
|
||||
// ModHaste, ModCritPercent) — non-
|
||||
// periodic, instantly applied.
|
||||
// makeMovement — 4 movement-impairing auras (Stun,
|
||||
// Root, ModDecreaseSpeed, ModConfuse)
|
||||
// typically applied by CC spells.
|
||||
static WoweeSpellAuraType makePeriodic(const std::string& catalogName);
|
||||
static WoweeSpellAuraType makeStatMod(const std::string& catalogName);
|
||||
static WoweeSpellAuraType makeMovement(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
247
src/pipeline/wowee_spell_aura_types.cpp
Normal file
247
src/pipeline/wowee_spell_aura_types.cpp
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
#include "pipeline/wowee_spell_aura_types.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kMagic[4] = {'W', 'A', 'U', 'R'};
|
||||
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) != ".waur") {
|
||||
base += ".waur";
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
uint32_t packRgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 0xFF) {
|
||||
return (static_cast<uint32_t>(a) << 24) |
|
||||
(static_cast<uint32_t>(b) << 16) |
|
||||
(static_cast<uint32_t>(g) << 8) |
|
||||
static_cast<uint32_t>(r);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const WoweeSpellAuraType::Entry*
|
||||
WoweeSpellAuraType::findById(uint32_t auraTypeId) const {
|
||||
for (const auto& e : entries)
|
||||
if (e.auraTypeId == auraTypeId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* WoweeSpellAuraType::auraKindName(uint8_t k) {
|
||||
switch (k) {
|
||||
case Periodic: return "periodic";
|
||||
case StatMod: return "stat-mod";
|
||||
case DamageMod: return "damage-mod";
|
||||
case Movement: return "movement";
|
||||
case Visual: return "visual";
|
||||
case Trigger: return "trigger";
|
||||
case Resource: return "resource";
|
||||
case Control: return "control";
|
||||
case Misc: return "misc";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
const char* WoweeSpellAuraType::targetingHintName(uint8_t t) {
|
||||
switch (t) {
|
||||
case AnyUnit: return "any";
|
||||
case SelfOnly: return "self";
|
||||
case HostileOnly: return "hostile";
|
||||
case BeneficialOnly: return "beneficial";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
bool WoweeSpellAuraTypeLoader::save(const WoweeSpellAuraType& 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.auraTypeId);
|
||||
writeStr(os, e.name);
|
||||
writeStr(os, e.description);
|
||||
writePOD(os, e.auraKind);
|
||||
writePOD(os, e.targetingHint);
|
||||
writePOD(os, e.isStackable);
|
||||
writePOD(os, e.maxStackCount);
|
||||
writePOD(os, e.updateFrequencyMs);
|
||||
writePOD(os, e.iconColorRGBA);
|
||||
}
|
||||
return os.good();
|
||||
}
|
||||
|
||||
WoweeSpellAuraType WoweeSpellAuraTypeLoader::load(
|
||||
const std::string& basePath) {
|
||||
WoweeSpellAuraType 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.auraTypeId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readStr(is, e.name) || !readStr(is, e.description)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.auraKind) ||
|
||||
!readPOD(is, e.targetingHint) ||
|
||||
!readPOD(is, e.isStackable) ||
|
||||
!readPOD(is, e.maxStackCount) ||
|
||||
!readPOD(is, e.updateFrequencyMs) ||
|
||||
!readPOD(is, e.iconColorRGBA)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeSpellAuraTypeLoader::exists(const std::string& basePath) {
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
return is.good();
|
||||
}
|
||||
|
||||
WoweeSpellAuraType WoweeSpellAuraTypeLoader::makePeriodic(
|
||||
const std::string& catalogName) {
|
||||
using A = WoweeSpellAuraType;
|
||||
WoweeSpellAuraType c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint8_t targeting,
|
||||
uint32_t freqMs, uint8_t r, uint8_t g, uint8_t b,
|
||||
const char* desc) {
|
||||
A::Entry e;
|
||||
e.auraTypeId = id; e.name = name; e.description = desc;
|
||||
e.auraKind = A::Periodic;
|
||||
e.targetingHint = targeting;
|
||||
e.updateFrequencyMs = freqMs;
|
||||
e.isStackable = 1; // most DoTs/HoTs are stackable
|
||||
e.maxStackCount = 5;
|
||||
e.iconColorRGBA = packRgba(r, g, b);
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
// Standard WotLK periodic aura type IDs from
|
||||
// SpellEffect.EffectAuraType.
|
||||
add(3, "PeriodicDamage", A::HostileOnly, 3000,
|
||||
220, 80, 80, "Tick damage every 3s (DoT — Corruption / Moonfire / etc).");
|
||||
add(8, "PeriodicHeal", A::BeneficialOnly, 3000,
|
||||
80, 240, 80, "Tick heal every 3s (HoT — Renew / Rejuvenation).");
|
||||
add(21, "PeriodicEnergize", A::AnyUnit, 2000,
|
||||
100, 200, 240, "Tick power restore every 2s (Innervate, Drink).");
|
||||
add(53, "PeriodicLeech", A::HostileOnly, 3000,
|
||||
140, 60, 200, "Tick damage every 3s, return % as caster heal "
|
||||
"(Drain Life, Death Coil-style).");
|
||||
add(23, "PeriodicTriggerSpell", A::AnyUnit, 1000,
|
||||
220, 200, 100, "Tick triggers another spell every N ms (Mind "
|
||||
"Flay -> Shadow Damage proc).");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeSpellAuraType WoweeSpellAuraTypeLoader::makeStatMod(
|
||||
const std::string& catalogName) {
|
||||
using A = WoweeSpellAuraType;
|
||||
WoweeSpellAuraType c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint8_t targeting,
|
||||
const char* desc) {
|
||||
A::Entry e;
|
||||
e.auraTypeId = id; e.name = name; e.description = desc;
|
||||
e.auraKind = A::StatMod;
|
||||
e.targetingHint = targeting;
|
||||
// Stat mods don't tick — instant on-apply.
|
||||
e.updateFrequencyMs = 0;
|
||||
e.iconColorRGBA = packRgba(180, 180, 240); // stat blue
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(29, "ModStat", A::BeneficialOnly,
|
||||
"Modify a primary stat by a flat amount (Mark of the "
|
||||
"Wild adds Stamina / Strength / etc).");
|
||||
add(22, "ModResistance", A::BeneficialOnly,
|
||||
"Modify school resistance (+ schoolMask, Shadow "
|
||||
"Protection grants Shadow resist).");
|
||||
add(79, "ModDamageDone", A::BeneficialOnly,
|
||||
"Modify spell-power-equivalent damage done by school.");
|
||||
add(170, "ModHaste", A::BeneficialOnly,
|
||||
"Modify melee attack speed and spell cast haste "
|
||||
"(Heroism / Bloodlust / Power Infusion).");
|
||||
add(57, "ModCritPercent", A::BeneficialOnly,
|
||||
"Modify crit-chance percentage (Leader of the Pack).");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeSpellAuraType WoweeSpellAuraTypeLoader::makeMovement(
|
||||
const std::string& catalogName) {
|
||||
using A = WoweeSpellAuraType;
|
||||
WoweeSpellAuraType c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, const char* desc) {
|
||||
A::Entry e;
|
||||
e.auraTypeId = id; e.name = name; e.description = desc;
|
||||
e.auraKind = A::Movement;
|
||||
e.targetingHint = A::HostileOnly;
|
||||
e.isStackable = 0; // movement debuffs typically don't stack
|
||||
e.iconColorRGBA = packRgba(240, 200, 100); // CC yellow
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(12, "Stun", "Stun — target cannot act or move.");
|
||||
add(33, "ModDecreaseSpeed", "Snare — reduce movement speed by %.");
|
||||
add(80, "ModConfuse", "Confuse — target wanders randomly, "
|
||||
"cannot use abilities.");
|
||||
add(83, "Root", "Root — target cannot move (can still act).");
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
|
|
@ -254,6 +254,8 @@ const char* const kArgRequired[] = {
|
|||
"--gen-sef", "--gen-sef-healing", "--gen-sef-aura",
|
||||
"--info-wsef", "--validate-wsef",
|
||||
"--export-wsef-json", "--import-wsef-json",
|
||||
"--gen-aur", "--gen-aur-stats", "--gen-aur-movement",
|
||||
"--info-waur", "--validate-waur",
|
||||
"--gen-weather-temperate", "--gen-weather-arctic",
|
||||
"--gen-weather-desert", "--gen-weather-stormy",
|
||||
"--gen-zone-atmosphere",
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@
|
|||
#include "cli_spell_reagents_catalog.hpp"
|
||||
#include "cli_achievement_criteria_catalog.hpp"
|
||||
#include "cli_spell_effect_types_catalog.hpp"
|
||||
#include "cli_spell_aura_types_catalog.hpp"
|
||||
#include "cli_quest_objective.hpp"
|
||||
#include "cli_quest_reward.hpp"
|
||||
#include "cli_clone.hpp"
|
||||
|
|
@ -289,6 +290,7 @@ constexpr DispatchFn kDispatchTable[] = {
|
|||
handleSpellReagentsCatalog,
|
||||
handleAchievementCriteriaCatalog,
|
||||
handleSpellEffectTypesCatalog,
|
||||
handleSpellAuraTypesCatalog,
|
||||
handleQuestObjective,
|
||||
handleQuestReward,
|
||||
handleClone,
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ constexpr FormatMagicEntry kFormats[] = {
|
|||
{{'W','S','P','R'}, ".wspr", "spells", "--info-wspr", "Spell reagent set catalog"},
|
||||
{{'W','A','C','R'}, ".wacr", "achieve", "--info-wacr", "Achievement criteria catalog"},
|
||||
{{'W','S','E','F'}, ".wsef", "spells", "--info-wsef", "Spell effect type catalog"},
|
||||
{{'W','A','U','R'}, ".waur", "spells", "--info-waur", "Spell aura type 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"},
|
||||
|
|
|
|||
|
|
@ -1909,6 +1909,16 @@ void printUsage(const char* argv0) {
|
|||
std::printf(" Export binary .wsef to a human-editable JSON sidecar (defaults to <base>.wsef.json)\n");
|
||||
std::printf(" --import-wsef-json <json-path> [out-base]\n");
|
||||
std::printf(" Import a .wsef.json sidecar back into binary .wsef (accepts effectKind int OR effectKindName string; behaviorFlags int OR pipe-separated label string)\n");
|
||||
std::printf(" --gen-aur <waur-base> [name]\n");
|
||||
std::printf(" Emit .waur 5 periodic auras (PeriodicDamage / PeriodicHeal / PeriodicEnergize / PeriodicLeech / PeriodicTriggerSpell) at canonical 3s tick\n");
|
||||
std::printf(" --gen-aur-stats <waur-base> [name]\n");
|
||||
std::printf(" Emit .waur 5 stat-modifier auras (ModStat / ModResistance / ModDamageDone / ModHaste / ModCritPercent) — non-periodic, instantly applied\n");
|
||||
std::printf(" --gen-aur-movement <waur-base> [name]\n");
|
||||
std::printf(" Emit .waur 4 movement-impairing auras (Stun / ModDecreaseSpeed / ModConfuse / Root) typically applied by CC spells\n");
|
||||
std::printf(" --info-waur <waur-base> [--json]\n");
|
||||
std::printf(" Print WAUR entries (id / kind / targeting / stack flag / max stack / tick interval / name)\n");
|
||||
std::printf(" --validate-waur <waur-base> [--json]\n");
|
||||
std::printf(" Static checks: name required, auraKind 0..8, targetingHint 0..3, no duplicate ids; errors on Periodic without tick interval; warns on non-periodic with tick interval, maxStackCount without isStackable\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");
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ constexpr FormatRow kFormats[] = {
|
|||
{"WSPR", ".wspr", "spells", "Spell.dbc Reagent[8]+Count[8]", "Spell reagent set catalog"},
|
||||
{"WACR", ".wacr", "achieve", "Achievement_Criteria.dbc", "Achievement criteria catalog"},
|
||||
{"WSEF", ".wsef", "spells", "SpellEffect.Effect dispatch", "Spell effect type catalog"},
|
||||
{"WAUR", ".waur", "spells", "SpellEffect.EffectAuraType", "Spell aura type catalog"},
|
||||
|
||||
// Additional pipeline catalogs without the alternating
|
||||
// gen/info/validate CLI surface (loaded by the engine
|
||||
|
|
|
|||
245
tools/editor/cli_spell_aura_types_catalog.cpp
Normal file
245
tools/editor/cli_spell_aura_types_catalog.cpp
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
#include "cli_spell_aura_types_catalog.hpp"
|
||||
#include "cli_arg_parse.hpp"
|
||||
#include "cli_box_emitter.hpp"
|
||||
|
||||
#include "pipeline/wowee_spell_aura_types.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 stripWaurExt(std::string base) {
|
||||
stripExt(base, ".waur");
|
||||
return base;
|
||||
}
|
||||
|
||||
bool saveOrError(const wowee::pipeline::WoweeSpellAuraType& c,
|
||||
const std::string& base, const char* cmd) {
|
||||
if (!wowee::pipeline::WoweeSpellAuraTypeLoader::save(c, base)) {
|
||||
std::fprintf(stderr, "%s: failed to save %s.waur\n",
|
||||
cmd, base.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void printGenSummary(const wowee::pipeline::WoweeSpellAuraType& c,
|
||||
const std::string& base) {
|
||||
std::printf("Wrote %s.waur\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" auras : %zu\n", c.entries.size());
|
||||
}
|
||||
|
||||
int handleGenPeriodic(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "PeriodicAuras";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWaurExt(base);
|
||||
auto c = wowee::pipeline::WoweeSpellAuraTypeLoader::makePeriodic(name);
|
||||
if (!saveOrError(c, base, "gen-aur")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenStatMod(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "StatModAuras";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWaurExt(base);
|
||||
auto c = wowee::pipeline::WoweeSpellAuraTypeLoader::makeStatMod(name);
|
||||
if (!saveOrError(c, base, "gen-aur-stats")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenMovement(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "MovementCCAuras";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWaurExt(base);
|
||||
auto c = wowee::pipeline::WoweeSpellAuraTypeLoader::makeMovement(name);
|
||||
if (!saveOrError(c, base, "gen-aur-movement")) 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 = stripWaurExt(base);
|
||||
if (!wowee::pipeline::WoweeSpellAuraTypeLoader::exists(base)) {
|
||||
std::fprintf(stderr, "WAUR not found: %s.waur\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeSpellAuraTypeLoader::load(base);
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["waur"] = base + ".waur";
|
||||
j["name"] = c.name;
|
||||
j["count"] = c.entries.size();
|
||||
nlohmann::json arr = nlohmann::json::array();
|
||||
for (const auto& e : c.entries) {
|
||||
arr.push_back({
|
||||
{"auraTypeId", e.auraTypeId},
|
||||
{"name", e.name},
|
||||
{"description", e.description},
|
||||
{"auraKind", e.auraKind},
|
||||
{"auraKindName", wowee::pipeline::WoweeSpellAuraType::auraKindName(e.auraKind)},
|
||||
{"targetingHint", e.targetingHint},
|
||||
{"targetingHintName", wowee::pipeline::WoweeSpellAuraType::targetingHintName(e.targetingHint)},
|
||||
{"isStackable", e.isStackable != 0},
|
||||
{"maxStackCount", e.maxStackCount},
|
||||
{"updateFrequencyMs", e.updateFrequencyMs},
|
||||
{"iconColorRGBA", e.iconColorRGBA},
|
||||
});
|
||||
}
|
||||
j["entries"] = arr;
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return 0;
|
||||
}
|
||||
std::printf("WAUR: %s.waur\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" auras : %zu\n", c.entries.size());
|
||||
if (c.entries.empty()) return 0;
|
||||
std::printf(" id kind target stack max tickMs name\n");
|
||||
for (const auto& e : c.entries) {
|
||||
std::printf(" %4u %-10s %-10s %s %3u %6u %s\n",
|
||||
e.auraTypeId,
|
||||
wowee::pipeline::WoweeSpellAuraType::auraKindName(e.auraKind),
|
||||
wowee::pipeline::WoweeSpellAuraType::targetingHintName(e.targetingHint),
|
||||
e.isStackable ? "yes" : "no ",
|
||||
e.maxStackCount, e.updateFrequencyMs,
|
||||
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 = stripWaurExt(base);
|
||||
if (!wowee::pipeline::WoweeSpellAuraTypeLoader::exists(base)) {
|
||||
std::fprintf(stderr,
|
||||
"validate-waur: WAUR not found: %s.waur\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeSpellAuraTypeLoader::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.auraTypeId);
|
||||
if (!e.name.empty()) ctx += " " + e.name;
|
||||
ctx += ")";
|
||||
if (e.name.empty())
|
||||
errors.push_back(ctx + ": name is empty");
|
||||
if (e.auraKind > wowee::pipeline::WoweeSpellAuraType::Misc) {
|
||||
errors.push_back(ctx + ": auraKind " +
|
||||
std::to_string(e.auraKind) + " not in 0..8");
|
||||
}
|
||||
if (e.targetingHint > wowee::pipeline::WoweeSpellAuraType::BeneficialOnly) {
|
||||
errors.push_back(ctx + ": targetingHint " +
|
||||
std::to_string(e.targetingHint) + " not in 0..3");
|
||||
}
|
||||
// Periodic kind requires updateFrequencyMs > 0.
|
||||
if (e.auraKind == wowee::pipeline::WoweeSpellAuraType::Periodic &&
|
||||
e.updateFrequencyMs == 0) {
|
||||
errors.push_back(ctx +
|
||||
": Periodic kind requires updateFrequencyMs > 0 "
|
||||
"— aura would never tick");
|
||||
}
|
||||
// Non-periodic with updateFrequencyMs > 0 is suspicious.
|
||||
if (e.auraKind != wowee::pipeline::WoweeSpellAuraType::Periodic &&
|
||||
e.auraKind != wowee::pipeline::WoweeSpellAuraType::Trigger &&
|
||||
e.updateFrequencyMs != 0) {
|
||||
warnings.push_back(ctx +
|
||||
": " +
|
||||
wowee::pipeline::WoweeSpellAuraType::auraKindName(e.auraKind) +
|
||||
" kind with updateFrequencyMs=" +
|
||||
std::to_string(e.updateFrequencyMs) +
|
||||
" — non-periodic auras don't tick, engine ignores");
|
||||
}
|
||||
// maxStackCount > 0 with isStackable=0 is contradictory.
|
||||
if (e.isStackable == 0 && e.maxStackCount > 0) {
|
||||
warnings.push_back(ctx +
|
||||
": maxStackCount=" + std::to_string(e.maxStackCount) +
|
||||
" set but isStackable=false — stack cap is "
|
||||
"unreachable");
|
||||
}
|
||||
for (uint32_t prev : idsSeen) {
|
||||
if (prev == e.auraTypeId) {
|
||||
errors.push_back(ctx + ": duplicate auraTypeId");
|
||||
break;
|
||||
}
|
||||
}
|
||||
idsSeen.push_back(e.auraTypeId);
|
||||
}
|
||||
bool ok = errors.empty();
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["waur"] = base + ".waur";
|
||||
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-waur: %s.waur\n", base.c_str());
|
||||
if (ok && warnings.empty()) {
|
||||
std::printf(" OK — %zu auras, all auraTypeIds unique\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 handleSpellAuraTypesCatalog(int& i, int argc, char** argv,
|
||||
int& outRc) {
|
||||
if (std::strcmp(argv[i], "--gen-aur") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenPeriodic(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-aur-stats") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenStatMod(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-aur-movement") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenMovement(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--info-waur") == 0 && i + 1 < argc) {
|
||||
outRc = handleInfo(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--validate-waur") == 0 && i + 1 < argc) {
|
||||
outRc = handleValidate(i, argc, argv); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
12
tools/editor/cli_spell_aura_types_catalog.hpp
Normal file
12
tools/editor/cli_spell_aura_types_catalog.hpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
bool handleSpellAuraTypesCatalog(int& i, int argc, char** argv,
|
||||
int& outRc);
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue