mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-10 02:53:51 +00:00
feat(pipeline): add WSEA (Wowee Seasonal Event) format
Novel open replacement for Blizzard's GameEvents.dbc + the
AzerothCore-style game_event / game_event_creature /
game_event_gameobject SQL tables. The 31st open format
added to the editor.
Calendar-based content: holidays (Hallow's End, Winter's
Veil), recurring promotional events (Children's Week,
Lunar Festival, Brewfest), one-time anniversaries, and
XP-bonus weekends. Each event has a start date, duration,
optional recurrence (yearly / monthly / weekly), faction
restriction, optional XP bonus, and a reward currency
cross-reference into WTKN.
Cross-references with previously-added formats:
WSEA.entry.tokenIdReward -> WTKN.entry.tokenId
(the seasonal currency the
event hands out — Tricky
Treats during Hallow's End,
Brewfest Tokens during
Brewfest, etc.)
The yearly preset's tokenIdReward values (200/201/202/203)
deliberately match WTKN.makeSeasonal's seasonal token ids
so the demo content stack already wires together: WSEA
yearly events grant WTKN tokens that vendors can charge in
via WTRN.item.extendedCost.
Format:
• magic "WSEA", version 1, little-endian
• per event: eventId / name / description / iconPath /
announceMessage / startDate (Unix epoch seconds) /
duration_seconds / recurrenceDays (0=one-shot, 365=yearly) /
holidayKind / factionGroup / bonusXpPercent / tokenIdReward
Enums:
• HolidayKind (7): Combat / Collection / Racial /
Anniversary / Fishing / Cosmetic /
WorldEvent
• FactionGroup (3): Both / Alliance / Horde
API: WoweeEventLoader::save / load / exists / findById.
Three preset emitters showcase typical event shapes:
• makeStarter — 3 events covering Combat /
Fishing / Anniversary kinds
• makeYearly — 4 yearly holidays with full WTKN
cross-refs (Hallow's End / Brewfest /
Lunar Festival / Winter's Veil)
• makeBonusWeekends — 3 monthly Fri-Sun bonus tiers
(50% / 100% / 200% RAF-style)
CLI added (5 flags, 614 documented total now):
--gen-events / --gen-events-yearly / --gen-events-weekends
--info-wsea / --validate-wsea
Validator catches: eventId=0 + duplicates, empty name,
unknown holidayKind / factionGroup, duration_seconds=0
(event never runs), duration > recurrence period (events
would overlap themselves on next iteration), bonusXpPercent
> 200 (very high — verify intentional).
This commit is contained in:
parent
dc3e566e45
commit
ff4159c369
8 changed files with 614 additions and 0 deletions
|
|
@ -618,6 +618,7 @@ set(WOWEE_SOURCES
|
|||
src/pipeline/wowee_tokens.cpp
|
||||
src/pipeline/wowee_triggers.cpp
|
||||
src/pipeline/wowee_titles.cpp
|
||||
src/pipeline/wowee_events.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/dbc_layout.cpp
|
||||
|
||||
|
|
@ -1382,6 +1383,7 @@ add_executable(wowee_editor
|
|||
tools/editor/cli_tokens_catalog.cpp
|
||||
tools/editor/cli_triggers_catalog.cpp
|
||||
tools/editor/cli_titles_catalog.cpp
|
||||
tools/editor/cli_events_catalog.cpp
|
||||
tools/editor/cli_quest_objective.cpp
|
||||
tools/editor/cli_quest_reward.cpp
|
||||
tools/editor/cli_clone.cpp
|
||||
|
|
@ -1478,6 +1480,7 @@ add_executable(wowee_editor
|
|||
src/pipeline/wowee_tokens.cpp
|
||||
src/pipeline/wowee_triggers.cpp
|
||||
src/pipeline/wowee_titles.cpp
|
||||
src/pipeline/wowee_events.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/terrain_mesh.cpp
|
||||
|
||||
|
|
|
|||
116
include/pipeline/wowee_events.hpp
Normal file
116
include/pipeline/wowee_events.hpp
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Seasonal Event catalog (.wsea) — novel
|
||||
// replacement for Blizzard's GameEvents.dbc + the
|
||||
// AzerothCore-style game_event / game_event_creature /
|
||||
// game_event_gameobject SQL tables. The 31st open format
|
||||
// added to the editor.
|
||||
//
|
||||
// Calendar-based content: holidays (Hallow's End, Winter's
|
||||
// Veil), recurring promotional events (Children's Week,
|
||||
// Lunar Festival, Brewfest), one-time anniversaries, and
|
||||
// XP-bonus weekends. Each event has a start date, duration,
|
||||
// optional recurrence, faction restriction, optional XP
|
||||
// bonus, and a reward currency cross-reference into WTKN.
|
||||
//
|
||||
// Cross-references with previously-added formats:
|
||||
// WSEA.entry.tokenIdReward → WTKN.entry.tokenId
|
||||
// (the seasonal currency the
|
||||
// event hands out — Tricky
|
||||
// Treats during Hallow's End,
|
||||
// Brewfest Tokens during
|
||||
// Brewfest, etc.)
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WSEA"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// eventId (uint32)
|
||||
// nameLen + name
|
||||
// descLen + description
|
||||
// iconLen + iconPath
|
||||
// announceLen + announceMessage
|
||||
// startDate (uint64) -- Unix timestamp seconds
|
||||
// duration_seconds (uint32)
|
||||
// recurrenceDays (uint16)
|
||||
// holidayKind (uint8) / factionGroup (uint8)
|
||||
// bonusXpPercent (uint8) / pad[3]
|
||||
// tokenIdReward (uint32)
|
||||
struct WoweeEvent {
|
||||
enum HolidayKind : uint8_t {
|
||||
Combat = 0,
|
||||
Collection = 1,
|
||||
Racial = 2,
|
||||
Anniversary = 3,
|
||||
Fishing = 4,
|
||||
Cosmetic = 5,
|
||||
WorldEvent = 6, // server-wide invasion / boss event
|
||||
};
|
||||
|
||||
enum FactionGroup : uint8_t {
|
||||
FactionBoth = 0,
|
||||
FactionAlliance = 1,
|
||||
FactionHorde = 2,
|
||||
};
|
||||
|
||||
struct Entry {
|
||||
uint32_t eventId = 0;
|
||||
std::string name;
|
||||
std::string description;
|
||||
std::string iconPath;
|
||||
std::string announceMessage;
|
||||
uint64_t startDate = 0; // Unix epoch seconds
|
||||
uint32_t duration_seconds = 0;
|
||||
uint16_t recurrenceDays = 0; // 0 = one-shot
|
||||
uint8_t holidayKind = Combat;
|
||||
uint8_t factionGroup = FactionBoth;
|
||||
uint8_t bonusXpPercent = 0; // 0 = no bonus
|
||||
uint32_t tokenIdReward = 0; // WTKN cross-ref, 0 = none
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::vector<Entry> entries;
|
||||
|
||||
bool isValid() const { return !entries.empty(); }
|
||||
|
||||
const Entry* findById(uint32_t eventId) const;
|
||||
|
||||
static const char* holidayKindName(uint8_t k);
|
||||
static const char* factionGroupName(uint8_t f);
|
||||
};
|
||||
|
||||
class WoweeEventLoader {
|
||||
public:
|
||||
static bool save(const WoweeEvent& cat,
|
||||
const std::string& basePath);
|
||||
static WoweeEvent load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-events* variants.
|
||||
//
|
||||
// makeStarter — 3 events covering Combat / Collection /
|
||||
// Anniversary holidayKind categories.
|
||||
// makeYearly — 4 yearly recurring holidays with WTKN
|
||||
// reward cross-refs (Hallow's End ->
|
||||
// Tricky Treats, Brewfest -> Brewfest
|
||||
// Tokens, Lunar Festival -> Coin of
|
||||
// Ancestry, Winter's Veil -> Stranger's
|
||||
// Gift).
|
||||
// makeBonusWeekends — 3 short XP-bonus weekend events
|
||||
// (50% / 100% / 200% bonus tiers).
|
||||
static WoweeEvent makeStarter(const std::string& catalogName);
|
||||
static WoweeEvent makeYearly(const std::string& catalogName);
|
||||
static WoweeEvent makeBonusWeekends(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
235
src/pipeline/wowee_events.cpp
Normal file
235
src/pipeline/wowee_events.cpp
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
#include "pipeline/wowee_events.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kMagic[4] = {'W', 'S', 'E', 'A'};
|
||||
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) != ".wsea") {
|
||||
base += ".wsea";
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const WoweeEvent::Entry* WoweeEvent::findById(uint32_t eventId) const {
|
||||
for (const auto& e : entries) if (e.eventId == eventId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* WoweeEvent::holidayKindName(uint8_t k) {
|
||||
switch (k) {
|
||||
case Combat: return "combat";
|
||||
case Collection: return "collection";
|
||||
case Racial: return "racial";
|
||||
case Anniversary: return "anniversary";
|
||||
case Fishing: return "fishing";
|
||||
case Cosmetic: return "cosmetic";
|
||||
case WorldEvent: return "world-event";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
const char* WoweeEvent::factionGroupName(uint8_t f) {
|
||||
switch (f) {
|
||||
case FactionBoth: return "both";
|
||||
case FactionAlliance: return "alliance";
|
||||
case FactionHorde: return "horde";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
bool WoweeEventLoader::save(const WoweeEvent& 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.eventId);
|
||||
writeStr(os, e.name);
|
||||
writeStr(os, e.description);
|
||||
writeStr(os, e.iconPath);
|
||||
writeStr(os, e.announceMessage);
|
||||
writePOD(os, e.startDate);
|
||||
writePOD(os, e.duration_seconds);
|
||||
writePOD(os, e.recurrenceDays);
|
||||
writePOD(os, e.holidayKind);
|
||||
writePOD(os, e.factionGroup);
|
||||
writePOD(os, e.bonusXpPercent);
|
||||
uint8_t pad[3] = {0, 0, 0};
|
||||
os.write(reinterpret_cast<const char*>(pad), 3);
|
||||
writePOD(os, e.tokenIdReward);
|
||||
}
|
||||
return os.good();
|
||||
}
|
||||
|
||||
WoweeEvent WoweeEventLoader::load(const std::string& basePath) {
|
||||
WoweeEvent 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.eventId)) { out.entries.clear(); return out; }
|
||||
if (!readStr(is, e.name) || !readStr(is, e.description) ||
|
||||
!readStr(is, e.iconPath) || !readStr(is, e.announceMessage)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.startDate) ||
|
||||
!readPOD(is, e.duration_seconds) ||
|
||||
!readPOD(is, e.recurrenceDays) ||
|
||||
!readPOD(is, e.holidayKind) ||
|
||||
!readPOD(is, e.factionGroup) ||
|
||||
!readPOD(is, e.bonusXpPercent)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
uint8_t pad[3];
|
||||
is.read(reinterpret_cast<char*>(pad), 3);
|
||||
if (is.gcount() != 3) { out.entries.clear(); return out; }
|
||||
if (!readPOD(is, e.tokenIdReward)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeEventLoader::exists(const std::string& basePath) {
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
return is.good();
|
||||
}
|
||||
|
||||
WoweeEvent WoweeEventLoader::makeStarter(const std::string& catalogName) {
|
||||
WoweeEvent c;
|
||||
c.name = catalogName;
|
||||
{
|
||||
WoweeEvent::Entry e;
|
||||
e.eventId = 1; e.name = "Brawl Week";
|
||||
e.description = "Double honor gains in all PvP combat.";
|
||||
e.holidayKind = WoweeEvent::Combat;
|
||||
e.duration_seconds = 7 * 24 * 3600; // 1 week
|
||||
e.bonusXpPercent = 200;
|
||||
c.entries.push_back(e);
|
||||
}
|
||||
{
|
||||
WoweeEvent::Entry e;
|
||||
e.eventId = 2; e.name = "Stranglethorn Fishing Extravaganza";
|
||||
e.description = "Catch the rare Tastyfish for prizes.";
|
||||
e.holidayKind = WoweeEvent::Fishing;
|
||||
e.duration_seconds = 4 * 3600; // 4 hours
|
||||
e.recurrenceDays = 7; // weekly
|
||||
c.entries.push_back(e);
|
||||
}
|
||||
{
|
||||
WoweeEvent::Entry e;
|
||||
e.eventId = 3; e.name = "Anniversary";
|
||||
e.description = "Celebrate the server's launch anniversary.";
|
||||
e.holidayKind = WoweeEvent::Anniversary;
|
||||
e.duration_seconds = 3 * 24 * 3600; // 3 days
|
||||
e.recurrenceDays = 365; // yearly
|
||||
e.bonusXpPercent = 50;
|
||||
c.entries.push_back(e);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeEvent WoweeEventLoader::makeYearly(const std::string& catalogName) {
|
||||
WoweeEvent c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint8_t kind,
|
||||
uint32_t durDays, uint32_t tokenId,
|
||||
const char* announce) {
|
||||
WoweeEvent::Entry e;
|
||||
e.eventId = id; e.name = name;
|
||||
e.holidayKind = kind;
|
||||
e.duration_seconds = durDays * 24 * 3600;
|
||||
e.recurrenceDays = 365;
|
||||
e.tokenIdReward = tokenId;
|
||||
e.announceMessage = announce;
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
// tokenIds (200/201/202/203) match WTKN.makeSeasonal.
|
||||
add(100, "Hallow's End", WoweeEvent::Collection, 14, 200,
|
||||
"The Headless Horseman rides! Tricky Treats await...");
|
||||
add(101, "Brewfest", WoweeEvent::Cosmetic, 14, 201,
|
||||
"Brewfest is here. Mount up and ride for the big kegs!");
|
||||
add(102, "Lunar Festival", WoweeEvent::Anniversary, 14, 202,
|
||||
"Visit the elders to receive Coins of Ancestry.");
|
||||
add(103, "Winter's Veil", WoweeEvent::Cosmetic, 21, 203,
|
||||
"Snow falls across the realm. Greatfather Winter awaits.");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeEvent WoweeEventLoader::makeBonusWeekends(const std::string& catalogName) {
|
||||
WoweeEvent c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name,
|
||||
uint8_t bonus, const char* desc) {
|
||||
WoweeEvent::Entry e;
|
||||
e.eventId = id; e.name = name; e.description = desc;
|
||||
e.holidayKind = WoweeEvent::Combat;
|
||||
e.duration_seconds = 3 * 24 * 3600; // Fri-Sun
|
||||
e.recurrenceDays = 30; // monthly
|
||||
e.bonusXpPercent = bonus;
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(300, "Quest XP Bonus", 50, "+50% experience from quests.");
|
||||
add(301, "Combat XP Bonus", 100, "Double experience from kills.");
|
||||
add(302, "Refer-A-Friend", 200, "Triple experience while grouped with a recruit.");
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
|
|
@ -88,6 +88,8 @@ const char* const kArgRequired[] = {
|
|||
"--export-wtrg-json", "--import-wtrg-json",
|
||||
"--gen-titles", "--gen-titles-pvp", "--gen-titles-achievement",
|
||||
"--info-wtit", "--validate-wtit",
|
||||
"--gen-events", "--gen-events-yearly", "--gen-events-weekends",
|
||||
"--info-wsea", "--validate-wsea",
|
||||
"--gen-weather-temperate", "--gen-weather-arctic",
|
||||
"--gen-weather-desert", "--gen-weather-stormy",
|
||||
"--gen-zone-atmosphere",
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
#include "cli_tokens_catalog.hpp"
|
||||
#include "cli_triggers_catalog.hpp"
|
||||
#include "cli_titles_catalog.hpp"
|
||||
#include "cli_events_catalog.hpp"
|
||||
#include "cli_quest_objective.hpp"
|
||||
#include "cli_quest_reward.hpp"
|
||||
#include "cli_clone.hpp"
|
||||
|
|
@ -157,6 +158,7 @@ constexpr DispatchFn kDispatchTable[] = {
|
|||
handleTokensCatalog,
|
||||
handleTriggersCatalog,
|
||||
handleTitlesCatalog,
|
||||
handleEventsCatalog,
|
||||
handleQuestObjective,
|
||||
handleQuestReward,
|
||||
handleClone,
|
||||
|
|
|
|||
235
tools/editor/cli_events_catalog.cpp
Normal file
235
tools/editor/cli_events_catalog.cpp
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
#include "cli_events_catalog.hpp"
|
||||
#include "cli_arg_parse.hpp"
|
||||
#include "cli_box_emitter.hpp"
|
||||
|
||||
#include "pipeline/wowee_events.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
namespace {
|
||||
|
||||
std::string stripWseaExt(std::string base) {
|
||||
stripExt(base, ".wsea");
|
||||
return base;
|
||||
}
|
||||
|
||||
bool saveOrError(const wowee::pipeline::WoweeEvent& c,
|
||||
const std::string& base, const char* cmd) {
|
||||
if (!wowee::pipeline::WoweeEventLoader::save(c, base)) {
|
||||
std::fprintf(stderr, "%s: failed to save %s.wsea\n",
|
||||
cmd, base.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void printGenSummary(const wowee::pipeline::WoweeEvent& c,
|
||||
const std::string& base) {
|
||||
std::printf("Wrote %s.wsea\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" events : %zu\n", c.entries.size());
|
||||
}
|
||||
|
||||
int handleGenStarter(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "StarterEvents";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWseaExt(base);
|
||||
auto c = wowee::pipeline::WoweeEventLoader::makeStarter(name);
|
||||
if (!saveOrError(c, base, "gen-events")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenYearly(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "YearlyEvents";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWseaExt(base);
|
||||
auto c = wowee::pipeline::WoweeEventLoader::makeYearly(name);
|
||||
if (!saveOrError(c, base, "gen-events-yearly")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenBonusWeekends(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "BonusWeekends";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWseaExt(base);
|
||||
auto c = wowee::pipeline::WoweeEventLoader::makeBonusWeekends(name);
|
||||
if (!saveOrError(c, base, "gen-events-weekends")) 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 = stripWseaExt(base);
|
||||
if (!wowee::pipeline::WoweeEventLoader::exists(base)) {
|
||||
std::fprintf(stderr, "WSEA not found: %s.wsea\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeEventLoader::load(base);
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wsea"] = base + ".wsea";
|
||||
j["name"] = c.name;
|
||||
j["count"] = c.entries.size();
|
||||
nlohmann::json arr = nlohmann::json::array();
|
||||
for (const auto& e : c.entries) {
|
||||
arr.push_back({
|
||||
{"eventId", e.eventId},
|
||||
{"name", e.name},
|
||||
{"description", e.description},
|
||||
{"iconPath", e.iconPath},
|
||||
{"announceMessage", e.announceMessage},
|
||||
{"startDate", e.startDate},
|
||||
{"duration_seconds", e.duration_seconds},
|
||||
{"recurrenceDays", e.recurrenceDays},
|
||||
{"holidayKind", e.holidayKind},
|
||||
{"holidayKindName", wowee::pipeline::WoweeEvent::holidayKindName(e.holidayKind)},
|
||||
{"factionGroup", e.factionGroup},
|
||||
{"factionGroupName", wowee::pipeline::WoweeEvent::factionGroupName(e.factionGroup)},
|
||||
{"bonusXpPercent", e.bonusXpPercent},
|
||||
{"tokenIdReward", e.tokenIdReward},
|
||||
});
|
||||
}
|
||||
j["entries"] = arr;
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return 0;
|
||||
}
|
||||
std::printf("WSEA: %s.wsea\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" events : %zu\n", c.entries.size());
|
||||
if (c.entries.empty()) return 0;
|
||||
std::printf(" id kind duration recur bonus%% token name\n");
|
||||
for (const auto& e : c.entries) {
|
||||
uint32_t durDays = e.duration_seconds / (24 * 3600);
|
||||
uint32_t durHours = (e.duration_seconds % (24 * 3600)) / 3600;
|
||||
std::printf(" %4u %-11s %2ud %2uh %4u %3u %4u %s\n",
|
||||
e.eventId,
|
||||
wowee::pipeline::WoweeEvent::holidayKindName(e.holidayKind),
|
||||
durDays, durHours,
|
||||
e.recurrenceDays, e.bonusXpPercent,
|
||||
e.tokenIdReward, 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 = stripWseaExt(base);
|
||||
if (!wowee::pipeline::WoweeEventLoader::exists(base)) {
|
||||
std::fprintf(stderr,
|
||||
"validate-wsea: WSEA not found: %s.wsea\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeEventLoader::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;
|
||||
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.eventId);
|
||||
if (!e.name.empty()) ctx += " " + e.name;
|
||||
ctx += ")";
|
||||
if (e.eventId == 0) errors.push_back(ctx + ": eventId is 0");
|
||||
if (e.name.empty()) errors.push_back(ctx + ": name is empty");
|
||||
if (e.holidayKind > wowee::pipeline::WoweeEvent::WorldEvent) {
|
||||
errors.push_back(ctx + ": holidayKind " +
|
||||
std::to_string(e.holidayKind) + " not in 0..6");
|
||||
}
|
||||
if (e.factionGroup > wowee::pipeline::WoweeEvent::FactionHorde) {
|
||||
errors.push_back(ctx + ": factionGroup " +
|
||||
std::to_string(e.factionGroup) + " not in 0..2");
|
||||
}
|
||||
if (e.duration_seconds == 0) {
|
||||
errors.push_back(ctx + ": duration_seconds is 0 (event never runs)");
|
||||
}
|
||||
if (e.recurrenceDays > 0 &&
|
||||
e.duration_seconds > e.recurrenceDays * 24u * 3600u) {
|
||||
errors.push_back(ctx +
|
||||
": duration exceeds recurrence period (events would overlap)");
|
||||
}
|
||||
if (e.bonusXpPercent > 200) {
|
||||
warnings.push_back(ctx +
|
||||
": bonusXpPercent > 200 (very high — verify intentional)");
|
||||
}
|
||||
for (uint32_t prev : idsSeen) {
|
||||
if (prev == e.eventId) {
|
||||
errors.push_back(ctx + ": duplicate eventId");
|
||||
break;
|
||||
}
|
||||
}
|
||||
idsSeen.push_back(e.eventId);
|
||||
}
|
||||
bool ok = errors.empty();
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wsea"] = base + ".wsea";
|
||||
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-wsea: %s.wsea\n", base.c_str());
|
||||
if (ok && warnings.empty()) {
|
||||
std::printf(" OK — %zu events, all eventIds 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 handleEventsCatalog(int& i, int argc, char** argv, int& outRc) {
|
||||
if (std::strcmp(argv[i], "--gen-events") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenStarter(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-events-yearly") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenYearly(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-events-weekends") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenBonusWeekends(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--info-wsea") == 0 && i + 1 < argc) {
|
||||
outRc = handleInfo(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--validate-wsea") == 0 && i + 1 < argc) {
|
||||
outRc = handleValidate(i, argc, argv); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
11
tools/editor/cli_events_catalog.hpp
Normal file
11
tools/editor/cli_events_catalog.hpp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
bool handleEventsCatalog(int& i, int argc, char** argv, int& outRc);
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
|
|
@ -1133,6 +1133,16 @@ void printUsage(const char* argv0) {
|
|||
std::printf(" Print WTIT entries (id / sort / prefix vs suffix / category / canonical name)\n");
|
||||
std::printf(" --validate-wtit <wtit-base> [--json]\n");
|
||||
std::printf(" Static checks: titleId>0+unique, name not empty, category in 0..7, gender variants paired\n");
|
||||
std::printf(" --gen-events <wsea-base> [name]\n");
|
||||
std::printf(" Emit .wsea starter: 3 events (Brawl Week / Fishing Extravaganza / Anniversary) covering kind categories\n");
|
||||
std::printf(" --gen-events-yearly <wsea-base> [name]\n");
|
||||
std::printf(" Emit .wsea 4 yearly holidays (Hallow's End / Brewfest / Lunar Festival / Winter's Veil) with WTKN reward refs\n");
|
||||
std::printf(" --gen-events-weekends <wsea-base> [name]\n");
|
||||
std::printf(" Emit .wsea 3 monthly XP-bonus weekends (50%% / 100%% / 200%% RAF tiers)\n");
|
||||
std::printf(" --info-wsea <wsea-base> [--json]\n");
|
||||
std::printf(" Print WSEA entries (id / kind / duration / recurrence / xp bonus / token reward / name)\n");
|
||||
std::printf(" --validate-wsea <wsea-base> [--json]\n");
|
||||
std::printf(" Static checks: id>0+unique, name not empty, kind in 0..6, duration>0, no overlapping recurrence\n");
|
||||
std::printf(" --gen-weather-temperate <wow-base> [zoneName]\n");
|
||||
std::printf(" Emit .wow weather schedule: clear-dominant + occasional rain + fog (forest / grassland)\n");
|
||||
std::printf(" --gen-weather-arctic <wow-base> [zoneName]\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue