Kelsidavis-WoWee/include/pipeline/wowee_channels.hpp
Kelsi af214d8b34 feat(pipeline): add WCHN (Wowee Chat Channel) catalog
Novel open replacement for Blizzard's ChatChannels.dbc +
the AzerothCore-style chat_channel SQL tables. The 40th
open format added to the editor.

Defines the world chat channel system: General, Trade,
LookingForGroup, GuildRecruitment, LocalDefense, plus
per-zone area channels and custom user-created channels.
Each channel has access rules (faction / level), join
behavior (auto vs opt-in), broadcast policy (announce /
moderated), and optional area / map gating that auto-joins
or auto-leaves the channel as the player moves.

Cross-references with previously-added formats:
  WCHN.entry.areaIdGate -> WMS.area.areaId
                           (channel auto-attaches in this area)
  WCHN.entry.mapIdGate  -> WMS.map.mapId
                           (channel auto-attaches on this map)

Format:
  • magic "WCHN", version 1, little-endian
  • per channel: channelId / name / description /
    channelType / factionAccess / autoJoin / announce /
    moderated / minLevel / areaIdGate / mapIdGate

Enums:
  • ChannelType (10): AreaLocal / Zone / Continent / World /
                      Trade / LookingForGroup / GuildRecruit /
                      LocalDefense / Custom / Pvp
  • FactionAccess (3): Alliance / Horde / Both

API: WoweeChannelLoader::save / load / exists / findById.

Three preset emitters:
  • makeStarter   — 4 stock channels (General Zone +
                     Trade + LFG + GuildRecruit) with
                     default autoJoin policies
  • makeCity      — 5 city-specific channels (3 Stormwind +
                     2 Orgrimmar) with mapId / areaId gates
                     so they auto-attach on entry
  • makeModerated — 3 moderated / restricted channels
                     (LocalDefense level 10+, WorldDefense
                     moderated, RaidCoordination level 60+)

CLI added (5 flags, 677 documented total now):
  --gen-channels / --gen-channels-city / --gen-channels-moderated
  --info-wchn / --validate-wchn

Validator catches: channelId=0 + duplicates, empty name,
unknown channelType / factionAccess, world / continent
channel with area or map gate (gate is silently ignored at
runtime — usually a typo), minLevel=0 (no level gate at all).
2026-05-09 18:43:26 -07:00

111 lines
4 KiB
C++

#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace wowee {
namespace pipeline {
// Wowee Open Chat Channel catalog (.wchn) — novel
// replacement for Blizzard's ChatChannels.dbc + the
// AzerothCore-style chat_channel SQL tables. The 40th
// open format added to the editor.
//
// Defines the world chat channel system: General, Trade,
// LookingForGroup, GuildRecruitment, LocalDefense, plus
// per-zone area channels and custom user-created channels.
// Each channel has access rules (faction / level), join
// behavior (auto vs opt-in), broadcast policy (announce /
// moderated), and optional area / map gating that
// auto-joins or auto-leaves the channel as the player moves.
//
// Cross-references with previously-added formats:
// WCHN.entry.areaIdGate → WMS.area.areaId
// (channel auto-attaches in this area)
// WCHN.entry.mapIdGate → WMS.map.mapId
// (channel auto-attaches on this map)
//
// Binary layout (little-endian):
// magic[4] = "WCHN"
// version (uint32) = current 1
// nameLen + name (catalog label)
// entryCount (uint32)
// entries (each):
// channelId (uint32)
// nameLen + name
// descLen + description
// channelType (uint8) / factionAccess (uint8) /
// autoJoin (uint8) / announce (uint8)
// moderated (uint8) / pad[1] / minLevel (uint16)
// areaIdGate (uint32) / mapIdGate (uint32)
struct WoweeChannel {
enum ChannelType : uint8_t {
AreaLocal = 0, // /local within a sub-zone
Zone = 1, // zone-wide
Continent = 2, // continent-wide
World = 3, // entire realm
Trade = 4, // trade district + opt-in
LookingForGroup = 5, // LFG global
GuildRecruit = 6, // GuildFinder global
LocalDefense = 7, // alarm channel for zone attacks
Custom = 8, // user-created
Pvp = 9, // PvP-mode players
};
enum FactionAccess : uint8_t {
Alliance = 0,
Horde = 1,
Both = 2,
};
struct Entry {
uint32_t channelId = 0;
std::string name;
std::string description;
uint8_t channelType = AreaLocal;
uint8_t factionAccess = Both;
uint8_t autoJoin = 0; // 1 = auto-join on context match
uint8_t announce = 1; // 1 = broadcast join/leave
uint8_t moderated = 0; // 1 = only operators speak
uint16_t minLevel = 1;
uint32_t areaIdGate = 0; // 0 = no gate
uint32_t mapIdGate = 0;
};
std::string name;
std::vector<Entry> entries;
bool isValid() const { return !entries.empty(); }
const Entry* findById(uint32_t channelId) const;
static const char* channelTypeName(uint8_t t);
static const char* factionAccessName(uint8_t f);
};
class WoweeChannelLoader {
public:
static bool save(const WoweeChannel& cat,
const std::string& basePath);
static WoweeChannel load(const std::string& basePath);
static bool exists(const std::string& basePath);
// Preset emitters used by --gen-channels* variants.
//
// makeStarter — 4 stock channels (General / Trade /
// LFG / GuildRecruit) with default
// autoJoin and announce rules.
// makeCity — 5 city-specific channels (Stormwind
// General / Trade / LFG + Orgrimmar
// General / Trade) with mapId gates.
// makeModerated — 3 moderated / restricted channels
// (LocalDefense level 10+, World event
// chat, custom raid coordination).
static WoweeChannel makeStarter(const std::string& catalogName);
static WoweeChannel makeCity(const std::string& catalogName);
static WoweeChannel makeModerated(const std::string& catalogName);
};
} // namespace pipeline
} // namespace wowee