feat: fire UNIT_MODEL_CHANGED event when unit display model changes

Fire UNIT_MODEL_CHANGED for player/target/focus/pet when their
UNIT_FIELD_DISPLAYID update field changes. This covers polymorph,
mount display changes, shapeshifting, and model swaps.

Used by unit frame addons that display 3D portraits and by nameplate
addons that track model state changes.
This commit is contained in:
Kelsi 2026-03-21 08:13:47 -07:00
parent a4d54e83bc
commit 2c6a345e32

View file

@ -11908,7 +11908,18 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
else if (key == ufFlags) { unit->setUnitFlags(val); }
else if (key == ufBytes0) {
unit->setPowerType(static_cast<uint8_t>((val >> 24) & 0xFF));
} else if (key == ufDisplayId) { unit->setDisplayId(val); }
} else if (key == ufDisplayId) {
unit->setDisplayId(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";
else if (block.guid == petGuid_) uid = "pet";
if (!uid.empty())
addonEventCallback_("UNIT_MODEL_CHANGED", {uid});
}
}
else if (key == ufNpcFlags) { unit->setNpcFlags(val); }
else if (key == ufDynFlags) {
unit->setDynamicFlags(val);