mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-06-02 13:12:45 -04:00
feat(editor): add WGRP (Group Composition) open catalog format
Novel replacement for the hardcoded LFG / Dungeon Finder group-composition rules. Defines per-instance role quotas (tanks / healers / dps), party-size bounds, and spec-gating. Cross-references WMS for mapId, WCDF for difficulty. Three preset emitters covering the canonical raid sizes: makeFiveMan (Classic 1T/1H/3D, Heavy-Heal trash 1T/2H/2D, Roleless 5D speedrun), makeRaid10 (Standard 2T/3H/5D, HealingHeavy 2T/4H/4D, MeleeStack 1T/2H/7D for cleave fights), makeRaid25 (Standard 2T/6H/17D, HealingHeavy 1T/8H/16D, ZergDPS 0T/4H/21D for tank-immune fights). Validator rejects role-sums that exceed maxPartySize (unfulfillable comp), enforces min<=max, no duplicate ids; warns on non-standard sizes (5/10/25/40 only) and zero-tank comps so authors confirm intent. Caught one real bug during smoke-test where a 25-player Wintergrasp preset was mis-bound to a 10-man maxPartySize. Format count 95 -> 96. CLI flag count 1090 -> 1095.
This commit is contained in:
@@ -684,6 +684,7 @@ set(WOWEE_SOURCES
|
||||
src/pipeline/wowee_stable_slots.cpp
|
||||
src/pipeline/wowee_stat_curves.cpp
|
||||
src/pipeline/wowee_action_bars.cpp
|
||||
src/pipeline/wowee_group_compositions.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/dbc_layout.cpp
|
||||
|
||||
@@ -1531,6 +1532,7 @@ add_executable(wowee_editor
|
||||
tools/editor/cli_stable_slots_catalog.cpp
|
||||
tools/editor/cli_stat_curves_catalog.cpp
|
||||
tools/editor/cli_action_bars_catalog.cpp
|
||||
tools/editor/cli_group_compositions_catalog.cpp
|
||||
tools/editor/cli_quest_objective.cpp
|
||||
tools/editor/cli_quest_reward.cpp
|
||||
tools/editor/cli_clone.cpp
|
||||
@@ -1693,6 +1695,7 @@ add_executable(wowee_editor
|
||||
src/pipeline/wowee_stable_slots.cpp
|
||||
src/pipeline/wowee_stat_curves.cpp
|
||||
src/pipeline/wowee_action_bars.cpp
|
||||
src/pipeline/wowee_group_compositions.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/terrain_mesh.cpp
|
||||
|
||||
|
||||
115
include/pipeline/wowee_group_compositions.hpp
Normal file
115
include/pipeline/wowee_group_compositions.hpp
Normal file
@@ -0,0 +1,115 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Group Composition catalog (.wgrp) — novel
|
||||
// replacement for the hardcoded LFG / Dungeon Finder
|
||||
// group-composition rules. Defines per-instance role
|
||||
// quotas: how many tanks, healers, and damage dealers a
|
||||
// group needs to queue for a given (map, difficulty)
|
||||
// combination.
|
||||
//
|
||||
// 5-man dungeons typically want 1T / 1H / 3D. 10-man
|
||||
// raids want 2T / 3H / 5D. 25-man raids want 2T / 6H /
|
||||
// 17D. Server-custom variants like 5-man "all DPS speed
|
||||
// runs" or "healer-heavy" 25-Heroic fights override the
|
||||
// stock distribution.
|
||||
//
|
||||
// Cross-references with previously-added formats:
|
||||
// WMS: mapId references the WMS map entry.
|
||||
// WCDF: difficultyId references the WCDF difficulty
|
||||
// routing entry.
|
||||
// WBOS: encounters in this composition's instance are
|
||||
// the WBOS entries whose mapId+difficultyId match.
|
||||
// WHLD: lockout schedule for this composition is the
|
||||
// WHLD entry with matching mapId+difficultyId.
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WGRP"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// compId (uint32)
|
||||
// nameLen + name
|
||||
// descLen + description
|
||||
// mapId (uint32)
|
||||
// difficultyId (uint32)
|
||||
// requiredTanks (uint8) / requiredHealers (uint8)
|
||||
// requiredDamageDealers (uint8) / minPartySize (uint8)
|
||||
// maxPartySize (uint8) / requireSpec (uint8) / pad[2]
|
||||
// iconColorRGBA (uint32)
|
||||
struct WoweeGroupComposition {
|
||||
struct Entry {
|
||||
uint32_t compId = 0;
|
||||
std::string name;
|
||||
std::string description;
|
||||
uint32_t mapId = 0;
|
||||
uint32_t difficultyId = 0;
|
||||
uint8_t requiredTanks = 1;
|
||||
uint8_t requiredHealers = 1;
|
||||
uint8_t requiredDamageDealers = 3;
|
||||
uint8_t minPartySize = 5;
|
||||
uint8_t maxPartySize = 5;
|
||||
uint8_t requireSpec = 1; // 0/1 bool
|
||||
uint8_t pad0 = 0;
|
||||
uint8_t pad1 = 0;
|
||||
uint32_t iconColorRGBA = 0xFFFFFFFFu;
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::vector<Entry> entries;
|
||||
|
||||
bool isValid() const { return !entries.empty(); }
|
||||
|
||||
const Entry* findById(uint32_t compId) const;
|
||||
|
||||
// Returns all compositions registered for one instance
|
||||
// (typically the per-difficulty variants). Used by the
|
||||
// LFG UI to populate the difficulty/comp picker.
|
||||
std::vector<const Entry*> findByMap(uint32_t mapId) const;
|
||||
|
||||
// Returns true if a queueing party of (tanks, healers,
|
||||
// dps) satisfies the composition's role requirements.
|
||||
// Used by the matchmaker to decide if a group is ready
|
||||
// to launch.
|
||||
bool partyMeetsComp(uint32_t compId,
|
||||
uint8_t haveTanks,
|
||||
uint8_t haveHealers,
|
||||
uint8_t haveDps) const;
|
||||
};
|
||||
|
||||
class WoweeGroupCompositionLoader {
|
||||
public:
|
||||
static bool save(const WoweeGroupComposition& cat,
|
||||
const std::string& basePath);
|
||||
static WoweeGroupComposition load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-grp* variants.
|
||||
//
|
||||
// makeFiveMan — 3 5-man composition variants
|
||||
// (Classic 1T/1H/3D, Heavy-Heal
|
||||
// 1T/2H/2D for trash, Roleless 5D
|
||||
// speed runs with requireSpec=0).
|
||||
// makeRaid10 — 3 10-man comps (Standard 2T/3H/5D,
|
||||
// Weighted 2T/4H/4D for healing-
|
||||
// heavy fights, MeleeStack 1T/2H/7D
|
||||
// for melee-cleave fights without
|
||||
// a tank swap mechanic).
|
||||
// makeRaid25 — 3 25-man comps (Standard 2T/6H/17D,
|
||||
// HealingHeavy 1T/8H/16D for ICC,
|
||||
// ZergDPS 0T/4H/21D for tank-immune
|
||||
// bosses).
|
||||
static WoweeGroupComposition makeFiveMan(const std::string& catalogName);
|
||||
static WoweeGroupComposition makeRaid10(const std::string& catalogName);
|
||||
static WoweeGroupComposition makeRaid25(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
267
src/pipeline/wowee_group_compositions.cpp
Normal file
267
src/pipeline/wowee_group_compositions.cpp
Normal file
@@ -0,0 +1,267 @@
|
||||
#include "pipeline/wowee_group_compositions.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kMagic[4] = {'W', 'G', 'R', 'P'};
|
||||
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) != ".wgrp") {
|
||||
base += ".wgrp";
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
uint32_t packRgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 0xFF) {
|
||||
return (static_cast<uint32_t>(a) << 24) |
|
||||
(static_cast<uint32_t>(b) << 16) |
|
||||
(static_cast<uint32_t>(g) << 8) |
|
||||
static_cast<uint32_t>(r);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const WoweeGroupComposition::Entry*
|
||||
WoweeGroupComposition::findById(uint32_t compId) const {
|
||||
for (const auto& e : entries)
|
||||
if (e.compId == compId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<const WoweeGroupComposition::Entry*>
|
||||
WoweeGroupComposition::findByMap(uint32_t mapId) const {
|
||||
std::vector<const Entry*> out;
|
||||
for (const auto& e : entries)
|
||||
if (e.mapId == mapId) out.push_back(&e);
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeGroupComposition::partyMeetsComp(uint32_t compId,
|
||||
uint8_t haveTanks,
|
||||
uint8_t haveHealers,
|
||||
uint8_t haveDps) const {
|
||||
const Entry* e = findById(compId);
|
||||
if (!e) return false;
|
||||
if (haveTanks < e->requiredTanks) return false;
|
||||
if (haveHealers < e->requiredHealers) return false;
|
||||
if (haveDps < e->requiredDamageDealers) return false;
|
||||
uint8_t total = haveTanks + haveHealers + haveDps;
|
||||
if (total < e->minPartySize) return false;
|
||||
if (total > e->maxPartySize) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WoweeGroupCompositionLoader::save(const WoweeGroupComposition& 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.compId);
|
||||
writeStr(os, e.name);
|
||||
writeStr(os, e.description);
|
||||
writePOD(os, e.mapId);
|
||||
writePOD(os, e.difficultyId);
|
||||
writePOD(os, e.requiredTanks);
|
||||
writePOD(os, e.requiredHealers);
|
||||
writePOD(os, e.requiredDamageDealers);
|
||||
writePOD(os, e.minPartySize);
|
||||
writePOD(os, e.maxPartySize);
|
||||
writePOD(os, e.requireSpec);
|
||||
writePOD(os, e.pad0);
|
||||
writePOD(os, e.pad1);
|
||||
writePOD(os, e.iconColorRGBA);
|
||||
}
|
||||
return os.good();
|
||||
}
|
||||
|
||||
WoweeGroupComposition WoweeGroupCompositionLoader::load(
|
||||
const std::string& basePath) {
|
||||
WoweeGroupComposition 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.compId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readStr(is, e.name) || !readStr(is, e.description)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.mapId) ||
|
||||
!readPOD(is, e.difficultyId) ||
|
||||
!readPOD(is, e.requiredTanks) ||
|
||||
!readPOD(is, e.requiredHealers) ||
|
||||
!readPOD(is, e.requiredDamageDealers) ||
|
||||
!readPOD(is, e.minPartySize) ||
|
||||
!readPOD(is, e.maxPartySize) ||
|
||||
!readPOD(is, e.requireSpec) ||
|
||||
!readPOD(is, e.pad0) ||
|
||||
!readPOD(is, e.pad1) ||
|
||||
!readPOD(is, e.iconColorRGBA)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeGroupCompositionLoader::exists(const std::string& basePath) {
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
return is.good();
|
||||
}
|
||||
|
||||
WoweeGroupComposition WoweeGroupCompositionLoader::makeFiveMan(
|
||||
const std::string& catalogName) {
|
||||
using G = WoweeGroupComposition;
|
||||
WoweeGroupComposition c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint32_t map,
|
||||
uint8_t tanks, uint8_t healers, uint8_t dps,
|
||||
uint8_t requireSpec, const char* desc) {
|
||||
G::Entry e;
|
||||
e.compId = id; e.name = name; e.description = desc;
|
||||
e.mapId = map;
|
||||
e.difficultyId = 1; // 5-man heroic
|
||||
e.requiredTanks = tanks;
|
||||
e.requiredHealers = healers;
|
||||
e.requiredDamageDealers = dps;
|
||||
e.minPartySize = 5;
|
||||
e.maxPartySize = 5;
|
||||
e.requireSpec = requireSpec;
|
||||
e.iconColorRGBA = packRgba(180, 220, 100); // dungeon green
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(1, "Classic5ManTanksHealsDPS", 600, 1, 1, 3, 1,
|
||||
"Classic 5-man comp — 1 tank / 1 healer / 3 dps, "
|
||||
"spec roles enforced.");
|
||||
add(2, "Heavy5ManTrashHeal", 600, 1, 2, 2, 1,
|
||||
"Heavy-heal 5-man trash run — 1T/2H/2D for "
|
||||
"healing-intensive content.");
|
||||
add(3, "RolelessSpeedRun", 600, 0, 0, 5, 0,
|
||||
"Roleless 5-man speed run — 5 dps, no spec gate. "
|
||||
"Used by speed-run guilds for sub-15min clears.");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeGroupComposition WoweeGroupCompositionLoader::makeRaid10(
|
||||
const std::string& catalogName) {
|
||||
using G = WoweeGroupComposition;
|
||||
WoweeGroupComposition c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint32_t map,
|
||||
uint8_t tanks, uint8_t healers, uint8_t dps,
|
||||
const char* desc) {
|
||||
G::Entry e;
|
||||
e.compId = id; e.name = name; e.description = desc;
|
||||
e.mapId = map;
|
||||
e.difficultyId = 100;
|
||||
e.requiredTanks = tanks;
|
||||
e.requiredHealers = healers;
|
||||
e.requiredDamageDealers = dps;
|
||||
e.minPartySize = 10;
|
||||
e.maxPartySize = 10;
|
||||
e.requireSpec = 1;
|
||||
e.iconColorRGBA = packRgba(220, 80, 100); // raid red
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(100, "Standard10Man", 631, 2, 3, 5,
|
||||
"Standard 10-man raid — 2T/3H/5D matches most ICC "
|
||||
"10N progression.");
|
||||
add(101, "HealingHeavy10Man", 631, 2, 4, 4,
|
||||
"Healing-heavy 10-man — 2T/4H/4D for healing-"
|
||||
"intensive ICC 10H bosses (Putricide, Sindragosa).");
|
||||
add(102, "MeleeStack10Man", 631, 1, 2, 7,
|
||||
"Melee-stack 10-man — 1T/2H/7D for melee-cleave "
|
||||
"fights with no DPS race (Saurfang heroic exec, "
|
||||
"Festergut). Brings extra melee to nuke a single "
|
||||
"target; one-tank because no swap mechanic.");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeGroupComposition WoweeGroupCompositionLoader::makeRaid25(
|
||||
const std::string& catalogName) {
|
||||
using G = WoweeGroupComposition;
|
||||
WoweeGroupComposition c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint32_t map,
|
||||
uint8_t tanks, uint8_t healers, uint8_t dps,
|
||||
const char* desc) {
|
||||
G::Entry e;
|
||||
e.compId = id; e.name = name; e.description = desc;
|
||||
e.mapId = map;
|
||||
e.difficultyId = 101;
|
||||
e.requiredTanks = tanks;
|
||||
e.requiredHealers = healers;
|
||||
e.requiredDamageDealers = dps;
|
||||
e.minPartySize = 25;
|
||||
e.maxPartySize = 25;
|
||||
e.requireSpec = 1;
|
||||
e.iconColorRGBA = packRgba(180, 100, 240); // 25-man purple
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(200, "Standard25Man", 631, 2, 6, 17,
|
||||
"Standard 25-man raid — 2T/6H/17D matches most ICC "
|
||||
"25N progression.");
|
||||
add(201, "HealingHeavy25Man", 631, 1, 8, 16,
|
||||
"Healing-heavy 25-man — 1T/8H/16D for healing-"
|
||||
"intensive ICC 25H Putricide / LK heroic.");
|
||||
add(202, "ZergDPS25Man", 631, 0, 4, 21,
|
||||
"Zerg DPS 25-man — 0T/4H/21D for tank-immune fights "
|
||||
"(Loatheb-style trash piles).");
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
@@ -294,6 +294,8 @@ const char* const kArgRequired[] = {
|
||||
"--gen-act", "--gen-act-mage", "--gen-act-pet",
|
||||
"--info-wact", "--validate-wact",
|
||||
"--export-wact-json", "--import-wact-json",
|
||||
"--gen-grp", "--gen-grp-raid10", "--gen-grp-raid25",
|
||||
"--info-wgrp", "--validate-wgrp",
|
||||
"--gen-weather-temperate", "--gen-weather-arctic",
|
||||
"--gen-weather-desert", "--gen-weather-stormy",
|
||||
"--gen-zone-atmosphere",
|
||||
|
||||
@@ -140,6 +140,7 @@
|
||||
#include "cli_stable_slots_catalog.hpp"
|
||||
#include "cli_stat_curves_catalog.hpp"
|
||||
#include "cli_action_bars_catalog.hpp"
|
||||
#include "cli_group_compositions_catalog.hpp"
|
||||
#include "cli_quest_objective.hpp"
|
||||
#include "cli_quest_reward.hpp"
|
||||
#include "cli_clone.hpp"
|
||||
@@ -321,6 +322,7 @@ constexpr DispatchFn kDispatchTable[] = {
|
||||
handleStableSlotsCatalog,
|
||||
handleStatCurvesCatalog,
|
||||
handleActionBarsCatalog,
|
||||
handleGroupCompositionsCatalog,
|
||||
handleQuestObjective,
|
||||
handleQuestReward,
|
||||
handleClone,
|
||||
|
||||
@@ -98,6 +98,7 @@ constexpr FormatMagicEntry kFormats[] = {
|
||||
{{'W','S','T','C'}, ".wstc", "pets", "--info-wstc", "Hunter stable slot catalog"},
|
||||
{{'W','S','T','M'}, ".wstm", "stats", "--info-wstm", "Stat modifier curve catalog"},
|
||||
{{'W','A','C','T'}, ".wact", "ui", "--info-wact", "Action bar layout catalog"},
|
||||
{{'W','G','R','P'}, ".wgrp", "social", "--info-wgrp", "Group composition catalog"},
|
||||
{{'W','F','A','C'}, ".wfac", "factions", nullptr, "Faction catalog"},
|
||||
{{'W','L','C','K'}, ".wlck", "locks", nullptr, "Lock catalog"},
|
||||
{{'W','S','K','L'}, ".wskl", "skills", nullptr, "Skill catalog"},
|
||||
|
||||
258
tools/editor/cli_group_compositions_catalog.cpp
Normal file
258
tools/editor/cli_group_compositions_catalog.cpp
Normal file
@@ -0,0 +1,258 @@
|
||||
#include "cli_group_compositions_catalog.hpp"
|
||||
#include "cli_arg_parse.hpp"
|
||||
#include "cli_box_emitter.hpp"
|
||||
|
||||
#include "pipeline/wowee_group_compositions.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 stripWgrpExt(std::string base) {
|
||||
stripExt(base, ".wgrp");
|
||||
return base;
|
||||
}
|
||||
|
||||
bool saveOrError(const wowee::pipeline::WoweeGroupComposition& c,
|
||||
const std::string& base, const char* cmd) {
|
||||
if (!wowee::pipeline::WoweeGroupCompositionLoader::save(c, base)) {
|
||||
std::fprintf(stderr, "%s: failed to save %s.wgrp\n",
|
||||
cmd, base.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void printGenSummary(const wowee::pipeline::WoweeGroupComposition& c,
|
||||
const std::string& base) {
|
||||
std::printf("Wrote %s.wgrp\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" comps : %zu\n", c.entries.size());
|
||||
}
|
||||
|
||||
int handleGenFiveMan(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "FiveManComps";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWgrpExt(base);
|
||||
auto c = wowee::pipeline::WoweeGroupCompositionLoader::makeFiveMan(name);
|
||||
if (!saveOrError(c, base, "gen-grp")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenRaid10(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "Raid10Comps";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWgrpExt(base);
|
||||
auto c = wowee::pipeline::WoweeGroupCompositionLoader::makeRaid10(name);
|
||||
if (!saveOrError(c, base, "gen-grp-raid10")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenRaid25(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "Raid25Comps";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWgrpExt(base);
|
||||
auto c = wowee::pipeline::WoweeGroupCompositionLoader::makeRaid25(name);
|
||||
if (!saveOrError(c, base, "gen-grp-raid25")) 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 = stripWgrpExt(base);
|
||||
if (!wowee::pipeline::WoweeGroupCompositionLoader::exists(base)) {
|
||||
std::fprintf(stderr, "WGRP not found: %s.wgrp\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeGroupCompositionLoader::load(base);
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wgrp"] = base + ".wgrp";
|
||||
j["name"] = c.name;
|
||||
j["count"] = c.entries.size();
|
||||
nlohmann::json arr = nlohmann::json::array();
|
||||
for (const auto& e : c.entries) {
|
||||
arr.push_back({
|
||||
{"compId", e.compId},
|
||||
{"name", e.name},
|
||||
{"description", e.description},
|
||||
{"mapId", e.mapId},
|
||||
{"difficultyId", e.difficultyId},
|
||||
{"requiredTanks", e.requiredTanks},
|
||||
{"requiredHealers", e.requiredHealers},
|
||||
{"requiredDamageDealers", e.requiredDamageDealers},
|
||||
{"minPartySize", e.minPartySize},
|
||||
{"maxPartySize", e.maxPartySize},
|
||||
{"requireSpec", e.requireSpec != 0},
|
||||
{"iconColorRGBA", e.iconColorRGBA},
|
||||
});
|
||||
}
|
||||
j["entries"] = arr;
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return 0;
|
||||
}
|
||||
std::printf("WGRP: %s.wgrp\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" comps : %zu\n", c.entries.size());
|
||||
if (c.entries.empty()) return 0;
|
||||
std::printf(" id map diff tanks heal dps min max spec name\n");
|
||||
for (const auto& e : c.entries) {
|
||||
std::printf(" %4u %4u %4u %3u %3u %3u %3u %3u %s %s\n",
|
||||
e.compId, e.mapId, e.difficultyId,
|
||||
e.requiredTanks, e.requiredHealers,
|
||||
e.requiredDamageDealers,
|
||||
e.minPartySize, e.maxPartySize,
|
||||
e.requireSpec ? "yes" : "no ",
|
||||
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 = stripWgrpExt(base);
|
||||
if (!wowee::pipeline::WoweeGroupCompositionLoader::exists(base)) {
|
||||
std::fprintf(stderr,
|
||||
"validate-wgrp: WGRP not found: %s.wgrp\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeGroupCompositionLoader::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.compId);
|
||||
if (!e.name.empty()) ctx += " " + e.name;
|
||||
ctx += ")";
|
||||
if (e.compId == 0)
|
||||
errors.push_back(ctx + ": compId is 0");
|
||||
if (e.name.empty())
|
||||
errors.push_back(ctx + ": name is empty");
|
||||
if (e.mapId == 0)
|
||||
errors.push_back(ctx +
|
||||
": mapId is 0 — composition is unbound to a map");
|
||||
if (e.minPartySize > e.maxPartySize) {
|
||||
errors.push_back(ctx + ": minPartySize " +
|
||||
std::to_string(e.minPartySize) +
|
||||
" > maxPartySize " +
|
||||
std::to_string(e.maxPartySize));
|
||||
}
|
||||
// Sum of required roles must fit in the party size.
|
||||
uint32_t requiredSum = e.requiredTanks +
|
||||
e.requiredHealers +
|
||||
e.requiredDamageDealers;
|
||||
if (requiredSum > e.maxPartySize) {
|
||||
errors.push_back(ctx +
|
||||
": required roles sum " + std::to_string(requiredSum) +
|
||||
" > maxPartySize " +
|
||||
std::to_string(e.maxPartySize) +
|
||||
" — composition can never be filled");
|
||||
}
|
||||
if (requiredSum < e.minPartySize) {
|
||||
warnings.push_back(ctx +
|
||||
": required roles sum " + std::to_string(requiredSum) +
|
||||
" < minPartySize " +
|
||||
std::to_string(e.minPartySize) +
|
||||
" — extra slots have no role requirement");
|
||||
}
|
||||
// Standard sizes: 5 / 10 / 25 / 40.
|
||||
if (e.maxPartySize != 5 && e.maxPartySize != 10 &&
|
||||
e.maxPartySize != 25 && e.maxPartySize != 40) {
|
||||
warnings.push_back(ctx +
|
||||
": non-standard maxPartySize " +
|
||||
std::to_string(e.maxPartySize) +
|
||||
" (canonical sizes are 5/10/25/40)");
|
||||
}
|
||||
// Zero-tank composition is unusual but legal for
|
||||
// tank-immune content; warn so the author confirms.
|
||||
if (e.requiredTanks == 0) {
|
||||
warnings.push_back(ctx +
|
||||
": requiredTanks=0 — zero-tank composition. "
|
||||
"Legal for tank-immune fights but unusual; "
|
||||
"double-check this is intentional");
|
||||
}
|
||||
for (uint32_t prev : idsSeen) {
|
||||
if (prev == e.compId) {
|
||||
errors.push_back(ctx + ": duplicate compId");
|
||||
break;
|
||||
}
|
||||
}
|
||||
idsSeen.push_back(e.compId);
|
||||
}
|
||||
bool ok = errors.empty();
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wgrp"] = base + ".wgrp";
|
||||
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-wgrp: %s.wgrp\n", base.c_str());
|
||||
if (ok && warnings.empty()) {
|
||||
std::printf(" OK — %zu compositions, all compIds 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 handleGroupCompositionsCatalog(int& i, int argc, char** argv,
|
||||
int& outRc) {
|
||||
if (std::strcmp(argv[i], "--gen-grp") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenFiveMan(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-grp-raid10") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenRaid10(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-grp-raid25") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenRaid25(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--info-wgrp") == 0 && i + 1 < argc) {
|
||||
outRc = handleInfo(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--validate-wgrp") == 0 && i + 1 < argc) {
|
||||
outRc = handleValidate(i, argc, argv); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
12
tools/editor/cli_group_compositions_catalog.hpp
Normal file
12
tools/editor/cli_group_compositions_catalog.hpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
bool handleGroupCompositionsCatalog(int& i, int argc, char** argv,
|
||||
int& outRc);
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
@@ -2097,6 +2097,16 @@ void printUsage(const char* argv0) {
|
||||
std::printf(" Export binary .wact to a human-editable JSON sidecar (defaults to <base>.wact.json)\n");
|
||||
std::printf(" --import-wact-json <json-path> [out-base]\n");
|
||||
std::printf(" Import a .wact.json sidecar back into binary .wact (accepts barMode int OR barModeName string)\n");
|
||||
std::printf(" --gen-grp <wgrp-base> [name]\n");
|
||||
std::printf(" Emit .wgrp 3 5-man comps (Classic 1T/1H/3D, Heavy-Heal 1T/2H/2D, Roleless 5D speed run)\n");
|
||||
std::printf(" --gen-grp-raid10 <wgrp-base> [name]\n");
|
||||
std::printf(" Emit .wgrp 3 10-man raid comps (Standard 2T/3H/5D, HealingHeavy 2T/4H/4D, MeleeStack 1T/2H/7D for melee-cleave fights)\n");
|
||||
std::printf(" --gen-grp-raid25 <wgrp-base> [name]\n");
|
||||
std::printf(" Emit .wgrp 3 25-man raid comps (Standard 2T/6H/17D, HealingHeavy 1T/8H/16D, ZergDPS 0T/4H/21D)\n");
|
||||
std::printf(" --info-wgrp <wgrp-base>\n");
|
||||
std::printf(" Print WGRP entries (id / map / diff / required tanks/heals/dps / min/max party / spec gate / name)\n");
|
||||
std::printf(" --validate-wgrp <wgrp-base>\n");
|
||||
std::printf(" Static checks: id+name+mapId required, min<=max, role sum<=maxParty (else unfulfillable), no duplicate ids; warns on non-standard size, role sum<minParty, requiredTanks=0 (tank-immune fights)\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");
|
||||
|
||||
@@ -120,6 +120,7 @@ constexpr FormatRow kFormats[] = {
|
||||
{"WSTC", ".wstc", "pets", "stable_slot SQL + hunter UI", "Hunter stable slot catalog"},
|
||||
{"WSTM", ".wstm", "stats", "gtChanceTo*.dbc + gtRegen*.dbc", "Stat modifier curve catalog"},
|
||||
{"WACT", ".wact", "ui", "Hardcoded class default action bar","Action bar layout catalog"},
|
||||
{"WGRP", ".wgrp", "social", "LFG group-composition rules", "Group composition catalog (role quotas)"},
|
||||
|
||||
// Additional pipeline catalogs without the alternating
|
||||
// gen/info/validate CLI surface (loaded by the engine
|
||||
|
||||
Reference in New Issue
Block a user