feat: fire UNIT_PET event when pet is summoned, dismissed, or dies

Fire UNIT_PET with "player" as arg from SMSG_PET_SPELLS when:
- Pet is cleared (dismissed/dies) — both size-based and guid=0 paths
- Pet is summoned (new pet GUID received with spell list)

Used by pet frame addons and unit frame addons to show/hide pet
frames and update pet action bars when pet state changes.
This commit is contained in:
Kelsi 2026-03-21 06:27:55 -07:00
parent 5ab6286f7e
commit b3ad64099b

View file

@ -18936,6 +18936,7 @@ void GameHandler::handlePetSpells(network::Packet& packet) {
petAutocastSpells_.clear();
memset(petActionSlots_, 0, sizeof(petActionSlots_));
LOG_INFO("SMSG_PET_SPELLS: pet cleared");
if (addonEventCallback_) addonEventCallback_("UNIT_PET", {"player"});
return;
}
@ -18945,6 +18946,7 @@ void GameHandler::handlePetSpells(network::Packet& packet) {
petAutocastSpells_.clear();
memset(petActionSlots_, 0, sizeof(petActionSlots_));
LOG_INFO("SMSG_PET_SPELLS: pet cleared (guid=0)");
if (addonEventCallback_) addonEventCallback_("UNIT_PET", {"player"});
return;
}
@ -18986,6 +18988,7 @@ done:
LOG_INFO("SMSG_PET_SPELLS: petGuid=0x", std::hex, petGuid_, std::dec,
" react=", (int)petReact_, " command=", (int)petCommand_,
" spells=", petSpellList_.size());
if (addonEventCallback_) addonEventCallback_("UNIT_PET", {"player"});
}
void GameHandler::sendPetAction(uint32_t action, uint64_t targetGuid) {