From d75f2c62e557bb501127fb7dbef98156cbd980e8 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sat, 21 Mar 2026 02:26:44 -0700 Subject: [PATCH] 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. --- src/game/game_handler.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 00b6ac48..3832eb39 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -2160,6 +2160,14 @@ void GameHandler::handlePacket(network::Packet& packet) { if (auto* unit = dynamic_cast(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(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; }