mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-10 19:13:52 +00:00
Novel open replacement for AzerothCore-style
mail_loot_template SQL + the in-game mail subset of the
inventory + currency systems. The 34th open format added
to the editor.
Defines templated mail messages with currency + item
attachments. Triggered by quest reward delivery (overflow
when bag is full), auction house bid wins / sales,
achievement reward attachments, GM correspondence, holiday
event mailings (Brewfest samples, Hallow's End candy), and
returned-mail-on-rejection.
Cross-references with previously-added formats:
WMAL.entry.senderNpcId -> WCRT.entry.creatureId
WMAL.entry.attachments.itemId -> WIT.entry.itemId
Format:
• magic "WMAL", version 1, little-endian
• per template: templateId / senderNpcId / subject / body /
senderName / moneyCopperAttached / categoryId / cod /
returnable / expiryDays / attachments[] (each: itemId +
quantity)
Enums:
• Category (8): QuestReward / Auction / GmCorrespondence /
AchievementReward / EventMailing / Raffle /
ScriptDelivery / ReturnedMail
API: WoweeMailLoader::save / load / exists / findById.
Three preset emitters showcase typical mail templates:
• makeStarter — 3 templates (quest overflow / auction won /
GM gift) covering the 3 most common
categories
• makeHoliday — 4 holiday samples that cross-reference the
WTKN seasonal token IDs (200=Tricky Treats,
201=Brewfest, 202=Coin of Ancestry,
203=Stranger's Gift) so the demo content
stack ships a full holiday onboarding
experience
• makeAuction — 5-template auction-house family (outbid /
won / sold / expired / cancelled) — runtime
fills in actual bid amounts / sold items
at send time
CLI added (5 flags, 635 documented total now):
--gen-mail / --gen-mail-holiday / --gen-mail-auction
--info-wmal / --validate-wmal
Validator catches: templateId=0 + duplicates, empty subject,
neither senderNpcId nor senderName set (no displayable
sender), unknown category, expiryDays=0 (mail expires
immediately), cod=1 with no money attached (free COD),
empty mail in categories where the runtime doesn't fill in
content (skips Auction / GmCorrespondence / ReturnedMail
where empty templates are intentional).
Two bugs caught + fixed during smoke-test on the auction
preset:
• print formatting glued the `0` from senderNpcId after
the senderName when no NPC was set (rendered as
"Postmaster0" instead of "Postmaster") — fixed with an
explicit if/else split
• validator's "no money + no items" warning was too
aggressive for the Auction category, where templates
are intentionally informational and the runtime fills
in the real values — added Auction + ReturnedMail to
the skip list
109 lines
3.6 KiB
C++
109 lines
3.6 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace wowee {
|
|
namespace pipeline {
|
|
|
|
// Wowee Open Mail Template catalog (.wmal) — novel
|
|
// replacement for AzerothCore-style mail_loot_template SQL
|
|
// + the in-game mail subset of the inventory + currency
|
|
// systems. The 34th open format added to the editor.
|
|
//
|
|
// Defines templated mail messages with currency + item
|
|
// attachments. Triggered by:
|
|
// • quest reward delivery (overflow mail when bag is full)
|
|
// • auction house bid wins / sales completion
|
|
// • achievement reward attachments
|
|
// • GM correspondence
|
|
// • holiday event mailings (Brewfest samples, Hallow's End
|
|
// candy, anniversary thank-you notes)
|
|
// • returned-mail-on-rejection
|
|
//
|
|
// Cross-references with previously-added formats:
|
|
// WMAL.entry.senderNpcId → WCRT.entry.creatureId
|
|
// WMAL.entry.attachments.itemId → WIT.entry.itemId
|
|
//
|
|
// Binary layout (little-endian):
|
|
// magic[4] = "WMAL"
|
|
// version (uint32) = current 1
|
|
// nameLen + name (catalog label)
|
|
// entryCount (uint32)
|
|
// entries (each):
|
|
// templateId (uint32)
|
|
// senderNpcId (uint32)
|
|
// subjectLen + subject
|
|
// bodyLen + body
|
|
// senderLen + senderName
|
|
// moneyCopperAttached (uint32)
|
|
// attachmentCount (uint8) / categoryId (uint8) /
|
|
// cod (uint8) / returnable (uint8)
|
|
// expiryDays (uint16) / pad[2]
|
|
// attachments (each: itemId (uint32) + quantity (uint16) + pad[2])
|
|
struct WoweeMail {
|
|
enum Category : uint8_t {
|
|
QuestReward = 0,
|
|
Auction = 1,
|
|
GmCorrespondence = 2,
|
|
AchievementReward = 3,
|
|
EventMailing = 4,
|
|
Raffle = 5,
|
|
ScriptDelivery = 6,
|
|
ReturnedMail = 7,
|
|
};
|
|
|
|
struct Attachment {
|
|
uint32_t itemId = 0;
|
|
uint16_t quantity = 1;
|
|
};
|
|
|
|
struct Entry {
|
|
uint32_t templateId = 0;
|
|
uint32_t senderNpcId = 0; // 0 = system / no NPC
|
|
std::string subject;
|
|
std::string body;
|
|
std::string senderName; // fallback when senderNpcId=0
|
|
uint32_t moneyCopperAttached = 0;
|
|
uint8_t categoryId = QuestReward;
|
|
uint8_t cod = 0; // 1 = cash on delivery
|
|
uint8_t returnable = 1; // 1 = unread mail returns
|
|
uint16_t expiryDays = 30;
|
|
std::vector<Attachment> attachments;
|
|
};
|
|
|
|
std::string name;
|
|
std::vector<Entry> entries;
|
|
|
|
bool isValid() const { return !entries.empty(); }
|
|
|
|
const Entry* findById(uint32_t templateId) const;
|
|
|
|
static const char* categoryName(uint8_t c);
|
|
};
|
|
|
|
class WoweeMailLoader {
|
|
public:
|
|
static bool save(const WoweeMail& cat,
|
|
const std::string& basePath);
|
|
static WoweeMail load(const std::string& basePath);
|
|
static bool exists(const std::string& basePath);
|
|
|
|
// Preset emitters used by --gen-mail* variants.
|
|
//
|
|
// makeStarter — 3 templates covering quest reward
|
|
// overflow / auction house / GM gift.
|
|
// makeHoliday — 4 holiday-event mailings tied to WSEA
|
|
// yearly events (Tricky Treats sample
|
|
// pack, Brewfest sampler, Lunar Festival
|
|
// blessing, Winter's Veil gift box).
|
|
// makeAuction — full auction-house template family:
|
|
// outbid / won / sold / expired / cancelled.
|
|
static WoweeMail makeStarter(const std::string& catalogName);
|
|
static WoweeMail makeHoliday(const std::string& catalogName);
|
|
static WoweeMail makeAuction(const std::string& catalogName);
|
|
};
|
|
|
|
} // namespace pipeline
|
|
} // namespace wowee
|