fix(Core/Creature): Move DespawnOnEvade() respawn handling to map level (#17806)

This commit is contained in:
Andrew
2023-11-20 12:18:48 -03:00
committed by GitHub
parent e8ccda12e4
commit e3a7613f56
3 changed files with 22 additions and 2 deletions

View File

@@ -754,6 +754,8 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
}
}
_creatureRespawnScheduler.Update(t_diff);
if (!t_diff)
{
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)
{
uint32 zoneId = player->GetZoneId();