From d00ebd00a03f19e374bb4a8ef382787c322adb7c Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 22 Mar 2026 17:33:22 -0700 Subject: [PATCH] fix: fire PLAYER_DEAD, PLAYER_ALIVE, and PLAYER_UNGHOST death events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PLAYER_DEAD only fired from SMSG_FORCED_DEATH_UPDATE (GM kill) — the normal death path (health dropping to 0 via VALUES update) never fired it. Death-related addons and the default release spirit dialog depend on this event. Also add PLAYER_ALIVE (fires when resurrected without having been a ghost) and PLAYER_UNGHOST (fires when player rezzes from ghost form) at the health-restored-from-zero VALUES path. These events control the transition from ghost form back to alive, letting addons restore normal UI state after death. --- src/game/game_handler.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 92589e5c..ed340c21 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -12515,6 +12515,8 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem LOG_INFO("Player died! Corpse position cached at server=(", corpseX_, ",", corpseY_, ",", corpseZ_, ") map=", corpseMapId_); + if (addonEventCallback_) + addonEventCallback_("PLAYER_DEAD", {}); } if ((entity->getType() == ObjectType::UNIT || entity->getType() == ObjectType::PLAYER) && npcDeathCallback_) { npcDeathCallback_(block.guid); @@ -12522,11 +12524,17 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem } } else if (oldHealth == 0 && val > 0) { if (block.guid == playerGuid) { + bool wasGhost = releasedSpirit_; playerDead_ = false; - if (!releasedSpirit_) { + if (!wasGhost) { LOG_INFO("Player resurrected!"); + if (addonEventCallback_) + addonEventCallback_("PLAYER_ALIVE", {}); } else { LOG_INFO("Player entered ghost form"); + releasedSpirit_ = false; + if (addonEventCallback_) + addonEventCallback_("PLAYER_UNGHOST", {}); } } if ((entity->getType() == ObjectType::UNIT || entity->getType() == ObjectType::PLAYER) && npcRespawnCallback_) {