diff options
Diffstat (limited to 'src/game/Creature.cpp')
| -rw-r--r-- | src/game/Creature.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 8868b24c768..69334a31562 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -137,6 +137,12 @@ CreatureBaseStats const* CreatureBaseStats::GetBaseStats(uint32 level, uint8 uni return objmgr.GetCreatureBaseStats(level, unitClass); } +bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) +{ + m_owner.ForcedDespawn(); + return true; +} + Creature::Creature() : Unit(), lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0), @@ -1586,9 +1592,19 @@ void Creature::Respawn(bool force) SetToNotify(); } -void Creature::ForcedDespawn() +void Creature::ForcedDespawn(uint32 timeMSToDespawn) { - setDeathState(JUST_DIED); + if (timeMSToDespawn) + { + ForcedDespawnDelayEvent *pEvent = new ForcedDespawnDelayEvent(*this); + + m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn)); + return; + } + + if (isAlive()) + setDeathState(JUST_DIED); + RemoveCorpse(); SetHealth(0); // just for nice GM-mode view } |
