feat(pipeline): WGCH global chat channel catalog (124th open format)

Novel replacement for vanilla ChatChannels.dbc + the per-server
zone-default chat-join behavior. Each WGCH entry binds one chat
channel to its access policy: PublicJoin, InviteOnly,
AutoJoinOnZone (with zoneDefaultMapId), or Moderated. Entries
also carry channelKind (Global/RealmZone/Faction/Custom),
passwordRequired, levelMin, maxMembers cap, topic-mod-only flag,
and an icon RGBA color.

Three presets:
  --gen-gch        4 standard server channels (LookingForGroup,
                   World, Trade auto-join Stormwind, General)
  --gen-gch-rp     4 RP channels (RP_OOC public, RP_IC moderated
                   200-cap, RP_Forum invite-only 50-cap, RP_Events
                   password-protected)
  --gen-gch-admin  3 moderator-only channels (GMTraffic, AuditLog,
                   Backstage — all password-gated)

Validator catches: id+name required, channelKind/accessKind
range, duplicate channelIds, duplicate channel names (which
would route /join ambiguously), AutoJoinOnZone with
zoneDefaultMapId=0 (auto-join trigger would never fire). Warns
on dead zoneDefaultMapId set with non-AutoJoin kind.

Format count 123 -> 124. CLI flag count 1290 -> 1317.
This commit is contained in:
Kelsi 2026-05-10 03:23:39 -07:00
parent cef571bb45
commit c7d85fc598
10 changed files with 734 additions and 0 deletions

View file

@ -712,6 +712,7 @@ set(WOWEE_SOURCES
src/pipeline/wowee_anniversary_events.cpp
src/pipeline/wowee_pvp_ranks.cpp
src/pipeline/wowee_localization.cpp
src/pipeline/wowee_global_channels.cpp
src/pipeline/custom_zone_discovery.cpp
src/pipeline/dbc_layout.cpp
@ -1587,6 +1588,7 @@ add_executable(wowee_editor
tools/editor/cli_anniversary_events_catalog.cpp
tools/editor/cli_pvp_ranks_catalog.cpp
tools/editor/cli_localization_catalog.cpp
tools/editor/cli_global_channels_catalog.cpp
tools/editor/cli_catalog_pluck.cpp
tools/editor/cli_catalog_find.cpp
tools/editor/cli_catalog_by_name.cpp
@ -1781,6 +1783,7 @@ add_executable(wowee_editor
src/pipeline/wowee_anniversary_events.cpp
src/pipeline/wowee_pvp_ranks.cpp
src/pipeline/wowee_localization.cpp
src/pipeline/wowee_global_channels.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 Global Chat Channel catalog (.wgch) —
// novel replacement for the implicit chat-channel
// configuration vanilla WoW carried in
// ChatChannels.dbc + the per-server zone-default chat
// joins. Each entry binds one server-wide or
// zone-scoped chat channel (LookingForGroup, World,
// Trade, GeneralChat, RP-OOC) to its access policy
// (public-join / invite-only / auto-join on zone
// entry / moderated), level gate, member cap, and
// password requirement.
//
// Cross-references with previously-added formats:
// WCHN: WGCH supersedes WCHN's narrower chat-channel
// catalog where access-policy semantics matter.
// WMS: zoneDefaultMapId references the WMS map
// catalog (for AutoJoin channels that auto-
// enroll players entering a specific zone).
//
// Binary layout (little-endian):
// magic[4] = "WGCH"
// version (uint32) = current 1
// nameLen + name (catalog label)
// entryCount (uint32)
// entries (each):
// channelId (uint32)
// nameLen + name (channel display name)
// descLen + description
// channelKind (uint8) — Global / RealmZone /
// Faction / Custom
// accessKind (uint8) — PublicJoin /
// InviteOnly /
// AutoJoinOnZone /
// Moderated
// passwordRequired (uint8) — 0/1 bool
// levelMin (uint8)
// maxMembers (uint16) — 0 = unlimited
// topicSetByMods (uint8) — 0/1 bool — false
// means anyone can /topic
// pad0 (uint8)
// zoneDefaultMapId (uint32) — for AutoJoinOnZone
// kind; 0 if not auto-
// joined per-zone
// iconColorRGBA (uint32)
struct WoweeGlobalChannels {
enum ChannelKind : uint8_t {
Global = 0, // server-wide
RealmZone = 1, // realm-wide zone-default
Faction = 2, // single-faction
Custom = 3, // player-created
};
enum AccessKind : uint8_t {
PublicJoin = 0, // /join chan
InviteOnly = 1, // requires owner invite
AutoJoinOnZone = 2, // auto-enroll on
// zoneDefaultMapId entry
Moderated = 3, // joinable but only mods
// can speak
};
struct Entry {
uint32_t channelId = 0;
std::string name;
std::string description;
uint8_t channelKind = Global;
uint8_t accessKind = PublicJoin;
uint8_t passwordRequired = 0;
uint8_t levelMin = 0;
uint16_t maxMembers = 0;
uint8_t topicSetByMods = 1;
uint8_t pad0 = 0;
uint32_t zoneDefaultMapId = 0;
uint32_t iconColorRGBA = 0xFFFFFFFFu;
};
std::string name;
std::vector<Entry> entries;
bool isValid() const { return !entries.empty(); }
const Entry* findById(uint32_t channelId) const;
// Returns all channels of one kind. Used by the
// chat-window UI to populate per-kind tabs (Global
// tab, Custom tab, etc.).
std::vector<const Entry*> findByKind(uint8_t channelKind) const;
// Returns AutoJoinOnZone channels that should
// enroll a player entering the given mapId. Used
// by the zone-load handler.
std::vector<const Entry*> findAutoJoinForZone(uint32_t mapId) const;
};
class WoweeGlobalChannelsLoader {
public:
static bool save(const WoweeGlobalChannels& cat,
const std::string& basePath);
static WoweeGlobalChannels load(const std::string& basePath);
static bool exists(const std::string& basePath);
// Preset emitters used by --gen-gch* variants.
//
// makeStandardChannels — 4 vanilla server-wide
// channels (LookingFor-
// Group / World / Trade
// on auto-join Stormwind /
// General).
// makeRoleplay — 4 RP server channels
// (RP-OOC / RP-IC moderated
// / RP-Forum invite-only /
// RP-Events).
// makeAdminChannels — 3 moderator-only channels
// (GMTraffic invite /
// AuditLog moderated /
// Backstage invite — all
// level 0 require GM flag
// via accessKind).
static WoweeGlobalChannels makeStandardChannels(const std::string& catalogName);
static WoweeGlobalChannels makeRoleplay(const std::string& catalogName);
static WoweeGlobalChannels makeAdminChannels(const std::string& catalogName);
};
} // namespace pipeline
} // namespace wowee

View file

@ -0,0 +1,287 @@
#include "pipeline/wowee_global_channels.hpp"
#include <cstdio>
#include <cstring>
#include <fstream>
namespace wowee {
namespace pipeline {
namespace {
constexpr char kMagic[4] = {'W', 'G', 'C', 'H'};
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) != ".wgch") {
base += ".wgch";
}
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 WoweeGlobalChannels::Entry*
WoweeGlobalChannels::findById(uint32_t channelId) const {
for (const auto& e : entries)
if (e.channelId == channelId) return &e;
return nullptr;
}
std::vector<const WoweeGlobalChannels::Entry*>
WoweeGlobalChannels::findByKind(uint8_t channelKind) const {
std::vector<const Entry*> out;
for (const auto& e : entries)
if (e.channelKind == channelKind) out.push_back(&e);
return out;
}
std::vector<const WoweeGlobalChannels::Entry*>
WoweeGlobalChannels::findAutoJoinForZone(uint32_t mapId) const {
std::vector<const Entry*> out;
for (const auto& e : entries) {
if (e.accessKind == AutoJoinOnZone &&
e.zoneDefaultMapId == mapId) {
out.push_back(&e);
}
}
return out;
}
bool WoweeGlobalChannelsLoader::save(
const WoweeGlobalChannels& 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.channelId);
writeStr(os, e.name);
writeStr(os, e.description);
writePOD(os, e.channelKind);
writePOD(os, e.accessKind);
writePOD(os, e.passwordRequired);
writePOD(os, e.levelMin);
writePOD(os, e.maxMembers);
writePOD(os, e.topicSetByMods);
writePOD(os, e.pad0);
writePOD(os, e.zoneDefaultMapId);
writePOD(os, e.iconColorRGBA);
}
return os.good();
}
WoweeGlobalChannels WoweeGlobalChannelsLoader::load(
const std::string& basePath) {
WoweeGlobalChannels 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.channelId)) {
out.entries.clear(); return out;
}
if (!readStr(is, e.name) || !readStr(is, e.description)) {
out.entries.clear(); return out;
}
if (!readPOD(is, e.channelKind) ||
!readPOD(is, e.accessKind) ||
!readPOD(is, e.passwordRequired) ||
!readPOD(is, e.levelMin) ||
!readPOD(is, e.maxMembers) ||
!readPOD(is, e.topicSetByMods) ||
!readPOD(is, e.pad0) ||
!readPOD(is, e.zoneDefaultMapId) ||
!readPOD(is, e.iconColorRGBA)) {
out.entries.clear(); return out;
}
}
return out;
}
bool WoweeGlobalChannelsLoader::exists(
const std::string& basePath) {
std::ifstream is(normalizePath(basePath), std::ios::binary);
return is.good();
}
WoweeGlobalChannels
WoweeGlobalChannelsLoader::makeStandardChannels(
const std::string& catalogName) {
using G = WoweeGlobalChannels;
WoweeGlobalChannels c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* name, uint8_t kind,
uint8_t access, uint8_t levelMin,
uint16_t maxMembers, uint32_t zoneMap,
const char* desc) {
G::Entry e;
e.channelId = id; e.name = name; e.description = desc;
e.channelKind = kind;
e.accessKind = access;
e.passwordRequired = 0;
e.levelMin = levelMin;
e.maxMembers = maxMembers;
e.topicSetByMods = 1;
e.zoneDefaultMapId = zoneMap;
e.iconColorRGBA = packRgba(140, 200, 255); // chat blue
c.entries.push_back(e);
};
add(1, "LookingForGroup", G::Global, G::PublicJoin,
15, 0, 0,
"Server-wide LFG channel — players queue for "
"5-man dungeons here. Level 15 required (matches "
"first dungeon access age).");
add(2, "World", G::Global, G::PublicJoin,
10, 0, 0,
"Server-wide World channel — general chat. "
"Level 10 minimum to filter trial-account spam.");
add(3, "TradeStormwind", G::RealmZone, G::AutoJoinOnZone,
0, 0, 1519,
"Trade chat — auto-enrolled when entering "
"Stormwind (areaId 1519). RealmZone scoped: "
"players in other capitals see their own "
"Trade channel.");
add(4, "General", G::Global, G::PublicJoin,
1, 0, 0,
"Generic catch-all general chat. Level 1 — "
"open to all characters.");
return c;
}
WoweeGlobalChannels WoweeGlobalChannelsLoader::makeRoleplay(
const std::string& catalogName) {
using G = WoweeGlobalChannels;
WoweeGlobalChannels c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* name, uint8_t kind,
uint8_t access, uint8_t pwReq,
uint8_t levelMin, uint16_t maxMembers,
const char* desc) {
G::Entry e;
e.channelId = id; e.name = name; e.description = desc;
e.channelKind = kind;
e.accessKind = access;
e.passwordRequired = pwReq;
e.levelMin = levelMin;
e.maxMembers = maxMembers;
e.topicSetByMods = 1;
e.zoneDefaultMapId = 0;
e.iconColorRGBA = packRgba(180, 100, 240); // RP purple
c.entries.push_back(e);
};
add(100, "RP_OOC", G::Custom, G::PublicJoin,
0, 1, 0,
"Out-of-character RP chat — meta-discussion "
"without breaking immersion in the IC channel. "
"Public join, no level gate.");
add(101, "RP_IC", G::Custom, G::Moderated,
0, 5, 200,
"In-character RP chat — moderated to enforce "
"RP-only language. 200-member cap. Mods can "
"/silence offenders.");
add(102, "RP_Forum", G::Custom, G::InviteOnly,
0, 1, 50,
"Invite-only RP planning channel. 50-member "
"cap. Used for guild RP coordination.");
add(103, "RP_Events", G::Custom, G::PublicJoin,
1, 1, 0,
"RP event announcements — password-protected "
"to prevent troll spam. Password is shared via "
"guild forums.");
return c;
}
WoweeGlobalChannels
WoweeGlobalChannelsLoader::makeAdminChannels(
const std::string& catalogName) {
using G = WoweeGlobalChannels;
WoweeGlobalChannels c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* name,
uint8_t access, uint16_t maxMembers,
const char* desc) {
G::Entry e;
e.channelId = id; e.name = name; e.description = desc;
e.channelKind = G::Custom;
e.accessKind = access;
e.passwordRequired = 1; // all admin
// channels gated
// by password
e.levelMin = 0;
e.maxMembers = maxMembers;
e.topicSetByMods = 1;
e.zoneDefaultMapId = 0;
e.iconColorRGBA = packRgba(220, 60, 60); // admin red
c.entries.push_back(e);
};
add(200, "GMTraffic", G::InviteOnly, 30,
"GM coordination chat — handles in-game support "
"tickets. Invite-only with password. 30 member "
"cap matches typical GM team size.");
add(201, "AuditLog", G::Moderated, 50,
"Read-only audit-log channel — automated GM-"
"command and trade-window logs broadcast here. "
"Moderated kind means only the audit bot can "
"speak; humans only read.");
add(202, "Backstage", G::InviteOnly, 20,
"Server admin backstage chat — devops + senior "
"GM only. Invite-only, password protected, "
"20-member cap. NOT logged to AuditLog.");
return c;
}
} // namespace pipeline
} // namespace wowee

