feat(editor): add WEMO (Emote Definition) — 101st open format

Novel replacement for the EmotesText.dbc + EmotesTextSound
+ EmotesTextData trio that maps /slash-emote commands
(/dance, /wave, /laugh, etc.) to their visible chat text,
animation ID, and per-race voice clip. Each entry binds
one slashCommand to an animationId (refs WANI), soundId
(refs WSND), targetMessage / noTargetMessage formats,
emote kind (Social / Combat / RolePlay / System), sex
filter (Both / Male / Female), required race bit, and a
TTS hint (Talk / Whisper / Yell / Silent) for accessibility
text-to-speech engines.

Three preset emitters covering the canonical emote
buckets: makeBasic (8 universal social emotes — wave /
bow / laugh / cheer / cry / sleep / kneel / applaud),
makeCombat (5 combat-themed — roar / threaten / charge /
victory / surrender), makeRolePlay (6 RP-focused — bonk
/ ponder / soothe / plead / shoo / scoff). Animation IDs
match AnimationData.dbc convention so existing WoW client
mods continue to play the right anims.

Validator catches authoring bugs unique to slash-command
parsing: leading '/' on slashCommand (chat parser strips
it before lookup so the entry would be doubly-prefixed),
uppercase letters (parser case-folds before lookup so the
entry is unreachable), duplicate slash commands (parser
dispatches by exact match — ambiguity would crash the
chat input handler), %s token counts that don't match
target/no-target distinction.

Also expanded --catalog-pluck's foreign-key filter to
include animationId / soundId / particleId / ribbonId /
vehicleId / seatId / currencyId / trainerId / vendorId /
mailTemplateId — caught during smoke-test where pluck
mis-identified WEMO entries by animationId instead of
emoteId. Same class of bug as the WHRT areaId fix.

Format count 100 -> 101. CLI flag count 1126 -> 1131.
This commit is contained in:
Kelsi 2026-05-10 00:53:33 -07:00
parent 4aa7b56e13
commit c9b822002f
11 changed files with 827 additions and 0 deletions

View file

