fix: include pet unit ID in UNIT_HEALTH/POWER events from dedicated packets

SMSG_HEALTH_UPDATE and SMSG_POWER_UPDATE were not checking for the pet
GUID when dispatching addon events. Pet health/power bar addons now
properly receive UNIT_HEALTH and UNIT_POWER with unitId="pet".

The UPDATE_OBJECT and UNIT_AURA paths already had the pet check.
This commit is contained in:
Kelsi 2026-03-21 06:23:03 -07:00
parent b04e36aaa4
commit 5ab6286f7e

View file

@ -2165,6 +2165,7 @@ void GameHandler::handlePacket(network::Packet& packet) {
if (guid == playerGuid) unitId = "player"; if (guid == playerGuid) unitId = "player";
else if (guid == targetGuid) unitId = "target"; else if (guid == targetGuid) unitId = "target";
else if (guid == focusGuid) unitId = "focus"; else if (guid == focusGuid) unitId = "focus";
else if (guid == petGuid_) unitId = "pet";
if (!unitId.empty()) if (!unitId.empty())
addonEventCallback_("UNIT_HEALTH", {unitId}); addonEventCallback_("UNIT_HEALTH", {unitId});
} }
@ -2190,6 +2191,7 @@ void GameHandler::handlePacket(network::Packet& packet) {
if (guid == playerGuid) unitId = "player"; if (guid == playerGuid) unitId = "player";
else if (guid == targetGuid) unitId = "target"; else if (guid == targetGuid) unitId = "target";
else if (guid == focusGuid) unitId = "focus"; else if (guid == focusGuid) unitId = "focus";
else if (guid == petGuid_) unitId = "pet";
if (!unitId.empty()) if (!unitId.empty())
addonEventCallback_("UNIT_POWER", {unitId}); addonEventCallback_("UNIT_POWER", {unitId});
} }