mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-11 03:23:51 +00:00
feat(pipeline): add WCHF (Wowee Character Customization Feature) catalog
59th open format — replaces CharHairGeosets.dbc + CharFacialHairStyles.dbc plus the variation portions of CharSections.dbc. Defines per-(race, sex) customization options the character creation screen exposes: skin colors, face variations, hair styles, hair colors, facial hair (beards / mustaches), and race-specific markings (Tauren horns, Draenei tendrils, Blood Elf ears). 9 feature kinds (SkinColor / FaceVariation / HairStyle / HairColor / FacialHair / FacialColor / EarStyle / Horns / Markings) cover the full canonical customization surface. Each entry is one selectable carousel choice for one (race, sex, kind) tuple — variationIndex disambiguates. expansionGate enum gates Blood Elf / Draenei (TBC) and DK features (WotLK) behind the right expansion unlock. Cross-references with prior formats — raceId points at WCHC.race.raceId. requiresExpansion bit positions match the WLFG expansion enum (Classic=0, TBC=1, WotLK=2, Turtle=3) for consistency. CLI: --gen-chf (5 Human Male starter — skin / face / 2 hair styles / facial hair), --gen-chf-bloodelf (8 Blood Elf Female hair styles, requiresExpansion=TBC — the iconic TBC race feature), --gen-chf-tauren (6 Tauren Male features using race-specific Horns kind + 3 facial hair variations), --info-wchf, --validate-wchf with --json variants. Validator catches id+name+raceId+texturePath required, kind 0..8 / sex 0..1 / expansion 0..3, and the critical (race, sex, kind, variation) tuple-uniqueness check — duplicates would shadow each other in the create- character carousel. Format graph: 58 → 59 binary formats. CLI flag count: 819 → 826.
This commit is contained in:
parent
bf43259e10
commit
243d7f4416
10 changed files with 678 additions and 0 deletions
|
|
@ -647,6 +647,7 @@ set(WOWEE_SOURCES
|
|||
src/pipeline/wowee_spell_schools.cpp
|
||||
src/pipeline/wowee_lfg.cpp
|
||||
src/pipeline/wowee_macros.cpp
|
||||
src/pipeline/wowee_char_features.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/dbc_layout.cpp
|
||||
|
||||
|
|
@ -1448,6 +1449,7 @@ add_executable(wowee_editor
|
|||
tools/editor/cli_lfg_catalog.cpp
|
||||
tools/editor/cli_catalog_grep.cpp
|
||||
tools/editor/cli_macros_catalog.cpp
|
||||
tools/editor/cli_char_features_catalog.cpp
|
||||
tools/editor/cli_quest_objective.cpp
|
||||
tools/editor/cli_quest_reward.cpp
|
||||
tools/editor/cli_clone.cpp
|
||||
|
|
@ -1573,6 +1575,7 @@ add_executable(wowee_editor
|
|||
src/pipeline/wowee_spell_schools.cpp
|
||||
src/pipeline/wowee_lfg.cpp
|
||||
src/pipeline/wowee_macros.cpp
|
||||
src/pipeline/wowee_char_features.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/terrain_mesh.cpp
|
||||
|
||||
|
|
|
|||
126
include/pipeline/wowee_char_features.hpp
Normal file
126
include/pipeline/wowee_char_features.hpp
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Character Customization Feature catalog (.wchf)
|
||||
// — novel replacement for Blizzard's CharHairGeosets.dbc +
|
||||
// CharFacialHairStyles.dbc plus the variation portions of
|
||||
// CharSections.dbc. Defines the per-(race, sex) customization
|
||||
// options that the character creation screen exposes:
|
||||
// skin colors, face variations, hair styles, hair colors,
|
||||
// facial hair (beards / mustaches), and race-specific
|
||||
// markings (Tauren horns, Draenei tendrils, Blood Elf ears).
|
||||
//
|
||||
// Each entry describes ONE selectable customization choice
|
||||
// for ONE (race, sex, featureKind) tuple — variationIndex
|
||||
// disambiguates between options of the same kind. The
|
||||
// character renderer reads this catalog at the create-
|
||||
// character screen to populate the variant carousels and at
|
||||
// world-load to assemble the player's textures + geosets.
|
||||
//
|
||||
// Cross-references with previously-added formats:
|
||||
// WCHF.entry.raceId → WCHC.race.raceId
|
||||
// WCHF.entry.requiresExpansion bit positions match the
|
||||
// expansion enum used by WLFG
|
||||
// (Classic=0, TBC=1, WotLK=2,
|
||||
// Turtle=3).
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WCHF"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// featureId (uint32)
|
||||
// raceId (uint32)
|
||||
// nameLen + name
|
||||
// descLen + description
|
||||
// texLen + texturePath
|
||||
// featureKind (uint8) / sexId (uint8) /
|
||||
// variationIndex (uint8) / requiresExpansion (uint8)
|
||||
// geosetGroupBits (uint32)
|
||||
// hairColorOverlayId (uint32)
|
||||
struct WoweeCharFeature {
|
||||
enum FeatureKind : uint8_t {
|
||||
SkinColor = 0, // base body skin tone
|
||||
FaceVariation = 1, // facial features (eyes, nose)
|
||||
HairStyle = 2, // hairstyle geoset
|
||||
HairColor = 3, // hair texture overlay
|
||||
FacialHair = 4, // beard / mustache geoset
|
||||
FacialColor = 5, // facial hair color
|
||||
EarStyle = 6, // race-specific ear variations
|
||||
Horns = 7, // Tauren / Draenei horns
|
||||
Markings = 8, // tribal paint / scars / freckles
|
||||
};
|
||||
|
||||
enum SexId : uint8_t {
|
||||
Male = 0,
|
||||
Female = 1,
|
||||
};
|
||||
|
||||
enum ExpansionGate : uint8_t {
|
||||
Classic = 0,
|
||||
TBC = 1, // unlocks Blood Elf + Draenei options
|
||||
WotLK = 2, // unlocks Death Knight starting features
|
||||
TurtleWoW = 3, // custom-server additions
|
||||
};
|
||||
|
||||
struct Entry {
|
||||
uint32_t featureId = 0;
|
||||
uint32_t raceId = 0; // WCHC cross-ref
|
||||
std::string name;
|
||||
std::string description;
|
||||
std::string texturePath; // body / face / hair texture
|
||||
uint8_t featureKind = SkinColor;
|
||||
uint8_t sexId = Male;
|
||||
uint8_t variationIndex = 0; // 0..N within (race, sex, kind)
|
||||
uint8_t requiresExpansion = Classic;
|
||||
uint32_t geosetGroupBits = 0; // M2 geoset enable mask
|
||||
uint32_t hairColorOverlayId = 0; // 0 = no overlay
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::vector<Entry> entries;
|
||||
|
||||
bool isValid() const { return !entries.empty(); }
|
||||
|
||||
const Entry* findById(uint32_t featureId) const;
|
||||
|
||||
static const char* featureKindName(uint8_t k);
|
||||
static const char* sexIdName(uint8_t s);
|
||||
static const char* expansionGateName(uint8_t e);
|
||||
};
|
||||
|
||||
class WoweeCharFeatureLoader {
|
||||
public:
|
||||
static bool save(const WoweeCharFeature& cat,
|
||||
const std::string& basePath);
|
||||
static WoweeCharFeature load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-chf* variants.
|
||||
//
|
||||
// makeStarter — 5 Human Male options covering
|
||||
// the canonical kind triad (1 skin
|
||||
// color, 1 face, 2 hair styles,
|
||||
// 1 facial hair).
|
||||
// makeBloodElfFemale — 8 Blood Elf Female hair styles
|
||||
// (TBC iconic feature, requires
|
||||
// expansion=TBC).
|
||||
// makeTauren — 6 Tauren Male features (3 horn
|
||||
// variations + 3 facial hair —
|
||||
// Tauren get hair on their face
|
||||
// and chin and have horn variants
|
||||
// instead of EarStyle).
|
||||
static WoweeCharFeature makeStarter(const std::string& catalogName);
|
||||
static WoweeCharFeature makeBloodElfFemale(const std::string& catalogName);
|
||||
static WoweeCharFeature makeTauren(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
265
src/pipeline/wowee_char_features.cpp
Normal file
265
src/pipeline/wowee_char_features.cpp
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
#include "pipeline/wowee_char_features.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kMagic[4] = {'W', 'C', 'H', 'F'};
|
||||
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) != ".wchf") {
|
||||
base += ".wchf";
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const WoweeCharFeature::Entry*
|
||||
WoweeCharFeature::findById(uint32_t featureId) const {
|
||||
for (const auto& e : entries)
|
||||
if (e.featureId == featureId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* WoweeCharFeature::featureKindName(uint8_t k) {
|
||||
switch (k) {
|
||||
case SkinColor: return "skin-color";
|
||||
case FaceVariation: return "face";
|
||||
case HairStyle: return "hair-style";
|
||||
case HairColor: return "hair-color";
|
||||
case FacialHair: return "facial-hair";
|
||||
case FacialColor: return "facial-color";
|
||||
case EarStyle: return "ear-style";
|
||||
case Horns: return "horns";
|
||||
case Markings: return "markings";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
const char* WoweeCharFeature::sexIdName(uint8_t s) {
|
||||
switch (s) {
|
||||
case Male: return "male";
|
||||
case Female: return "female";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
const char* WoweeCharFeature::expansionGateName(uint8_t e) {
|
||||
switch (e) {
|
||||
case Classic: return "classic";
|
||||
case TBC: return "tbc";
|
||||
case WotLK: return "wotlk";
|
||||
case TurtleWoW: return "turtle";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
bool WoweeCharFeatureLoader::save(const WoweeCharFeature& 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.featureId);
|
||||
writePOD(os, e.raceId);
|
||||
writeStr(os, e.name);
|
||||
writeStr(os, e.description);
|
||||
writeStr(os, e.texturePath);
|
||||
writePOD(os, e.featureKind);
|
||||
writePOD(os, e.sexId);
|
||||
writePOD(os, e.variationIndex);
|
||||
writePOD(os, e.requiresExpansion);
|
||||
writePOD(os, e.geosetGroupBits);
|
||||
writePOD(os, e.hairColorOverlayId);
|
||||
}
|
||||
return os.good();
|
||||
}
|
||||
|
||||
WoweeCharFeature WoweeCharFeatureLoader::load(
|
||||
const std::string& basePath) {
|
||||
WoweeCharFeature 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.featureId) ||
|
||||
!readPOD(is, e.raceId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readStr(is, e.name) || !readStr(is, e.description) ||
|
||||
!readStr(is, e.texturePath)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.featureKind) ||
|
||||
!readPOD(is, e.sexId) ||
|
||||
!readPOD(is, e.variationIndex) ||
|
||||
!readPOD(is, e.requiresExpansion) ||
|
||||
!readPOD(is, e.geosetGroupBits) ||
|
||||
!readPOD(is, e.hairColorOverlayId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeCharFeatureLoader::exists(const std::string& basePath) {
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
return is.good();
|
||||
}
|
||||
|
||||
WoweeCharFeature WoweeCharFeatureLoader::makeStarter(
|
||||
const std::string& catalogName) {
|
||||
WoweeCharFeature c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, uint8_t kind, uint8_t variation,
|
||||
const char* name, const char* tex) {
|
||||
WoweeCharFeature::Entry e;
|
||||
e.featureId = id;
|
||||
e.raceId = 1; // Human raceId
|
||||
e.sexId = WoweeCharFeature::Male;
|
||||
e.featureKind = kind;
|
||||
e.variationIndex = variation;
|
||||
e.name = name;
|
||||
e.texturePath = tex;
|
||||
e.description = std::string("Human Male — ") +
|
||||
WoweeCharFeature::featureKindName(kind) +
|
||||
" variation " + std::to_string(variation);
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(1, WoweeCharFeature::SkinColor, 0, "Skin0",
|
||||
"textures/character/Human/Male/HumanMaleSkin00.blp");
|
||||
add(2, WoweeCharFeature::FaceVariation, 0, "Face0",
|
||||
"textures/character/Human/Male/HumanMaleFace00.blp");
|
||||
add(3, WoweeCharFeature::HairStyle, 0, "Hair0",
|
||||
"textures/character/Human/Male/HumanMaleHair00.blp");
|
||||
add(4, WoweeCharFeature::HairStyle, 1, "Hair1",
|
||||
"textures/character/Human/Male/HumanMaleHair01.blp");
|
||||
add(5, WoweeCharFeature::FacialHair, 0, "Beard0",
|
||||
"textures/character/Human/Male/HumanMaleFacialHair00.blp");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeCharFeature WoweeCharFeatureLoader::makeBloodElfFemale(
|
||||
const std::string& catalogName) {
|
||||
WoweeCharFeature c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, uint8_t variation, const char* name,
|
||||
uint32_t geosets) {
|
||||
WoweeCharFeature::Entry e;
|
||||
e.featureId = id;
|
||||
e.raceId = 10; // Blood Elf raceId
|
||||
e.sexId = WoweeCharFeature::Female;
|
||||
e.featureKind = WoweeCharFeature::HairStyle;
|
||||
e.variationIndex = variation;
|
||||
e.name = name;
|
||||
e.requiresExpansion = WoweeCharFeature::TBC;
|
||||
e.geosetGroupBits = geosets;
|
||||
e.texturePath = std::string("textures/character/BloodElf/Female/") +
|
||||
"BloodElfFemaleHair" +
|
||||
(variation < 10
|
||||
? std::string("0") + std::to_string(variation)
|
||||
: std::to_string(variation)) +
|
||||
".blp";
|
||||
e.description = std::string("Blood Elf Female hair style ") +
|
||||
std::to_string(variation);
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
// 8 iconic Blood Elf Female hairstyles. geosetGroupBits
|
||||
// values are placeholder — real M2 geoset masks come from
|
||||
// CharHairGeosets.dbc when ported.
|
||||
add(100, 0, "LongStraight", 0x0001);
|
||||
add(101, 1, "ShortBob", 0x0002);
|
||||
add(102, 2, "PonytailHigh", 0x0004);
|
||||
add(103, 3, "BraidedTwin", 0x0008);
|
||||
add(104, 4, "ShortPixie", 0x0010);
|
||||
add(105, 5, "LongWavy", 0x0020);
|
||||
add(106, 6, "TopknotMessy", 0x0040);
|
||||
add(107, 7, "SideSwept", 0x0080);
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeCharFeature WoweeCharFeatureLoader::makeTauren(
|
||||
const std::string& catalogName) {
|
||||
WoweeCharFeature c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, uint8_t kind, uint8_t variation,
|
||||
const char* name) {
|
||||
WoweeCharFeature::Entry e;
|
||||
e.featureId = id;
|
||||
e.raceId = 6; // Tauren raceId
|
||||
e.sexId = WoweeCharFeature::Male;
|
||||
e.featureKind = kind;
|
||||
e.variationIndex = variation;
|
||||
e.name = name;
|
||||
e.texturePath = std::string("textures/character/Tauren/Male/Tauren") +
|
||||
WoweeCharFeature::featureKindName(kind) +
|
||||
"_" + std::to_string(variation) + ".blp";
|
||||
e.description = std::string("Tauren Male — ") +
|
||||
WoweeCharFeature::featureKindName(kind) +
|
||||
" variant " + std::to_string(variation);
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
// 3 horn variations + 3 facial hair variations.
|
||||
add(200, WoweeCharFeature::Horns, 0, "ShortStraight");
|
||||
add(201, WoweeCharFeature::Horns, 1, "LongCurled");
|
||||
add(202, WoweeCharFeature::Horns, 2, "BrokenLeft");
|
||||
add(203, WoweeCharFeature::FacialHair, 0, "GoateeShort");
|
||||
add(204, WoweeCharFeature::FacialHair, 1, "FullBeard");
|
||||
add(205, WoweeCharFeature::FacialHair, 2, "HandlebarMustache");
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
|
|
@ -179,6 +179,8 @@ const char* const kArgRequired[] = {
|
|||
"--gen-mac", "--gen-mac-combat", "--gen-mac-utility",
|
||||
"--info-wmac", "--validate-wmac",
|
||||
"--export-wmac-json", "--import-wmac-json",
|
||||
"--gen-chf", "--gen-chf-bloodelf", "--gen-chf-tauren",
|
||||
"--info-wchf", "--validate-wchf",
|
||||
"--gen-weather-temperate", "--gen-weather-arctic",
|
||||
"--gen-weather-desert", "--gen-weather-stormy",
|
||||
"--gen-zone-atmosphere",
|
||||
|
|
|
|||
256
tools/editor/cli_char_features_catalog.cpp
Normal file
256
tools/editor/cli_char_features_catalog.cpp
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
#include "cli_char_features_catalog.hpp"
|
||||
#include "cli_arg_parse.hpp"
|
||||
#include "cli_box_emitter.hpp"
|
||||
|
||||
#include "pipeline/wowee_char_features.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
namespace {
|
||||
|
||||
std::string stripWchfExt(std::string base) {
|
||||
stripExt(base, ".wchf");
|
||||
return base;
|
||||
}
|
||||
|
||||
bool saveOrError(const wowee::pipeline::WoweeCharFeature& c,
|
||||
const std::string& base, const char* cmd) {
|
||||
if (!wowee::pipeline::WoweeCharFeatureLoader::save(c, base)) {
|
||||
std::fprintf(stderr, "%s: failed to save %s.wchf\n",
|
||||
cmd, base.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void printGenSummary(const wowee::pipeline::WoweeCharFeature& c,
|
||||
const std::string& base) {
|
||||
std::printf("Wrote %s.wchf\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" features : %zu\n", c.entries.size());
|
||||
}
|
||||
|
||||
int handleGenStarter(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "StarterCharFeatures";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWchfExt(base);
|
||||
auto c = wowee::pipeline::WoweeCharFeatureLoader::makeStarter(name);
|
||||
if (!saveOrError(c, base, "gen-chf")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenBloodElf(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "BloodElfFemaleHair";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWchfExt(base);
|
||||
auto c = wowee::pipeline::WoweeCharFeatureLoader::makeBloodElfFemale(name);
|
||||
if (!saveOrError(c, base, "gen-chf-bloodelf")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenTauren(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "TaurenMaleFeatures";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWchfExt(base);
|
||||
auto c = wowee::pipeline::WoweeCharFeatureLoader::makeTauren(name);
|
||||
if (!saveOrError(c, base, "gen-chf-tauren")) 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 = stripWchfExt(base);
|
||||
if (!wowee::pipeline::WoweeCharFeatureLoader::exists(base)) {
|
||||
std::fprintf(stderr, "WCHF not found: %s.wchf\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeCharFeatureLoader::load(base);
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wchf"] = base + ".wchf";
|
||||
j["name"] = c.name;
|
||||
j["count"] = c.entries.size();
|
||||
nlohmann::json arr = nlohmann::json::array();
|
||||
for (const auto& e : c.entries) {
|
||||
arr.push_back({
|
||||
{"featureId", e.featureId},
|
||||
{"raceId", e.raceId},
|
||||
{"name", e.name},
|
||||
{"description", e.description},
|
||||
{"texturePath", e.texturePath},
|
||||
{"featureKind", e.featureKind},
|
||||
{"featureKindName", wowee::pipeline::WoweeCharFeature::featureKindName(e.featureKind)},
|
||||
{"sexId", e.sexId},
|
||||
{"sexIdName", wowee::pipeline::WoweeCharFeature::sexIdName(e.sexId)},
|
||||
{"variationIndex", e.variationIndex},
|
||||
{"requiresExpansion", e.requiresExpansion},
|
||||
{"requiresExpansionName", wowee::pipeline::WoweeCharFeature::expansionGateName(e.requiresExpansion)},
|
||||
{"geosetGroupBits", e.geosetGroupBits},
|
||||
{"hairColorOverlayId", e.hairColorOverlayId},
|
||||
});
|
||||
}
|
||||
j["entries"] = arr;
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return 0;
|
||||
}
|
||||
std::printf("WCHF: %s.wchf\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" features : %zu\n", c.entries.size());
|
||||
if (c.entries.empty()) return 0;
|
||||
std::printf(" id race sex kind var geosets exp name\n");
|
||||
for (const auto& e : c.entries) {
|
||||
std::printf(" %4u %3u %-6s %-12s %3u 0x%08x %-7s %s\n",
|
||||
e.featureId, e.raceId,
|
||||
wowee::pipeline::WoweeCharFeature::sexIdName(e.sexId),
|
||||
wowee::pipeline::WoweeCharFeature::featureKindName(e.featureKind),
|
||||
e.variationIndex, e.geosetGroupBits,
|
||||
wowee::pipeline::WoweeCharFeature::expansionGateName(e.requiresExpansion),
|
||||
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 = stripWchfExt(base);
|
||||
if (!wowee::pipeline::WoweeCharFeatureLoader::exists(base)) {
|
||||
std::fprintf(stderr,
|
||||
"validate-wchf: WCHF not found: %s.wchf\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeCharFeatureLoader::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;
|
||||
// (race, sex, kind, variation) tuples must be unique —
|
||||
// duplicates would shadow each other in the carousel.
|
||||
std::set<std::string> tupleSeen;
|
||||
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.featureId);
|
||||
if (!e.name.empty()) ctx += " " + e.name;
|
||||
ctx += ")";
|
||||
if (e.featureId == 0)
|
||||
errors.push_back(ctx + ": featureId is 0");
|
||||
if (e.name.empty())
|
||||
errors.push_back(ctx + ": name is empty");
|
||||
if (e.raceId == 0)
|
||||
errors.push_back(ctx +
|
||||
": raceId is 0 (feature not bound to a WCHC race)");
|
||||
if (e.featureKind > wowee::pipeline::WoweeCharFeature::Markings) {
|
||||
errors.push_back(ctx + ": featureKind " +
|
||||
std::to_string(e.featureKind) + " not in 0..8");
|
||||
}
|
||||
if (e.sexId > wowee::pipeline::WoweeCharFeature::Female) {
|
||||
errors.push_back(ctx + ": sexId " +
|
||||
std::to_string(e.sexId) + " not in 0..1");
|
||||
}
|
||||
if (e.requiresExpansion > wowee::pipeline::WoweeCharFeature::TurtleWoW) {
|
||||
errors.push_back(ctx + ": requiresExpansion " +
|
||||
std::to_string(e.requiresExpansion) + " not in 0..3");
|
||||
}
|
||||
if (e.texturePath.empty()) {
|
||||
errors.push_back(ctx +
|
||||
": texturePath is empty (feature has no texture)");
|
||||
}
|
||||
// Check tuple uniqueness.
|
||||
std::string tuple =
|
||||
std::to_string(e.raceId) + "/" +
|
||||
std::to_string(e.sexId) + "/" +
|
||||
std::to_string(e.featureKind) + "/" +
|
||||
std::to_string(e.variationIndex);
|
||||
if (tupleSeen.count(tuple)) {
|
||||
errors.push_back(ctx +
|
||||
": duplicate (race=" + std::to_string(e.raceId) +
|
||||
", sex=" + std::to_string(e.sexId) +
|
||||
", kind=" + std::to_string(e.featureKind) +
|
||||
", variation=" + std::to_string(e.variationIndex) +
|
||||
") — would shadow earlier entry in carousel");
|
||||
}
|
||||
tupleSeen.insert(tuple);
|
||||
for (uint32_t prev : idsSeen) {
|
||||
if (prev == e.featureId) {
|
||||
errors.push_back(ctx + ": duplicate featureId");
|
||||
break;
|
||||
}
|
||||
}
|
||||
idsSeen.push_back(e.featureId);
|
||||
}
|
||||
bool ok = errors.empty();
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wchf"] = base + ".wchf";
|
||||
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-wchf: %s.wchf\n", base.c_str());
|
||||
if (ok && warnings.empty()) {
|
||||
std::printf(" OK — %zu features, all featureIds unique, "
|
||||
"all (race,sex,kind,variation) tuples 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 handleCharFeaturesCatalog(int& i, int argc, char** argv,
|
||||
int& outRc) {
|
||||
if (std::strcmp(argv[i], "--gen-chf") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenStarter(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-chf-bloodelf") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenBloodElf(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-chf-tauren") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenTauren(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--info-wchf") == 0 && i + 1 < argc) {
|
||||
outRc = handleInfo(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--validate-wchf") == 0 && i + 1 < argc) {
|
||||
outRc = handleValidate(i, argc, argv); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
12
tools/editor/cli_char_features_catalog.hpp
Normal file
12
tools/editor/cli_char_features_catalog.hpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
bool handleCharFeaturesCatalog(int& i, int argc, char** argv,
|
||||
int& outRc);
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
|
|
@ -94,6 +94,7 @@
|
|||
#include "cli_lfg_catalog.hpp"
|
||||
#include "cli_catalog_grep.hpp"
|
||||
#include "cli_macros_catalog.hpp"
|
||||
#include "cli_char_features_catalog.hpp"
|
||||
#include "cli_quest_objective.hpp"
|
||||
#include "cli_quest_reward.hpp"
|
||||
#include "cli_clone.hpp"
|
||||
|
|
@ -229,6 +230,7 @@ constexpr DispatchFn kDispatchTable[] = {
|
|||
handleLFGCatalog,
|
||||
handleCatalogGrep,
|
||||
handleMacrosCatalog,
|
||||
handleCharFeaturesCatalog,
|
||||
handleQuestObjective,
|
||||
handleQuestReward,
|
||||
handleClone,
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ constexpr FormatMagicEntry kFormats[] = {
|
|||
{{'W','S','C','H'}, ".wsch", "spells", "--info-wsch", "Spell school / damage type catalog"},
|
||||
{{'W','L','F','G'}, ".wlfg", "social", "--info-wlfg", "LFG / Dungeon Finder catalog"},
|
||||
{{'W','M','A','C'}, ".wmac", "ui", "--info-wmac", "Macro / slash command catalog"},
|
||||
{{'W','C','H','F'}, ".wchf", "chars", "--info-wchf", "Character hair / face customization 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"},
|
||||
|
|
|
|||
|
|
@ -1559,6 +1559,16 @@ void printUsage(const char* argv0) {
|
|||
std::printf(" Export binary .wmac to a human-editable JSON sidecar (defaults to <base>.wmac.json; multi-line bodies escape \\n)\n");
|
||||
std::printf(" --import-wmac-json <json-path> [out-base]\n");
|
||||
std::printf(" Import a .wmac.json sidecar back into binary .wmac (accepts macroKind int OR name string; maxLength defaults to 255)\n");
|
||||
std::printf(" --gen-chf <wchf-base> [name]\n");
|
||||
std::printf(" Emit .wchf starter: 5 Human Male features (1 skin / 1 face / 2 hair styles / 1 facial hair)\n");
|
||||
std::printf(" --gen-chf-bloodelf <wchf-base> [name]\n");
|
||||
std::printf(" Emit .wchf 8 Blood Elf Female hair styles (TBC iconic feature, requiresExpansion=TBC)\n");
|
||||
std::printf(" --gen-chf-tauren <wchf-base> [name]\n");
|
||||
std::printf(" Emit .wchf 6 Tauren Male features (3 horn variants + 3 facial hair) using race-specific kinds\n");
|
||||
std::printf(" --info-wchf <wchf-base> [--json]\n");
|
||||
std::printf(" Print WCHF entries (id / race / sex / kind / variation / geoset bits / expansion / name)\n");
|
||||
std::printf(" --validate-wchf <wchf-base> [--json]\n");
|
||||
std::printf(" Static checks: id+name+raceId+texturePath required, kind 0..8 / sex 0..1 / expansion 0..3, unique (race,sex,kind,variation) tuples\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");
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ constexpr FormatRow kFormats[] = {
|
|||
{"WSCH", ".wsch", "spells", "SpellSchools.dbc + Resistances", "Spell school / damage type catalog"},
|
||||
{"WLFG", ".wlfg", "social", "LFGDungeons.dbc + LFG rewards", "LFG / Dungeon Finder catalog"},
|
||||
{"WMAC", ".wmac", "ui", "(client-side macro storage)", "Macro / slash command catalog"},
|
||||
{"WCHF", ".wchf", "chars", "CharHairGeosets + CharFacialHair", "Character hair / face customization catalog"},
|
||||
|
||||
// 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