mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-14 22:19:25 +01:00
Core/Instance: add new hook & method
(cherry picked from commit 953b05459a)
This commit is contained in:
@@ -4058,12 +4058,19 @@ void InstanceMap::Update(uint32 t_diff)
|
||||
void InstanceMap::RemovePlayerFromMap(Player* player, bool remove)
|
||||
{
|
||||
TC_LOG_DEBUG("maps", "MAP: Removing player '%s' from instance '%u' of map '%s' before relocating to another map", player->GetName().c_str(), GetInstanceId(), GetMapName());
|
||||
//if last player set unload timer
|
||||
|
||||
if (i_data)
|
||||
i_data->OnPlayerLeave(player);
|
||||
|
||||
// if last player set unload timer
|
||||
if (!m_unloadTimer && m_mapRefManager.getSize() == 1)
|
||||
m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY);
|
||||
|
||||
if (i_scenario)
|
||||
i_scenario->OnPlayerExit(player);
|
||||
|
||||
Map::RemovePlayerFromMap(player, remove);
|
||||
|
||||
// for normal instances schedule the reset after all players have left
|
||||
SetResetSchedule(true);
|
||||
sInstanceSaveMgr->UnloadInstanceSave(GetInstanceId());
|
||||
|
||||
Reference in New Issue
Block a user