fix(Core/Creature): Move DespawnOnEvade() respawn handling to map level (#17806)
This commit is contained in:
@@ -2102,8 +2102,10 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer)
|
|||||||
|
|
||||||
if (forceRespawnTimer > Seconds::zero())
|
if (forceRespawnTimer > Seconds::zero())
|
||||||
{
|
{
|
||||||
m_respawnTime = GameTime::GetGameTime().count() + forceRespawnTimer.count();
|
if (GetMap())
|
||||||
m_respawnDelay = forceRespawnTimer.count();
|
{
|
||||||
|
GetMap()->ScheduleCreatureRespawn(GetGUID(), forceRespawnTimer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -754,6 +754,8 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_creatureRespawnScheduler.Update(t_diff);
|
||||||
|
|
||||||
if (!t_diff)
|
if (!t_diff)
|
||||||
{
|
{
|
||||||
for (m_mapRefIter = m_mapRefMgr.begin(); m_mapRefIter != m_mapRefMgr.end(); ++m_mapRefIter)
|
for (m_mapRefIter = m_mapRefMgr.begin(); m_mapRefIter != m_mapRefMgr.end(); ++m_mapRefIter)
|
||||||
@@ -3695,6 +3697,17 @@ void Map::RemoveOldCorpses()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Map::ScheduleCreatureRespawn(ObjectGuid creatureGuid, Milliseconds respawnTimer)
|
||||||
|
{
|
||||||
|
_creatureRespawnScheduler.Schedule(respawnTimer, [this, creatureGuid](TaskContext)
|
||||||
|
{
|
||||||
|
if (Creature* creature = GetCreature(creatureGuid))
|
||||||
|
{
|
||||||
|
creature->Respawn();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Map::SendZoneDynamicInfo(Player* player)
|
void Map::SendZoneDynamicInfo(Player* player)
|
||||||
{
|
{
|
||||||
uint32 zoneId = player->GetZoneId();
|
uint32 zoneId = player->GetZoneId();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "PathGenerator.h"
|
#include "PathGenerator.h"
|
||||||
#include "Position.h"
|
#include "Position.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
|
#include "TaskScheduler.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <list>
|
#include <list>
|
||||||
@@ -594,6 +595,10 @@ public:
|
|||||||
void DeleteRespawnTimes();
|
void DeleteRespawnTimes();
|
||||||
[[nodiscard]] time_t GetInstanceResetPeriod() const { return _instanceResetPeriod; }
|
[[nodiscard]] time_t GetInstanceResetPeriod() const { return _instanceResetPeriod; }
|
||||||
|
|
||||||
|
TaskScheduler _creatureRespawnScheduler;
|
||||||
|
|
||||||
|
void ScheduleCreatureRespawn(ObjectGuid /*creatureGuid*/, Milliseconds /*respawnTimer*/);
|
||||||
|
|
||||||
void LoadCorpseData();
|
void LoadCorpseData();
|
||||||
void DeleteCorpseData();
|
void DeleteCorpseData();
|
||||||
void AddCorpse(Corpse* corpse);
|
void AddCorpse(Corpse* corpse);
|
||||||
|
|||||||
Reference in New Issue
Block a user