mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-26 00:40:15 +00:00
feat: fire UNIT_DISPLAYPOWER when unit power type changes
When a unit's power type changes (e.g., druid shifting from mana to rage in bear form, or warrior switching stances), fire UNIT_DISPLAYPOWER so unit frame addons can switch the power bar display (mana blue bar → rage red bar). Detected via UNIT_FIELD_BYTES_0 byte 3 changes in the VALUES update path.
This commit is contained in:
parent
92a1e9b0c3
commit
81180086e3
1 changed files with 10 additions and 0 deletions
|
|
@ -12546,7 +12546,17 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
|||
// (Classic packs maxHealth/level/faction adjacent to power indices)
|
||||
} else if (key == ufMaxHealth) { unit->setMaxHealth(val); healthChanged = true; }
|
||||
else if (key == ufBytes0) {
|
||||
uint8_t oldPT = unit->getPowerType();
|
||||
unit->setPowerType(static_cast<uint8_t>((val >> 24) & 0xFF));
|
||||
if (unit->getPowerType() != oldPT && addonEventCallback_) {
|
||||
std::string uid;
|
||||
if (block.guid == playerGuid) uid = "player";
|
||||
else if (block.guid == targetGuid) uid = "target";
|
||||
else if (block.guid == focusGuid) uid = "focus";
|
||||
else if (block.guid == petGuid_) uid = "pet";
|
||||
if (!uid.empty())
|
||||
addonEventCallback_("UNIT_DISPLAYPOWER", {uid});
|
||||
}
|
||||
} else if (key == ufFlags) { unit->setUnitFlags(val); }
|
||||
else if (key == ufDynFlags) {
|
||||
uint32_t oldDyn = unit->getDynamicFlags();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue