feat(pipeline): add WCEQ (Wowee Creature Equipment) — 50th open format

Replaces the AzerothCore-style creature_equip_template SQL
tables plus the visible-weapon / shield / ranged-slot data
that was traditionally embedded in creature templates. Closes
a long-standing gap in the creature subsystem: until now WCRT
defined a creature's stats, WSPN placed it in the world, and
WLOT defined what it drops — but nothing defined what items
it visibly equips.

Each entry binds a creatureId to up to three equipped items
(main hand / off hand / ranged) plus the visual kit that
fires when the main-hand weapon is brandished. equipFlags
bits encode hidden / dual-wield / shield-offhand /
thrown-ranged / 2H polearm to drive the renderer's
attachment-point selection.

Cross-references with prior formats — creatureId points at
WCRT.creatureId, mainHandItemId / offHandItemId / rangedItemId
all point at WIT.itemId, and mainHandVisualId points at
WSVK.visualKitId so brandished weapons can play their
signature glow / aura.

CLI: --gen-ceq (3 generic guard/hunter/rogue starters),
--gen-ceq-bosses (4 iconic loadouts incl. Frostmourne and
Illidan's warglaives, with WSVK visual cross-refs),
--gen-ceq-ranged (3 ranged-only rifle/bow/crossbow loadouts),
--info-wceq, --validate-wceq with --json variants. Validator
catches id=0/duplicates, missing creatureId, all-empty-slots
warning, kFlagDualWield without both hand items, kFlagShield
without offhand item, mutually-exclusive dual-wield + shield,
and 2H polearm with offhand item filled.

Format graph milestone: 50 distinct binary formats. CLI flag
count: 754 → 760.
This commit is contained in:
Kelsi 2026-05-09 19:48:13 -07:00
parent d76fa93760
commit 71d504822b
10 changed files with 630 additions and 0 deletions

View file

@ -151,6 +151,8 @@ const char* const kArgRequired[] = {
"--gen-tsk", "--gen-tsk-blacksmithing", "--gen-tsk-alchemy",
"--info-wtsk", "--validate-wtsk",
"--export-wtsk-json", "--import-wtsk-json",
"--gen-ceq", "--gen-ceq-bosses", "--gen-ceq-ranged",
"--info-wceq", "--validate-wceq",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",

View file

@ -0,0 +1,260 @@
#include "cli_creature_equipment_catalog.hpp"
#include "cli_arg_parse.hpp"
#include "cli_box_emitter.hpp"
#include "pipeline/wowee_creature_equipment.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 stripWceqExt(std::string base) {
stripExt(base, ".wceq");
return base;
}
bool saveOrError(const wowee::pipeline::WoweeCreatureEquipment& c,
const std::string& base, const char* cmd) {
if (!wowee::pipeline::WoweeCreatureEquipmentLoader::save(c, base)) {
std::fprintf(stderr, "%s: failed to save %s.wceq\n",
cmd, base.c_str());
return false;
}
return true;
}
void printGenSummary(const wowee::pipeline::WoweeCreatureEquipment& c,
const std::string& base) {
std::printf("Wrote %s.wceq\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" loadouts : %zu\n", c.entries.size());
}
int handleGenStarter(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "StarterCreatureEq";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWceqExt(base);
auto c = wowee::pipeline::WoweeCreatureEquipmentLoader::makeStarter(name);
if (!saveOrError(c, base, "gen-ceq")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenBosses(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "BossLoadouts";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWceqExt(base);
auto c = wowee::pipeline::WoweeCreatureEquipmentLoader::makeBosses(name);
if (!saveOrError(c, base, "gen-ceq-bosses")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenRanged(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "RangedLoadouts";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWceqExt(base);
auto c = wowee::pipeline::WoweeCreatureEquipmentLoader::makeRanged(name);
if (!saveOrError(c, base, "gen-ceq-ranged")) 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 = stripWceqExt(base);
if (!wowee::pipeline::WoweeCreatureEquipmentLoader::exists(base)) {
std::fprintf(stderr, "WCEQ not found: %s.wceq\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeCreatureEquipmentLoader::load(base);
if (jsonOut) {
nlohmann::json j;
j["wceq"] = base + ".wceq";
j["name"] = c.name;
j["count"] = c.entries.size();
nlohmann::json arr = nlohmann::json::array();
for (const auto& e : c.entries) {
arr.push_back({
{"equipmentId", e.equipmentId},
{"creatureId", e.creatureId},
{"name", e.name},
{"description", e.description},
{"mainHandItemId", e.mainHandItemId},
{"offHandItemId", e.offHandItemId},
{"rangedItemId", e.rangedItemId},
{"mainHandSlot", e.mainHandSlot},
{"offHandSlot", e.offHandSlot},
{"rangedSlot", e.rangedSlot},
{"equipFlags", e.equipFlags},
{"mainHandVisualId", e.mainHandVisualId},
});
}
j["entries"] = arr;
std::printf("%s\n", j.dump(2).c_str());
return 0;
}
std::printf("WCEQ: %s.wceq\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" loadouts : %zu\n", c.entries.size());
if (c.entries.empty()) return 0;
std::printf(" id creature mainHand offHand ranged flags visKit name\n");
for (const auto& e : c.entries) {
std::printf(" %4u %5u %5u %5u %5u 0x%02x %5u %s\n",
e.equipmentId, e.creatureId,
e.mainHandItemId, e.offHandItemId,
e.rangedItemId, e.equipFlags,
e.mainHandVisualId, 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 = stripWceqExt(base);
if (!wowee::pipeline::WoweeCreatureEquipmentLoader::exists(base)) {
std::fprintf(stderr,
"validate-wceq: WCEQ not found: %s.wceq\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeCreatureEquipmentLoader::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.equipmentId);
if (!e.name.empty()) ctx += " " + e.name;
ctx += ")";
if (e.equipmentId == 0)
errors.push_back(ctx + ": equipmentId is 0");
if (e.name.empty())
errors.push_back(ctx + ": name is empty");
if (e.creatureId == 0)
errors.push_back(ctx +
": creatureId is 0 (loadout not bound to a WCRT entry)");
// All three slots empty = nothing to render. Most
// useful for "unarmed but visible" creatures, so
// warn rather than error.
if (e.mainHandItemId == 0 && e.offHandItemId == 0 &&
e.rangedItemId == 0) {
warnings.push_back(ctx +
": all three slots empty (creature is unarmed)");
}
// dual-wield flag set but no offhand item, OR no
// mainhand — both are inconsistent.
if ((e.equipFlags &
wowee::pipeline::WoweeCreatureEquipment::kFlagDualWield) &&
(e.mainHandItemId == 0 || e.offHandItemId == 0)) {
errors.push_back(ctx +
": kFlagDualWield set but missing mainhand or offhand "
"item (dual-wield needs both slots filled)");
}
// shield flag set but no offhand item.
if ((e.equipFlags &
wowee::pipeline::WoweeCreatureEquipment::kFlagShieldOffhand) &&
e.offHandItemId == 0) {
errors.push_back(ctx +
": kFlagShieldOffhand set but offHandItemId=0");
}
// dual-wield + shield are mutually exclusive — can't
// hold a shield AND a second weapon in the offhand.
if ((e.equipFlags &
wowee::pipeline::WoweeCreatureEquipment::kFlagDualWield) &&
(e.equipFlags &
wowee::pipeline::WoweeCreatureEquipment::kFlagShieldOffhand)) {
errors.push_back(ctx +
": both kFlagDualWield and kFlagShieldOffhand set "
"(mutually exclusive)");
}
// 2H polearm flag set with an offhand item — polearms
// occupy both hands.
if ((e.equipFlags &
wowee::pipeline::WoweeCreatureEquipment::kFlagPolearmTwoHand) &&
e.offHandItemId != 0) {
errors.push_back(ctx +
": kFlagPolearmTwoHand set but offHandItemId=" +
std::to_string(e.offHandItemId) +
" (2H polearm occupies both hands)");
}
for (uint32_t prev : idsSeen) {
if (prev == e.equipmentId) {
errors.push_back(ctx + ": duplicate equipmentId");
break;
}
}
idsSeen.push_back(e.equipmentId);
}
bool ok = errors.empty();
if (jsonOut) {
nlohmann::json j;
j["wceq"] = base + ".wceq";
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-wceq: %s.wceq\n", base.c_str());
if (ok && warnings.empty()) {
std::printf(" OK — %zu loadouts, all equipmentIds unique, all flag combos consistent\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 handleCreatureEquipmentCatalog(int& i, int argc, char** argv,
int& outRc) {
if (std::strcmp(argv[i], "--gen-ceq") == 0 && i + 1 < argc) {
outRc = handleGenStarter(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-ceq-bosses") == 0 && i + 1 < argc) {
outRc = handleGenBosses(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-ceq-ranged") == 0 && i + 1 < argc) {
outRc = handleGenRanged(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--info-wceq") == 0 && i + 1 < argc) {
outRc = handleInfo(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--validate-wceq") == 0 && i + 1 < argc) {
outRc = handleValidate(i, argc, argv); return true;
}
return false;
}
} // namespace cli
} // namespace editor
} // namespace wowee

View file

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

View file

@ -82,6 +82,7 @@
#include "cli_world_state_ui_catalog.hpp"
#include "cli_player_conditions_catalog.hpp"
#include "cli_trade_skills_catalog.hpp"
#include "cli_creature_equipment_catalog.hpp"
#include "cli_quest_objective.hpp"
#include "cli_quest_reward.hpp"
#include "cli_clone.hpp"
@ -205,6 +206,7 @@ constexpr DispatchFn kDispatchTable[] = {
handleWorldStateUICatalog,
handlePlayerConditionsCatalog,
handleTradeSkillsCatalog,
handleCreatureEquipmentCatalog,
handleQuestObjective,
handleQuestReward,
handleClone,

View file

@ -52,6 +52,7 @@ constexpr FormatMagicEntry kFormats[] = {
{{'W','W','U','I'}, ".wwui", "ui", "--info-wwui", "World-state UI catalog"},
{{'W','P','C','N'}, ".wpcn", "logic", "--info-wpcn", "Player condition catalog"},
{{'W','T','S','K'}, ".wtsk", "crafting", "--info-wtsk", "Trade skill recipe catalog"},
{{'W','C','E','Q'}, ".wceq", "creatures", "--info-wceq", "Creature equipment loadout 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

@ -1427,6 +1427,16 @@ void printUsage(const char* argv0) {
std::printf(" Export binary .wtsk to a human-editable JSON sidecar with nested reagents (defaults to <base>.wtsk.json)\n");
std::printf(" --import-wtsk-json <json-path> [out-base]\n");
std::printf(" Import a .wtsk.json sidecar back into binary .wtsk (accepts profession int OR name string, reagents array up to 4 slots)\n");
std::printf(" --gen-ceq <wceq-base> [name]\n");
std::printf(" Emit .wceq starter: 3 generic creature loadouts (guard 1H+shield, hunter bow, rogue dual-dagger)\n");
std::printf(" --gen-ceq-bosses <wceq-base> [name]\n");
std::printf(" Emit .wceq 4 iconic boss loadouts (Onyxia 2H, Lich King Frostmourne, Sylvanas bow, Illidan dual warglaives) with WSVK refs\n");
std::printf(" --gen-ceq-ranged <wceq-base> [name]\n");
std::printf(" Emit .wceq 3 ranged-only loadouts (rifle / bow / crossbow) — ranged slot only, no melee\n");
std::printf(" --info-wceq <wceq-base> [--json]\n");
std::printf(" Print WCEQ entries (id / creatureId / mainhand+offhand+ranged item IDs / equipFlags / visualKitId / name)\n");
std::printf(" --validate-wceq <wceq-base> [--json]\n");
std::printf(" Static checks: id+creatureId>0+unique, dual-wield/shield/2H polearm flag coherence, mutually-exclusive flag combos\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

@ -74,6 +74,7 @@ constexpr FormatRow kFormats[] = {
{"WWUI", ".wwui", "ui", "WorldStateUI.dbc + world_state", "World-state UI (BG scoreboards / siege counters)"},
{"WPCN", ".wpcn", "logic", "PlayerCondition.dbc + conditions", "Player condition (gates, AND/OR/NOT chains)"},
{"WTSK", ".wtsk", "crafting", "SkillLineAbility.dbc + recipes", "Trade skill recipes (per-profession crafts)"},
{"WCEQ", ".wceq", "creatures", "creature_equip_template", "Creature equipment loadout (visible weapons)"},
// Additional pipeline catalogs without the alternating
// gen/info/validate CLI surface (loaded by the engine