@ -689,6 +689,7 @@ set(WOWEE_SOURCES
src/pipeline/wowee_server_broadcasts.cpp
src/pipeline/wowee_combat_maneuvers.cpp
src/pipeline/wowee_realm_list.cpp
src/pipeline/wowee_emotes.cpp
src/pipeline/custom_zone_discovery.cpp
src/pipeline/dbc_layout.cpp
@ -1541,6 +1542,7 @@ add_executable(wowee_editor
tools/editor/cli_server_broadcasts_catalog.cpp
tools/editor/cli_combat_maneuvers_catalog.cpp
tools/editor/cli_realm_list_catalog.cpp
tools/editor/cli_emotes_catalog.cpp
tools/editor/cli_catalog_pluck.cpp
tools/editor/cli_quest_objective.cpp
tools/editor/cli_quest_reward.cpp
@ -1709,6 +1711,7 @@ add_executable(wowee_editor
src/pipeline/wowee_server_broadcasts.cpp
src/pipeline/wowee_combat_maneuvers.cpp
src/pipeline/wowee_realm_list.cpp
src/pipeline/wowee_emotes.cpp
src/pipeline/custom_zone_discovery.cpp
src/pipeline/terrain_mesh.cpp

View file

@ -0,0 +1,133 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace wowee {
namespace pipeline {
// Wowee Open Emote Definition catalog (.wemo) — novel
// replacement for the hardcoded EmotesText.dbc /
// EmotesTextSound.dbc / EmotesTextData.dbc trio that maps
// /slash-emote commands (e.g. /dance, /wave, /laugh) to
// their visible text, animation ID, and per-race voice
// audio. Each entry is one emote definition.
//
// Cross-references with previously-added formats:
// WANI: animationId references the WANI animation
// catalog. Emote anims map to AnimationData.dbc
// IDs in the original system (e.g. ANIM_DANCE=29,
// ANIM_WAVE=70).
// WSND: soundId references the WSND sound catalog (the
// per-race voice clip; falls back to no sound if
// soundId=0).
// WCHC: sex bit constraints use WCHC's gender enum
// (0=both, 1=male, 2=female). Race-restricted
// emotes (e.g. orcgrunt) embed the requiredRace
// field.
//
// Binary layout (little-endian):
// magic[4] = "WEMO"
// version (uint32) = current 1
// nameLen + name (catalog label)
// entryCount (uint32)
// entries (each):
// emoteId (uint32)
// nameLen + name
// descLen + description
// cmdLen + slashCommand — e.g. "dance" (no slash)
// animationId (uint32)
// soundId (uint32)
// targetMsgLen + targetMessage — "%s waves at %s"
// noTargetMsgLen + noTargetMessage — "%s waves"
// emoteKind (uint8) — Social / Combat /
// RolePlay / System
// sex (uint8) — 0=both, 1=male, 2=female
// requiredRace (uint8) — 0=any, else WCHC race
// bit
// ttsHint (uint8) — Whisper / Yell / Talk /
// Silent for accessibility
// TTS engines
// iconColorRGBA (uint32)
struct WoweeEmotes {
enum EmoteKind : uint8_t {
Social = 0, // wave, bow, laugh, etc.
Combat = 1, // roar, threaten, charge
RolePlay = 2, // bonk, ponder, soothe
System = 3, // ready, group, AFK / DND
// status emotes
};
enum SexFilter : uint8_t {
SexBoth = 0,
MaleOnly = 1,
FemaleOnly = 2,
};
enum TtsHint : uint8_t {
TtsTalk = 0, // normal speaking volume
TtsWhisper = 1, // soft, intimate
TtsYell = 2, // loud, aggressive
TtsSilent = 3, // pure animation, no audio TTS
};
struct Entry {
uint32_t emoteId = 0;
std::string name;
std::string description;
std::string slashCommand; // e.g. "dance"
uint32_t animationId = 0;
uint32_t soundId = 0;
std::string targetMessage; // "%s waves at %s"
std::string noTargetMessage; // "%s waves"
uint8_t emoteKind = Social;
uint8_t sex = SexBoth;
uint8_t requiredRace = 0;
uint8_t ttsHint = TtsTalk;
uint32_t iconColorRGBA = 0xFFFFFFFFu;
};
std::string name;
std::vector<Entry> entries;
bool isValid() const { return !entries.empty(); }
const Entry* findById(uint32_t emoteId) const;
// Looks up an emote by its slash-command string (the
// bit after the slash — "dance", "wave"). Used by the
// chat input parser to dispatch /<cmd> to the right
// emote without scanning the full table.
const Entry* findByCommand(const std::string& cmd) const;
// Returns all emotes of one kind — used by the social
// wheel UI to populate per-tab listings (Social /
// Combat / RolePlay / System).
std::vector<const Entry*> findByKind(uint8_t emoteKind) const;
};
class WoweeEmotesLoader {
public:
static bool save(const WoweeEmotes& cat,
const std::string& basePath);
static WoweeEmotes load(const std::string& basePath);
static bool exists(const std::string& basePath);
// Preset emitters used by --gen-emo* variants.
//
// makeBasic — 8 universal social emotes (wave,
// bow, laugh, cheer, cry, sleep,
// kneel, applaud).
// makeCombat — 5 combat-themed emotes (roar,
// threaten, charge, victory,
// surrender).
// makeRolePlay — 6 RP-focused emotes (bonk, ponder,
// soothe, plead, shoo, scoff).
static WoweeEmotes makeBasic(const std::string& catalogName);
static WoweeEmotes makeCombat(const std::string& catalogName);
static WoweeEmotes makeRolePlay(const std::string& catalogName);
};
} // namespace pipeline
} // namespace wowee

View file

@ -0,0 +1,334 @@
#include "pipeline/wowee_emotes.hpp"
#include <cstdio>
#include <cstring>
#include <fstream>
namespace wowee {
namespace pipeline {
namespace {
constexpr char kMagic[4] = {'W', 'E', 'M', 'O'};
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) != ".wemo") {
base += ".wemo";
}
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);
}
} // namespace
const WoweeEmotes::Entry*
WoweeEmotes::findById(uint32_t emoteId) const {
for (const auto& e : entries)
if (e.emoteId == emoteId) return &e;
return nullptr;
}
const WoweeEmotes::Entry*
WoweeEmotes::findByCommand(const std::string& cmd) const {
for (const auto& e : entries)
if (e.slashCommand == cmd) return &e;
return nullptr;
}
std::vector<const WoweeEmotes::Entry*>
WoweeEmotes::findByKind(uint8_t emoteKind) const {
std::vector<const Entry*> out;
for (const auto& e : entries)
if (e.emoteKind == emoteKind) out.push_back(&e);
return out;
}
bool WoweeEmotesLoader::save(const WoweeEmotes& 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.emoteId);
writeStr(os, e.name);
writeStr(os, e.description);
writeStr(os, e.slashCommand);
writePOD(os, e.animationId);
writePOD(os, e.soundId);
writeStr(os, e.targetMessage);
writeStr(os, e.noTargetMessage);
writePOD(os, e.emoteKind);
writePOD(os, e.sex);
writePOD(os, e.requiredRace);
writePOD(os, e.ttsHint);
writePOD(os, e.iconColorRGBA);
}
return os.good();
}
WoweeEmotes WoweeEmotesLoader::load(const std::string& basePath) {
WoweeEmotes 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.emoteId)) {
out.entries.clear(); return out;
}
if (!readStr(is, e.name) ||
!readStr(is, e.description) ||
!readStr(is, e.slashCommand)) {
out.entries.clear(); return out;
}
if (!readPOD(is, e.animationId) ||
!readPOD(is, e.soundId)) {
out.entries.clear(); return out;
}
if (!readStr(is, e.targetMessage) ||
!readStr(is, e.noTargetMessage)) {
out.entries.clear(); return out;
}
if (!readPOD(is, e.emoteKind) ||
!readPOD(is, e.sex) ||
!readPOD(is, e.requiredRace) ||
!readPOD(is, e.ttsHint) ||
!readPOD(is, e.iconColorRGBA)) {
out.entries.clear(); return out;
}
}
return out;
}
bool WoweeEmotesLoader::exists(const std::string& basePath) {
std::ifstream is(normalizePath(basePath), std::ios::binary);
return is.good();
}
WoweeEmotes WoweeEmotesLoader::makeBasic(
const std::string& catalogName) {
using E = WoweeEmotes;
WoweeEmotes c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* slash,
uint32_t anim, uint32_t snd,
const char* targetMsg,
const char* noTargetMsg, uint8_t tts,
const char* desc) {
E::Entry e;
e.emoteId = id; e.name = slash;
e.description = desc;
e.slashCommand = slash;
e.animationId = anim;
e.soundId = snd;
e.targetMessage = targetMsg;
e.noTargetMessage = noTargetMsg;
e.emoteKind = E::Social;
e.sex = E::SexBoth;
e.ttsHint = tts;
e.iconColorRGBA = packRgba(140, 220, 200); // social teal
c.entries.push_back(e);
};
// Animation IDs from AnimationData.dbc — well-known
// WoW 3.3.5a values for these emotes.
add(1, "wave", 70, 6373,
"%s waves at %s.", "%s waves.",
E::TtsTalk,
"Friendly hand wave — universal greeting.");
add(2, "bow", 68, 6371,
"%s bows before %s.", "%s bows.",
E::TtsTalk,
"Respectful bow — common in formal social "
"encounters.");
add(3, "laugh", 31, 6362,
"%s laughs at %s.", "%s laughs.",
E::TtsTalk,
"Hearty laugh — also fires the racial laugh "
"voice clip.");
add(4, "cheer", 29, 6365,
"%s cheers at %s.", "%s cheers.",
E::TtsYell,
"Boisterous cheer — pairs with raid victory "
"moments.");
add(5, "cry", 32, 6361,
"%s cries on %s.", "%s cries.",
E::TtsWhisper,
"Soft cry — typically used in RP for sad "
"moments.");
add(6, "sleep", 93, 0,
"%s falls asleep on %s.", "%s falls asleep. Zzzz.",
E::TtsSilent,
"Lay-down sleep — character lies prone with "
"snore particle effect.");
add(7, "kneel", 35, 0,
"%s kneels before %s.", "%s kneels down.",
E::TtsSilent,
"Kneel — used for swearing oaths and showing "
"deference.");
add(8, "applaud", 79, 6360,
"%s applauds at %s.", "%s applauds.",
E::TtsTalk,
"Polite golf-clap applause — distinct from /cheer "
"(which is louder).");
return c;
}
WoweeEmotes WoweeEmotesLoader::makeCombat(
const std::string& catalogName) {
using E = WoweeEmotes;
WoweeEmotes c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* slash,
uint32_t anim, uint32_t snd,
const char* targetMsg,
const char* noTargetMsg, uint8_t tts,
const char* desc) {
E::Entry e;
e.emoteId = id; e.name = slash;
e.description = desc;
e.slashCommand = slash;
e.animationId = anim;
e.soundId = snd;
e.targetMessage = targetMsg;
e.noTargetMessage = noTargetMsg;
e.emoteKind = E::Combat;
e.sex = E::SexBoth;
e.ttsHint = tts;
e.iconColorRGBA = packRgba(220, 80, 80); // combat red
c.entries.push_back(e);
};
add(100, "roar", 67, 6364,
"%s roars at %s. Goosebumps appear.",
"%s roars with bestial fury.",
E::TtsYell,
"Aggressive roar — pairs with intimidation "
"moments.");
add(101, "threaten", 77, 0,
"%s threatens %s with violence.",
"%s makes a threatening gesture.",
E::TtsYell,
"Menacing pose — finger-wag or weapon brandish.");
add(102, "charge", 52, 6358,
"%s charges at %s!", "%s charges forward!",
E::TtsYell,
"Forward-lean charge pose — RP companion to a "
"Warrior Charge ability.");
add(103, "victory", 85, 6376,
"%s celebrates victory over %s.",
"%s celebrates a great victory!",
E::TtsYell,
"Arms-raised victory pose — duel-end signature.");
add(104, "surrender", 90, 0,
"%s surrenders to %s.", "%s surrenders.",
E::TtsWhisper,
"Hands-up surrender — used in PvP duel forfeits.");
return c;
}
WoweeEmotes WoweeEmotesLoader::makeRolePlay(
const std::string& catalogName) {
using E = WoweeEmotes;
WoweeEmotes c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* slash,
uint32_t anim, uint32_t snd,
const char* targetMsg,
const char* noTargetMsg, uint8_t tts,
const char* desc) {
E::Entry e;
e.emoteId = id; e.name = slash;
e.description = desc;
e.slashCommand = slash;
e.animationId = anim;
e.soundId = snd;
e.targetMessage = targetMsg;
e.noTargetMessage = noTargetMsg;
e.emoteKind = E::RolePlay;
e.sex = E::SexBoth;
e.ttsHint = tts;
e.iconColorRGBA = packRgba(180, 100, 240); // rp purple
c.entries.push_back(e);
};
add(200, "bonk", 72, 0,
"%s bonks %s on the head.", "%s bonks the air.",
E::TtsTalk,
"Light tap on the head — friendly playful "
"gesture.");
add(201, "ponder", 61, 0,
"%s ponders %s.", "%s ponders deep thoughts.",
E::TtsWhisper,
"Hand-on-chin contemplation pose.");
add(202, "soothe", 75, 0,
"%s soothes %s gently.", "%s makes soothing noises.",
E::TtsWhisper,
"Calming pat-pat motion — used in RP healer "
"scenes.");
add(203, "plead", 47, 0,
"%s pleads with %s.", "%s pleads desperately.",
E::TtsWhisper,
"Hands-clasped pleading pose — kneels slightly.");
add(204, "shoo", 77, 0,
"%s shoos %s away.", "%s shoos the air.",
E::TtsTalk,
"Brushing-away gesture — dismiss undesired "
"attention.");
add(205, "scoff", 42, 0,
"%s scoffs at %s.", "%s scoffs.",
E::TtsTalk,
"Disdainful scoff with arms-crossed pose.");
return c;
}
} // namespace pipeline
} // namespace wowee

