feat(pipeline): add WSVK (Wowee Spell Visual Kit) catalog

47th open format — replaces SpellVisualKit.dbc +
SpellVisualEffectName.dbc plus the AzerothCore-style spell
visual SQL data. Defines per-spell visual presentations:
cast-bar effect model, projectile model + travel speed +
arc gravity, impact effect model, hand effect on the caster,
and the animations + sounds that fire at cast / channel /
impact time.

Cross-references with prior formats — castAnimId / impactAnimId
/ precastAnimId point at WANI.animationId, castSoundId /
impactSoundId point at WSND.soundId. Spell catalogs (WSPL)
will reference visualKitId here to bind "what mechanically
happens" to "what plays visually."

CLI: --gen-svk (3-kit Frostbolt/Fireball/HealingTouch starter
showing projectile + AoE + heal patterns), --gen-svk-combat
(5 melee/ranged with WANI animation refs), --gen-svk-utility
(4 portal/hearth/mount/resurrect with no projectile),
--info-wsvk, --validate-wsvk with --json variants. Validator
catches id=0/duplicates, missing name, negative speeds/radii,
projectile-model + speed coherence (model without speed =
never travels; speed without model = invisible), and a
no-effect catch-all (no models + no anims + no sounds).
This commit is contained in:
Kelsi 2026-05-09 19:23:36 -07:00
parent 441b962c3f
commit beca69352a
10 changed files with 658 additions and 0 deletions

View file

@ -0,0 +1,253 @@
#include "cli_spell_visuals_catalog.hpp"
#include "cli_arg_parse.hpp"
#include "cli_box_emitter.hpp"
#include "pipeline/wowee_spell_visuals.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 stripWsvkExt(std::string base) {
stripExt(base, ".wsvk");
return base;
}
bool saveOrError(const wowee::pipeline::WoweeSpellVisualKit& c,
const std::string& base, const char* cmd) {
if (!wowee::pipeline::WoweeSpellVisualKitLoader::save(c, base)) {
std::fprintf(stderr, "%s: failed to save %s.wsvk\n",
cmd, base.c_str());
return false;
}
return true;
}
void printGenSummary(const wowee::pipeline::WoweeSpellVisualKit& c,
const std::string& base) {
std::printf("Wrote %s.wsvk\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" visuals : %zu\n", c.entries.size());
}
int handleGenStarter(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "StarterVisualKits";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWsvkExt(base);
auto c = wowee::pipeline::WoweeSpellVisualKitLoader::makeStarter(name);
if (!saveOrError(c, base, "gen-svk")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenCombat(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "CombatVisualKits";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWsvkExt(base);
auto c = wowee::pipeline::WoweeSpellVisualKitLoader::makeCombat(name);
if (!saveOrError(c, base, "gen-svk-combat")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenUtility(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "UtilityVisualKits";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWsvkExt(base);
auto c = wowee::pipeline::WoweeSpellVisualKitLoader::makeUtility(name);
if (!saveOrError(c, base, "gen-svk-utility")) 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 = stripWsvkExt(base);
if (!wowee::pipeline::WoweeSpellVisualKitLoader::exists(base)) {
std::fprintf(stderr, "WSVK not found: %s.wsvk\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeSpellVisualKitLoader::load(base);
if (jsonOut) {
nlohmann::json j;
j["wsvk"] = base + ".wsvk";
j["name"] = c.name;
j["count"] = c.entries.size();
nlohmann::json arr = nlohmann::json::array();
for (const auto& e : c.entries) {
arr.push_back({
{"visualKitId", e.visualKitId},
{"name", e.name},
{"description", e.description},
{"castEffectModelPath", e.castEffectModelPath},
{"projectileModelPath", e.projectileModelPath},
{"impactEffectModelPath", e.impactEffectModelPath},
{"handEffectModelPath", e.handEffectModelPath},
{"precastAnimId", e.precastAnimId},
{"castAnimId", e.castAnimId},
{"impactAnimId", e.impactAnimId},
{"castSoundId", e.castSoundId},
{"impactSoundId", e.impactSoundId},
{"projectileSpeed", e.projectileSpeed},
{"projectileGravity", e.projectileGravity},
{"castDurationMs", e.castDurationMs},
{"impactRadius", e.impactRadius},
});
}
j["entries"] = arr;
std::printf("%s\n", j.dump(2).c_str());
return 0;
}
std::printf("WSVK: %s.wsvk\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" visuals : %zu\n", c.entries.size());
if (c.entries.empty()) return 0;
std::printf(" id castAnim impAnim speed grav dur(ms) AoE castSnd impSnd name\n");
for (const auto& e : c.entries) {
std::printf(" %4u %5u %5u %5.1f %4.2f %5u %4.1f %5u %5u %s\n",
e.visualKitId, e.castAnimId, e.impactAnimId,
e.projectileSpeed, e.projectileGravity,
e.castDurationMs, e.impactRadius,
e.castSoundId, e.impactSoundId, 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 = stripWsvkExt(base);
if (!wowee::pipeline::WoweeSpellVisualKitLoader::exists(base)) {
std::fprintf(stderr,
"validate-wsvk: WSVK not found: %s.wsvk\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeSpellVisualKitLoader::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.visualKitId);
if (!e.name.empty()) ctx += " " + e.name;
ctx += ")";
if (e.visualKitId == 0)
errors.push_back(ctx + ": visualKitId is 0");
if (e.name.empty())
errors.push_back(ctx + ": name is empty");
if (e.projectileSpeed < 0.0f)
errors.push_back(ctx + ": projectileSpeed " +
std::to_string(e.projectileSpeed) +
" negative (use 0 for instant)");
if (e.projectileGravity < 0.0f)
errors.push_back(ctx + ": projectileGravity " +
std::to_string(e.projectileGravity) +
" negative (use 0 for straight line)");
if (e.impactRadius < 0.0f)
errors.push_back(ctx + ": impactRadius " +
std::to_string(e.impactRadius) +
" negative (use 0 for single-target)");
// Projectile model + zero speed = projectile defined
// but never travels. Inverse: speed > 0 + no model =
// invisible projectile. Both are usually mistakes.
if (!e.projectileModelPath.empty() &&
e.projectileSpeed == 0.0f) {
warnings.push_back(ctx +
": projectileModelPath set but projectileSpeed=0 "
"(model never travels)");
}
if (e.projectileModelPath.empty() &&
e.projectileSpeed > 0.0f) {
warnings.push_back(ctx +
": projectileSpeed > 0 but no projectileModelPath "
"(invisible projectile)");
}
// No effect model AND no animation AND no sound = the
// visual kit has no observable effect at all.
if (e.castEffectModelPath.empty() &&
e.impactEffectModelPath.empty() &&
e.handEffectModelPath.empty() &&
e.castAnimId == 0 && e.impactAnimId == 0 &&
e.castSoundId == 0 && e.impactSoundId == 0) {
warnings.push_back(ctx +
": no models, animations, or sounds — visual kit has no observable effect");
}
for (uint32_t prev : idsSeen) {
if (prev == e.visualKitId) {
errors.push_back(ctx + ": duplicate visualKitId");
break;
}
}
idsSeen.push_back(e.visualKitId);
}
bool ok = errors.empty();
if (jsonOut) {
nlohmann::json j;
j["wsvk"] = base + ".wsvk";
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-wsvk: %s.wsvk\n", base.c_str());
if (ok && warnings.empty()) {
std::printf(" OK — %zu visual kits, all visualKitIds 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 handleSpellVisualsCatalog(int& i, int argc, char** argv, int& outRc) {
if (std::strcmp(argv[i], "--gen-svk") == 0 && i + 1 < argc) {
outRc = handleGenStarter(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-svk-combat") == 0 && i + 1 < argc) {
outRc = handleGenCombat(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-svk-utility") == 0 && i + 1 < argc) {
outRc = handleGenUtility(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--info-wsvk") == 0 && i + 1 < argc) {
outRc = handleInfo(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--validate-wsvk") == 0 && i + 1 < argc) {
outRc = handleValidate(i, argc, argv); return true;
}
return false;
}
} // namespace cli
} // namespace editor
} // namespace wowee