mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: fire UNIT_HEALTH/UNIT_POWER events from dedicated update packets
SMSG_HEALTH_UPDATE and SMSG_POWER_UPDATE are high-frequency WotLK packets that update entity health/power values but weren't firing addon events. Unit frame addons (Pitbull, oUF, SUF) depend on these events to update health/mana bars in real-time. Now fire UNIT_HEALTH for player/target/focus on SMSG_HEALTH_UPDATE and UNIT_POWER on SMSG_POWER_UPDATE, matching the events already fired from the UPDATE_OBJECT path.
This commit is contained in:
parent
55ef607093
commit
d75f2c62e5
1 changed files with 16 additions and 0 deletions
|
|
@ -2160,6 +2160,14 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
if (auto* unit = dynamic_cast<Unit*>(entity.get())) {
|
||||
unit->setHealth(hp);
|
||||
}
|
||||
if (addonEventCallback_ && guid != 0) {
|
||||
std::string unitId;
|
||||
if (guid == playerGuid) unitId = "player";
|
||||
else if (guid == targetGuid) unitId = "target";
|
||||
else if (guid == focusGuid) unitId = "focus";
|
||||
if (!unitId.empty())
|
||||
addonEventCallback_("UNIT_HEALTH", {unitId});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Opcode::SMSG_POWER_UPDATE: {
|
||||
|
|
@ -2177,6 +2185,14 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
if (auto* unit = dynamic_cast<Unit*>(entity.get())) {
|
||||
unit->setPowerByType(powerType, value);
|
||||
}
|
||||
if (addonEventCallback_ && guid != 0) {
|
||||
std::string unitId;
|
||||
if (guid == playerGuid) unitId = "player";
|
||||
else if (guid == targetGuid) unitId = "target";
|
||||
else if (guid == focusGuid) unitId = "focus";
|
||||
if (!unitId.empty())
|
||||
addonEventCallback_("UNIT_POWER", {unitId});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue