mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-10 11:03:51 +00:00
feat(editor): add WACT (Action Bar Layout) open catalog format
Open replacement for the hardcoded per-class default action bar
bindings. Defines which abilities auto-populate which action
button slots when a new character is created or a class is
reset. A Warrior's button 1 binds Heroic Strike, button 2
Charge, button 3 Rend, etc. — new characters of that class get
those buttons pre-populated so the action bar isn't empty on
first login.
Distinct from WKBD (Keybindings) which maps physical keys to
action button slots — WACT maps action button slots to
abilities. The two together complete the default-control
configuration: Key 1 -> Action Slot 1 (WKBD) -> Heroic Strike
(WACT).
Seven barMode values cover the major action bar contexts:
- Main (slots 0-11, standard 12-button bar)
- Pet (hunter/warlock pet action bar)
- Vehicle (mounted/vehicle action bar)
- Stance1/2/3 (warrior battle/defensive/berserker; druid
bear/cat/tree)
- Custom (server-custom bar overlay)
Cross-references back to WCHC (classMask layout), WSPL (spellId
for the bound ability), and WIT (itemId for item-macro bindings
like Hearthstone in slot 12). findByClass(classBit, barMode)
returns the bindings sorted by buttonSlot — used directly by
character creation to populate action bars.
Three preset emitters: --gen-act (10 Warrior starter bindings on
Main bar with canonical 3.3.5a abilities), --gen-act-mage (10
Mage starter bindings including Counterspell + Polymorph),
--gen-act-pet (10 Hunter pet-bar bindings using barMode=Pet for
Attack/Stance/Bite/Claw/Dismiss).
Validation enforces id+name+classMask presence, barMode 0..6,
no duplicate ids; warns on:
- buttonSlot > 143 (max is 12 bars × 12 slots = 144)
- both spellId and itemId set (engine prefers spellId, item
is silently ignored)
- both spellId=0 AND itemId=0 (button will render empty)
- (classMask + barMode + buttonSlot) collisions for
overlapping classes — multiple bindings fighting for the
same physical slot
Wired through the cross-format table; WACT appears in all 18
cross-format utilities. Format count 94 -> 95; CLI flag count
1083 -> 1088.
This commit is contained in:
parent
48ca202716
commit
48dbf72f11
10 changed files with 692 additions and 0 deletions
|
|
@ -683,6 +683,7 @@ set(WOWEE_SOURCES
|
|||
src/pipeline/wowee_instance_lockouts.cpp
|
||||
src/pipeline/wowee_stable_slots.cpp
|
||||
src/pipeline/wowee_stat_curves.cpp
|
||||
src/pipeline/wowee_action_bars.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/dbc_layout.cpp
|
||||
|
||||
|
|
@ -1529,6 +1530,7 @@ add_executable(wowee_editor
|
|||
tools/editor/cli_instance_lockouts_catalog.cpp
|
||||
tools/editor/cli_stable_slots_catalog.cpp
|
||||
tools/editor/cli_stat_curves_catalog.cpp
|
||||
tools/editor/cli_action_bars_catalog.cpp
|
||||
tools/editor/cli_quest_objective.cpp
|
||||
tools/editor/cli_quest_reward.cpp
|
||||
tools/editor/cli_clone.cpp
|
||||
|
|
@ -1690,6 +1692,7 @@ add_executable(wowee_editor
|
|||
src/pipeline/wowee_instance_lockouts.cpp
|
||||
src/pipeline/wowee_stable_slots.cpp
|
||||
src/pipeline/wowee_stat_curves.cpp
|
||||
src/pipeline/wowee_action_bars.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/terrain_mesh.cpp
|
||||
|
||||
|
|
|
|||
117
include/pipeline/wowee_action_bars.hpp
Normal file
117
include/pipeline/wowee_action_bars.hpp
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Action Bar Layout catalog (.wact) — novel
|
||||
// replacement for the hardcoded per-class default action
|
||||
// bar bindings in the WoW client. Defines which abilities
|
||||
// auto-populate which action button slots when a new
|
||||
// character is created or a class is reset.
|
||||
//
|
||||
// Each entry binds one (classMask, buttonSlot) pair to a
|
||||
// spell or item. A Warrior's button 1 might bind Heroic
|
||||
// Strike, button 2 Charge, button 3 Battle Shout, etc.
|
||||
// New characters of that class get those buttons pre-
|
||||
// populated so the action bar isn't empty on first login.
|
||||
//
|
||||
// Distinct from WKBD (Keybindings) which maps physical
|
||||
// keys to action button slots — WACT maps action button
|
||||
// slots to abilities. The two together complete the
|
||||
// default-control configuration: Key 1 -> Action Slot 1
|
||||
// (WKBD) -> Heroic Strike (WACT).
|
||||
//
|
||||
// Cross-references with previously-added formats:
|
||||
// WCHC: classMask uses the same bit layout as WCHC
|
||||
// class IDs (Warrior=0x01, Paladin=0x02, ...).
|
||||
// WSPL: spellId references the WSPL spell entry that
|
||||
// the button casts when triggered.
|
||||
// WIT: itemId references a WIT item entry for item
|
||||
// macro bindings (Hearthstone in slot 12, etc.).
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WACT"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// bindingId (uint32)
|
||||
// nameLen + name
|
||||
// descLen + description
|
||||
// classMask (uint32)
|
||||
// spellId (uint32)
|
||||
// itemId (uint32)
|
||||
// buttonSlot (uint8) / barMode (uint8) / pad[2]
|
||||
// iconColorRGBA (uint32)
|
||||
struct WoweeActionBar {
|
||||
enum BarMode : uint8_t {
|
||||
Main = 0, // standard 12-button main bar (slots 0-11)
|
||||
Pet = 1, // hunter/warlock pet action bar
|
||||
Vehicle = 2, // mounted/vehicle action bar
|
||||
Stance1 = 3, // warrior battle / druid bear stance
|
||||
Stance2 = 4, // warrior defensive / druid cat
|
||||
Stance3 = 5, // warrior berserker / druid tree
|
||||
Custom = 6, // server-custom bar overlay
|
||||
};
|
||||
|
||||
struct Entry {
|
||||
uint32_t bindingId = 0;
|
||||
std::string name;
|
||||
std::string description;
|
||||
uint32_t classMask = 0;
|
||||
uint32_t spellId = 0;
|
||||
uint32_t itemId = 0; // 0 if spell-only
|
||||
uint8_t buttonSlot = 0; // 0..143 (12 bars × 12 slots)
|
||||
uint8_t barMode = Main;
|
||||
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 bindingId) const;
|
||||
|
||||
// Return all entries for a given class on a specific
|
||||
// bar mode, in buttonSlot order. Used by character
|
||||
// creation to populate the action bar with defaults.
|
||||
std::vector<const Entry*> findByClass(uint32_t classBit,
|
||||
uint8_t barMode) const;
|
||||
|
||||
static const char* barModeName(uint8_t m);
|
||||
};
|
||||
|
||||
class WoweeActionBarLoader {
|
||||
public:
|
||||
static bool save(const WoweeActionBar& cat,
|
||||
const std::string& basePath);
|
||||
static WoweeActionBar load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-act* variants.
|
||||
//
|
||||
// makeWarrior — 10 Warrior starter bindings on the
|
||||
// Main bar (Heroic Strike, Charge,
|
||||
// Rend, Thunder Clap, Battle Shout,
|
||||
// Sunder Armor, Mocking Blow, etc).
|
||||
// makeMage — 10 Mage starter bindings on the Main
|
||||
// bar (Fireball, Frostbolt, Frost
|
||||
// Nova, Polymorph, Mage Armor, etc).
|
||||
// makeHunterPet — 10 Hunter Pet-bar bindings using
|
||||
// barMode=Pet (Attack, Follow, Stay,
|
||||
// Aggressive/Defensive/Passive
|
||||
// stances, Bite, Claw, etc).
|
||||
static WoweeActionBar makeWarrior(const std::string& catalogName);
|
||||
static WoweeActionBar makeMage(const std::string& catalogName);
|
||||
static WoweeActionBar makeHunterPet(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
290
src/pipeline/wowee_action_bars.cpp
Normal file
290
src/pipeline/wowee_action_bars.cpp
Normal file
|
|
@ -0,0 +1,290 @@
|
|||
#include "pipeline/wowee_action_bars.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kMagic[4] = {'W', 'A', 'C', 'T'};
|
||||
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) != ".wact") {
|
||||
base += ".wact";
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
constexpr uint32_t CLS_WARRIOR = 1u << 0;
|
||||
constexpr uint32_t CLS_HUNTER = 1u << 2;
|
||||
constexpr uint32_t CLS_MAGE = 1u << 7;
|
||||
|
||||
} // namespace
|
||||
|
||||
const WoweeActionBar::Entry*
|
||||
WoweeActionBar::findById(uint32_t bindingId) const {
|
||||
for (const auto& e : entries)
|
||||
if (e.bindingId == bindingId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<const WoweeActionBar::Entry*>
|
||||
WoweeActionBar::findByClass(uint32_t classBit, uint8_t barMode) const {
|
||||
std::vector<const Entry*> out;
|
||||
for (const auto& e : entries) {
|
||||
if ((e.classMask & classBit) == 0) continue;
|
||||
if (e.barMode != barMode) continue;
|
||||
out.push_back(&e);
|
||||
}
|
||||
std::sort(out.begin(), out.end(),
|
||||
[](const Entry* a, const Entry* b) {
|
||||
return a->buttonSlot < b->buttonSlot;
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
const char* WoweeActionBar::barModeName(uint8_t m) {
|
||||
switch (m) {
|
||||
case Main: return "main";
|
||||
case Pet: return "pet";
|
||||
case Vehicle: return "vehicle";
|
||||
case Stance1: return "stance1";
|
||||
case Stance2: return "stance2";
|
||||
case Stance3: return "stance3";
|
||||
case Custom: return "custom";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
bool WoweeActionBarLoader::save(const WoweeActionBar& 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.bindingId);
|
||||
writeStr(os, e.name);
|
||||
writeStr(os, e.description);
|
||||
writePOD(os, e.classMask);
|
||||
writePOD(os, e.spellId);
|
||||
writePOD(os, e.itemId);
|
||||
writePOD(os, e.buttonSlot);
|
||||
writePOD(os, e.barMode);
|
||||
writePOD(os, e.pad0);
|
||||
writePOD(os, e.pad1);
|
||||
writePOD(os, e.iconColorRGBA);
|
||||
}
|
||||
return os.good();
|
||||
}
|
||||
|
||||
WoweeActionBar WoweeActionBarLoader::load(const std::string& basePath) {
|
||||
WoweeActionBar 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.bindingId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readStr(is, e.name) || !readStr(is, e.description)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.classMask) ||
|
||||
!readPOD(is, e.spellId) ||
|
||||
!readPOD(is, e.itemId) ||
|
||||
!readPOD(is, e.buttonSlot) ||
|
||||
!readPOD(is, e.barMode) ||
|
||||
!readPOD(is, e.pad0) ||
|
||||
!readPOD(is, e.pad1) ||
|
||||
!readPOD(is, e.iconColorRGBA)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeActionBarLoader::exists(const std::string& basePath) {
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
return is.good();
|
||||
}
|
||||
|
||||
WoweeActionBar WoweeActionBarLoader::makeWarrior(
|
||||
const std::string& catalogName) {
|
||||
using A = WoweeActionBar;
|
||||
WoweeActionBar c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint8_t slot,
|
||||
uint32_t spell, const char* desc) {
|
||||
A::Entry e;
|
||||
e.bindingId = id; e.name = name; e.description = desc;
|
||||
e.classMask = CLS_WARRIOR;
|
||||
e.spellId = spell;
|
||||
e.buttonSlot = slot;
|
||||
e.barMode = A::Main;
|
||||
e.iconColorRGBA = packRgba(220, 60, 60); // warrior red
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
// Warrior starter bindings — 10 abilities on slots 0-9.
|
||||
add(1, "WarriorBtn0_HeroicStrike", 0, 78,
|
||||
"Heroic Strike — replaces next melee swing.");
|
||||
add(2, "WarriorBtn1_Charge", 1, 100,
|
||||
"Charge — close gap from out of combat.");
|
||||
add(3, "WarriorBtn2_Rend", 2, 772,
|
||||
"Rend — physical bleed DoT.");
|
||||
add(4, "WarriorBtn3_ThunderClap", 3, 6343,
|
||||
"Thunder Clap — AoE damage + attack speed slow.");
|
||||
add(5, "WarriorBtn4_BattleShout", 4, 6673,
|
||||
"Battle Shout — party-wide attack power buff.");
|
||||
add(6, "WarriorBtn5_SunderArmor", 5, 7386,
|
||||
"Sunder Armor — armor reduction stack.");
|
||||
add(7, "WarriorBtn6_MockingBlow", 6, 694,
|
||||
"Mocking Blow — taunt single target.");
|
||||
add(8, "WarriorBtn7_Hamstring", 7, 1715,
|
||||
"Hamstring — movement-speed slow.");
|
||||
add(9, "WarriorBtn8_OverPower", 8, 7384,
|
||||
"Overpower — instant strike after enemy dodge.");
|
||||
add(10, "WarriorBtn9_VictoryRush", 9, 34428,
|
||||
"Victory Rush — instant strike after a kill.");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeActionBar WoweeActionBarLoader::makeMage(
|
||||
const std::string& catalogName) {
|
||||
using A = WoweeActionBar;
|
||||
WoweeActionBar c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint8_t slot,
|
||||
uint32_t spell, const char* desc) {
|
||||
A::Entry e;
|
||||
e.bindingId = id; e.name = name; e.description = desc;
|
||||
e.classMask = CLS_MAGE;
|
||||
e.spellId = spell;
|
||||
e.buttonSlot = slot;
|
||||
e.barMode = A::Main;
|
||||
e.iconColorRGBA = packRgba(80, 140, 240); // mage blue
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(100, "MageBtn0_Fireball", 0, 133,
|
||||
"Fireball — primary fire-school spell.");
|
||||
add(101, "MageBtn1_Frostbolt", 1, 116,
|
||||
"Frostbolt — primary frost-school spell with chill.");
|
||||
add(102, "MageBtn2_FrostNova", 2, 122,
|
||||
"Frost Nova — AoE root and minor damage.");
|
||||
add(103, "MageBtn3_Polymorph", 3, 118,
|
||||
"Polymorph — single-target sheep CC.");
|
||||
add(104, "MageBtn4_MageArmor", 4, 6117,
|
||||
"Mage Armor — passive resistance + mana regen.");
|
||||
add(105, "MageBtn5_ArcaneIntellect",5, 1459,
|
||||
"Arcane Intellect — party-wide Intellect buff.");
|
||||
add(106, "MageBtn6_Counterspell", 6, 2139,
|
||||
"Counterspell — interrupt + 8s school lockout.");
|
||||
add(107, "MageBtn7_Blink", 7, 1953,
|
||||
"Blink — 20y forward teleport, breaks roots.");
|
||||
add(108, "MageBtn8_FireBlast", 8, 2136,
|
||||
"Fire Blast — instant fire damage, off-GCD trigger.");
|
||||
add(109, "MageBtn9_ConjureWater", 9, 5504,
|
||||
"Conjure Water — create mana-restoring water stack.");
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeActionBar WoweeActionBarLoader::makeHunterPet(
|
||||
const std::string& catalogName) {
|
||||
using A = WoweeActionBar;
|
||||
WoweeActionBar c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint8_t slot,
|
||||
uint32_t spell, const char* desc) {
|
||||
A::Entry e;
|
||||
e.bindingId = id; e.name = name; e.description = desc;
|
||||
e.classMask = CLS_HUNTER;
|
||||
e.spellId = spell;
|
||||
e.buttonSlot = slot;
|
||||
// Pet bar — separate from main bar.
|
||||
e.barMode = A::Pet;
|
||||
e.iconColorRGBA = packRgba(100, 200, 100); // pet green
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
// Hunter pet bar — 10 standard slots on the dedicated
|
||||
// Pet bar mode (slots 0-9).
|
||||
add(200, "PetBtn0_Attack", 0, 2649,
|
||||
"Attack — sic pet on current target.");
|
||||
add(201, "PetBtn1_Follow", 1, 23110,
|
||||
"Follow — recall pet to stand behind owner.");
|
||||
add(202, "PetBtn2_Stay", 2, 6991,
|
||||
"Stay — hold position, no auto-attack.");
|
||||
add(203, "PetBtn3_Aggressive", 3, 2106,
|
||||
"Aggressive stance — auto-engage nearby hostiles.");
|
||||
add(204, "PetBtn4_Defensive", 4, 2104,
|
||||
"Defensive stance — retaliate when hit.");
|
||||
add(205, "PetBtn5_Passive", 5, 2105,
|
||||
"Passive stance — never auto-engage.");
|
||||
add(206, "PetBtn6_Bite", 6, 17253,
|
||||
"Bite — pet's primary damage ability.");
|
||||
add(207, "PetBtn7_Claw", 7, 16827,
|
||||
"Claw — alt damage ability for cat/raptor families.");
|
||||
add(208, "PetBtn8_Growl", 8, 2649,
|
||||
"Growl — pet's taunt ability.");
|
||||
add(209, "PetBtn9_DismissPet", 9, 2641,
|
||||
"Dismiss Pet — return active pet to the stable.");
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
254
tools/editor/cli_action_bars_catalog.cpp
Normal file
254
tools/editor/cli_action_bars_catalog.cpp
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
#include "cli_action_bars_catalog.hpp"
|
||||
#include "cli_arg_parse.hpp"
|
||||
#include "cli_box_emitter.hpp"
|
||||
|
||||
#include "pipeline/wowee_action_bars.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <cctype>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
namespace {
|
||||
|
||||
std::string stripWactExt(std::string base) {
|
||||
stripExt(base, ".wact");
|
||||
return base;
|
||||
}
|
||||
|
||||
bool saveOrError(const wowee::pipeline::WoweeActionBar& c,
|
||||
const std::string& base, const char* cmd) {
|
||||
if (!wowee::pipeline::WoweeActionBarLoader::save(c, base)) {
|
||||
std::fprintf(stderr, "%s: failed to save %s.wact\n",
|
||||
cmd, base.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void printGenSummary(const wowee::pipeline::WoweeActionBar& c,
|
||||
const std::string& base) {
|
||||
std::printf("Wrote %s.wact\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" bindings : %zu\n", c.entries.size());
|
||||
}
|
||||
|
||||
int handleGenWarrior(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "WarriorActionBar";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWactExt(base);
|
||||
auto c = wowee::pipeline::WoweeActionBarLoader::makeWarrior(name);
|
||||
if (!saveOrError(c, base, "gen-act")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenMage(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "MageActionBar";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWactExt(base);
|
||||
auto c = wowee::pipeline::WoweeActionBarLoader::makeMage(name);
|
||||
if (!saveOrError(c, base, "gen-act-mage")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenHunterPet(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "HunterPetBar";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWactExt(base);
|
||||
auto c = wowee::pipeline::WoweeActionBarLoader::makeHunterPet(name);
|
||||
if (!saveOrError(c, base, "gen-act-pet")) 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 = stripWactExt(base);
|
||||
if (!wowee::pipeline::WoweeActionBarLoader::exists(base)) {
|
||||
std::fprintf(stderr, "WACT not found: %s.wact\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeActionBarLoader::load(base);
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wact"] = base + ".wact";
|
||||
j["name"] = c.name;
|
||||
j["count"] = c.entries.size();
|
||||
nlohmann::json arr = nlohmann::json::array();
|
||||
for (const auto& e : c.entries) {
|
||||
arr.push_back({
|
||||
{"bindingId", e.bindingId},
|
||||
{"name", e.name},
|
||||
{"description", e.description},
|
||||
{"classMask", e.classMask},
|
||||
{"spellId", e.spellId},
|
||||
{"itemId", e.itemId},
|
||||
{"buttonSlot", e.buttonSlot},
|
||||
{"barMode", e.barMode},
|
||||
{"barModeName", wowee::pipeline::WoweeActionBar::barModeName(e.barMode)},
|
||||
{"iconColorRGBA", e.iconColorRGBA},
|
||||
});
|
||||
}
|
||||
j["entries"] = arr;
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return 0;
|
||||
}
|
||||
std::printf("WACT: %s.wact\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" bindings : %zu\n", c.entries.size());
|
||||
if (c.entries.empty()) return 0;
|
||||
std::printf(" id classMask bar slot spellId itemId name\n");
|
||||
for (const auto& e : c.entries) {
|
||||
std::printf(" %4u 0x%08x %-8s %3u %5u %5u %s\n",
|
||||
e.bindingId, e.classMask,
|
||||
wowee::pipeline::WoweeActionBar::barModeName(e.barMode),
|
||||
e.buttonSlot, e.spellId, e.itemId,
|
||||
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 = stripWactExt(base);
|
||||
if (!wowee::pipeline::WoweeActionBarLoader::exists(base)) {
|
||||
std::fprintf(stderr,
|
||||
"validate-wact: WACT not found: %s.wact\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeActionBarLoader::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.bindingId);
|
||||
if (!e.name.empty()) ctx += " " + e.name;
|
||||
ctx += ")";
|
||||
if (e.bindingId == 0)
|
||||
errors.push_back(ctx + ": bindingId is 0");
|
||||
if (e.name.empty())
|
||||
errors.push_back(ctx + ": name is empty");
|
||||
if (e.classMask == 0)
|
||||
errors.push_back(ctx +
|
||||
": classMask is 0 — no class can use this binding");
|
||||
if (e.barMode > wowee::pipeline::WoweeActionBar::Custom) {
|
||||
errors.push_back(ctx + ": barMode " +
|
||||
std::to_string(e.barMode) + " not in 0..6");
|
||||
}
|
||||
if (e.buttonSlot > 143) {
|
||||
warnings.push_back(ctx +
|
||||
": buttonSlot " + std::to_string(e.buttonSlot) +
|
||||
" > 143 (12 bars × 12 slots = 144 max)");
|
||||
}
|
||||
// Both spellId and itemId set is contradictory.
|
||||
if (e.spellId != 0 && e.itemId != 0) {
|
||||
warnings.push_back(ctx +
|
||||
": both spellId and itemId set — engine prefers "
|
||||
"spellId; itemId is ignored");
|
||||
}
|
||||
// Neither set means an empty button.
|
||||
if (e.spellId == 0 && e.itemId == 0) {
|
||||
warnings.push_back(ctx +
|
||||
": both spellId=0 and itemId=0 — button will be empty");
|
||||
}
|
||||
for (uint32_t prev : idsSeen) {
|
||||
if (prev == e.bindingId) {
|
||||
errors.push_back(ctx + ": duplicate bindingId");
|
||||
break;
|
||||
}
|
||||
}
|
||||
idsSeen.push_back(e.bindingId);
|
||||
}
|
||||
// Cross-entry: detect (classMask, barMode, buttonSlot)
|
||||
// collisions where overlapping classes would fight for
|
||||
// the same physical slot.
|
||||
for (size_t a = 0; a < c.entries.size(); ++a) {
|
||||
for (size_t b = a + 1; b < c.entries.size(); ++b) {
|
||||
const auto& ea = c.entries[a];
|
||||
const auto& eb = c.entries[b];
|
||||
if (ea.barMode != eb.barMode) continue;
|
||||
if (ea.buttonSlot != eb.buttonSlot) continue;
|
||||
if ((ea.classMask & eb.classMask) == 0) continue;
|
||||
warnings.push_back(
|
||||
"entries " + std::to_string(a) + " (" +
|
||||
ea.name + ") and " + std::to_string(b) + " (" +
|
||||
eb.name + ") share " +
|
||||
wowee::pipeline::WoweeActionBar::barModeName(ea.barMode) +
|
||||
" bar slot " + std::to_string(ea.buttonSlot) +
|
||||
" for overlapping classMask — slot collision");
|
||||
}
|
||||
}
|
||||
bool ok = errors.empty();
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wact"] = base + ".wact";
|
||||
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-wact: %s.wact\n", base.c_str());
|
||||
if (ok && warnings.empty()) {
|
||||
std::printf(" OK — %zu bindings, all bindingIds unique, no slot collisions\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 handleActionBarsCatalog(int& i, int argc, char** argv,
|
||||
int& outRc) {
|
||||
if (std::strcmp(argv[i], "--gen-act") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenWarrior(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-act-mage") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenMage(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-act-pet") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenHunterPet(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--info-wact") == 0 && i + 1 < argc) {
|
||||
outRc = handleInfo(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--validate-wact") == 0 && i + 1 < argc) {
|
||||
outRc = handleValidate(i, argc, argv); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
12
tools/editor/cli_action_bars_catalog.hpp
Normal file
12
tools/editor/cli_action_bars_catalog.hpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
bool handleActionBarsCatalog(int& i, int argc, char** argv,
|
||||
int& outRc);
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
|
|
@ -291,6 +291,8 @@ const char* const kArgRequired[] = {
|
|||
"--gen-stm", "--gen-stm-regen", "--gen-stm-armor",
|
||||
"--info-wstm", "--validate-wstm",
|
||||
"--export-wstm-json", "--import-wstm-json",
|
||||
"--gen-act", "--gen-act-mage", "--gen-act-pet",
|
||||
"--info-wact", "--validate-wact",
|
||||
"--gen-weather-temperate", "--gen-weather-arctic",
|
||||
"--gen-weather-desert", "--gen-weather-stormy",
|
||||
"--gen-zone-atmosphere",
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@
|
|||
#include "cli_instance_lockouts_catalog.hpp"
|
||||
#include "cli_stable_slots_catalog.hpp"
|
||||
#include "cli_stat_curves_catalog.hpp"
|
||||
#include "cli_action_bars_catalog.hpp"
|
||||
#include "cli_quest_objective.hpp"
|
||||
#include "cli_quest_reward.hpp"
|
||||
#include "cli_clone.hpp"
|
||||
|
|
@ -319,6 +320,7 @@ constexpr DispatchFn kDispatchTable[] = {
|
|||
handleInstanceLockoutsCatalog,
|
||||
handleStableSlotsCatalog,
|
||||
handleStatCurvesCatalog,
|
||||
handleActionBarsCatalog,
|
||||
handleQuestObjective,
|
||||
handleQuestReward,
|
||||
handleClone,
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ constexpr FormatMagicEntry kFormats[] = {
|
|||
{{'W','H','L','D'}, ".whld", "raid", "--info-whld", "Instance lockout schedule catalog"},
|
||||
{{'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','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"},
|
||||
|
|
|
|||
|
|
@ -2083,6 +2083,16 @@ void printUsage(const char* argv0) {
|
|||
std::printf(" Export binary .wstm to a human-editable JSON sidecar (defaults to <base>.wstm.json)\n");
|
||||
std::printf(" --import-wstm-json <json-path> [out-base]\n");
|
||||
std::printf(" Import a .wstm.json sidecar back into binary .wstm (accepts curveKind int OR curveKindName string)\n");
|
||||
std::printf(" --gen-act <wact-base> [name]\n");
|
||||
std::printf(" Emit .wact 10 Warrior starter bindings on Main bar (Heroic Strike / Charge / Rend / Thunder Clap / Battle Shout / Sunder Armor / Mocking Blow / Hamstring / Overpower / Victory Rush)\n");
|
||||
std::printf(" --gen-act-mage <wact-base> [name]\n");
|
||||
std::printf(" Emit .wact 10 Mage starter bindings on Main bar (Fireball / Frostbolt / Frost Nova / Polymorph / Mage Armor / Arcane Intellect / Counterspell / Blink / Fire Blast / Conjure Water)\n");
|
||||
std::printf(" --gen-act-pet <wact-base> [name]\n");
|
||||
std::printf(" Emit .wact 10 Hunter pet-bar bindings on Pet bar mode (Attack / Follow / Stay / Aggressive / Defensive / Passive / Bite / Claw / Growl / Dismiss)\n");
|
||||
std::printf(" --info-wact <wact-base> [--json]\n");
|
||||
std::printf(" Print WACT entries (id / classMask / barMode / buttonSlot / spellId / itemId / name)\n");
|
||||
std::printf(" --validate-wact <wact-base> [--json]\n");
|
||||
std::printf(" Static checks: id+name+classMask required, barMode 0..6, no duplicate ids; warns on slot>143, both spellId+itemId set, both 0 (empty button), and (classMask+barMode+slot) collisions for overlapping classes\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");
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ constexpr FormatRow kFormats[] = {
|
|||
{"WHLD", ".whld", "raid", "InstanceTemplate.dbc reset fields","Instance lockout schedule catalog"},
|
||||
{"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"},
|
||||
|
||||
// Additional pipeline catalogs without the alternating
|
||||
// gen/info/validate CLI surface (loaded by the engine
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue