mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Instances: Delete InstanceSaveMgr and replace most of its uses with new InstanceLockMgr
This commit is contained in:
@@ -35,8 +35,8 @@
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "InstanceLockMgr.h"
|
||||
#include "InstancePackets.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
@@ -644,18 +644,25 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPackets::AreaTrigger::AreaTrigge
|
||||
if (!teleported)
|
||||
{
|
||||
WorldSafeLocsEntry const* entranceLocation = nullptr;
|
||||
InstanceSave* instanceSave = player->GetInstanceSave(at->target_mapId);
|
||||
if (instanceSave)
|
||||
MapEntry const* mapEntry = sMapStore.AssertEntry(at->target_mapId);
|
||||
if (mapEntry->Instanceable())
|
||||
{
|
||||
// Check if we can contact the instancescript of the instance for an updated entrance location
|
||||
if (Map* map = sMapMgr->FindMap(at->target_mapId, player->GetInstanceSave(at->target_mapId)->GetInstanceId()))
|
||||
if (InstanceMap* instanceMap = map->ToInstanceMap())
|
||||
if (InstanceScript* instanceScript = instanceMap->GetInstanceScript())
|
||||
entranceLocation = sObjectMgr->GetWorldSafeLoc(instanceScript->GetEntranceLocation());
|
||||
if (uint32 targetInstanceId = sMapMgr->FindInstanceIdForPlayer(at->target_mapId, _player))
|
||||
if (Map* map = sMapMgr->FindMap(at->target_mapId, targetInstanceId))
|
||||
if (InstanceMap* instanceMap = map->ToInstanceMap())
|
||||
if (InstanceScript* instanceScript = instanceMap->GetInstanceScript())
|
||||
entranceLocation = sObjectMgr->GetWorldSafeLoc(instanceScript->GetEntranceLocation());
|
||||
|
||||
// Finally check with the instancesave for an entrance location if we did not get a valid one from the instancescript
|
||||
if (!entranceLocation)
|
||||
entranceLocation = sObjectMgr->GetWorldSafeLoc(instanceSave->GetEntranceLocation());
|
||||
{
|
||||
Group* group = player->GetGroup();
|
||||
Difficulty difficulty = group ? group->GetDifficultyID(mapEntry) : player->GetDifficultyID(mapEntry);
|
||||
ObjectGuid instanceOwnerGuid = group ? group->GetRecentInstanceOwner(at->target_mapId) : player->GetGUID();
|
||||
if (InstanceLock const* instanceLock = sInstanceLockMgr.FindActiveInstanceLock(instanceOwnerGuid, { mapEntry, sDB2Manager.GetDownscaledMapDifficultyData(at->target_mapId, difficulty) }))
|
||||
entranceLocation = sObjectMgr->GetWorldSafeLoc(instanceLock->GetData()->EntranceWorldSafeLocId);
|
||||
}
|
||||
}
|
||||
|
||||
if (entranceLocation)
|
||||
|
||||
Reference in New Issue
Block a user