From 1665077dc4c8a9a51875985fa38cd76aaab1b180 Mon Sep 17 00:00:00 2001 From: balrok Date: Thu, 24 Sep 2009 15:21:05 +0200 Subject: [PATCH] [8547] implemented scriptcall: CorpseRemoved(uint32 & /*respawnDelay*/) it will be called when the corpse of the scripted creature get's removed, it's possible to adjust the next respawn inside the script --- src/game/Creature.cpp | 6 +++++- src/game/CreatureAI.h | 3 +++ src/shared/revision_nr.h | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index c407f733d..d6c25141d 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -160,7 +160,11 @@ void Creature::RemoveCorpse() setDeathState(DEAD); ObjectAccessor::UpdateObjectVisibility(this); loot.clear(); - m_respawnTime = time(NULL) + m_respawnDelay; + uint32 respawnDelay = m_respawnDelay; + if (AI()) + AI()->CorpseRemoved(respawnDelay); + + m_respawnTime = time(NULL) + respawnDelay; float x,y,z,o; GetRespawnCoord(x, y, z, &o); diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index 778c2c6d1..a9857eb2a 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -109,6 +109,9 @@ class MANGOS_DLL_SPEC CreatureAI // Is unit visible for MoveInLineOfSight virtual bool IsVisible(Unit *) const { return false; } + // called when the corpse of this creature gets removed + virtual void CorpseRemoved(uint32 & /*respawnDelay*/) {} + // Called when victim entered water and creature can not enter water virtual bool canReachByRangeAttack(Unit*) { return false; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9754a3804..1bd7e517b 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 "8546" + #define REVISION_NR "8547" #endif // __REVISION_NR_H__