feat(Core/Hooks): Add OnPlayerJustDied hook (#17973)

feat(Core/Hooks): Add OnPlayerJustDied
This commit is contained in:
avarishd
2023-12-11 00:06:23 +02:00
committed by GitHub
parent af03611faf
commit f476c8a6c9
4 changed files with 14 additions and 0 deletions

View File

@@ -4484,6 +4484,7 @@ void Player::KillPlayer()
if (corpseReclaimDelay >= 0)
SendCorpseReclaimDelay(corpseReclaimDelay);
sScriptMgr->OnPlayerJustDied(this);
// don't create corpse at this moment, player might be falling
// update visibility

View File

@@ -67,6 +67,14 @@ void ScriptMgr::OnBattlegroundDesertion(Player* player, BattlegroundDesertionTyp
});
}
void ScriptMgr::OnPlayerJustDied(Player* player)
{
ExecuteScript<PlayerScript>([&](PlayerScript* script)
{
script->OnPlayerJustDied(player);
});
}
void ScriptMgr::OnPlayerReleasedGhost(Player* player)
{
ExecuteScript<PlayerScript>([&](PlayerScript* script)

View File

@@ -29,6 +29,10 @@ protected:
PlayerScript(const char* name);
public:
// Called when a player dies
virtual void OnPlayerJustDied(Player* /*player*/) { }
// Called when clicking the release button
virtual void OnPlayerReleasedGhost(Player* /*player*/) { }
// Called on Send Initial Packets Before Add To Map

View File

@@ -297,6 +297,7 @@ public: /* PlayerScript */
void OnBeforePlayerUpdate(Player* player, uint32 p_time);
void OnPlayerUpdate(Player* player, uint32 p_time);
void OnSendInitialPacketsBeforeAddToMap(Player* player, WorldPacket& data);
void OnPlayerJustDied(Player* player);
void OnPlayerReleasedGhost(Player* player);
void OnPVPKill(Player* killer, Player* killed);
void OnPlayerPVPFlagChange(Player* player, bool state);