mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
|||
void RemoveCorpse();
|
||||
bool isDeadByDefault() const { return m_isDeadByDefault; };
|
||||
|
||||
void ForcedDespawn();
|
||||
void ForcedDespawn(uint32 timeMSToDespawn = 0);
|
||||
|
||||
time_t const& GetRespawnTime() const { return m_respawnTime; }
|
||||
time_t GetRespawnTimeEx() const;
|
||||
|
|
@ -660,4 +660,14 @@ class AssistDelayEvent : public BasicEvent
|
|||
Unit& m_owner;
|
||||
};
|
||||
|
||||
class ForcedDespawnDelayEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
ForcedDespawnDelayEvent(Creature& owner) : BasicEvent(), m_owner(owner) { }
|
||||
bool Execute(uint64 e_time, uint32 p_time);
|
||||
|
||||
private:
|
||||
Creature& m_owner;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9119"
|
||||
#define REVISION_NR "9120"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue