mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-10 02:53:51 +00:00
feat(pipeline): add WCRT (Wowee Creature Template) format
Novel open replacement for the AzerothCore-style
creature_template SQL table PLUS the Blizzard
CreatureTemplate / CreatureFamily / CreatureType.dbc trio.
The 14th open format added to the editor.
This is the canonical metadata side of creatures shared
across every spawn instance: HP, level range, faction,
behavior flags, NPC role bits (vendor / trainer /
quest-giver / innkeeper), base damage, equipped gear
references.
Cross-references with the previously-added formats:
WSPN.entry.entryId -> WCRT.entry.creatureId
WLOT.entry.creatureId -> WCRT.entry.creatureId
WCRT.entry.equipped* -> WIT.entry.itemId
The 4-format set (WIT + WLOT + WSPN + WCRT) now lets a
content pack define a complete RPG zone's creature
ecosystem: what creatures are, where they spawn, what they
drop, and what gear they carry — entirely in open formats
with no SQL dependencies.
Format:
• magic "WCRT", version 1, little-endian
• per entry: creatureId / displayId / name / subname /
minLevel..maxLevel / baseHealth + healthPerLevel /
baseMana + manaPerLevel / factionId / npcFlags /
typeId / familyId / damageMin..Max / attackSpeedMs /
baseArmor / walkSpeed + runSpeed / gossipId /
equippedMain + equippedOffhand + equippedRanged /
aiFlags
Enums:
• TypeId: Beast / Dragon / Demon / Elemental / Giant /
Undead / Humanoid / Critter / Mechanical
• FamilyId: Wolf / Cat / Bear / Boar / Raptor / Hyena /
Spider / Gorilla / Crab (for Beast types)
• NpcFlags: Vendor / QuestGiver / Trainer / Banker /
Innkeeper / FlightMaster / Auctioneer /
Repair / Stable
• Behavior: Passive / Aggressive / FleeLowHp / CallHelp /
NoLeash
API: WoweeCreatureLoader::save / load / exists /
findById; presets makeStarter (1 innkeeper),
makeBandit (creatureId=1000 matches WSPN/WLOT bandit
references, equips WIT itemId=1001 sword), makeMerchants
(creatureIds 4001/4002/4003 match WSPN village labels).
CLI added (5 flags, 493 documented total):
--gen-creatures / --gen-creatures-bandit / --gen-creatures-merchants
--info-wcrt / --validate-wcrt
Validator catches: creatureId=0, duplicates, level=0,
minLevel>maxLevel, baseHealth=0, damageMin>damageMax,
attackSpeed=0, non-positive walk/runSpeed, behavior flag
contradictions (passive+aggressive), vendor with
aggressive behavior (player can't trade).
This commit is contained in:
parent
356fe53a9a
commit
b2b84139aa
8 changed files with 754 additions and 0 deletions
164
include/pipeline/wowee_creatures.hpp
Normal file
164
include/pipeline/wowee_creatures.hpp
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Creature Template (.wcrt) — novel replacement
|
||||
// for AzerothCore-style creature_template SQL tables PLUS
|
||||
// the CreatureTemplate / CreatureFamily / CreatureType.dbc
|
||||
// trio. The 14th open format added to the editor.
|
||||
//
|
||||
// This is the gameplay data side of creatures: HP, level
|
||||
// range, faction, AI flags, NPC role bits (vendor /
|
||||
// trainer / quest-giver / innkeeper), base damage, equipped
|
||||
// gear references. The WSPN file says where creatures
|
||||
// spawn; the WLOT file says what they drop on death; the
|
||||
// WCRT file says what they ARE — the canonical metadata
|
||||
// shared across every spawn instance.
|
||||
//
|
||||
// Cross-references:
|
||||
// WSPN.entry.entryId → WCRT.entry.creatureId
|
||||
// WLOT.entry.creatureId → WCRT.entry.creatureId
|
||||
// WCRT.entry.equipped* → WIT.entry.itemId
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WCRT"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// creatureId (uint32)
|
||||
// displayId (uint32)
|
||||
// nameLen + name
|
||||
// subnameLen + subname
|
||||
// minLevel (uint16) / maxLevel (uint16)
|
||||
// baseHealth (uint32) -- at minLevel
|
||||
// healthPerLevel (uint16)
|
||||
// baseMana (uint32)
|
||||
// manaPerLevel (uint16)
|
||||
// factionId (uint32)
|
||||
// npcFlags (uint32)
|
||||
// typeId (uint8) / familyId (uint8) / pad[2]
|
||||
// damageMin (uint32) / damageMax (uint32) / attackSpeedMs (uint32)
|
||||
// baseArmor (uint32)
|
||||
// walkSpeed (float) / runSpeed (float)
|
||||
// gossipId (uint32) -- 0 if none
|
||||
// equippedMain (uint32) -- WIT itemId, 0 if none
|
||||
// equippedOffhand (uint32)
|
||||
// equippedRanged (uint32)
|
||||
// aiFlags (uint32)
|
||||
struct WoweeCreature {
|
||||
enum NpcFlags : uint32_t {
|
||||
Vendor = 0x01,
|
||||
QuestGiver = 0x02,
|
||||
Trainer = 0x04,
|
||||
Banker = 0x08,
|
||||
Innkeeper = 0x10,
|
||||
FlightMaster = 0x20,
|
||||
Auctioneer = 0x40,
|
||||
Repair = 0x80,
|
||||
Stable = 0x100,
|
||||
};
|
||||
|
||||
enum TypeId : uint8_t {
|
||||
Beast = 1,
|
||||
Dragon = 2,
|
||||
Demon = 3,
|
||||
Elemental = 4,
|
||||
Giant = 5,
|
||||
Undead = 6,
|
||||
Humanoid = 7,
|
||||
Critter = 8,
|
||||
Mechanical = 9,
|
||||
};
|
||||
|
||||
enum FamilyId : uint8_t {
|
||||
FamNone = 0,
|
||||
FamWolf = 1,
|
||||
FamCat = 2,
|
||||
FamBear = 3,
|
||||
FamBoar = 4,
|
||||
FamRaptor = 5,
|
||||
FamHyena = 6,
|
||||
FamSpider = 7,
|
||||
FamGorilla = 8,
|
||||
FamCrab = 9,
|
||||
};
|
||||
|
||||
enum AiFlags : uint32_t {
|
||||
AiPassive = 0x01, // never attacks unless attacked
|
||||
AiAggressive = 0x02, // attacks players within aggro radius
|
||||
AiFleeLowHp = 0x04, // runs at low health
|
||||
AiCallHelp = 0x08, // calls allies into combat
|
||||
AiNoLeash = 0x10, // does not return to spawn point
|
||||
};
|
||||
|
||||
struct Entry {
|
||||
uint32_t creatureId = 0;
|
||||
uint32_t displayId = 0;
|
||||
std::string name;
|
||||
std::string subname; // e.g. "Innkeeper", "Stable Master"
|
||||
uint16_t minLevel = 1;
|
||||
uint16_t maxLevel = 1;
|
||||
uint32_t baseHealth = 50;
|
||||
uint16_t healthPerLevel = 10;
|
||||
uint32_t baseMana = 0;
|
||||
uint16_t manaPerLevel = 0;
|
||||
uint32_t factionId = 35; // friendly default
|
||||
uint32_t npcFlags = 0;
|
||||
uint8_t typeId = Humanoid;
|
||||
uint8_t familyId = FamNone;
|
||||
uint32_t damageMin = 1;
|
||||
uint32_t damageMax = 3;
|
||||
uint32_t attackSpeedMs = 2000;
|
||||
uint32_t baseArmor = 0;
|
||||
float walkSpeed = 1.0f;
|
||||
float runSpeed = 1.14f; // canonical WoW base
|
||||
uint32_t gossipId = 0;
|
||||
uint32_t equippedMain = 0;
|
||||
uint32_t equippedOffhand = 0;
|
||||
uint32_t equippedRanged = 0;
|
||||
uint32_t aiFlags = AiPassive;
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::vector<Entry> entries;
|
||||
|
||||
bool isValid() const { return !entries.empty(); }
|
||||
|
||||
// Lookup by creatureId — nullptr if not present.
|
||||
const Entry* findById(uint32_t creatureId) const;
|
||||
|
||||
static const char* typeName(uint8_t t);
|
||||
static const char* familyName(uint8_t f);
|
||||
};
|
||||
|
||||
class WoweeCreatureLoader {
|
||||
public:
|
||||
static bool save(const WoweeCreature& cat,
|
||||
const std::string& basePath);
|
||||
static WoweeCreature load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-creatures* variants.
|
||||
//
|
||||
// makeStarter — 1 friendly humanoid (innkeeper), level
|
||||
// 30, vendor + innkeeper flags.
|
||||
// makeBandit — 1 hostile humanoid (creatureId=1000,
|
||||
// matches WSPN camp + WLOT bandit table).
|
||||
// level 5..7, aggressive AI, equips a
|
||||
// sword (WIT itemId=1001).
|
||||
// makeMerchants — 3 NPCs covering the WSPN village
|
||||
// creatures (innkeeper / smith / alchemist),
|
||||
// creatureIds 4001/4002/4003.
|
||||
static WoweeCreature makeStarter(const std::string& catalogName);
|
||||
static WoweeCreature makeBandit(const std::string& catalogName);
|
||||
static WoweeCreature makeMerchants(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue