mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-10 02:53:51 +00:00
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:
parent
d76fa93760
commit
71d504822b
10 changed files with 630 additions and 0 deletions
|
|
@ -638,6 +638,7 @@ set(WOWEE_SOURCES
|
|||
src/pipeline/wowee_world_state_ui.cpp
|
||||
src/pipeline/wowee_player_conditions.cpp
|
||||
src/pipeline/wowee_trade_skills.cpp
|
||||
src/pipeline/wowee_creature_equipment.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/dbc_layout.cpp
|
||||
|
||||
|
|
@ -1427,6 +1428,7 @@ add_executable(wowee_editor
|
|||
tools/editor/cli_world_state_ui_catalog.cpp
|
||||
tools/editor/cli_player_conditions_catalog.cpp
|
||||
tools/editor/cli_trade_skills_catalog.cpp
|
||||
tools/editor/cli_creature_equipment_catalog.cpp
|
||||
tools/editor/cli_quest_objective.cpp
|
||||
tools/editor/cli_quest_reward.cpp
|
||||
tools/editor/cli_clone.cpp
|
||||
|
|
@ -1543,6 +1545,7 @@ add_executable(wowee_editor
|
|||
src/pipeline/wowee_world_state_ui.cpp
|
||||
src/pipeline/wowee_player_conditions.cpp
|
||||
src/pipeline/wowee_trade_skills.cpp
|
||||
src/pipeline/wowee_creature_equipment.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/terrain_mesh.cpp
|
||||
|
||||
|
|
|
|||
111
include/pipeline/wowee_creature_equipment.hpp
Normal file
111
include/pipeline/wowee_creature_equipment.hpp
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Creature Equipment catalog (.wceq) — novel
|
||||
// replacement for the AzerothCore-style creature_equip_template
|
||||
// SQL tables plus the visible-weapon / shield / ranged-slot
|
||||
// data that's traditionally embedded in creature templates.
|
||||
// New open format that closes a long-standing gap in the
|
||||
// creature subsystem.
|
||||
//
|
||||
// Until this format existed, 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. WCEQ
|
||||
// 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.
|
||||
//
|
||||
// Cross-references with previously-added formats:
|
||||
// WCEQ.entry.creatureId → WCRT.creatureId
|
||||
// WCEQ.entry.mainHandItemId → WIT.itemId
|
||||
// WCEQ.entry.offHandItemId → WIT.itemId
|
||||
// WCEQ.entry.rangedItemId → WIT.itemId
|
||||
// WCEQ.entry.mainHandVisualId → WSVK.visualKitId
|
||||
// (cast effect when equipped)
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WCEQ"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// equipmentId (uint32)
|
||||
// creatureId (uint32)
|
||||
// nameLen + name
|
||||
// descLen + description
|
||||
// mainHandItemId (uint32)
|
||||
// offHandItemId (uint32)
|
||||
// rangedItemId (uint32)
|
||||
// mainHandSlot (uint8) / offHandSlot (uint8) /
|
||||
// rangedSlot (uint8) / equipFlags (uint8)
|
||||
// mainHandVisualId (uint32)
|
||||
struct WoweeCreatureEquipment {
|
||||
// Equipment-slot indices match the WoW visible-equipment
|
||||
// attachment table — Mainhand=16, Offhand=17, Ranged=18.
|
||||
static constexpr uint8_t kSlotMainHand = 16;
|
||||
static constexpr uint8_t kSlotOffHand = 17;
|
||||
static constexpr uint8_t kSlotRanged = 18;
|
||||
|
||||
// equipFlags bits — modifiers for how the items are
|
||||
// worn / brandished.
|
||||
static constexpr uint8_t kFlagHidden = 0x01; // weapons sheathed
|
||||
static constexpr uint8_t kFlagDualWield = 0x02; // off-hand is weapon
|
||||
static constexpr uint8_t kFlagShieldOffhand = 0x04; // off-hand is shield
|
||||
static constexpr uint8_t kFlagThrownRanged = 0x08; // ranged is thrown
|
||||
static constexpr uint8_t kFlagPolearmTwoHand = 0x10; // main is 2H polearm
|
||||
|
||||
struct Entry {
|
||||
uint32_t equipmentId = 0;
|
||||
uint32_t creatureId = 0; // WCRT cross-ref
|
||||
std::string name;
|
||||
std::string description;
|
||||
uint32_t mainHandItemId = 0; // WIT cross-ref (0 = unarmed)
|
||||
uint32_t offHandItemId = 0; // WIT cross-ref (0 = none)
|
||||
uint32_t rangedItemId = 0; // WIT cross-ref (0 = none)
|
||||
uint8_t mainHandSlot = kSlotMainHand;
|
||||
uint8_t offHandSlot = kSlotOffHand;
|
||||
uint8_t rangedSlot = kSlotRanged;
|
||||
uint8_t equipFlags = 0;
|
||||
uint32_t mainHandVisualId = 0; // WSVK cross-ref (optional)
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::vector<Entry> entries;
|
||||
|
||||
bool isValid() const { return !entries.empty(); }
|
||||
|
||||
const Entry* findById(uint32_t equipmentId) const;
|
||||
};
|
||||
|
||||
class WoweeCreatureEquipmentLoader {
|
||||
public:
|
||||
static bool save(const WoweeCreatureEquipment& cat,
|
||||
const std::string& basePath);
|
||||
static WoweeCreatureEquipment load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-ceq* variants.
|
||||
//
|
||||
// makeStarter — 3 generic loadouts (warrior 1H+
|
||||
// shield, hunter bow + offhand,
|
||||
// rogue dual-dagger).
|
||||
// makeBosses — 4 boss loadouts (Onyxian 2H sword,
|
||||
// Lich King's Frostmourne, Sylvanas's
|
||||
// bow, Illidan dual warglaives) with
|
||||
// WSVK main-hand visual cross-refs.
|
||||
// makeRanged — 3 ranged-only loadouts (gun, bow,
|
||||
// crossbow) covering the kFlagThrown
|
||||
// and Ranged-slot variants.
|
||||
static WoweeCreatureEquipment makeStarter(const std::string& catalogName);
|
||||
static WoweeCreatureEquipment makeBosses(const std::string& catalogName);
|
||||
static WoweeCreatureEquipment makeRanged(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
228
src/pipeline/wowee_creature_equipment.cpp
Normal file
228
src/pipeline/wowee_creature_equipment.cpp
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
#include "pipeline/wowee_creature_equipment.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kMagic[4] = {'W', 'C', 'E', 'Q'};
|
||||
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) != ".wceq") {
|
||||
base += ".wceq";
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const WoweeCreatureEquipment::Entry*
|
||||
WoweeCreatureEquipment::findById(uint32_t equipmentId) const {
|
||||
for (const auto& e : entries)
|
||||
if (e.equipmentId == equipmentId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool WoweeCreatureEquipmentLoader::save(
|
||||
const WoweeCreatureEquipment& 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.equipmentId);
|
||||
writePOD(os, e.creatureId);
|
||||
writeStr(os, e.name);
|
||||
writeStr(os, e.description);
|
||||
writePOD(os, e.mainHandItemId);
|
||||
writePOD(os, e.offHandItemId);
|
||||
writePOD(os, e.rangedItemId);
|
||||
writePOD(os, e.mainHandSlot);
|
||||
writePOD(os, e.offHandSlot);
|
||||
writePOD(os, e.rangedSlot);
|
||||
writePOD(os, e.equipFlags);
|
||||
writePOD(os, e.mainHandVisualId);
|
||||
}
|
||||
return os.good();
|
||||
}
|
||||
|
||||
WoweeCreatureEquipment WoweeCreatureEquipmentLoader::load(
|
||||
const std::string& basePath) {
|
||||
WoweeCreatureEquipment 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.equipmentId) ||
|
||||
!readPOD(is, e.creatureId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readStr(is, e.name) || !readStr(is, e.description)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.mainHandItemId) ||
|
||||
!readPOD(is, e.offHandItemId) ||
|
||||
!readPOD(is, e.rangedItemId) ||
|
||||
!readPOD(is, e.mainHandSlot) ||
|
||||
!readPOD(is, e.offHandSlot) ||
|
||||
!readPOD(is, e.rangedSlot) ||
|
||||
!readPOD(is, e.equipFlags) ||
|
||||
!readPOD(is, e.mainHandVisualId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeCreatureEquipmentLoader::exists(const std::string& basePath) {
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
return is.good();
|
||||
}
|
||||
|
||||
WoweeCreatureEquipment WoweeCreatureEquipmentLoader::makeStarter(
|
||||
const std::string& catalogName) {
|
||||
WoweeCreatureEquipment c;
|
||||
c.name = catalogName;
|
||||
{
|
||||
WoweeCreatureEquipment::Entry e;
|
||||
e.equipmentId = 1; e.creatureId = 295; // Stormwind Guard
|
||||
e.name = "GuardSwordAndShield";
|
||||
e.description = "Stormwind guard — 1H sword + heater shield.";
|
||||
e.mainHandItemId = 1909; // Long Sword
|
||||
e.offHandItemId = 2129; // Heater Shield
|
||||
e.equipFlags = WoweeCreatureEquipment::kFlagShieldOffhand;
|
||||
c.entries.push_back(e);
|
||||
}
|
||||
{
|
||||
WoweeCreatureEquipment::Entry e;
|
||||
e.equipmentId = 2; e.creatureId = 1419; // Hunter trainer
|
||||
e.name = "HunterBowAndOffhand";
|
||||
e.description = "Bow with quiver — no weapon in offhand.";
|
||||
e.mainHandItemId = 2511; // Worn Shortsword
|
||||
e.rangedItemId = 2504; // Worn Shortbow
|
||||
c.entries.push_back(e);
|
||||
}
|
||||
{
|
||||
WoweeCreatureEquipment::Entry e;
|
||||
e.equipmentId = 3; e.creatureId = 1416; // Rogue trainer
|
||||
e.name = "RogueDualDagger";
|
||||
e.description = "Dual-wielding daggers (mainhand + offhand).";
|
||||
e.mainHandItemId = 2092; // Worn Dagger
|
||||
e.offHandItemId = 2092;
|
||||
e.equipFlags = WoweeCreatureEquipment::kFlagDualWield;
|
||||
c.entries.push_back(e);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeCreatureEquipment WoweeCreatureEquipmentLoader::makeBosses(
|
||||
const std::string& catalogName) {
|
||||
WoweeCreatureEquipment c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t eid, uint32_t cid, const char* name,
|
||||
uint32_t mainHand, uint32_t offHand,
|
||||
uint32_t ranged, uint8_t flags,
|
||||
uint32_t visualKitId, const char* desc) {
|
||||
WoweeCreatureEquipment::Entry e;
|
||||
e.equipmentId = eid; e.creatureId = cid;
|
||||
e.name = name; e.description = desc;
|
||||
e.mainHandItemId = mainHand;
|
||||
e.offHandItemId = offHand;
|
||||
e.rangedItemId = ranged;
|
||||
e.equipFlags = flags;
|
||||
e.mainHandVisualId = visualKitId; // WSVK cross-ref
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
// Iconic boss loadouts. visualKitId values reference WSVK
|
||||
// entries — non-zero so the brandished weapon plays its
|
||||
// signature glow / aura.
|
||||
add(100, 11583, "Onyxian2HSword", 17075, 0, 0,
|
||||
WoweeCreatureEquipment::kFlagPolearmTwoHand, 100,
|
||||
"Onyxia's caster form — 2H greatsword with smoke trail.");
|
||||
add(101, 36597, "FrostmournePrime", 49623, 0, 0,
|
||||
WoweeCreatureEquipment::kFlagPolearmTwoHand, 101,
|
||||
"The Lich King — Frostmourne with frost runes.");
|
||||
add(102, 37955, "SylvanasBow", 0, 0, 50613,
|
||||
0, 102,
|
||||
"Sylvanas Windrunner — bow only, banshee aura.");
|
||||
add(103, 22917, "IllidanDualWarglaives", 32837, 32837, 0,
|
||||
WoweeCreatureEquipment::kFlagDualWield, 103,
|
||||
"Illidan Stormrage — dual warglaives, fel green glow.");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeCreatureEquipment WoweeCreatureEquipmentLoader::makeRanged(
|
||||
const std::string& catalogName) {
|
||||
WoweeCreatureEquipment c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t eid, uint32_t cid, const char* name,
|
||||
uint32_t rangedItem, uint8_t flags,
|
||||
const char* desc) {
|
||||
WoweeCreatureEquipment::Entry e;
|
||||
e.equipmentId = eid; e.creatureId = cid;
|
||||
e.name = name; e.description = desc;
|
||||
e.rangedItemId = rangedItem;
|
||||
e.equipFlags = flags;
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(200, 829, "DwarfRifleman", 2511, 0,
|
||||
"Dwarf rifleman — long rifle in ranged slot only.");
|
||||
add(201, 1419, "ElvenLongbow", 2504, 0,
|
||||
"Night-elf hunter — long bow in ranged slot.");
|
||||
add(202, 6791, "TrollCrossbow", 2508, 0,
|
||||
"Troll Sentinel — crossbow in ranged slot.");
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
260
tools/editor/cli_creature_equipment_catalog.cpp
Normal file
260
tools/editor/cli_creature_equipment_catalog.cpp
Normal 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
|
||||
12
tools/editor/cli_creature_equipment_catalog.hpp
Normal file
12
tools/editor/cli_creature_equipment_catalog.hpp
Normal 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
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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"},
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue