From 3332ed72a6940d34413ca83bfebed00349b875c1 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sat, 21 Aug 2010 13:19:24 +0200 Subject: [PATCH] [10393] Add script call for InstanceData, OnPlayerDeath Called when a player really dies and also unrelated to the source of the death (for example a player can die indirectly from some mob ability, but must be registered. Achievements, other special events) Signed-off-by: NoFantasy --- src/game/InstanceData.h | 3 +++ src/game/Player.cpp | 6 ++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/game/InstanceData.h b/src/game/InstanceData.h index d45f8c99c..f3e68efcc 100644 --- a/src/game/InstanceData.h +++ b/src/game/InstanceData.h @@ -57,6 +57,9 @@ class MANGOS_DLL_SPEC InstanceData //Called when a player successfully enters the instance (after really added to map) virtual void OnPlayerEnter(Player *) {} + //Called when a player dies inside instance + virtual void OnPlayerDeath(Player *) {} + //Called when a player leaves the instance (before really removed from map (or possibly world)) virtual void OnPlayerLeave(Player *) {} diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 398948287..261394b34 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -37,6 +37,7 @@ #include "MapManager.h" #include "MapInstanced.h" #include "InstanceSaveMgr.h" +#include "InstanceData.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" @@ -1508,10 +1509,15 @@ void Player::setDeathState(DeathState s) // passive spell if(!ressSpellId) ressSpellId = GetResurrectionSpellId(); + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP, 1); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH, 1); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON, 1); + + if (InstanceData* mapInstance = this->GetInstanceData()) + mapInstance->OnPlayerDeath(this); } + Unit::setDeathState(s); // restore resurrection spell id for player after aura remove diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index bdf5b52b0..c96b1d9f1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10392" + #define REVISION_NR "10393" #endif // __REVISION_NR_H__