mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 23:56:25 +00:00
feat(Core/SAI): Allow forcing creatures/gameobjects's respawn timers when using SMART_ACTION_FORCE_DESPAWN (#8714)
This commit is contained in:
@@ -170,7 +170,7 @@ CreatureBaseStats const* CreatureBaseStats::GetBaseStats(uint8 level, uint8 unit
|
||||
|
||||
bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
{
|
||||
m_owner.DespawnOrUnsummon(); // since we are here, we are not TempSummon as object type cannot change during runtime
|
||||
m_owner.DespawnOrUnsummon(0s, m_respawnTimer); // since we are here, we are not TempSummon as object type cannot change during runtime
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1916,12 +1916,11 @@ void Creature::Respawn(bool force)
|
||||
UpdateObjectVisibility(false);
|
||||
}
|
||||
|
||||
void Creature::ForcedDespawn(uint32 timeMSToDespawn)
|
||||
void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer)
|
||||
{
|
||||
if (timeMSToDespawn)
|
||||
{
|
||||
ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this);
|
||||
|
||||
ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this, forceRespawnTimer);
|
||||
m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn));
|
||||
return;
|
||||
}
|
||||
@@ -1931,14 +1930,20 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn)
|
||||
|
||||
// Xinef: set new respawn time, ignore corpse decay time...
|
||||
RemoveCorpse(true);
|
||||
|
||||
if (forceRespawnTimer > Seconds::zero())
|
||||
{
|
||||
m_respawnTime = time(nullptr) + forceRespawnTimer.count();
|
||||
m_respawnDelay = forceRespawnTimer.count();
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::DespawnOrUnsummon(uint32 msTimeToDespawn /*= 0*/)
|
||||
void Creature::DespawnOrUnsummon(Milliseconds msTimeToDespawn /*= 0*/, Seconds forcedRespawnTimer)
|
||||
{
|
||||
if (TempSummon* summon = this->ToTempSummon())
|
||||
summon->UnSummon(msTimeToDespawn);
|
||||
summon->UnSummon(msTimeToDespawn.count());
|
||||
else
|
||||
ForcedDespawn(msTimeToDespawn);
|
||||
ForcedDespawn(msTimeToDespawn.count(), forcedRespawnTimer);
|
||||
}
|
||||
|
||||
void Creature::DespawnOnEvade()
|
||||
|
||||
Reference in New Issue
Block a user