mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-10 19:13:52 +00:00
feat(editor): add WPSP (Player Spawn Profile) open catalog format
Open replacement for AzerothCore's playercreateinfo SQL table plus the per-class/race starting fields in CharStartOutfit.dbc. Defines the initial state for a newly created character: starting map / zone / position / facing, bind point (Hearthstone destination), up to 4 starting items with counts, and up to 4 starting spells. One entry per (race, class) combination — a Human Warrior spawns at Northshire Abbey with a Worn Shortsword and Heroic Strike already learned, while an Orc Hunter spawns in Valley of Trials with Aimed Shot and a starter rifle. Death Knights have their own preset spawning at lvl 55 in Acherus, the Ebon Hold. The race+class fields are bitmasks (mirroring WCHC layout) so one profile entry can cover multiple class/race combinations that share starting state. findByRaceClass(raceBit, classBit) is the engine helper used by character creation. Cross-references back to WCHC (race/class bit layouts), WMS (map ids), WIT (starting item ids), and WSPL (starting spell ids). Three preset emitters: --gen-psp (5 Alliance combos covering each starting zone from Northshire to Ammen Vale), --gen-psp-horde (5 Horde combos from Valley of Trials to Sunstrider Isle), --gen-psp-dk (2 DK combos at lvl 55 in Acherus with Death Coil / Plague Strike / Death Grip starter loadout). Validation enforces id+name+race+class+startingLevel presence, no duplicate ids; warns on (0,0,0) spawn (uninitialized entry), item id/count mismatch (granted item without count or vice versa), startingLevel > 80 (above WotLK cap), and Death Knight class with startingLevel < 55 (DKs canonically start at 55). Wired through the cross-format table; WPSP appears automatically in all 12 cross-format utilities. Format count 76 -> 77; CLI flag count 951 -> 956.
This commit is contained in:
parent
f606edc4c9
commit
082ee495dc
10 changed files with 789 additions and 0 deletions
|
|
@ -665,6 +665,7 @@ set(WOWEE_SOURCES
|
|||
src/pipeline/wowee_glyph_slots.cpp
|
||||
src/pipeline/wowee_creature_difficulties.cpp
|
||||
src/pipeline/wowee_item_materials.cpp
|
||||
src/pipeline/wowee_player_spawn_profiles.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/dbc_layout.cpp
|
||||
|
||||
|
|
@ -1488,6 +1489,7 @@ add_executable(wowee_editor
|
|||
tools/editor/cli_glyph_slots_catalog.cpp
|
||||
tools/editor/cli_creature_difficulties_catalog.cpp
|
||||
tools/editor/cli_item_materials_catalog.cpp
|
||||
tools/editor/cli_player_spawn_profiles_catalog.cpp
|
||||
tools/editor/cli_quest_objective.cpp
|
||||
tools/editor/cli_quest_reward.cpp
|
||||
tools/editor/cli_clone.cpp
|
||||
|
|
@ -1631,6 +1633,7 @@ add_executable(wowee_editor
|
|||
src/pipeline/wowee_glyph_slots.cpp
|
||||
src/pipeline/wowee_creature_difficulties.cpp
|
||||
src/pipeline/wowee_item_materials.cpp
|
||||
src/pipeline/wowee_player_spawn_profiles.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/terrain_mesh.cpp
|
||||
|
||||
|
|
|
|||
138
include/pipeline/wowee_player_spawn_profiles.hpp
Normal file
138
include/pipeline/wowee_player_spawn_profiles.hpp
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Player Spawn Profile catalog (.wpsp) —
|
||||
// novel replacement for AzerothCore's playercreateinfo
|
||||
// SQL table plus the per-class/race starting fields in
|
||||
// CharStartOutfit.dbc. Defines the initial state for a
|
||||
// newly created character: starting map / zone /
|
||||
// position, bind point (Hearthstone destination),
|
||||
// starting items, and starting spells.
|
||||
//
|
||||
// One entry per (class, race) combination — a Human
|
||||
// Warrior spawns at Northshire Abbey with a Warrior's
|
||||
// Hammer and Heroic Strike already learned, while an
|
||||
// Orc Hunter spawns in Valley of Trials with a starter
|
||||
// gun and Aimed Shot. Death Knights have their own
|
||||
// preset spawning at lvl 55 in Acherus.
|
||||
//
|
||||
// Cross-references with previously-added formats:
|
||||
// WCHC: race / class fields use the same bit layout
|
||||
// as WCHC class / race IDs.
|
||||
// WMS: mapId / bindMapId reference WMS map entries.
|
||||
// WIT: startingItem*Id reference WIT item entries.
|
||||
// WSPL: startingSpell*Id reference WSPL spell entries.
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WPSP"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// profileId (uint32)
|
||||
// nameLen + name
|
||||
// descLen + description
|
||||
// raceMask (uint32)
|
||||
// classMask (uint32)
|
||||
// mapId (uint32)
|
||||
// zoneId (uint32)
|
||||
// spawnX (float) / spawnY (float) / spawnZ (float)
|
||||
// spawnFacing (float)
|
||||
// bindMapId (uint32)
|
||||
// bindZoneId (uint32)
|
||||
// startingItem1Id (uint32) / startingItem1Count (uint32)
|
||||
// startingItem2Id (uint32) / startingItem2Count (uint32)
|
||||
// startingItem3Id (uint32) / startingItem3Count (uint32)
|
||||
// startingItem4Id (uint32) / startingItem4Count (uint32)
|
||||
// startingSpell1Id (uint32)
|
||||
// startingSpell2Id (uint32)
|
||||
// startingSpell3Id (uint32)
|
||||
// startingSpell4Id (uint32)
|
||||
// startingLevel (uint8) / pad[3]
|
||||
// iconColorRGBA (uint32)
|
||||
struct WoweePlayerSpawnProfile {
|
||||
struct Entry {
|
||||
uint32_t profileId = 0;
|
||||
std::string name;
|
||||
std::string description;
|
||||
uint32_t raceMask = 0;
|
||||
uint32_t classMask = 0;
|
||||
uint32_t mapId = 0;
|
||||
uint32_t zoneId = 0;
|
||||
float spawnX = 0.0f;
|
||||
float spawnY = 0.0f;
|
||||
float spawnZ = 0.0f;
|
||||
float spawnFacing = 0.0f;
|
||||
uint32_t bindMapId = 0;
|
||||
uint32_t bindZoneId = 0;
|
||||
uint32_t startingItem1Id = 0;
|
||||
uint32_t startingItem1Count = 0;
|
||||
uint32_t startingItem2Id = 0;
|
||||
uint32_t startingItem2Count = 0;
|
||||
uint32_t startingItem3Id = 0;
|
||||
uint32_t startingItem3Count = 0;
|
||||
uint32_t startingItem4Id = 0;
|
||||
uint32_t startingItem4Count = 0;
|
||||
uint32_t startingSpell1Id = 0;
|
||||
uint32_t startingSpell2Id = 0;
|
||||
uint32_t startingSpell3Id = 0;
|
||||
uint32_t startingSpell4Id = 0;
|
||||
uint8_t startingLevel = 1;
|
||||
uint8_t pad0 = 0;
|
||||
uint8_t pad1 = 0;
|
||||
uint8_t pad2 = 0;
|
||||
uint32_t iconColorRGBA = 0xFFFFFFFFu;
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::vector<Entry> entries;
|
||||
|
||||
bool isValid() const { return !entries.empty(); }
|
||||
|
||||
const Entry* findById(uint32_t profileId) const;
|
||||
|
||||
// Find the first profile whose race/class masks both
|
||||
// include the given bits. Used by character creation
|
||||
// to look up "Human Warrior" given race=Human(1) +
|
||||
// class=Warrior(1).
|
||||
const Entry* findByRaceClass(uint32_t raceBit,
|
||||
uint32_t classBit) const;
|
||||
};
|
||||
|
||||
class WoweePlayerSpawnProfileLoader {
|
||||
public:
|
||||
static bool save(const WoweePlayerSpawnProfile& cat,
|
||||
const std::string& basePath);
|
||||
static WoweePlayerSpawnProfile load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-psp* variants.
|
||||
//
|
||||
// makeAlliance — 5 Alliance combos covering each
|
||||
// starting zone (Human Warrior in
|
||||
// Northshire, Dwarf Hunter in Coldridge,
|
||||
// NightElf Druid in Shadowglen, Gnome
|
||||
// Mage in Anvilmar, Draenei Shaman
|
||||
// in Ammen Vale).
|
||||
// makeHorde — 5 Horde combos (Orc Warrior in
|
||||
// Valley of Trials, Tauren Druid in
|
||||
// Camp Narache, Undead Mage in Deathknell,
|
||||
// Troll Hunter in Valley of Trials,
|
||||
// BloodElf Priest in Sunstrider Isle).
|
||||
// makeDeathKnight — 2 DK combos (Alliance Human DK and
|
||||
// Horde Orc DK) starting at lvl 55 in
|
||||
// Acherus, with the standard DK
|
||||
// starter spell set.
|
||||
static WoweePlayerSpawnProfile makeAlliance(const std::string& catalogName);
|
||||
static WoweePlayerSpawnProfile makeHorde(const std::string& catalogName);
|
||||
static WoweePlayerSpawnProfile makeDeathKnight(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
342
src/pipeline/wowee_player_spawn_profiles.cpp
Normal file
342
src/pipeline/wowee_player_spawn_profiles.cpp
Normal file
|
|
@ -0,0 +1,342 @@
|
|||
#include "pipeline/wowee_player_spawn_profiles.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kMagic[4] = {'W', 'P', 'S', 'P'};
|
||||
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) != ".wpsp") {
|
||||
base += ".wpsp";
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
// Race bits, mirroring WCHC layout. Used by presets.
|
||||
constexpr uint32_t RACE_HUMAN = 1u << 0;
|
||||
constexpr uint32_t RACE_ORC = 1u << 1;
|
||||
constexpr uint32_t RACE_DWARF = 1u << 2;
|
||||
constexpr uint32_t RACE_NIGHTELF = 1u << 3;
|
||||
constexpr uint32_t RACE_UNDEAD = 1u << 4;
|
||||
constexpr uint32_t RACE_TAUREN = 1u << 5;
|
||||
constexpr uint32_t RACE_GNOME = 1u << 6;
|
||||
constexpr uint32_t RACE_TROLL = 1u << 7;
|
||||
constexpr uint32_t RACE_BLOODELF = 1u << 9;
|
||||
constexpr uint32_t RACE_DRAENEI = 1u << 10;
|
||||
|
||||
// Class bits, mirroring WCHC layout. Used by presets.
|
||||
constexpr uint32_t CLS_WARRIOR = 1u << 0;
|
||||
constexpr uint32_t CLS_PALADIN = 1u << 1;
|
||||
constexpr uint32_t CLS_HUNTER = 1u << 2;
|
||||
constexpr uint32_t CLS_PRIEST = 1u << 4;
|
||||
constexpr uint32_t CLS_DK = 1u << 5;
|
||||
constexpr uint32_t CLS_SHAMAN = 1u << 6;
|
||||
constexpr uint32_t CLS_MAGE = 1u << 7;
|
||||
constexpr uint32_t CLS_DRUID = 1u << 10;
|
||||
|
||||
} // namespace
|
||||
|
||||
const WoweePlayerSpawnProfile::Entry*
|
||||
WoweePlayerSpawnProfile::findById(uint32_t profileId) const {
|
||||
for (const auto& e : entries)
|
||||
if (e.profileId == profileId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const WoweePlayerSpawnProfile::Entry*
|
||||
WoweePlayerSpawnProfile::findByRaceClass(uint32_t raceBit,
|
||||
uint32_t classBit) const {
|
||||
for (const auto& e : entries) {
|
||||
if ((e.raceMask & raceBit) && (e.classMask & classBit))
|
||||
return &e;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool WoweePlayerSpawnProfileLoader::save(
|
||||
const WoweePlayerSpawnProfile& 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.profileId);
|
||||
writeStr(os, e.name);
|
||||
writeStr(os, e.description);
|
||||
writePOD(os, e.raceMask);
|
||||
writePOD(os, e.classMask);
|
||||
writePOD(os, e.mapId);
|
||||
writePOD(os, e.zoneId);
|
||||
writePOD(os, e.spawnX);
|
||||
writePOD(os, e.spawnY);
|
||||
writePOD(os, e.spawnZ);
|
||||
writePOD(os, e.spawnFacing);
|
||||
writePOD(os, e.bindMapId);
|
||||
writePOD(os, e.bindZoneId);
|
||||
writePOD(os, e.startingItem1Id);
|
||||
writePOD(os, e.startingItem1Count);
|
||||
writePOD(os, e.startingItem2Id);
|
||||
writePOD(os, e.startingItem2Count);
|
||||
writePOD(os, e.startingItem3Id);
|
||||
writePOD(os, e.startingItem3Count);
|
||||
writePOD(os, e.startingItem4Id);
|
||||
writePOD(os, e.startingItem4Count);
|
||||
writePOD(os, e.startingSpell1Id);
|
||||
writePOD(os, e.startingSpell2Id);
|
||||
writePOD(os, e.startingSpell3Id);
|
||||
writePOD(os, e.startingSpell4Id);
|
||||
writePOD(os, e.startingLevel);
|
||||
writePOD(os, e.pad0);
|
||||
writePOD(os, e.pad1);
|
||||
writePOD(os, e.pad2);
|
||||
writePOD(os, e.iconColorRGBA);
|
||||
}
|
||||
return os.good();
|
||||
}
|
||||
|
||||
WoweePlayerSpawnProfile WoweePlayerSpawnProfileLoader::load(
|
||||
const std::string& basePath) {
|
||||
WoweePlayerSpawnProfile 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.profileId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readStr(is, e.name) || !readStr(is, e.description)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.raceMask) ||
|
||||
!readPOD(is, e.classMask) ||
|
||||
!readPOD(is, e.mapId) ||
|
||||
!readPOD(is, e.zoneId) ||
|
||||
!readPOD(is, e.spawnX) ||
|
||||
!readPOD(is, e.spawnY) ||
|
||||
!readPOD(is, e.spawnZ) ||
|
||||
!readPOD(is, e.spawnFacing) ||
|
||||
!readPOD(is, e.bindMapId) ||
|
||||
!readPOD(is, e.bindZoneId) ||
|
||||
!readPOD(is, e.startingItem1Id) ||
|
||||
!readPOD(is, e.startingItem1Count) ||
|
||||
!readPOD(is, e.startingItem2Id) ||
|
||||
!readPOD(is, e.startingItem2Count) ||
|
||||
!readPOD(is, e.startingItem3Id) ||
|
||||
!readPOD(is, e.startingItem3Count) ||
|
||||
!readPOD(is, e.startingItem4Id) ||
|
||||
!readPOD(is, e.startingItem4Count) ||
|
||||
!readPOD(is, e.startingSpell1Id) ||
|
||||
!readPOD(is, e.startingSpell2Id) ||
|
||||
!readPOD(is, e.startingSpell3Id) ||
|
||||
!readPOD(is, e.startingSpell4Id) ||
|
||||
!readPOD(is, e.startingLevel) ||
|
||||
!readPOD(is, e.pad0) ||
|
||||
!readPOD(is, e.pad1) ||
|
||||
!readPOD(is, e.pad2) ||
|
||||
!readPOD(is, e.iconColorRGBA)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweePlayerSpawnProfileLoader::exists(
|
||||
const std::string& basePath) {
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
return is.good();
|
||||
}
|
||||
|
||||
WoweePlayerSpawnProfile WoweePlayerSpawnProfileLoader::makeAlliance(
|
||||
const std::string& catalogName) {
|
||||
using P = WoweePlayerSpawnProfile;
|
||||
WoweePlayerSpawnProfile c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint32_t race,
|
||||
uint32_t cls, uint32_t map, uint32_t zone,
|
||||
float x, float y, float z, float facing,
|
||||
uint32_t i1, uint32_t i2, uint32_t i3,
|
||||
uint32_t s1, uint32_t s2, const char* desc) {
|
||||
P::Entry e;
|
||||
e.profileId = id; e.name = name; e.description = desc;
|
||||
e.raceMask = race; e.classMask = cls;
|
||||
e.mapId = map; e.zoneId = zone;
|
||||
e.spawnX = x; e.spawnY = y; e.spawnZ = z;
|
||||
e.spawnFacing = facing;
|
||||
e.bindMapId = map; e.bindZoneId = zone;
|
||||
e.startingItem1Id = i1; e.startingItem1Count = i1 ? 1 : 0;
|
||||
e.startingItem2Id = i2; e.startingItem2Count = i2 ? 1 : 0;
|
||||
e.startingItem3Id = i3; e.startingItem3Count = i3 ? 1 : 0;
|
||||
e.startingSpell1Id = s1;
|
||||
e.startingSpell2Id = s2;
|
||||
e.startingLevel = 1;
|
||||
e.iconColorRGBA = packRgba(100, 140, 240); // alliance blue
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
// Map 0 = Eastern Kingdoms, Map 1 = Kalimdor, Map 530 = Outland.
|
||||
// Coordinates are illustrative — match standard 3.3.5a starting
|
||||
// positions for each race's home zone.
|
||||
add(1, "HumanWarrior", RACE_HUMAN, CLS_WARRIOR, 0, 9,
|
||||
-8949.95f, -132.49f, 83.53f, 0.0f,
|
||||
25, 38, 6948, 78, 81, "Human Warrior — Northshire Abbey, Elwynn Forest.");
|
||||
add(2, "DwarfHunter", RACE_DWARF, CLS_HUNTER, 0, 132,
|
||||
-6240.32f, 331.03f, 382.76f, 6.18f,
|
||||
117, 38, 6948, 75, 2480, "Dwarf Hunter — Coldridge Valley, Dun Morogh.");
|
||||
add(3, "NightElfDruid", RACE_NIGHTELF, CLS_DRUID, 1, 141,
|
||||
10311.30f, 832.97f, 1326.41f, 5.69f,
|
||||
2070, 38, 6948, 5176, 8946, "Night Elf Druid — Shadowglen, Teldrassil.");
|
||||
add(4, "GnomeMage", RACE_GNOME, CLS_MAGE, 0, 132,
|
||||
-6240.32f, 331.03f, 382.76f, 6.18f,
|
||||
2362, 38, 6948, 168, 5009, "Gnome Mage — Coldridge Valley, Dun Morogh.");
|
||||
add(5, "DraeneiShaman", RACE_DRAENEI, CLS_SHAMAN, 530, 3524,
|
||||
-3961.64f, -13931.20f, 100.61f, 2.08f,
|
||||
24146, 38, 6948, 403, 332, "Draenei Shaman — Ammen Vale, Azuremyst Isle.");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweePlayerSpawnProfile WoweePlayerSpawnProfileLoader::makeHorde(
|
||||
const std::string& catalogName) {
|
||||
using P = WoweePlayerSpawnProfile;
|
||||
WoweePlayerSpawnProfile c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint32_t race,
|
||||
uint32_t cls, uint32_t map, uint32_t zone,
|
||||
float x, float y, float z, float facing,
|
||||
uint32_t i1, uint32_t i2, uint32_t i3,
|
||||
uint32_t s1, uint32_t s2, const char* desc) {
|
||||
P::Entry e;
|
||||
e.profileId = id; e.name = name; e.description = desc;
|
||||
e.raceMask = race; e.classMask = cls;
|
||||
e.mapId = map; e.zoneId = zone;
|
||||
e.spawnX = x; e.spawnY = y; e.spawnZ = z;
|
||||
e.spawnFacing = facing;
|
||||
e.bindMapId = map; e.bindZoneId = zone;
|
||||
e.startingItem1Id = i1; e.startingItem1Count = i1 ? 1 : 0;
|
||||
e.startingItem2Id = i2; e.startingItem2Count = i2 ? 1 : 0;
|
||||
e.startingItem3Id = i3; e.startingItem3Count = i3 ? 1 : 0;
|
||||
e.startingSpell1Id = s1;
|
||||
e.startingSpell2Id = s2;
|
||||
e.startingLevel = 1;
|
||||
e.iconColorRGBA = packRgba(220, 60, 60); // horde red
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(100, "OrcWarrior", RACE_ORC, CLS_WARRIOR, 1, 14,
|
||||
-618.51f, -4251.67f, 38.71f, 4.74f,
|
||||
25, 38, 6948, 78, 81, "Orc Warrior — Valley of Trials, Durotar.");
|
||||
add(101, "TaurenDruid", RACE_TAUREN, CLS_DRUID, 1, 215,
|
||||
-2917.58f, -257.98f, 52.99f, 5.27f,
|
||||
2070, 38, 6948, 5176, 8946, "Tauren Druid — Camp Narache, Mulgore.");
|
||||
add(102, "UndeadMage", RACE_UNDEAD, CLS_MAGE, 0, 85,
|
||||
1676.71f, 1677.45f, 121.67f, 2.70f,
|
||||
2362, 38, 6948, 168, 5009, "Undead Mage — Deathknell, Tirisfal Glades.");
|
||||
add(103, "TrollHunter", RACE_TROLL, CLS_HUNTER, 1, 14,
|
||||
-618.51f, -4251.67f, 38.71f, 4.74f,
|
||||
117, 38, 6948, 75, 2480, "Troll Hunter — Valley of Trials, Durotar.");
|
||||
add(104, "BloodElfPriest", RACE_BLOODELF, CLS_PRIEST, 530, 3431,
|
||||
10349.60f, -6357.29f, 33.43f, 5.31f,
|
||||
24145, 38, 6948, 585, 2050, "Blood Elf Priest — Sunstrider Isle, Eversong.");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweePlayerSpawnProfile WoweePlayerSpawnProfileLoader::makeDeathKnight(
|
||||
const std::string& catalogName) {
|
||||
using P = WoweePlayerSpawnProfile;
|
||||
WoweePlayerSpawnProfile c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint32_t race,
|
||||
const char* desc) {
|
||||
P::Entry e;
|
||||
e.profileId = id; e.name = name; e.description = desc;
|
||||
e.raceMask = race;
|
||||
e.classMask = CLS_DK;
|
||||
// Acherus, the Ebon Hold — instance map 609.
|
||||
e.mapId = 609; e.zoneId = 4298;
|
||||
e.spawnX = 2406.18f;
|
||||
e.spawnY = -5342.66f;
|
||||
e.spawnZ = 382.34f;
|
||||
e.spawnFacing = 1.43f;
|
||||
e.bindMapId = 609; e.bindZoneId = 4298;
|
||||
// Standard DK starter loadout: Acherus Knight's
|
||||
// sword, mail set, runeforging knowledge.
|
||||
e.startingItem1Id = 38147; // Tabard of the Lich King
|
||||
e.startingItem1Count = 1;
|
||||
e.startingItem2Id = 38149; // Acherus Knight sword
|
||||
e.startingItem2Count = 1;
|
||||
// Standard DK starter spells: Death Coil, Plague
|
||||
// Strike, Death Grip.
|
||||
e.startingSpell1Id = 47541; // Death Coil
|
||||
e.startingSpell2Id = 45462; // Plague Strike
|
||||
e.startingSpell3Id = 49576; // Death Grip
|
||||
e.startingLevel = 55;
|
||||
e.iconColorRGBA = packRgba(140, 240, 220); // DK frost cyan
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(200, "AllianceHumanDK", RACE_HUMAN,
|
||||
"Alliance Human Death Knight — starts at lvl 55 in "
|
||||
"Acherus, the Ebon Hold.");
|
||||
add(201, "HordeOrcDK", RACE_ORC,
|
||||
"Horde Orc Death Knight — starts at lvl 55 in "
|
||||
"Acherus, the Ebon Hold.");
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
|
|
@ -234,6 +234,8 @@ const char* const kArgRequired[] = {
|
|||
"--gen-mat", "--gen-mat-weapon", "--gen-mat-magical",
|
||||
"--info-wmat", "--validate-wmat",
|
||||
"--export-wmat-json", "--import-wmat-json",
|
||||
"--gen-psp", "--gen-psp-horde", "--gen-psp-dk",
|
||||
"--info-wpsp", "--validate-wpsp",
|
||||
"--gen-weather-temperate", "--gen-weather-arctic",
|
||||
"--gen-weather-desert", "--gen-weather-stormy",
|
||||
"--gen-zone-atmosphere",
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@
|
|||
#include "cli_glyph_slots_catalog.hpp"
|
||||
#include "cli_creature_difficulties_catalog.hpp"
|
||||
#include "cli_item_materials_catalog.hpp"
|
||||
#include "cli_player_spawn_profiles_catalog.hpp"
|
||||
#include "cli_quest_objective.hpp"
|
||||
#include "cli_quest_reward.hpp"
|
||||
#include "cli_clone.hpp"
|
||||
|
|
@ -273,6 +274,7 @@ constexpr DispatchFn kDispatchTable[] = {
|
|||
handleGlyphSlotsCatalog,
|
||||
handleCreatureDifficultiesCatalog,
|
||||
handleItemMaterialsCatalog,
|
||||
handlePlayerSpawnProfilesCatalog,
|
||||
handleQuestObjective,
|
||||
handleQuestReward,
|
||||
handleClone,
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ constexpr FormatMagicEntry kFormats[] = {
|
|||
{{'W','G','F','S'}, ".wgfs", "glyphs", "--info-wgfs", "Glyph slot layout catalog"},
|
||||
{{'W','C','D','F'}, ".wcdf", "creatures", "--info-wcdf", "Creature difficulty variant catalog"},
|
||||
{{'W','M','A','T'}, ".wmat", "items", "--info-wmat", "Item material catalog"},
|
||||
{{'W','P','S','P'}, ".wpsp", "chars", "--info-wpsp", "Player spawn profile 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"},
|
||||
|
|
|
|||
|
|
@ -1819,6 +1819,16 @@ void printUsage(const char* argv0) {
|
|||
std::printf(" Export binary .wmat to a human-editable JSON sidecar (defaults to <base>.wmat.json)\n");
|
||||
std::printf(" --import-wmat-json <json-path> [out-base]\n");
|
||||
std::printf(" Import a .wmat.json sidecar back into binary .wmat (accepts materialKind/weightCategory int OR name; materialFlags int OR pipe-separated label string)\n");
|
||||
std::printf(" --gen-psp <wpsp-base> [name]\n");
|
||||
std::printf(" Emit .wpsp 5 Alliance starting profiles (Human Warrior / Dwarf Hunter / NightElf Druid / Gnome Mage / Draenei Shaman) with race+class spawn coords\n");
|
||||
std::printf(" --gen-psp-horde <wpsp-base> [name]\n");
|
||||
std::printf(" Emit .wpsp 5 Horde starting profiles (Orc Warrior / Tauren Druid / Undead Mage / Troll Hunter / BloodElf Priest)\n");
|
||||
std::printf(" --gen-psp-dk <wpsp-base> [name]\n");
|
||||
std::printf(" Emit .wpsp 2 Death Knight profiles (Alliance Human / Horde Orc) starting at lvl 55 in Acherus with DK starter spell loadout\n");
|
||||
std::printf(" --info-wpsp <wpsp-base> [--json]\n");
|
||||
std::printf(" Print WPSP entries (id / raceMask / classMask / map / zone / startingLevel / spawn coords / name)\n");
|
||||
std::printf(" --validate-wpsp <wpsp-base> [--json]\n");
|
||||
std::printf(" Static checks: id+name+race+class+startingLevel required, no duplicate ids; warns on (0,0,0) spawn, item id/count mismatch, lvl>80, DK not at 55\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");
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ constexpr FormatRow kFormats[] = {
|
|||
{"WGFS", ".wgfs", "glyphs", "GlyphSlot.dbc", "Glyph slot layout catalog"},
|
||||
{"WCDF", ".wcdf", "creatures", "CreatureDifficulty.dbc", "Creature difficulty variant catalog"},
|
||||
{"WMAT", ".wmat", "items", "Material.dbc + ItemDisplayInfo", "Item material catalog"},
|
||||
{"WPSP", ".wpsp", "chars", "playercreateinfo SQL + StartOutfit","Player spawn profile catalog"},
|
||||
|
||||
// Additional pipeline catalogs without the alternating
|
||||
// gen/info/validate CLI surface (loaded by the engine
|
||||
|
|
|
|||
278
tools/editor/cli_player_spawn_profiles_catalog.cpp
Normal file
278
tools/editor/cli_player_spawn_profiles_catalog.cpp
Normal file
|
|
@ -0,0 +1,278 @@
|
|||
#include "cli_player_spawn_profiles_catalog.hpp"
|
||||
#include "cli_arg_parse.hpp"
|
||||
#include "cli_box_emitter.hpp"
|
||||
|
||||
#include "pipeline/wowee_player_spawn_profiles.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 stripWpspExt(std::string base) {
|
||||
stripExt(base, ".wpsp");
|
||||
return base;
|
||||
}
|
||||
|
||||
bool saveOrError(const wowee::pipeline::WoweePlayerSpawnProfile& c,
|
||||
const std::string& base, const char* cmd) {
|
||||
if (!wowee::pipeline::WoweePlayerSpawnProfileLoader::save(c, base)) {
|
||||
std::fprintf(stderr, "%s: failed to save %s.wpsp\n",
|
||||
cmd, base.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void printGenSummary(const wowee::pipeline::WoweePlayerSpawnProfile& c,
|
||||
const std::string& base) {
|
||||
std::printf("Wrote %s.wpsp\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" profiles : %zu\n", c.entries.size());
|
||||
}
|
||||
|
||||
int handleGenAlliance(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "AllianceStartingProfiles";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWpspExt(base);
|
||||
auto c = wowee::pipeline::WoweePlayerSpawnProfileLoader::makeAlliance(name);
|
||||
if (!saveOrError(c, base, "gen-psp")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenHorde(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "HordeStartingProfiles";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWpspExt(base);
|
||||
auto c = wowee::pipeline::WoweePlayerSpawnProfileLoader::makeHorde(name);
|
||||
if (!saveOrError(c, base, "gen-psp-horde")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenDeathKnight(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "DeathKnightProfiles";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWpspExt(base);
|
||||
auto c = wowee::pipeline::WoweePlayerSpawnProfileLoader::makeDeathKnight(name);
|
||||
if (!saveOrError(c, base, "gen-psp-dk")) 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 = stripWpspExt(base);
|
||||
if (!wowee::pipeline::WoweePlayerSpawnProfileLoader::exists(base)) {
|
||||
std::fprintf(stderr, "WPSP not found: %s.wpsp\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweePlayerSpawnProfileLoader::load(base);
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wpsp"] = base + ".wpsp";
|
||||
j["name"] = c.name;
|
||||
j["count"] = c.entries.size();
|
||||
nlohmann::json arr = nlohmann::json::array();
|
||||
for (const auto& e : c.entries) {
|
||||
arr.push_back({
|
||||
{"profileId", e.profileId},
|
||||
{"name", e.name},
|
||||
{"description", e.description},
|
||||
{"raceMask", e.raceMask},
|
||||
{"classMask", e.classMask},
|
||||
{"mapId", e.mapId},
|
||||
{"zoneId", e.zoneId},
|
||||
{"spawnX", e.spawnX},
|
||||
{"spawnY", e.spawnY},
|
||||
{"spawnZ", e.spawnZ},
|
||||
{"spawnFacing", e.spawnFacing},
|
||||
{"bindMapId", e.bindMapId},
|
||||
{"bindZoneId", e.bindZoneId},
|
||||
{"startingItem1Id", e.startingItem1Id},
|
||||
{"startingItem1Count", e.startingItem1Count},
|
||||
{"startingItem2Id", e.startingItem2Id},
|
||||
{"startingItem2Count", e.startingItem2Count},
|
||||
{"startingItem3Id", e.startingItem3Id},
|
||||
{"startingItem3Count", e.startingItem3Count},
|
||||
{"startingItem4Id", e.startingItem4Id},
|
||||
{"startingItem4Count", e.startingItem4Count},
|
||||
{"startingSpell1Id", e.startingSpell1Id},
|
||||
{"startingSpell2Id", e.startingSpell2Id},
|
||||
{"startingSpell3Id", e.startingSpell3Id},
|
||||
{"startingSpell4Id", e.startingSpell4Id},
|
||||
{"startingLevel", e.startingLevel},
|
||||
{"iconColorRGBA", e.iconColorRGBA},
|
||||
});
|
||||
}
|
||||
j["entries"] = arr;
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return 0;
|
||||
}
|
||||
std::printf("WPSP: %s.wpsp\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" profiles : %zu\n", c.entries.size());
|
||||
if (c.entries.empty()) return 0;
|
||||
std::printf(" id raceMask classMask map zone lvl spawn (x,y,z) name\n");
|
||||
for (const auto& e : c.entries) {
|
||||
std::printf(" %4u 0x%08x 0x%08x %4u %4u %3u (%8.1f,%8.1f,%6.1f) %s\n",
|
||||
e.profileId,
|
||||
e.raceMask, e.classMask,
|
||||
e.mapId, e.zoneId,
|
||||
e.startingLevel,
|
||||
e.spawnX, e.spawnY, e.spawnZ,
|
||||
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 = stripWpspExt(base);
|
||||
if (!wowee::pipeline::WoweePlayerSpawnProfileLoader::exists(base)) {
|
||||
std::fprintf(stderr,
|
||||
"validate-wpsp: WPSP not found: %s.wpsp\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweePlayerSpawnProfileLoader::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.profileId);
|
||||
if (!e.name.empty()) ctx += " " + e.name;
|
||||
ctx += ")";
|
||||
if (e.profileId == 0)
|
||||
errors.push_back(ctx + ": profileId is 0");
|
||||
if (e.name.empty())
|
||||
errors.push_back(ctx + ": name is empty");
|
||||
if (e.raceMask == 0)
|
||||
errors.push_back(ctx +
|
||||
": raceMask is 0 — no race can spawn here");
|
||||
if (e.classMask == 0)
|
||||
errors.push_back(ctx +
|
||||
": classMask is 0 — no class can spawn here");
|
||||
if (e.startingLevel == 0)
|
||||
errors.push_back(ctx + ": startingLevel is 0");
|
||||
if (e.startingLevel > 80)
|
||||
warnings.push_back(ctx +
|
||||
": startingLevel " +
|
||||
std::to_string(e.startingLevel) +
|
||||
" > 80 — character will spawn above WotLK level cap");
|
||||
// (0,0,0) spawn position is suspicious — usually a
|
||||
// forgotten coord on a hand-edited entry.
|
||||
if (e.spawnX == 0.0f && e.spawnY == 0.0f && e.spawnZ == 0.0f) {
|
||||
warnings.push_back(ctx +
|
||||
": spawn position is (0,0,0) — likely an "
|
||||
"uninitialized entry");
|
||||
}
|
||||
// Item count without item id (or vice versa) is a
|
||||
// misconfiguration.
|
||||
auto checkItem = [&](uint32_t id, uint32_t count, int slot) {
|
||||
if (id == 0 && count != 0) {
|
||||
warnings.push_back(ctx +
|
||||
": startingItem" + std::to_string(slot) +
|
||||
" has count=" + std::to_string(count) +
|
||||
" but id=0 — item will not be granted");
|
||||
} else if (id != 0 && count == 0) {
|
||||
warnings.push_back(ctx +
|
||||
": startingItem" + std::to_string(slot) +
|
||||
" has id=" + std::to_string(id) +
|
||||
" but count=0 — item will not be granted");
|
||||
}
|
||||
};
|
||||
checkItem(e.startingItem1Id, e.startingItem1Count, 1);
|
||||
checkItem(e.startingItem2Id, e.startingItem2Count, 2);
|
||||
checkItem(e.startingItem3Id, e.startingItem3Count, 3);
|
||||
checkItem(e.startingItem4Id, e.startingItem4Count, 4);
|
||||
// DK spawning at lvl < 55 is misconfigured (DKs
|
||||
// always start at 55).
|
||||
constexpr uint32_t CLS_DK_BIT = 1u << 5;
|
||||
if ((e.classMask & CLS_DK_BIT) && e.startingLevel < 55) {
|
||||
warnings.push_back(ctx +
|
||||
": Death Knight class with startingLevel=" +
|
||||
std::to_string(e.startingLevel) +
|
||||
" — DKs canonically start at level 55");
|
||||
}
|
||||
for (uint32_t prev : idsSeen) {
|
||||
if (prev == e.profileId) {
|
||||
errors.push_back(ctx + ": duplicate profileId");
|
||||
break;
|
||||
}
|
||||
}
|
||||
idsSeen.push_back(e.profileId);
|
||||
}
|
||||
bool ok = errors.empty();
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wpsp"] = base + ".wpsp";
|
||||
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-wpsp: %s.wpsp\n", base.c_str());
|
||||
if (ok && warnings.empty()) {
|
||||
std::printf(" OK — %zu profiles, all profileIds unique, all masks set\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 handlePlayerSpawnProfilesCatalog(int& i, int argc, char** argv,
|
||||
int& outRc) {
|
||||
if (std::strcmp(argv[i], "--gen-psp") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenAlliance(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-psp-horde") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenHorde(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-psp-dk") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenDeathKnight(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--info-wpsp") == 0 && i + 1 < argc) {
|
||||
outRc = handleInfo(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--validate-wpsp") == 0 && i + 1 < argc) {
|
||||
outRc = handleValidate(i, argc, argv); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
12
tools/editor/cli_player_spawn_profiles_catalog.hpp
Normal file
12
tools/editor/cli_player_spawn_profiles_catalog.hpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
bool handlePlayerSpawnProfilesCatalog(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