View file

@ -310,6 +310,8 @@ const char* const kArgRequired[] = {
"--gen-msp", "--gen-msp-cluster", "--gen-msp-multi",
"--info-wmsp", "--validate-wmsp",
"--export-wmsp-json", "--import-wmsp-json",
"--gen-emo", "--gen-emo-combat", "--gen-emo-rp",
"--info-wemo", "--validate-wemo",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",

View file

@ -101,6 +101,9 @@ bool isExternalRefField(const std::string& k) {
"achievementId", "criteriaId", "lootId",
"soundId", "movieId", "displayId", "modelId",
"iconId", "textureId", "auraId",
"animationId", "particleId", "ribbonId",
"vehicleId", "seatId", "currencyId",
"trainerId", "vendorId", "mailTemplateId",
};
for (const char* ref : kExternals) {
if (k == ref) return true;

View file

@ -145,6 +145,7 @@
#include "cli_server_broadcasts_catalog.hpp"
#include "cli_combat_maneuvers_catalog.hpp"
#include "cli_realm_list_catalog.hpp"
#include "cli_emotes_catalog.hpp"
#include "cli_catalog_pluck.hpp"
#include "cli_quest_objective.hpp"
#include "cli_quest_reward.hpp"
@ -332,6 +333,7 @@ constexpr DispatchFn kDispatchTable[] = {
handleServerBroadcastsCatalog,
handleCombatManeuversCatalog,
handleRealmListCatalog,
handleEmotesCatalog,
handleCatalogPluck,
handleQuestObjective,
handleQuestReward,

View file

@ -0,0 +1,327 @@
#include "cli_emotes_catalog.hpp"
#include "cli_arg_parse.hpp"
#include "cli_box_emitter.hpp"
#include "pipeline/wowee_emotes.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 stripWemoExt(std::string base) {
stripExt(base, ".wemo");
return base;
}
const char* emoteKindName(uint8_t k) {
using E = wowee::pipeline::WoweeEmotes;
switch (k) {
case E::Social: return "social";
case E::Combat: return "combat";
case E::RolePlay: return "roleplay";
case E::System: return "system";
default: return "unknown";
}
}
const char* sexFilterName(uint8_t s) {
using E = wowee::pipeline::WoweeEmotes;
switch (s) {
case E::SexBoth: return "both";
case E::MaleOnly: return "male";
case E::FemaleOnly: return "female";
default: return "unknown";
}
}
const char* ttsHintName(uint8_t h) {
using E = wowee::pipeline::WoweeEmotes;
switch (h) {
case E::TtsTalk: return "talk";
case E::TtsWhisper: return "whisper";
case E::TtsYell: return "yell";
case E::TtsSilent: return "silent";
default: return "unknown";
}
}
bool saveOrError(const wowee::pipeline::WoweeEmotes& c,
const std::string& base, const char* cmd) {
if (!wowee::pipeline::WoweeEmotesLoader::save(c, base)) {
std::fprintf(stderr, "%s: failed to save %s.wemo\n",
cmd, base.c_str());
return false;
}
return true;
}
void printGenSummary(const wowee::pipeline::WoweeEmotes& c,
const std::string& base) {
std::printf("Wrote %s.wemo\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" emotes : %zu\n", c.entries.size());
}
int handleGenBasic(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "BasicSocialEmotes";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWemoExt(base);
auto c = wowee::pipeline::WoweeEmotesLoader::makeBasic(name);
if (!saveOrError(c, base, "gen-emo")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenCombat(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "CombatEmotes";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWemoExt(base);
auto c = wowee::pipeline::WoweeEmotesLoader::makeCombat(name);
if (!saveOrError(c, base, "gen-emo-combat")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenRolePlay(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "RolePlayEmotes";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWemoExt(base);
auto c = wowee::pipeline::WoweeEmotesLoader::makeRolePlay(name);
if (!saveOrError(c, base, "gen-emo-rp")) 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 = stripWemoExt(base);
if (!wowee::pipeline::WoweeEmotesLoader::exists(base)) {
std::fprintf(stderr, "WEMO not found: %s.wemo\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeEmotesLoader::load(base);
if (jsonOut) {
nlohmann::json j;
j["wemo"] = base + ".wemo";
j["name"] = c.name;
j["count"] = c.entries.size();
nlohmann::json arr = nlohmann::json::array();
for (const auto& e : c.entries) {
arr.push_back({
{"emoteId", e.emoteId},
{"name", e.name},
{"description", e.description},
{"slashCommand", e.slashCommand},
{"animationId", e.animationId},
{"soundId", e.soundId},
{"targetMessage", e.targetMessage},
{"noTargetMessage", e.noTargetMessage},
{"emoteKind", e.emoteKind},
{"emoteKindName", emoteKindName(e.emoteKind)},
{"sex", e.sex},
{"sexName", sexFilterName(e.sex)},
{"requiredRace", e.requiredRace},
{"ttsHint", e.ttsHint},
{"ttsHintName", ttsHintName(e.ttsHint)},
{"iconColorRGBA", e.iconColorRGBA},
});
}
j["entries"] = arr;
std::printf("%s\n", j.dump(2).c_str());
return 0;
}
std::printf("WEMO: %s.wemo\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" emotes : %zu\n", c.entries.size());
if (c.entries.empty()) return 0;
std::printf(" id /command kind anim snd sex tts \n");
for (const auto& e : c.entries) {
std::printf(" %4u /%-12s %-8s %4u %4u %-5s %-7s\n",
e.emoteId, e.slashCommand.c_str(),
emoteKindName(e.emoteKind),
e.animationId, e.soundId,
sexFilterName(e.sex),
ttsHintName(e.ttsHint));
}
return 0;
}
int handleValidate(int& i, int argc, char** argv) {
std::string base = argv[++i];
bool jsonOut = consumeJsonFlag(i, argc, argv);
base = stripWemoExt(base);
if (!wowee::pipeline::WoweeEmotesLoader::exists(base)) {
std::fprintf(stderr,
"validate-wemo: WEMO not found: %s.wemo\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeEmotesLoader::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;
std::set<std::string> commandsSeen;
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.emoteId);
if (!e.name.empty()) ctx += " " + e.name;
ctx += ")";
if (e.emoteId == 0)
errors.push_back(ctx + ": emoteId is 0");
if (e.name.empty())
errors.push_back(ctx + ": name is empty");
if (e.slashCommand.empty()) {
errors.push_back(ctx +
": slashCommand is empty — chat parser "
"would fail to dispatch");
}
// Slash command should not start with '/' (the
// chat parser strips it before the lookup).
if (!e.slashCommand.empty() &&
e.slashCommand[0] == '/') {
errors.push_back(ctx + ": slashCommand starts "
"with '/' — store it bare (chat parser "
"strips the leading slash before lookup)");
}
// Lowercase only — chat commands are
// case-folded before lookup, so an uppercase
// letter would be unreachable.
for (char ch : e.slashCommand) {
if (ch >= 'A' && ch <= 'Z') {
errors.push_back(ctx + ": slashCommand '" +
e.slashCommand +
"' contains uppercase — chat parser "
"lowercases input before lookup so "
"this entry would be unreachable");
break;
}
}
if (e.emoteKind > 3) {
errors.push_back(ctx + ": emoteKind " +
std::to_string(e.emoteKind) +
" out of range (must be 0..3)");
}
if (e.sex > 2) {
errors.push_back(ctx + ": sex " +
std::to_string(e.sex) +
" out of range (must be 0..2)");
}
if (e.ttsHint > 3) {
errors.push_back(ctx + ": ttsHint " +
std::to_string(e.ttsHint) +
" out of range (must be 0..3)");
}
// If targetMessage references a target slot, it
// should contain TWO %s tokens (actor + target);
// noTargetMessage should contain exactly ONE.
auto countPercentS = [](const std::string& s) {
int n = 0;
for (size_t k = 0; k + 1 < s.size(); ++k) {
if (s[k] == '%' && s[k + 1] == 's') ++n;
}
return n;
};
int tgtTokens = countPercentS(e.targetMessage);
int noTgtTokens = countPercentS(e.noTargetMessage);
if (!e.targetMessage.empty() && tgtTokens < 2) {
warnings.push_back(ctx +
": targetMessage has " +
std::to_string(tgtTokens) +
" %s token(s) — expected 2 (actor name + "
"target name)");
}
if (!e.noTargetMessage.empty() && noTgtTokens != 1) {
warnings.push_back(ctx +
": noTargetMessage has " +
std::to_string(noTgtTokens) +
" %s token(s) — expected exactly 1 (actor "
"name)");
}
// Slash commands must be unique — chat parser
// dispatches by exact match.
if (!e.slashCommand.empty() &&
!commandsSeen.insert(e.slashCommand).second) {
errors.push_back(ctx + ": duplicate slashCommand "
"'" + e.slashCommand + "' — chat parser "
"would dispatch ambiguously");
}
for (uint32_t prev : idsSeen) {
if (prev == e.emoteId) {
errors.push_back(ctx + ": duplicate emoteId");
break;
}
}
idsSeen.push_back(e.emoteId);
}
bool ok = errors.empty();
if (jsonOut) {
nlohmann::json j;
j["wemo"] = base + ".wemo";
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-wemo: %s.wemo\n", base.c_str());
if (ok && warnings.empty()) {
std::printf(" OK — %zu emotes, all emoteIds + "
"slash commands 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 handleEmotesCatalog(int& i, int argc, char** argv, int& outRc) {
if (std::strcmp(argv[i], "--gen-emo") == 0 && i + 1 < argc) {
outRc = handleGenBasic(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-emo-combat") == 0 && i + 1 < argc) {
outRc = handleGenCombat(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-emo-rp") == 0 && i + 1 < argc) {
outRc = handleGenRolePlay(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--info-wemo") == 0 && i + 1 < argc) {
outRc = handleInfo(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--validate-wemo") == 0 && i + 1 < argc) {
outRc = handleValidate(i, argc, argv); return true;
}
return false;
}
} // namespace cli
} // namespace editor
} // namespace wowee

View file

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

View file

@ -103,6 +103,7 @@ constexpr FormatMagicEntry kFormats[] = {
{{'W','S','C','B'}, ".wscb", "server", "--info-wscb", "Server channel broadcast catalog"},
{{'W','C','M','G'}, ".wcmg", "spells", "--info-wcmg", "Combat maneuver group catalog"},
{{'W','M','S','P'}, ".wmsp", "server", "--info-wmsp", "Master server profile / realmlist catalog"},
{{'W','E','M','O'}, ".wemo", "social", "--info-wemo", "Emote definition catalog"},
{{'W','F','A','C'}, ".wfac", "factions", nullptr, "Faction catalog"},
{{'W','L','C','K'}, ".wlck", "locks", nullptr, "Lock catalog"},
{{'W','S','K','L'}, ".wskl", "skills", nullptr, "Skill catalog"},

View file

@ -2167,6 +2167,16 @@ void printUsage(const char* argv0) {
std::printf(" Export binary .wmsp to a human-editable JSON sidecar (defaults to <base>.wmsp.json; emits all 4 enums as both int AND name string + a versionString \"x.y.z\" convenience field)\n");
std::printf(" --import-wmsp-json <json-path> [out-base]\n");
std::printf(" Import a .wmsp.json sidecar back into binary .wmsp (realmType int OR \"normal\"/\"pvp\"/\"rp\"/\"rppvp\"/\"test\"; realmCategory \"public\"/\"private\"/\"beta\"/\"dev\"; expansion \"vanilla\"/\"tbc\"/\"wotlk\"/\"cata\"; population \"low\"/\"medium\"/\"high\"/\"full\"/\"locked\")\n");
std::printf(" --gen-emo <wemo-base> [name]\n");
std::printf(" Emit .wemo 8 universal social emotes (wave / bow / laugh / cheer / cry / sleep / kneel / applaud)\n");
std::printf(" --gen-emo-combat <wemo-base> [name]\n");
std::printf(" Emit .wemo 5 combat-themed emotes (roar / threaten / charge / victory / surrender)\n");
std::printf(" --gen-emo-rp <wemo-base> [name]\n");
std::printf(" Emit .wemo 6 roleplay emotes (bonk / ponder / soothe / plead / shoo / scoff)\n");
std::printf(" --info-wemo <wemo-base> [--json]\n");
std::printf(" Print WEMO entries (id / slash command / kind / animation / sound / sex filter / TTS hint)\n");
std::printf(" --validate-wemo <wemo-base> [--json]\n");
std::printf(" Static checks: id+name+slashCommand required, slash must be lowercase + no leading '/' (chat parser case-folds before lookup), emoteKind 0..3, sex 0..2, ttsHint 0..3, no duplicate ids OR commands; warns on targetMessage with !=2 %s tokens, noTargetMessage with !=1\n");
std::printf(" --catalog-pluck <wXXX-file> <id> [--json]\n");
std::printf(" Extract one entry by id from any registered catalog format. Auto-detects magic, dispatches to the per-format --info-* handler internally, then prints just the matching entry. Primary-key field is auto-detected (first *Id field, or first numeric)\n");
std::printf(" --gen-weather-temperate <wow-base> [zoneName]\n");

View file

@ -125,6 +125,7 @@ constexpr FormatRow kFormats[] = {
{"WSCB", ".wscb", "server", "MOTD + scheduled SMSG_NOTIFICATION","Server channel broadcast catalog"},
{"WCMG", ".wcmg", "spells", "Stance/Form/Aspect mutex tables", "Combat maneuver group catalog (mutex spells)"},
{"WMSP", ".wmsp", "server", "realmlist + SMSG_REALM_LIST data", "Master server profile / realmlist catalog"},
{"WEMO", ".wemo", "social", "EmotesText.dbc + EmotesTextSound", "Emote definition catalog (/dance, /wave, etc.)"},
// Additional pipeline catalogs without the alternating
// gen/info/validate CLI surface (loaded by the engine