mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: fire UNIT_FACTION event when unit faction template changes
Fire UNIT_FACTION for player/target/focus when UNIT_FIELD_FACTIONTEMPLATE updates. Covers PvP flag toggling, mind control faction swaps, and any server-side faction changes. Used by nameplate addons to update hostility coloring and by PvP addons tracking faction state.
This commit is contained in:
parent
2c6a345e32
commit
e7be60c624
1 changed files with 11 additions and 1 deletions
|
|
@ -11904,7 +11904,17 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
||||||
} else if (key == ufMaxHealth) { unit->setMaxHealth(val); }
|
} else if (key == ufMaxHealth) { unit->setMaxHealth(val); }
|
||||||
else if (key == ufLevel) {
|
else if (key == ufLevel) {
|
||||||
unit->setLevel(val);
|
unit->setLevel(val);
|
||||||
} else if (key == ufFaction) { unit->setFactionTemplate(val); }
|
} else if (key == ufFaction) {
|
||||||
|
unit->setFactionTemplate(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_FACTION", {uid});
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (key == ufFlags) { unit->setUnitFlags(val); }
|
else if (key == ufFlags) { unit->setUnitFlags(val); }
|
||||||
else if (key == ufBytes0) {
|
else if (key == ufBytes0) {
|
||||||
unit->setPowerType(static_cast<uint8_t>((val >> 24) & 0xFF));
|
unit->setPowerType(static_cast<uint8_t>((val >> 24) & 0xFF));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue