mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 08:30:13 +00:00
fix: fire PLAYER_DEAD, PLAYER_ALIVE, and PLAYER_UNGHOST death events
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.
This commit is contained in:
parent
2a2db5cfb5
commit
d00ebd00a0
1 changed files with 9 additions and 1 deletions
|
|
@ -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_) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue