mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
fix: remove dead duplicate ufNpcFlags check and add missing UNIT_MODEL_CHANGED events
In the CREATE update block, the ufNpcFlags check at the end of the else-if chain was unreachable dead code — it was already handled earlier in the same chain. Remove the duplicate. In the VALUES update block, mount display changes via field updates fired mountCallback_ but not the UNIT_MODEL_CHANGED addon event, unlike the CREATE path which fired both. Add the missing event so Lua addons are notified when the player mounts/dismounts via VALUES updates (the common case for aura-based mounting). Also fire UNIT_MODEL_CHANGED for target/focus/pet display ID changes in the VALUES displayIdChanged path, matching the CREATE path behavior.
This commit is contained in:
parent
cbdf03c07e
commit
31ab76427f
1 changed files with 12 additions and 1 deletions
|
|
@ -12039,7 +12039,7 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
|||
}
|
||||
}
|
||||
unit->setMountDisplayId(val);
|
||||
} else if (key == ufNpcFlags) { unit->setNpcFlags(val); }
|
||||
}
|
||||
}
|
||||
if (block.guid == playerGuid) {
|
||||
constexpr uint32_t UNIT_FLAG_TAXI_FLIGHT = 0x00000100;
|
||||
|
|
@ -12587,6 +12587,8 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
|||
uint32_t old = currentMountDisplayId_;
|
||||
currentMountDisplayId_ = val;
|
||||
if (val != old && mountCallback_) mountCallback_(val);
|
||||
if (val != old && addonEventCallback_)
|
||||
addonEventCallback_("UNIT_MODEL_CHANGED", {"player"});
|
||||
if (old == 0 && val != 0) {
|
||||
mountAuraSpellId_ = 0;
|
||||
for (const auto& a : playerAuras) {
|
||||
|
|
@ -12732,6 +12734,15 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
|||
qsPkt.writeUInt64(block.guid);
|
||||
socket->send(qsPkt);
|
||||
}
|
||||
// Fire UNIT_MODEL_CHANGED for addons that track model swaps
|
||||
if (addonEventCallback_) {
|
||||
std::string uid;
|
||||
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});
|
||||
}
|
||||
}
|
||||
}
|
||||
// Update XP / inventory slot / skill fields for player entity
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue