mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-11 03:23:51 +00:00
feat(editor): add WMAR (Raid Marker Set) — 117th open format
Novel replacement for the hardcoded 8-marker raid set
vanilla WoW shipped (Star/Circle/Diamond/Triangle/Moon/
Square/Cross/Skull) plus world-map pin markers and
5-man party role markers. Each entry binds one marker
slot to its icon resource, single-character chat-overlay
glyph (for "{star}" chat-style links), and priority for
sort order in the marker-picker UI.
Four markerKind values (RaidTarget / WorldMap / Party /
Custom) cover the full marker-system surface. The chat-
overlay displayChar field enables the WoW-canonical
chat shortcuts: "{star}" gets rendered as a star icon
inline in chat, with "*" as the fallback glyph for
non-rich-text contexts (clipboard, log files, mod-
script handlers).
Three preset emitters: makeRaidTargets (8 canonical
raid markers in /raidicon priority order 0..7 with
their iconic colors and glyph mnemonics), makeWorldMap-
Pins (5 world-map pin markers — Pin/Flag/Crosshair/
Question/Compass), makeParty (4 role markers for group-
finder filtering — Tank/Healer/DPS/Caster).
Validator's most novel checks: per-(markerKind,
priority) tuple uniqueness — two markers at same kind+
priority would render in unstable picker UI order. Plus
RaidTarget priority > 7 warns (exceeds canonical 8-slot
/raidicon dispatch range; client keybind macros may not
reach the slot).
Format count 116 -> 117. CLI flag count 1241 -> 1246.
This commit is contained in:
parent
4be543a2ed
commit
42842958df
10 changed files with 714 additions and 0 deletions
|
|
@ -705,6 +705,7 @@ set(WOWEE_SOURCES
|
|||
src/pipeline/wowee_voiceovers.cpp
|
||||
src/pipeline/wowee_trade_rules.cpp
|
||||
src/pipeline/wowee_word_filters.cpp
|
||||
src/pipeline/wowee_raid_markers.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/dbc_layout.cpp
|
||||
|
||||
|
|
@ -1573,6 +1574,7 @@ add_executable(wowee_editor
|
|||
tools/editor/cli_voiceovers_catalog.cpp
|
||||
tools/editor/cli_trade_rules_catalog.cpp
|
||||
tools/editor/cli_word_filters_catalog.cpp
|
||||
tools/editor/cli_raid_markers_catalog.cpp
|
||||
tools/editor/cli_catalog_pluck.cpp
|
||||
tools/editor/cli_catalog_find.cpp
|
||||
tools/editor/cli_catalog_by_name.cpp
|
||||
|
|
@ -1760,6 +1762,7 @@ add_executable(wowee_editor
|
|||
src/pipeline/wowee_voiceovers.cpp
|
||||
src/pipeline/wowee_trade_rules.cpp
|
||||
src/pipeline/wowee_word_filters.cpp
|
||||
src/pipeline/wowee_raid_markers.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/terrain_mesh.cpp
|
||||
|
||||
|
|
|
|||
107
include/pipeline/wowee_raid_markers.hpp
Normal file
107
include/pipeline/wowee_raid_markers.hpp
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Raid Marker Set catalog (.wmar) — novel
|
||||
// replacement for the hardcoded 8-marker set vanilla
|
||||
// WoW shipped (Star/Circle/Diamond/Triangle/Moon/Square
|
||||
// /Cross/Skull) plus world-map pin markers and 5-man
|
||||
// party markers. Each entry binds one marker slot to
|
||||
// its icon resource, single-character chat-overlay
|
||||
// glyph (for "{star}" chat-style links), and priority
|
||||
// for sort order in the marker-picker UI.
|
||||
//
|
||||
// Cross-references with previously-added formats:
|
||||
// No catalog cross-references — markers are visual-
|
||||
// identity primitives consumed directly by the raid
|
||||
// UI / minimap renderer.
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WMAR"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// markerId (uint32)
|
||||
// nameLen + name
|
||||
// descLen + description
|
||||
// markerKind (uint8) — RaidTarget /
|
||||
// WorldMap / Party /
|
||||
// Custom
|
||||
// priority (uint8) — sort order in
|
||||
// picker UI
|
||||
// pad0 (uint8) / pad1 (uint8)
|
||||
// pathLen + iconPath — BLP/WOT icon path
|
||||
// glyphLen + displayChar — single-character
|
||||
// glyph for chat
|
||||
// overlay (e.g.
|
||||
// "*" for star)
|
||||
// iconColorRGBA (uint32)
|
||||
struct WoweeRaidMarkers {
|
||||
enum MarkerKind : uint8_t {
|
||||
RaidTarget = 0, // 8-marker standard raid set
|
||||
WorldMap = 1, // map-pin marker
|
||||
Party = 2, // 5-man party-only set
|
||||
Custom = 3, // server-custom marker
|
||||
};
|
||||
|
||||
struct Entry {
|
||||
uint32_t markerId = 0;
|
||||
std::string name;
|
||||
std::string description;
|
||||
uint8_t markerKind = RaidTarget;
|
||||
uint8_t priority = 0;
|
||||
uint8_t pad0 = 0;
|
||||
uint8_t pad1 = 0;
|
||||
std::string iconPath;
|
||||
std::string displayChar; // 1 char glyph
|
||||
uint32_t iconColorRGBA = 0xFFFFFFFFu;
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::vector<Entry> entries;
|
||||
|
||||
bool isValid() const { return !entries.empty(); }
|
||||
|
||||
const Entry* findById(uint32_t markerId) const;
|
||||
|
||||
// Returns all markers of one kind, sorted by
|
||||
// priority. Used by the marker-picker UI to
|
||||
// populate per-tab listings.
|
||||
std::vector<const Entry*> findByKind(uint8_t markerKind) const;
|
||||
};
|
||||
|
||||
class WoweeRaidMarkersLoader {
|
||||
public:
|
||||
static bool save(const WoweeRaidMarkers& cat,
|
||||
const std::string& basePath);
|
||||
static WoweeRaidMarkers load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-mar* variants.
|
||||
//
|
||||
// makeRaidTargets — 8 standard raid markers
|
||||
// (Star / Circle / Diamond /
|
||||
// Triangle / Moon / Square /
|
||||
// Cross / Skull) at priorities
|
||||
// 0..7 matching their canonical
|
||||
// keybind slot.
|
||||
// makeWorldMapPins — 5 world-map pin markers
|
||||
// (Pin / Flag / Crosshair /
|
||||
// Question / Compass).
|
||||
// makeParty — 4 5-man party-only markers
|
||||
// (Tank / Healer / DPS /
|
||||
// Caster — role icons for
|
||||
// groupfinder).
|
||||
static WoweeRaidMarkers makeRaidTargets(const std::string& catalogName);
|
||||
static WoweeRaidMarkers makeWorldMapPins(const std::string& catalogName);
|
||||
static WoweeRaidMarkers makeParty(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
296
src/pipeline/wowee_raid_markers.cpp
Normal file
296
src/pipeline/wowee_raid_markers.cpp
Normal file
|
|
@ -0,0 +1,296 @@
|
|||
#include "pipeline/wowee_raid_markers.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kMagic[4] = {'W', 'M', 'A', 'R'};
|
||||
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) != ".wmar") {
|
||||
base += ".wmar";
|
||||
}
|
||||
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 WoweeRaidMarkers::Entry*
|
||||
WoweeRaidMarkers::findById(uint32_t markerId) const {
|
||||
for (const auto& e : entries)
|
||||
if (e.markerId == markerId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<const WoweeRaidMarkers::Entry*>
|
||||
WoweeRaidMarkers::findByKind(uint8_t markerKind) const {
|
||||
std::vector<const Entry*> out;
|
||||
for (const auto& e : entries)
|
||||
if (e.markerKind == markerKind) out.push_back(&e);
|
||||
std::sort(out.begin(), out.end(),
|
||||
[](const Entry* a, const Entry* b) {
|
||||
return a->priority < b->priority;
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeRaidMarkersLoader::save(const WoweeRaidMarkers& 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.markerId);
|
||||
writeStr(os, e.name);
|
||||
writeStr(os, e.description);
|
||||
writePOD(os, e.markerKind);
|
||||
writePOD(os, e.priority);
|
||||
writePOD(os, e.pad0);
|
||||
writePOD(os, e.pad1);
|
||||
writeStr(os, e.iconPath);
|
||||
writeStr(os, e.displayChar);
|
||||
writePOD(os, e.iconColorRGBA);
|
||||
}
|
||||
return os.good();
|
||||
}
|
||||
|
||||
WoweeRaidMarkers WoweeRaidMarkersLoader::load(
|
||||
const std::string& basePath) {
|
||||
WoweeRaidMarkers 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.markerId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readStr(is, e.name) || !readStr(is, e.description)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.markerKind) ||
|
||||
!readPOD(is, e.priority) ||
|
||||
!readPOD(is, e.pad0) ||
|
||||
!readPOD(is, e.pad1)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readStr(is, e.iconPath) ||
|
||||
!readStr(is, e.displayChar)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.iconColorRGBA)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeRaidMarkersLoader::exists(const std::string& basePath) {
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
return is.good();
|
||||
}
|
||||
|
||||
WoweeRaidMarkers WoweeRaidMarkersLoader::makeRaidTargets(
|
||||
const std::string& catalogName) {
|
||||
using M = WoweeRaidMarkers;
|
||||
WoweeRaidMarkers c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name,
|
||||
uint8_t prio, const char* iconPath,
|
||||
const char* glyph, uint32_t color,
|
||||
const char* desc) {
|
||||
M::Entry e;
|
||||
e.markerId = id; e.name = name; e.description = desc;
|
||||
e.markerKind = M::RaidTarget;
|
||||
e.priority = prio;
|
||||
e.iconPath = iconPath;
|
||||
e.displayChar = glyph;
|
||||
e.iconColorRGBA = color;
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
// Canonical 8-marker order from /raidicon command.
|
||||
add(1, "Star", 0,
|
||||
"Interface\\TargetingFrame\\UI-RaidTargetingIcon_1.blp",
|
||||
"*", packRgba(255, 220, 80),
|
||||
"Star (yellow). Mark slot 1. /raidicon star.");
|
||||
add(2, "Circle", 1,
|
||||
"Interface\\TargetingFrame\\UI-RaidTargetingIcon_2.blp",
|
||||
"o", packRgba(255, 130, 60),
|
||||
"Circle (orange). Mark slot 2.");
|
||||
add(3, "Diamond", 2,
|
||||
"Interface\\TargetingFrame\\UI-RaidTargetingIcon_3.blp",
|
||||
"<>", packRgba(180, 100, 240),
|
||||
"Diamond (purple). Mark slot 3 — common "
|
||||
"polymorph CC-target marker.");
|
||||
add(4, "Triangle", 3,
|
||||
"Interface\\TargetingFrame\\UI-RaidTargetingIcon_4.blp",
|
||||
"^", packRgba(80, 220, 80),
|
||||
"Triangle (green). Mark slot 4.");
|
||||
add(5, "Moon", 4,
|
||||
"Interface\\TargetingFrame\\UI-RaidTargetingIcon_5.blp",
|
||||
"(", packRgba(220, 220, 240),
|
||||
"Moon (silver). Mark slot 5 — common Sap CC-"
|
||||
"target marker.");
|
||||
add(6, "Square", 5,
|
||||
"Interface\\TargetingFrame\\UI-RaidTargetingIcon_6.blp",
|
||||
"#", packRgba(80, 130, 240),
|
||||
"Square (blue). Mark slot 6.");
|
||||
add(7, "Cross", 6,
|
||||
"Interface\\TargetingFrame\\UI-RaidTargetingIcon_7.blp",
|
||||
"X", packRgba(220, 60, 60),
|
||||
"Cross (red). Mark slot 7 — universal kill-this-"
|
||||
"first marker.");
|
||||
add(8, "Skull", 7,
|
||||
"Interface\\TargetingFrame\\UI-RaidTargetingIcon_8.blp",
|
||||
"$", packRgba(220, 220, 220),
|
||||
"Skull (white). Mark slot 8 — universal HIGHEST-"
|
||||
"priority kill-target marker.");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeRaidMarkers WoweeRaidMarkersLoader::makeWorldMapPins(
|
||||
const std::string& catalogName) {
|
||||
using M = WoweeRaidMarkers;
|
||||
WoweeRaidMarkers c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name,
|
||||
uint8_t prio, const char* iconPath,
|
||||
const char* glyph, uint32_t color,
|
||||
const char* desc) {
|
||||
M::Entry e;
|
||||
e.markerId = id; e.name = name; e.description = desc;
|
||||
e.markerKind = M::WorldMap;
|
||||
e.priority = prio;
|
||||
e.iconPath = iconPath;
|
||||
e.displayChar = glyph;
|
||||
e.iconColorRGBA = color;
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(100, "Pin", 0,
|
||||
"Interface\\Minimap\\WorldMap\\Pin_Yellow.blp",
|
||||
"P", packRgba(255, 220, 80),
|
||||
"Generic yellow pin. Player-placed waypoint.");
|
||||
add(101, "Flag", 1,
|
||||
"Interface\\Minimap\\WorldMap\\Flag_Red.blp",
|
||||
"F", packRgba(220, 60, 60),
|
||||
"Red flag. Used by raid leaders for "
|
||||
"rendezvous points.");
|
||||
add(102, "Crosshair", 2,
|
||||
"Interface\\Minimap\\WorldMap\\Crosshair.blp",
|
||||
"+", packRgba(180, 180, 180),
|
||||
"Crosshair. Targeting / sniping indicator on "
|
||||
"PvP maps.");
|
||||
add(103, "Question", 3,
|
||||
"Interface\\Minimap\\WorldMap\\Question_Blue.blp",
|
||||
"?", packRgba(140, 200, 255),
|
||||
"Blue question mark. Quest-related point of "
|
||||
"interest.");
|
||||
add(104, "Compass", 4,
|
||||
"Interface\\Minimap\\WorldMap\\Compass.blp",
|
||||
"N", packRgba(220, 220, 240),
|
||||
"Compass rose. North-indicator overlay (rare; "
|
||||
"minimap usually fixes north at top).");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeRaidMarkers WoweeRaidMarkersLoader::makeParty(
|
||||
const std::string& catalogName) {
|
||||
using M = WoweeRaidMarkers;
|
||||
WoweeRaidMarkers c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name,
|
||||
uint8_t prio, const char* iconPath,
|
||||
const char* glyph, uint32_t color,
|
||||
const char* desc) {
|
||||
M::Entry e;
|
||||
e.markerId = id; e.name = name; e.description = desc;
|
||||
e.markerKind = M::Party;
|
||||
e.priority = prio;
|
||||
e.iconPath = iconPath;
|
||||
e.displayChar = glyph;
|
||||
e.iconColorRGBA = color;
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(200, "TankRole", 0,
|
||||
"Interface\\PartyFrame\\Role_Tank.blp",
|
||||
"T", packRgba(60, 100, 200),
|
||||
"Tank role icon. Shown in groupfinder + party "
|
||||
"frame for tank-specced players.");
|
||||
add(201, "HealerRole", 1,
|
||||
"Interface\\PartyFrame\\Role_Healer.blp",
|
||||
"H", packRgba(80, 200, 80),
|
||||
"Healer role icon. Shown for healer-specced "
|
||||
"players.");
|
||||
add(202, "DamageRole", 2,
|
||||
"Interface\\PartyFrame\\Role_Damage.blp",
|
||||
"D", packRgba(220, 80, 80),
|
||||
"DPS role icon (melee + ranged grouped).");
|
||||
add(203, "CasterRole", 3,
|
||||
"Interface\\PartyFrame\\Role_Caster.blp",
|
||||
"C", packRgba(180, 100, 240),
|
||||
"Caster sub-role icon for groupfinder filtering "
|
||||
"(distinct from melee DPS in some custom-server "
|
||||
"configurations).");
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
|
|
@ -359,6 +359,8 @@ const char* const kArgRequired[] = {
|
|||
"--gen-wfl", "--gen-wfl-caps", "--gen-wfl-url",
|
||||
"--info-wwfl", "--validate-wwfl",
|
||||
"--export-wwfl-json", "--import-wwfl-json",
|
||||
"--gen-mar", "--gen-mar-world", "--gen-mar-party",
|
||||
"--info-wmar", "--validate-wmar",
|
||||
"--gen-weather-temperate", "--gen-weather-arctic",
|
||||
"--gen-weather-desert", "--gen-weather-stormy",
|
||||
"--gen-zone-atmosphere",
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@
|
|||
#include "cli_voiceovers_catalog.hpp"
|
||||
#include "cli_trade_rules_catalog.hpp"
|
||||
#include "cli_word_filters_catalog.hpp"
|
||||
#include "cli_raid_markers_catalog.hpp"
|
||||
#include "cli_catalog_pluck.hpp"
|
||||
#include "cli_catalog_find.hpp"
|
||||
#include "cli_catalog_by_name.hpp"
|
||||
|
|
@ -367,6 +368,7 @@ constexpr DispatchFn kDispatchTable[] = {
|
|||
handleVoiceoversCatalog,
|
||||
handleTradeRulesCatalog,
|
||||
handleWordFiltersCatalog,
|
||||
handleRaidMarkersCatalog,
|
||||
handleCatalogPluck,
|
||||
handleCatalogFind,
|
||||
handleCatalogByName,
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ constexpr FormatMagicEntry kFormats[] = {
|
|||
{{'W','V','O','X'}, ".wvox", "audio", "--info-wvox", "Voiceover audio catalog"},
|
||||
{{'W','T','R','D'}, ".wtrd", "social", "--info-wtrd", "Trade window rules catalog"},
|
||||
{{'W','W','F','L'}, ".wwfl", "social", "--info-wwfl", "Word filter catalog"},
|
||||
{{'W','M','A','R'}, ".wmar", "ui", "--info-wmar", "Raid marker 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"},
|
||||
|
|
|
|||
|
|
@ -2391,6 +2391,16 @@ void printUsage(const char* argv0) {
|
|||
std::printf(" Export binary .wwfl to a human-editable JSON sidecar (defaults to <base>.wwfl.json; emits both filterKind and severity as int + name string; pattern and replacement as plain strings)\n");
|
||||
std::printf(" --import-wwfl-json <json-path> [out-base]\n");
|
||||
std::printf(" Import a .wwfl.json sidecar back into binary .wwfl (filterKind int OR \"spam\"/\"goldseller\"/\"allcaps\"/\"repeatchar\"/\"url\"/\"advertreward\"/\"misc\"; severity int OR \"warn\"/\"replace\"/\"drop\"/\"mute\"; caseSensitive accepts bool OR int)\n");
|
||||
std::printf(" --gen-mar <wmar-base> [name]\n");
|
||||
std::printf(" Emit .wmar 8 standard raid markers (Star/Circle/Diamond/Triangle/Moon/Square/Cross/Skull) at canonical priorities 0..7\n");
|
||||
std::printf(" --gen-mar-world <wmar-base> [name]\n");
|
||||
std::printf(" Emit .wmar 5 world-map pin markers (Pin/Flag/Crosshair/Question/Compass)\n");
|
||||
std::printf(" --gen-mar-party <wmar-base> [name]\n");
|
||||
std::printf(" Emit .wmar 4 party role markers (Tank/Healer/DPS/Caster) for groupfinder filtering\n");
|
||||
std::printf(" --info-wmar <wmar-base> [--json]\n");
|
||||
std::printf(" Print WMAR entries (id / kind / priority / glyph / name)\n");
|
||||
std::printf(" --validate-wmar <wmar-base> [--json]\n");
|
||||
std::printf(" Static checks: id+name required, markerKind 0..3, no duplicate markerIds, no two markers at same (kind, priority) slot (picker UI sort would be non-deterministic); warns on empty iconPath, empty/oversized displayChar, RaidTarget priority > 7 (exceeds canonical /raidicon dispatch range)\n");
|
||||
std::printf(" --catalog-pluck <wXXX-file> <id> [--json]\n");
|
||||
std::printf(" Extract one entry by id from any registered catalog format. Auto-detects magic, dispatches to the per-format --info-* handler internally, then prints just the matching entry. Primary-key field is auto-detected (first *Id field, or first numeric)\n");
|
||||
std::printf(" --catalog-find <directory> <id> [--magic <WXXX>] [--json]\n");
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ constexpr FormatRow kFormats[] = {
|
|||
{"WVOX", ".wvox", "audio", "CreatureTextSounds + per-quest voice","Voiceover audio catalog (per-NPC, per-event clips)"},
|
||||
{"WTRD", ".wtrd", "social", "trade-window state machine policy", "Trade window rules catalog (P2P trade policy)"},
|
||||
{"WWFL", ".wwfl", "social", "chat preprocessor bad-word matcher", "Word filter catalog (spam/RMT/all-caps/URL)"},
|
||||
{"WMAR", ".wmar", "ui", "raid-target icon set (8 fixed)", "Raid marker catalog (8 raid + map pins + party roles)"},
|
||||
|
||||
// Additional pipeline catalogs without the alternating
|
||||
// gen/info/validate CLI surface (loaded by the engine
|
||||
|
|
|
|||
280
tools/editor/cli_raid_markers_catalog.cpp
Normal file
280
tools/editor/cli_raid_markers_catalog.cpp
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
#include "cli_raid_markers_catalog.hpp"
|
||||
#include "cli_arg_parse.hpp"
|
||||
#include "cli_box_emitter.hpp"
|
||||
|
||||
#include "pipeline/wowee_raid_markers.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
namespace {
|
||||
|
||||
std::string stripWmarExt(std::string base) {
|
||||
stripExt(base, ".wmar");
|
||||
return base;
|
||||
}
|
||||
|
||||
const char* markerKindName(uint8_t k) {
|
||||
using M = wowee::pipeline::WoweeRaidMarkers;
|
||||
switch (k) {
|
||||
case M::RaidTarget: return "raidtarget";
|
||||
case M::WorldMap: return "worldmap";
|
||||
case M::Party: return "party";
|
||||
case M::Custom: return "custom";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
bool saveOrError(const wowee::pipeline::WoweeRaidMarkers& c,
|
||||
const std::string& base, const char* cmd) {
|
||||
if (!wowee::pipeline::WoweeRaidMarkersLoader::save(c, base)) {
|
||||
std::fprintf(stderr, "%s: failed to save %s.wmar\n",
|
||||
cmd, base.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void printGenSummary(const wowee::pipeline::WoweeRaidMarkers& c,
|
||||
const std::string& base) {
|
||||
std::printf("Wrote %s.wmar\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" markers : %zu\n", c.entries.size());
|
||||
}
|
||||
|
||||
int handleGenRaid(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "RaidTargetMarkers";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWmarExt(base);
|
||||
auto c = wowee::pipeline::WoweeRaidMarkersLoader::makeRaidTargets(name);
|
||||
if (!saveOrError(c, base, "gen-mar")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenWorld(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "WorldMapPinMarkers";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWmarExt(base);
|
||||
auto c = wowee::pipeline::WoweeRaidMarkersLoader::makeWorldMapPins(name);
|
||||
if (!saveOrError(c, base, "gen-mar-world")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenParty(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "PartyRoleMarkers";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWmarExt(base);
|
||||
auto c = wowee::pipeline::WoweeRaidMarkersLoader::makeParty(name);
|
||||
if (!saveOrError(c, base, "gen-mar-party")) 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 = stripWmarExt(base);
|
||||
if (!wowee::pipeline::WoweeRaidMarkersLoader::exists(base)) {
|
||||
std::fprintf(stderr, "WMAR not found: %s.wmar\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeRaidMarkersLoader::load(base);
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wmar"] = base + ".wmar";
|
||||
j["name"] = c.name;
|
||||
j["count"] = c.entries.size();
|
||||
nlohmann::json arr = nlohmann::json::array();
|
||||
for (const auto& e : c.entries) {
|
||||
arr.push_back({
|
||||
{"markerId", e.markerId},
|
||||
{"name", e.name},
|
||||
{"description", e.description},
|
||||
{"markerKind", e.markerKind},
|
||||
{"markerKindName", markerKindName(e.markerKind)},
|
||||
{"priority", e.priority},
|
||||
{"iconPath", e.iconPath},
|
||||
{"displayChar", e.displayChar},
|
||||
{"iconColorRGBA", e.iconColorRGBA},
|
||||
});
|
||||
}
|
||||
j["entries"] = arr;
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return 0;
|
||||
}
|
||||
std::printf("WMAR: %s.wmar\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" markers : %zu\n", c.entries.size());
|
||||
if (c.entries.empty()) return 0;
|
||||
std::printf(" id kind prio glyph name\n");
|
||||
for (const auto& e : c.entries) {
|
||||
std::printf(" %4u %-10s %3u '%s' %s\n",
|
||||
e.markerId,
|
||||
markerKindName(e.markerKind),
|
||||
e.priority,
|
||||
e.displayChar.c_str(),
|
||||
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 = stripWmarExt(base);
|
||||
if (!wowee::pipeline::WoweeRaidMarkersLoader::exists(base)) {
|
||||
std::fprintf(stderr,
|
||||
"validate-wmar: WMAR not found: %s.wmar\n",
|
||||
base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeRaidMarkersLoader::load(base);
|
||||
std::vector<std::string> errors;
|
||||
std::vector<std::string> warnings;
|
||||
if (c.entries.empty()) {
|
||||
warnings.push_back("catalog has zero entries");
|
||||
}
|
||||
std::set<uint32_t> idsSeen;
|
||||
// Per-(markerKind, priority) tuple uniqueness — two
|
||||
// markers at same kind+priority would render in
|
||||
// unstable order in the picker UI.
|
||||
std::set<uint32_t> kindPrioSeen;
|
||||
auto kindPrioKey = [](uint8_t kind, uint8_t prio) {
|
||||
return (static_cast<uint32_t>(kind) << 8) | prio;
|
||||
};
|
||||
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.markerId);
|
||||
if (!e.name.empty()) ctx += " " + e.name;
|
||||
ctx += ")";
|
||||
if (e.markerId == 0)
|
||||
errors.push_back(ctx + ": markerId is 0");
|
||||
if (e.name.empty())
|
||||
errors.push_back(ctx + ": name is empty");
|
||||
if (e.markerKind > 3) {
|
||||
errors.push_back(ctx + ": markerKind " +
|
||||
std::to_string(e.markerKind) +
|
||||
" out of range (must be 0..3)");
|
||||
}
|
||||
if (e.iconPath.empty()) {
|
||||
warnings.push_back(ctx +
|
||||
": iconPath is empty — marker would "
|
||||
"render as untextured fallback glyph");
|
||||
}
|
||||
// displayChar should be 1-3 visible characters
|
||||
// (single ASCII like "*" or short Unicode code-
|
||||
// point sequences like "<>" for diamond). Empty
|
||||
// would break chat-overlay text.
|
||||
if (e.displayChar.empty()) {
|
||||
warnings.push_back(ctx +
|
||||
": displayChar is empty — chat overlay "
|
||||
"(e.g. \"{star}\" link) would render "
|
||||
"blank");
|
||||
}
|
||||
if (e.displayChar.size() > 4) {
|
||||
warnings.push_back(ctx +
|
||||
": displayChar is " +
|
||||
std::to_string(e.displayChar.size()) +
|
||||
" bytes (>4) — chat overlay glyphs "
|
||||
"should be terse (1-3 chars typical)");
|
||||
}
|
||||
// RaidTarget kind has a canonical 8-marker max
|
||||
// (priorities 0-7). More would conflict with
|
||||
// the Blizzard-canonical /raidicon dispatch.
|
||||
using M = wowee::pipeline::WoweeRaidMarkers;
|
||||
if (e.markerKind == M::RaidTarget && e.priority > 7) {
|
||||
warnings.push_back(ctx +
|
||||
": RaidTarget priority " +
|
||||
std::to_string(e.priority) +
|
||||
" > 7 — exceeds the canonical 8-slot "
|
||||
"/raidicon dispatch range; client "
|
||||
"keybind macros may not reach this slot");
|
||||
}
|
||||
// Tuple uniqueness: two markers at same
|
||||
// (kind, priority) would render unstably.
|
||||
uint32_t key = kindPrioKey(e.markerKind, e.priority);
|
||||
if (!kindPrioSeen.insert(key).second) {
|
||||
errors.push_back(ctx +
|
||||
": (markerKind=" +
|
||||
std::string(markerKindName(e.markerKind)) +
|
||||
", priority=" + std::to_string(e.priority) +
|
||||
") slot already occupied by another "
|
||||
"marker — picker UI sort would be non-"
|
||||
"deterministic");
|
||||
}
|
||||
if (!idsSeen.insert(e.markerId).second) {
|
||||
errors.push_back(ctx + ": duplicate markerId");
|
||||
}
|
||||
}
|
||||
bool ok = errors.empty();
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wmar"] = base + ".wmar";
|
||||
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-wmar: %s.wmar\n", base.c_str());
|
||||
if (ok && warnings.empty()) {
|
||||
std::printf(" OK — %zu markers, all markerIds + "
|
||||
"(kind,priority) tuples 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 handleRaidMarkersCatalog(int& i, int argc, char** argv,
|
||||
int& outRc) {
|
||||
if (std::strcmp(argv[i], "--gen-mar") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenRaid(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-mar-world") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenWorld(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-mar-party") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenParty(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--info-wmar") == 0 && i + 1 < argc) {
|
||||
outRc = handleInfo(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--validate-wmar") == 0 && i + 1 < argc) {
|
||||
outRc = handleValidate(i, argc, argv); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
12
tools/editor/cli_raid_markers_catalog.hpp
Normal file
12
tools/editor/cli_raid_markers_catalog.hpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
bool handleRaidMarkersCatalog(int& i, int argc, char** argv,
|
||||
int& outRc);
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue