feat: implement client-side macro text storage and execution

Macros in WoW are client-side — the server sends only a macro index via
SMSG_ACTION_BUTTONS, never the text. This commit adds local storage and
a UI so macro slots are actually usable.

- GameHandler: getMacroText/setMacroText accessors backed by macros_ map;
  text is persisted to the character .cfg file as macro_N_text= entries
- Action bar left-click: MACRO slot executes first line of macro text as
  a chat/slash command (same path as /cast, /use, etc.)
- Context menu: "Execute" and "Edit" items for MACRO slots; "Edit" opens
  a multiline modal editor (320×80 px, up to 255 chars) with Save/Cancel
- Tooltip: shows macro text body below the index; hints "right-click to
  Edit" when no text is set yet
This commit is contained in:
Kelsi 2026-03-18 02:07:59 -07:00
parent 1588c1029a
commit 2c86fb4fa6
4 changed files with 96 additions and 0 deletions

View file

@ -885,6 +885,10 @@ public:
const std::array<ActionBarSlot, ACTION_BAR_SLOTS>& getActionBar() const { return actionBar; }
void setActionBarSlot(int slot, ActionBarSlot::Type type, uint32_t id);
// Client-side macro text storage (server sends only macro index; text is stored locally)
const std::string& getMacroText(uint32_t macroId) const;
void setMacroText(uint32_t macroId, const std::string& text);
void saveCharacterConfig();
void loadCharacterConfig();
static std::string getCharacterConfigDir();
@ -2759,6 +2763,7 @@ private:
float castTimeTotal = 0.0f;
std::array<ActionBarSlot, ACTION_BAR_SLOTS> actionBar{};
std::unordered_map<uint32_t, std::string> macros_; // client-side macro text (persisted in char config)
std::vector<AuraSlot> playerAuras;
std::vector<AuraSlot> targetAuras;
std::unordered_map<uint64_t, std::vector<AuraSlot>> unitAurasCache_; // per-unit aura cache