mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: fire PET_BAR_UPDATE event when pet action bar changes
Fire PET_BAR_UPDATE when: - Pet is summoned (SMSG_PET_SPELLS with new spell list) - Pet learns a new spell (SMSG_PET_LEARNED_SPELL) Used by pet action bar addons to refresh their display when the pet's available abilities change.
This commit is contained in:
parent
6ab1a189c7
commit
c6a6849c86
1 changed files with 5 additions and 1 deletions
|
|
@ -7993,6 +7993,7 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
||||||
const std::string& sname = getSpellName(spellId);
|
const std::string& sname = getSpellName(spellId);
|
||||||
addSystemChatMessage("Your pet has learned " + (sname.empty() ? "a new ability." : sname + "."));
|
addSystemChatMessage("Your pet has learned " + (sname.empty() ? "a new ability." : sname + "."));
|
||||||
LOG_DEBUG("SMSG_PET_LEARNED_SPELL: spellId=", spellId);
|
LOG_DEBUG("SMSG_PET_LEARNED_SPELL: spellId=", spellId);
|
||||||
|
if (addonEventCallback_) addonEventCallback_("PET_BAR_UPDATE", {});
|
||||||
}
|
}
|
||||||
packet.setReadPos(packet.getSize());
|
packet.setReadPos(packet.getSize());
|
||||||
break;
|
break;
|
||||||
|
|
@ -19017,7 +19018,10 @@ done:
|
||||||
LOG_INFO("SMSG_PET_SPELLS: petGuid=0x", std::hex, petGuid_, std::dec,
|
LOG_INFO("SMSG_PET_SPELLS: petGuid=0x", std::hex, petGuid_, std::dec,
|
||||||
" react=", (int)petReact_, " command=", (int)petCommand_,
|
" react=", (int)petReact_, " command=", (int)petCommand_,
|
||||||
" spells=", petSpellList_.size());
|
" spells=", petSpellList_.size());
|
||||||
if (addonEventCallback_) addonEventCallback_("UNIT_PET", {"player"});
|
if (addonEventCallback_) {
|
||||||
|
addonEventCallback_("UNIT_PET", {"player"});
|
||||||
|
addonEventCallback_("PET_BAR_UPDATE", {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameHandler::sendPetAction(uint32_t action, uint64_t targetGuid) {
|
void GameHandler::sendPetAction(uint32_t action, uint64_t targetGuid) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue