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:
Kelsi 2026-05-10 00:20:44 -07:00
parent 54353e03e6
commit 869880fd66
10 changed files with 671 additions and 0 deletions

View file

@ -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",

View file

@ -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,

View file

@ -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"},

View 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

View 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

View file

@ -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");

View file

@ -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