feat(pipeline): add WPCD (Wowee Player Condition) format

Novel open replacement for Blizzard's PlayerCondition.dbc +
the AzerothCore-style condition_template SQL tables. The
37th open format added to the editor.

Defines reusable boolean conditions that other formats can
reference for gating: "player has quest X completed",
"player level >= N", "player class is mage", "player has
item Y in inventory", "WSEA event Z is active".

Conditions can be grouped and combined with AND/OR
aggregators on a per-group basis: a quest-giver gossip
option that says "show only to level 60 alliance mages
who completed quest 1234" composes 4 conditions sharing
the same groupId with AND aggregation. The runtime walks
each group, applies the group's aggregator, and returns
the boolean result to the caller.

Cross-references with previously-added formats — the
targetId field has a polymorphic interpretation by kind:
  WPCD.targetId (kind=QuestCompleted/Active) -> WQT.questId
  WPCD.targetId (kind=HasItem)               -> WIT.itemId
  WPCD.targetId (kind=HasSpell)              -> WSPL.spellId
  WPCD.targetId (kind=HasAchievement)        -> WACH.achievementId
  WPCD.targetId (kind=AreaId)                -> WMS.areaId
  WPCD.targetId (kind=EventActive)           -> WSEA.eventId
  WPCD.targetId (kind=HasTitle)              -> WTIT.titleId
  WPCD.targetId (kind=FactionRep)            -> WFAC.factionId
  WPCD.targetId (kind=Class/Race)            -> WCHC class/race id

Future format extensions can reference WPCD.conditionId in
their own gating fields — WTRG triggers gated by player
state, WGSP options visible only when conditions are met,
WMOU summon spells condition-gated by quest progress, etc.

Format:
  • magic "WPCD", version 1, little-endian
  • per condition: conditionId / groupId (0 = standalone) /
    name / description / kind / aggregator / negated /
    targetId / minValue / maxValue

Enums:
  • Kind (17): AlwaysTrue / AlwaysFalse / QuestCompleted /
                QuestActive / HasItem / HasSpell / MinLevel /
                MaxLevel / ClassMatch / RaceMatch /
                FactionRep / HasAchievement / TeamSize /
                GuildLevel / EventActive / AreaId / HasTitle
  • Aggregator (2): And / Or

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

Three preset emitters showcase typical usage:
  • makeStarter — 4 standalone conditions covering the most
                   common kinds (quest-done / has-item /
                   min-level / class)
  • makeGated   — 5 conditions in 2 groups demonstrating
                   AND-aggregation (alliance + mage + lvl 60)
                   and OR-aggregation (did quest 1 OR quest 100)
  • makeEvent   — 3 event-gated conditions cross-referencing
                   WSEA event IDs (Hallow's End / Brewfest /
                   Winter's Veil)

CLI added (5 flags, 656 documented total now):
  --gen-conditions / --gen-conditions-gated / --gen-conditions-event
  --info-wpcd / --validate-wpcd

Validator catches: conditionId=0 + duplicates, kind /
aggregator out of range, kinds requiring targetId having
target=0 (skips AlwaysTrue/False, MinLevel/MaxLevel,
TeamSize, GuildLevel which use min/max instead), TeamSize
with min > max.
This commit is contained in:
Kelsi 2026-05-09 18:18:27 -07:00
parent d14f820a14
commit f290a0d4a9
8 changed files with 674 additions and 0 deletions

View file

@ -624,6 +624,7 @@ set(WOWEE_SOURCES
src/pipeline/wowee_mail.cpp
src/pipeline/wowee_gems.cpp
src/pipeline/wowee_guilds.cpp
src/pipeline/wowee_conditions.cpp
src/pipeline/custom_zone_discovery.cpp
src/pipeline/dbc_layout.cpp
@ -1394,6 +1395,7 @@ add_executable(wowee_editor
tools/editor/cli_mail_catalog.cpp
tools/editor/cli_gems_catalog.cpp
tools/editor/cli_guilds_catalog.cpp
tools/editor/cli_conditions_catalog.cpp
tools/editor/cli_quest_objective.cpp
tools/editor/cli_quest_reward.cpp
tools/editor/cli_clone.cpp
@ -1496,6 +1498,7 @@ add_executable(wowee_editor
src/pipeline/wowee_mail.cpp
src/pipeline/wowee_gems.cpp
src/pipeline/wowee_guilds.cpp
src/pipeline/wowee_conditions.cpp
src/pipeline/custom_zone_discovery.cpp
src/pipeline/terrain_mesh.cpp

View file

@ -0,0 +1,129 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace wowee {
namespace pipeline {
// Wowee Open Player Condition catalog (.wpcd) — novel
// replacement for Blizzard's PlayerCondition.dbc + the
// AzerothCore-style condition_template SQL tables. The
// 37th open format added to the editor.
//
// Defines reusable boolean conditions that other formats
// reference for gating: "player has quest X completed",
// "player level >= N", "player class is mage", "player
// has item Y in inventory", "event is currently active".
//
// Conditions can be grouped and combined with AND/OR
// aggregators on a per-group basis: a quest-giver gossip
// option that says "show only to level 60 alliance mages
// who completed quest 1234" composes 4 conditions sharing
// the same groupId with AND aggregation.
//
// Cross-references with previously-added formats:
// WPCD.targetId (kind=QuestCompleted/Active) → WQT.questId
// WPCD.targetId (kind=HasItem) → WIT.itemId
// WPCD.targetId (kind=HasSpell) → WSPL.spellId
// WPCD.targetId (kind=HasAchievement) → WACH.achievementId
// WPCD.targetId (kind=AreaId) → WMS.areaId
// WPCD.targetId (kind=EventActive) → WSEA.eventId
// WPCD.targetId (kind=HasTitle) → WTIT.titleId
// WPCD.targetId (kind=FactionRep) → WFAC.factionId
//
// Other formats can reference WPCD.conditionId in future
// extensions to gate triggers, gossip options, quest
// availability, vendor visibility, mount summons, etc.
//
// Binary layout (little-endian):
// magic[4] = "WPCD"
// version (uint32) = current 1
// nameLen + name (catalog label)
// entryCount (uint32)
// entries (each):
// conditionId (uint32)
// groupId (uint32)
// nameLen + name
// descLen + description
// kind (uint8) / aggregator (uint8) / negated (uint8) / pad[1]
// targetId (uint32)
// minValue (int32) / maxValue (int32)
struct WoweeCondition {
enum Kind : uint8_t {
AlwaysTrue = 0,
AlwaysFalse = 1,
QuestCompleted = 2,
QuestActive = 3,
HasItem = 4, // qty >= minValue
HasSpell = 5, // spell known
MinLevel = 6, // player.level >= minValue
MaxLevel = 7, // player.level <= minValue
ClassMatch = 8, // player.classId in raceMask sense
RaceMatch = 9,
FactionRep = 10, // player.rep[targetId] >= minValue
HasAchievement = 11,
TeamSize = 12, // group size in [minValue, maxValue]
GuildLevel = 13, // player's guild level >= minValue
EventActive = 14, // WSEA event currently running
AreaId = 15, // player in WMS.areaId
HasTitle = 16,
};
enum Aggregator : uint8_t {
And = 0, // all siblings in groupId must be true
Or = 1, // any sibling in groupId being true is enough
};
struct Entry {
uint32_t conditionId = 0;
uint32_t groupId = 0; // 0 = standalone (no group)
std::string name;
std::string description;
uint8_t kind = AlwaysTrue;
uint8_t aggregator = And;
uint8_t negated = 0; // 1 = invert the result
uint32_t targetId = 0;
int32_t minValue = 0;
int32_t maxValue = 0;
};
std::string name;
std::vector<Entry> entries;
bool isValid() const { return !entries.empty(); }
const Entry* findById(uint32_t conditionId) const;
static const char* kindName(uint8_t k);
static const char* aggregatorName(uint8_t a);
};
class WoweeConditionLoader {
public:
static bool save(const WoweeCondition& cat,
const std::string& basePath);
static WoweeCondition load(const std::string& basePath);
static bool exists(const std::string& basePath);
// Preset emitters used by --gen-conditions* variants.
//
// makeStarter — 4 standalone conditions covering common
// kinds (quest completed / has item /
// min level / class match).
// makeGated — 5 conditions in 2 groups demonstrating
// AND aggregation (group 100: alliance
// AND mage AND lvl 60+) and OR
// aggregation (group 200: completed
// quest 1 OR completed quest 2).
// makeEvent — 3 event-gated conditions (Brewfest /
// Hallow's End / Winter's Veil)
// cross-referencing WSEA event IDs.
static WoweeCondition makeStarter(const std::string& catalogName);
static WoweeCondition makeGated(const std::string& catalogName);
static WoweeCondition makeEvent(const std::string& catalogName);
};
} // namespace pipeline
} // namespace wowee

View file

@ -0,0 +1,277 @@
#include "pipeline/wowee_conditions.hpp"
#include <cstdio>
#include <cstring>
#include <fstream>
namespace wowee {
namespace pipeline {
namespace {
constexpr char kMagic[4] = {'W', 'P', 'C', 'D'};
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) != ".wpcd") {
base += ".wpcd";
}
return base;
}
} // namespace
const WoweeCondition::Entry*
WoweeCondition::findById(uint32_t conditionId) const {
for (const auto& e : entries) if (e.conditionId == conditionId) return &e;
return nullptr;
}
const char* WoweeCondition::kindName(uint8_t k) {
switch (k) {
case AlwaysTrue: return "true";
case AlwaysFalse: return "false";
case QuestCompleted: return "quest-done";
case QuestActive: return "quest-active";
case HasItem: return "has-item";
case HasSpell: return "has-spell";
case MinLevel: return "min-level";
case MaxLevel: return "max-level";
case ClassMatch: return "class";
case RaceMatch: return "race";
case FactionRep: return "rep";
case HasAchievement: return "achievement";
case TeamSize: return "team-size";
case GuildLevel: return "guild-level";
case EventActive: return "event";
case AreaId: return "area";
case HasTitle: return "title";
default: return "unknown";
}
}
const char* WoweeCondition::aggregatorName(uint8_t a) {
switch (a) {
case And: return "and";
case Or: return "or";
default: return "unknown";
}
}
bool WoweeConditionLoader::save(const WoweeCondition& 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.conditionId);
writePOD(os, e.groupId);
writeStr(os, e.name);
writeStr(os, e.description);
writePOD(os, e.kind);
writePOD(os, e.aggregator);
writePOD(os, e.negated);
uint8_t pad = 0;
writePOD(os, pad);
writePOD(os, e.targetId);
writePOD(os, e.minValue);
writePOD(os, e.maxValue);
}
return os.good();
}
WoweeCondition WoweeConditionLoader::load(const std::string& basePath) {
WoweeCondition 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.conditionId) ||
!readPOD(is, e.groupId)) {
out.entries.clear(); return out;
}
if (!readStr(is, e.name) || !readStr(is, e.description)) {
out.entries.clear(); return out;
}
if (!readPOD(is, e.kind) ||
!readPOD(is, e.aggregator) ||
!readPOD(is, e.negated)) {
out.entries.clear(); return out;
}
uint8_t pad = 0;
if (!readPOD(is, pad)) {
out.entries.clear(); return out;
}
if (!readPOD(is, e.targetId) ||
!readPOD(is, e.minValue) ||
!readPOD(is, e.maxValue)) {
out.entries.clear(); return out;
}
}
return out;
}
bool WoweeConditionLoader::exists(const std::string& basePath) {
std::ifstream is(normalizePath(basePath), std::ios::binary);
return is.good();
}
WoweeCondition WoweeConditionLoader::makeStarter(const std::string& catalogName) {
WoweeCondition c;
c.name = catalogName;
{
WoweeCondition::Entry e;
e.conditionId = 1; e.name = "Bandit Trouble done";
e.description = "Player has completed the Bandit Trouble quest.";
e.kind = WoweeCondition::QuestCompleted;
e.targetId = 1; // matches WQT.makeStarter quest 1
c.entries.push_back(e);
}
{
WoweeCondition::Entry e;
e.conditionId = 2; e.name = "Has Healing Potion";
e.description = "Player has at least 1 healing potion in bags.";
e.kind = WoweeCondition::HasItem;
e.targetId = 3; // WIT.makeStarter healing potion
e.minValue = 1;
c.entries.push_back(e);
}
{
WoweeCondition::Entry e;
e.conditionId = 3; e.name = "Level 60+";
e.description = "Player is level 60 or higher.";
e.kind = WoweeCondition::MinLevel;
e.minValue = 60;
c.entries.push_back(e);
}
{
WoweeCondition::Entry e;
e.conditionId = 4; e.name = "Is Mage";
e.description = "Player class is Mage.";
e.kind = WoweeCondition::ClassMatch;
e.targetId = 8; // WCHC mage class id
c.entries.push_back(e);
}
return c;
}
WoweeCondition WoweeConditionLoader::makeGated(const std::string& catalogName) {
WoweeCondition c;
c.name = catalogName;
// Group 100: Alliance AND Mage AND level >= 60.
{
WoweeCondition::Entry e;
e.conditionId = 100; e.groupId = 100;
e.name = "Alliance race";
e.kind = WoweeCondition::RaceMatch;
e.aggregator = WoweeCondition::And;
// raceMask bits for Alliance races (Human/Dwarf/NightElf/Gnome).
e.targetId = (1u << 1) | (1u << 3) | (1u << 4) | (1u << 7);
c.entries.push_back(e);
}
{
WoweeCondition::Entry e;
e.conditionId = 101; e.groupId = 100;
e.name = "Mage class";
e.kind = WoweeCondition::ClassMatch;
e.aggregator = WoweeCondition::And;
e.targetId = 8;
c.entries.push_back(e);
}
{
WoweeCondition::Entry e;
e.conditionId = 102; e.groupId = 100;
e.name = "Level 60+";
e.kind = WoweeCondition::MinLevel;
e.aggregator = WoweeCondition::And;
e.minValue = 60;
c.entries.push_back(e);
}
// Group 200: completed quest 1 OR completed quest 2.
{
WoweeCondition::Entry e;
e.conditionId = 200; e.groupId = 200;
e.name = "Did quest 1";
e.kind = WoweeCondition::QuestCompleted;
e.aggregator = WoweeCondition::Or;
e.targetId = 1;
c.entries.push_back(e);
}
{
WoweeCondition::Entry e;
e.conditionId = 201; e.groupId = 200;
e.name = "Did quest 100";
e.kind = WoweeCondition::QuestCompleted;
e.aggregator = WoweeCondition::Or;
e.targetId = 100;
c.entries.push_back(e);
}
return c;
}
WoweeCondition WoweeConditionLoader::makeEvent(const std::string& catalogName) {
WoweeCondition c;
c.name = catalogName;
auto add = [&](uint32_t id, const char* name, uint32_t eventId,
const char* desc) {
WoweeCondition::Entry e;
e.conditionId = id; e.name = name; e.description = desc;
e.kind = WoweeCondition::EventActive;
e.targetId = eventId;
c.entries.push_back(e);
};
// eventIds 100/101/103 match WSEA.makeYearly (Hallow's End,
// Brewfest, Winter's Veil).
add(300, "Hallow's End active", 100, "Hallow's End event is currently running.");
add(301, "Brewfest active", 101, "Brewfest event is currently running.");
add(302, "Winter's Veil active", 103, "Winter's Veil event is currently running.");
return c;
}
} // namespace pipeline
} // namespace wowee

View file

@ -106,6 +106,8 @@ const char* const kArgRequired[] = {
"--export-wgem-json", "--import-wgem-json",
"--gen-guilds", "--gen-guilds-full", "--gen-guilds-pair",
"--info-wgld", "--validate-wgld",
"--gen-conditions", "--gen-conditions-gated", "--gen-conditions-event",
"--info-wpcd", "--validate-wpcd",
"--gen-weather-temperate", "--gen-weather-arctic",
"--gen-weather-desert", "--gen-weather-stormy",
"--gen-zone-atmosphere",

View file

@ -0,0 +1,240 @@
#include "cli_conditions_catalog.hpp"
#include "cli_arg_parse.hpp"
#include "cli_box_emitter.hpp"
#include "pipeline/wowee_conditions.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 stripWpcdExt(std::string base) {
stripExt(base, ".wpcd");
return base;
}
bool saveOrError(const wowee::pipeline::WoweeCondition& c,
const std::string& base, const char* cmd) {
if (!wowee::pipeline::WoweeConditionLoader::save(c, base)) {
std::fprintf(stderr, "%s: failed to save %s.wpcd\n",
cmd, base.c_str());
return false;
}
return true;
}
void printGenSummary(const wowee::pipeline::WoweeCondition& c,
const std::string& base) {
std::printf("Wrote %s.wpcd\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" conditions : %zu\n", c.entries.size());
}
int handleGenStarter(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "StarterConditions";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWpcdExt(base);
auto c = wowee::pipeline::WoweeConditionLoader::makeStarter(name);
if (!saveOrError(c, base, "gen-conditions")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenGated(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "GatedConditions";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWpcdExt(base);
auto c = wowee::pipeline::WoweeConditionLoader::makeGated(name);
if (!saveOrError(c, base, "gen-conditions-gated")) return 1;
printGenSummary(c, base);
return 0;
}
int handleGenEvent(int& i, int argc, char** argv) {
std::string base = argv[++i];
std::string name = "EventConditions";
if (parseOptArg(i, argc, argv)) name = argv[++i];
base = stripWpcdExt(base);
auto c = wowee::pipeline::WoweeConditionLoader::makeEvent(name);
if (!saveOrError(c, base, "gen-conditions-event")) 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 = stripWpcdExt(base);
if (!wowee::pipeline::WoweeConditionLoader::exists(base)) {
std::fprintf(stderr, "WPCD not found: %s.wpcd\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeConditionLoader::load(base);
if (jsonOut) {
nlohmann::json j;
j["wpcd"] = base + ".wpcd";
j["name"] = c.name;
j["count"] = c.entries.size();
nlohmann::json arr = nlohmann::json::array();
for (const auto& e : c.entries) {
arr.push_back({
{"conditionId", e.conditionId},
{"groupId", e.groupId},
{"name", e.name},
{"description", e.description},
{"kind", e.kind},
{"kindName", wowee::pipeline::WoweeCondition::kindName(e.kind)},
{"aggregator", e.aggregator},
{"aggregatorName", wowee::pipeline::WoweeCondition::aggregatorName(e.aggregator)},
{"negated", e.negated},
{"targetId", e.targetId},
{"minValue", e.minValue},
{"maxValue", e.maxValue},
});
}
j["entries"] = arr;
std::printf("%s\n", j.dump(2).c_str());
return 0;
}
std::printf("WPCD: %s.wpcd\n", base.c_str());
std::printf(" catalog : %s\n", c.name.c_str());
std::printf(" conditions : %zu\n", c.entries.size());
if (c.entries.empty()) return 0;
std::printf(" id grp kind agg neg target min/max name\n");
for (const auto& e : c.entries) {
std::printf(" %4u %4u %-12s %-3s %u %5u %5d/%-5d %s\n",
e.conditionId, e.groupId,
wowee::pipeline::WoweeCondition::kindName(e.kind),
wowee::pipeline::WoweeCondition::aggregatorName(e.aggregator),
e.negated, e.targetId,
e.minValue, e.maxValue, 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 = stripWpcdExt(base);
if (!wowee::pipeline::WoweeConditionLoader::exists(base)) {
std::fprintf(stderr,
"validate-wpcd: WPCD not found: %s.wpcd\n", base.c_str());
return 1;
}
auto c = wowee::pipeline::WoweeConditionLoader::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.conditionId);
if (!e.name.empty()) ctx += " " + e.name;
ctx += ")";
if (e.conditionId == 0) {
errors.push_back(ctx + ": conditionId is 0");
}
if (e.kind > wowee::pipeline::WoweeCondition::HasTitle) {
errors.push_back(ctx + ": kind " +
std::to_string(e.kind) + " not in 0..16");
}
if (e.aggregator > wowee::pipeline::WoweeCondition::Or) {
errors.push_back(ctx + ": aggregator " +
std::to_string(e.aggregator) + " not in 0..1");
}
// Most kinds need a non-zero targetId. Exceptions:
// AlwaysTrue / AlwaysFalse (no target), MinLevel /
// MaxLevel (use minValue), TeamSize (uses min/max),
// GuildLevel (uses minValue).
bool needsTarget =
e.kind != wowee::pipeline::WoweeCondition::AlwaysTrue &&
e.kind != wowee::pipeline::WoweeCondition::AlwaysFalse &&
e.kind != wowee::pipeline::WoweeCondition::MinLevel &&
e.kind != wowee::pipeline::WoweeCondition::MaxLevel &&
e.kind != wowee::pipeline::WoweeCondition::TeamSize &&
e.kind != wowee::pipeline::WoweeCondition::GuildLevel;
if (needsTarget && e.targetId == 0) {
errors.push_back(ctx +
": kind needs a non-zero targetId");
}
if (e.kind == wowee::pipeline::WoweeCondition::TeamSize &&
e.minValue > 0 && e.maxValue > 0 &&
e.minValue > e.maxValue) {
errors.push_back(ctx + ": team-size minValue > maxValue");
}
for (uint32_t prev : idsSeen) {
if (prev == e.conditionId) {
errors.push_back(ctx + ": duplicate conditionId");
break;
}
}
idsSeen.push_back(e.conditionId);
}
bool ok = errors.empty();
if (jsonOut) {
nlohmann::json j;
j["wpcd"] = base + ".wpcd";
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-wpcd: %s.wpcd\n", base.c_str());
if (ok && warnings.empty()) {
std::printf(" OK — %zu conditions, all conditionIds 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 handleConditionsCatalog(int& i, int argc, char** argv, int& outRc) {
if (std::strcmp(argv[i], "--gen-conditions") == 0 && i + 1 < argc) {
outRc = handleGenStarter(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-conditions-gated") == 0 && i + 1 < argc) {
outRc = handleGenGated(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-conditions-event") == 0 && i + 1 < argc) {
outRc = handleGenEvent(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--info-wpcd") == 0 && i + 1 < argc) {
outRc = handleInfo(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--validate-wpcd") == 0 && i + 1 < argc) {
outRc = handleValidate(i, argc, argv); return true;
}
return false;
}
} // namespace cli
} // namespace editor
} // namespace wowee

View file

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

View file

@ -64,6 +64,7 @@
#include "cli_mail_catalog.hpp"
#include "cli_gems_catalog.hpp"
#include "cli_guilds_catalog.hpp"
#include "cli_conditions_catalog.hpp"
#include "cli_quest_objective.hpp"
#include "cli_quest_reward.hpp"
#include "cli_clone.hpp"
@ -169,6 +170,7 @@ constexpr DispatchFn kDispatchTable[] = {
handleMailCatalog,
handleGemsCatalog,
handleGuildsCatalog,
handleConditionsCatalog,
handleQuestObjective,
handleQuestReward,
handleClone,

View file

@ -1217,6 +1217,16 @@ void printUsage(const char* argv0) {
std::printf(" Print WGLD entries (id / faction / level / leader + motd / rank+member+tab+perk counts)\n");
std::printf(" --validate-wgld <wgld-base> [--json]\n");
std::printf(" Static checks: id>0+unique, name+leader not empty, faction 0..1, members reference valid ranks, unique tab indices\n");
std::printf(" --gen-conditions <wpcd-base> [name]\n");
std::printf(" Emit .wpcd starter: 4 conditions covering quest-done / has-item / min-level / class kinds\n");
std::printf(" --gen-conditions-gated <wpcd-base> [name]\n");
std::printf(" Emit .wpcd 5 conditions in 2 groups (group 100 AND alliance+mage+lvl60; group 200 OR did-quest-1/100)\n");
std::printf(" --gen-conditions-event <wpcd-base> [name]\n");
std::printf(" Emit .wpcd 3 event-gated conditions referencing WSEA event IDs (Hallow's End / Brewfest / Winter's Veil)\n");
std::printf(" --info-wpcd <wpcd-base> [--json]\n");
std::printf(" Print WPCD entries (id / group / kind / aggregator / negated / target / min..max value / name)\n");
std::printf(" --validate-wpcd <wpcd-base> [--json]\n");
std::printf(" Static checks: id>0+unique, kind in 0..16, aggregator 0..1, kinds that need targetId have non-zero target\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");