View file

@ -380,6 +380,8 @@ const char* const kArgRequired[] = {
"--gen-lan", "--gen-lan-quest", "--gen-lan-tooltip",
"--info-wlan", "--validate-wlan",
"--export-wlan-json", "--import-wlan-json",
"--gen-gch", "--gen-gch-rp", "--gen-gch-admin",
"--info-wgch", "--validate-wgch",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",

View file

@ -168,6 +168,7 @@
#include "cli_anniversary_events_catalog.hpp"
#include "cli_pvp_ranks_catalog.hpp"
#include "cli_localization_catalog.hpp"
#include "cli_global_channels_catalog.hpp"
#include "cli_catalog_pluck.hpp"
#include "cli_catalog_find.hpp"
#include "cli_catalog_by_name.hpp"
@ -381,6 +382,7 @@ constexpr DispatchFn kDispatchTable[] = {
handleAnniversaryEventsCatalog,
handlePvPRanksCatalog,
handleLocalizationCatalog,
handleGlobalChannelsCatalog,
handleCatalogPluck,
handleCatalogFind,
handleCatalogByName,

View file

@ -126,6 +126,7 @@ constexpr FormatMagicEntry kFormats[] = {
{{'W','A','N','V'}, ".wanv", "events", "--info-wanv", "Anniversary & recurring event catalog"},
{{'W','P','R','G'}, ".wprg", "pvp", "--info-wprg", "PvP ranking grades catalog"},
{{'W','L','A','N'}, ".wlan", "i18n", "--info-wlan", "Localization catalog"},
{{'W','G','C','H'}, ".wgch", "chat", "--info-wgch", "Global chat channel 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

@ -0,0 +1,283 @@
#include "cli_global_channels_catalog.hpp"
#include "cli_arg_parse.hpp"
#include "cli_box_emitter.hpp"
#include "pipeline/wowee_global_channels.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 stripWgchExt(std::string base) {
stripExt(base, ".wgch");
return base;
}
const char* channelKindName(uint8_t k) {
using G = wowee::pipeline::WoweeGlobalChannels;
switch (k) {
case G::Global: return "global";
case G::RealmZone: return "realmzone";
case G::Faction: return "faction";
case G::Custom: return "custom";
default: return "unknown";
}
}
const char* accessKindName(uint8_t k) {
using G = wowee::pipeline::WoweeGlobalChannels;
switch (k) {
case G::PublicJoin: return "publicjoin";
case G::InviteOnly: return "inviteonly";
case G::AutoJoinOnZone: return "autojoinonzone";
case G::Moderated: return "moderated";
default: return "unknown";
}
}
bool saveOrError(const wowee::pipeline::WoweeGlobalChannels& c,
const std::string& base, const char* cmd) {
if (!wowee::pipeline::WoweeGlobalChannelsLoader::save(c, base)) {
std::fprintf(stderr, "%s: failed to save %s.wgch\n",
cmd, base.c_str());
return false;
}
return true;
}
void printGenSummary(const wowee::pipeline::WoweeGlobalChannels& c,
const std::string& base) {
std::printf("Wrote %s.wgch\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" channels: %zu\n", c.entries.size());
}
int handleGenStandard(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "StandardChatChannels";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWgchExt(base);
auto c = wowee::pipeline::WoweeGlobalChannelsLoader::
makeStandardChannels(name);
if (!saveOrError(c, base, "gen-gch")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenRoleplay(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "RoleplayChannels";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWgchExt(base);
auto c = wowee::pipeline::WoweeGlobalChannelsLoader::
makeRoleplay(name);
if (!saveOrError(c, base, "gen-gch-rp")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenAdmin(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "AdminChannels";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWgchExt(base);
auto c = wowee::pipeline::WoweeGlobalChannelsLoader::
makeAdminChannels(name);
if (!saveOrError(c, base, "gen-gch-admin")) 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 = stripWgchExt(base);
if (!wowee::pipeline::WoweeGlobalChannelsLoader::exists(base)) {
std::fprintf(stderr, "WGCH not found: %s.wgch\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeGlobalChannelsLoader::load(base);
if (jsonOut) {
nlohmann::json j;
j["wgch"] = base + ".wgch";
j["name"] = c.name;
j["count"] = c.entries.size();
nlohmann::json arr = nlohmann::json::array();
for (const auto& e : c.entries) {
arr.push_back({
{"channelId", e.channelId},
{"name", e.name},
{"description", e.description},
{"channelKind", e.channelKind},
{"channelKindName", channelKindName(e.channelKind)},
{"accessKind", e.accessKind},
{"accessKindName", accessKindName(e.accessKind)},
{"passwordRequired", e.passwordRequired != 0},
{"levelMin", e.levelMin},
{"maxMembers", e.maxMembers},
{"topicSetByMods", e.topicSetByMods != 0},
{"zoneDefaultMapId", e.zoneDefaultMapId},
{"iconColorRGBA", e.iconColorRGBA},
});
}
j["entries"] = arr;
std::printf("%s\n", j.dump(2).c_str());
return 0;
}
std::printf("WGCH: %s.wgch\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" channels: %zu\n", c.entries.size());
if (c.entries.empty()) return 0;
std::printf(" id kind access pw lvl max zone name\n");
for (const auto& e : c.entries) {
std::printf(" %4u %-10s %-15s %s %3u %5u %5u %s\n",
e.channelId, channelKindName(e.channelKind),
accessKindName(e.accessKind),
e.passwordRequired ? "Y" : "n",
e.levelMin, e.maxMembers,
e.zoneDefaultMapId, 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 = stripWgchExt(base);
if (!wowee::pipeline::WoweeGlobalChannelsLoader::exists(base)) {
std::fprintf(stderr,
"validate-wgch: WGCH not found: %s.wgch\n",
base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeGlobalChannelsLoader::load(base);
std::vector<std::string> errors;
std::vector<std::string> warnings;
if (c.entries.empty()) {
warnings.push_back("catalog has zero entries");
}
std::set<uint32_t> idsSeen;
std::set<std::string> namesSeen;
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.channelId);
if (!e.name.empty()) ctx += " " + e.name;
ctx += ")";
if (e.channelId == 0)
errors.push_back(ctx + ": channelId is 0");
if (e.name.empty())
errors.push_back(ctx + ": name is empty");
if (e.channelKind > 3) {
errors.push_back(ctx + ": channelKind " +
std::to_string(e.channelKind) +
" out of range (must be 0..3)");
}
if (e.accessKind > 3) {
errors.push_back(ctx + ": accessKind " +
std::to_string(e.accessKind) +
" out of range (must be 0..3)");
}
// AutoJoinOnZone REQUIRES zoneDefaultMapId — else
// the auto-join trigger never fires.
using G = wowee::pipeline::WoweeGlobalChannels;
if (e.accessKind == G::AutoJoinOnZone &&
e.zoneDefaultMapId == 0) {
errors.push_back(ctx +
": AutoJoinOnZone access kind with "
"zoneDefaultMapId=0 — auto-join trigger "
"would never fire (no zone bound to "
"this channel)");
}
// Inverse: zoneDefaultMapId set with non-AutoJoin
// kind is dead data — warn.
if (e.zoneDefaultMapId != 0 &&
e.accessKind != G::AutoJoinOnZone) {
warnings.push_back(ctx +
": zoneDefaultMapId=" +
std::to_string(e.zoneDefaultMapId) +
" set but accessKind is not AutoJoinOn"
"Zone — the field is ignored at runtime");
}
// Channel names must be unique — chat-window
// dispatch identifies channels by name in /chat
// commands.
if (!e.name.empty() &&
!namesSeen.insert(e.name).second) {
errors.push_back(ctx +
": duplicate channel name '" + e.name +
"' — /join command would route "
"ambiguously");
}
if (!idsSeen.insert(e.channelId).second) {
errors.push_back(ctx + ": duplicate channelId");
}
}
bool ok = errors.empty();
if (jsonOut) {
nlohmann::json j;
j["wgch"] = base + ".wgch";
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-wgch: %s.wgch\n", base.c_str());
if (ok && warnings.empty()) {
std::printf(" OK — %zu channels, all channelIds "
"+ names unique, AutoJoinOnZone "
"channels have zoneDefaultMapId 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 handleGlobalChannelsCatalog(int& i, int argc, char** argv,
int& outRc) {
if (std::strcmp(argv[i], "--gen-gch") == 0 && i + 1 < argc) {
outRc = handleGenStandard(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-gch-rp") == 0 && i + 1 < argc) {
outRc = handleGenRoleplay(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-gch-admin") == 0 &&
i + 1 < argc) {
outRc = handleGenAdmin(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--info-wgch") == 0 && i + 1 < argc) {
outRc = handleInfo(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--validate-wgch") == 0 && i + 1 < argc) {
outRc = handleValidate(i, argc, argv); return true;
}
return false;
}
} // namespace cli
} // namespace editor
} // namespace wowee

View file

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

View file

@ -2489,6 +2489,16 @@ void printUsage(const char* argv0) {
std::printf(" Export binary .wlan to a human-editable JSON sidecar (defaults to <base>.wlan.json; emits both languageCode and namespace as int + name string; UTF-8 multibyte strings preserved)\n");
std::printf(" --import-wlan-json <json-path> [out-base]\n");
std::printf(" Import a .wlan.json sidecar back into binary .wlan (languageCode int OR \"enUS\"/\"enGB\"/\"deDE\"/\"esES\"/\"frFR\"/\"itIT\"/\"koKR\"/\"ptBR\"/\"ruRU\"/\"zhCN\"/\"zhTW\"; namespace int OR \"ui\"/\"quest\"/\"item\"/\"spell\"/\"creature\"/\"tooltip\"/\"gossip\"/\"system\")\n");
std::printf(" --gen-gch <wgch-base> [name]\n");
std::printf(" Emit .wgch 4 standard server channels (LookingForGroup/World/General Global PublicJoin + Trade RealmZone AutoJoinOnZone Stormwind)\n");
std::printf(" --gen-gch-rp <wgch-base> [name]\n");
std::printf(" Emit .wgch 4 RP server channels (RP_OOC PublicJoin + RP_IC Moderated 200-cap + RP_Forum InviteOnly 50-cap + RP_Events password-protected)\n");
std::printf(" --gen-gch-admin <wgch-base> [name]\n");
std::printf(" Emit .wgch 3 moderator-only channels (GMTraffic invite + AuditLog moderated + Backstage invite — all password-gated, no logging on Backstage)\n");
std::printf(" --info-wgch <wgch-base> [--json]\n");
std::printf(" Print WGCH entries (id / channelKind / accessKind / passwordRequired / levelMin / maxMembers / zoneDefaultMapId / name)\n");
std::printf(" --validate-wgch <wgch-base> [--json]\n");
std::printf(" Static checks: id+name required, channelKind 0..3, accessKind 0..3, no duplicate channelIds, no duplicate channel names (chat /join routing collision), AutoJoinOnZone REQUIRES zoneDefaultMapId; warns on dead zoneDefaultMapId set with non-AutoJoin kind\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(" --catalog-find <directory> <id> [--magic <WXXX>] [--json]\n");

View file

@ -148,6 +148,7 @@ constexpr FormatRow kFormats[] = {
{"WANV", ".wanv", "events", "GameEvent SQL + per-holiday script", "Anniversary & recurring event catalog (cron-like scheduling)"},
{"WPRG", ".wprg", "pvp", "vanilla 14-rank PvP ladder ladder", "PvP ranking grades catalog (faction + tier + honor thresholds)"},
{"WLAN", ".wlan", "i18n", "Locale_*.MPQ + DBC trailing strings","Localization catalog (per-language string overlay)"},
{"WGCH", ".wgch", "chat", "ChatChannels.dbc + zone-default joins","Global chat channel catalog (access policy + zone auto-join)"},
// Additional pipeline catalogs without the alternating
// gen/info/validate CLI surface (loaded by the engine