feat(pipeline): add WTKN (Wowee Token catalog) format

Novel open replacement for Blizzard's Currency.dbc +
CurrencyCategory.dbc + CurrencyTypes.dbc + the AzerothCore-
style player_currency SQL tables. The 28th open format
added to the editor.

Defines secondary currency tokens beyond gold: Honor Points
(PvP), Arena Points (rated PvP), Marks of Honor (per
battleground), faction reputation tokens, holiday-event
currencies. Each token has a balance cap, optional weekly
cap (regenerating earnings limit), and a category for
grouping in the player's currency tab.

Cross-references:
  WTRN.item.extendedCost -> WTKN.entry.tokenId
                             (vendors can charge in tokens
                              instead of copper — when
                              extendedCost > 0 the runtime
                              looks up the matching token)

Format:
  • magic "WTKN", version 1, little-endian
  • per token: tokenId / name / description / iconPath /
    category / maxBalance / weeklyCap / flags

Enums:
  • Category (6): Misc / Pvp / Reputation / Crafting /
                   Seasonal / Holiday
  • Flags:        AccountWide / Tradeable / HiddenUntilEarned /
                   ResetsOnLogout / ConvertsToGold

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

Three preset emitters showcase typical token shapes:
  • makeStarter  — 3 tokens (Honor / Marks / Stormwind Guard
                    rep) covering Pvp + Reputation categories
  • makePvp      — full PvP set: Honor (75k) + Arena (5k +
                    weekly 1500) + 6 BG marks of honor for
                    classic + TBC + WotLK battlegrounds
  • makeSeasonal — 4 holiday tokens (Tricky Treats /
                    Brewfest / Coin of Ancestry / Stranger's
                    Gift) all flagged ResetsOnLogout to make
                    them event-bound

CLI added (5 flags, 592 documented total now):
  --gen-tokens / --gen-tokens-pvp / --gen-tokens-seasonal
  --info-wtkn / --validate-wtkn

Validator catches: tokenId=0 + duplicates, empty name,
unknown category, weeklyCap > maxBalance (cap unreachable),
ResetsOnLogout + AccountWide combo (incoherent — account
state survives logout by definition).
This commit is contained in:
Kelsi 2026-05-09 16:53:11 -07:00
parent 68812b6c41
commit b632554b5b
8 changed files with 606 additions and 0 deletions

View file

@ -0,0 +1,107 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace wowee {
namespace pipeline {
// Wowee Open Token / Currency catalog (.wtkn) — novel
// replacement for Blizzard's Currency.dbc +
// CurrencyCategory.dbc + CurrencyTypes.dbc + the
// AzerothCore-style player_currency SQL tables. The 28th
// open format added to the editor.
//
// Defines secondary currency tokens beyond gold: Honor
// Points (PvP), Arena Points (rated PvP), Marks of Honor
// (per battleground), faction reputation tokens, etc. Each
// token has a balance cap, optional weekly cap (regenerating
// per-week limit on earnings), and a category for grouping
// in the player's currency tab.
//
// Cross-references with previously-added formats:
// WTRN.item.extendedCost → WTKN.entry.tokenId
// (vendors can charge in tokens
// instead of copper — when
// extendedCost > 0 the runtime
// looks up the corresponding token)
//
// Binary layout (little-endian):
// magic[4] = "WTKN"
// version (uint32) = current 1
// nameLen + name (catalog label)
// entryCount (uint32)
// entries (each):
// tokenId (uint32)
// nameLen + name
// descLen + description
// iconLen + iconPath
// category (uint8) + flags_byte (uint8) + pad[2]
// maxBalance (uint32) -- 0 = unlimited
// weeklyCap (uint32) -- 0 = no weekly cap
// flags (uint32)
struct WoweeToken {
enum Category : uint8_t {
Misc = 0,
Pvp = 1, // Honor / Arena / Marks
Reputation = 2, // faction-specific tokens
Crafting = 3, // profession turn-in tokens
Seasonal = 4, // event-only currencies
Holiday = 5,
};
enum Flags : uint32_t {
AccountWide = 0x01,
Tradeable = 0x02,
HiddenUntilEarned = 0x04,
ResetsOnLogout = 0x08,
ConvertsToGold = 0x10,
};
struct Entry {
uint32_t tokenId = 0;
std::string name;
std::string description;
std::string iconPath;
uint8_t category = Misc;
uint32_t maxBalance = 0; // 0 = unlimited
uint32_t weeklyCap = 0; // 0 = no cap
uint32_t flags = 0;
};
std::string name;
std::vector<Entry> entries;
bool isValid() const { return !entries.empty(); }
const Entry* findById(uint32_t tokenId) const;
static const char* categoryName(uint8_t c);
};
class WoweeTokenLoader {
public:
static bool save(const WoweeToken& cat,
const std::string& basePath);
static WoweeToken load(const std::string& basePath);
static bool exists(const std::string& basePath);
// Preset emitters used by --gen-tokens* variants.
//
// makeStarter — 3 tokens covering Pvp / Reputation /
// Misc categories with realistic caps.
// makePvp — full PvP currency set: Honor (75k cap)
// + Arena Points (5k cap, weekly) + Marks
// of Honor for 6 classic battlegrounds.
// makeSeasonal — 4 holiday-event tokens (Hallow's End
// masks, Brewfest tokens, Winter's Veil
// coins, etc.) all flagged ResetsOnLogout
// to be event-bound.
static WoweeToken makeStarter(const std::string& catalogName);
static WoweeToken makePvp(const std::string& catalogName);
static WoweeToken makeSeasonal(const std::string& catalogName);
};
} // namespace pipeline
} // namespace wowee