feat: fire UNIT_FLAGS event when unit flags change

Fire UNIT_FLAGS for player/target/focus when UNIT_FIELD_FLAGS updates.
Covers PvP flag, combat state, silenced, disarmed, and other flag
changes. Used by nameplate addons for PvP indicators and by unit frame
addons tracking CC/silence state.
This commit is contained in:
Kelsi 2026-03-21 08:22:52 -07:00
parent e7be60c624
commit 82990f5891

View file

@ -11915,7 +11915,17 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
addonEventCallback_("UNIT_FACTION", {uid});
}
}
else if (key == ufFlags) { unit->setUnitFlags(val); }
else if (key == ufFlags) {
unit->setUnitFlags(val);
if (addonEventCallback_) {
std::string uid;
if (block.guid == playerGuid) uid = "player";
else if (block.guid == targetGuid) uid = "target";
else if (block.guid == focusGuid) uid = "focus";
if (!uid.empty())
addonEventCallback_("UNIT_FLAGS", {uid});
}
}
else if (key == ufBytes0) {
unit->setPowerType(static_cast<uint8_t>((val >> 24) & 0xFF));
} else if (key == ufDisplayId) {