mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9120] Implement option to use delay in ForcedDespawn for creature
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
a2e92cdb4e
commit
9c48e32bb7
3 changed files with 30 additions and 4 deletions
|
|
@ -105,6 +105,12 @@ bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
m_owner.ForcedDespawn();
|
||||
return true;
|
||||
}
|
||||
|
||||
Creature::Creature() :
|
||||
Unit(), i_AI(NULL),
|
||||
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0),
|
||||
|
|
@ -1294,9 +1300,19 @@ void Creature::Respawn()
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue