feat: fire SPELL_UPDATE_USABLE alongside ACTIONBAR_UPDATE_USABLE

Some addons register for SPELL_UPDATE_USABLE instead of
ACTIONBAR_UPDATE_USABLE to detect when spell usability changes
due to power fluctuations. Fire both events together when the
player's mana/rage/energy changes.
This commit is contained in:
Kelsi 2026-03-22 19:00:34 -07:00
parent 661fba12c0
commit 491dd2b673

View file

@ -2201,8 +2201,10 @@ void GameHandler::handlePacket(network::Packet& packet) {
else if (guid == petGuid_) unitId = "pet";
if (!unitId.empty()) {
addonEventCallback_("UNIT_POWER", {unitId});
if (guid == playerGuid)
if (guid == playerGuid) {
addonEventCallback_("ACTIONBAR_UPDATE_USABLE", {});
addonEventCallback_("SPELL_UPDATE_USABLE", {});
}
}
}
break;
@ -12681,8 +12683,10 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
if (powerChanged) {
addonEventCallback_("UNIT_POWER", {unitId});
// When player power changes, action bar usability may change
if (block.guid == playerGuid)
if (block.guid == playerGuid) {
addonEventCallback_("ACTIONBAR_UPDATE_USABLE", {});
addonEventCallback_("SPELL_UPDATE_USABLE", {});
}
}
}
}