From 661fba12c07bf0d39a904ed57a303a909cca8016 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 22 Mar 2026 18:53:11 -0700 Subject: [PATCH] feat: fire ACTIONBAR_UPDATE_USABLE on player power changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the player's mana/rage/energy changes, action bar addons need ACTIONBAR_UPDATE_USABLE to update button dimming (grey out abilities the player can't afford). Now fires from both the SMSG_POWER_UPDATE handler and the SMSG_UPDATE_OBJECT VALUES power field change path. Without this event, action bar buttons showed as usable even when the player ran out of mana — the usability state only refreshed on spell cast attempts, not on power changes. --- src/game/game_handler.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index d984e6cf..e04ee3b4 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -2199,8 +2199,11 @@ void GameHandler::handlePacket(network::Packet& packet) { else if (guid == targetGuid) unitId = "target"; else if (guid == focusGuid) unitId = "focus"; else if (guid == petGuid_) unitId = "pet"; - if (!unitId.empty()) + if (!unitId.empty()) { addonEventCallback_("UNIT_POWER", {unitId}); + if (guid == playerGuid) + addonEventCallback_("ACTIONBAR_UPDATE_USABLE", {}); + } } break; } @@ -12675,7 +12678,12 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem else if (block.guid == petGuid_) unitId = "pet"; if (!unitId.empty()) { if (healthChanged) addonEventCallback_("UNIT_HEALTH", {unitId}); - if (powerChanged) addonEventCallback_("UNIT_POWER", {unitId}); + if (powerChanged) { + addonEventCallback_("UNIT_POWER", {unitId}); + // When player power changes, action bar usability may change + if (block.guid == playerGuid) + addonEventCallback_("ACTIONBAR_UPDATE_USABLE", {}); + } } }