diff options
author | Shauren <shauren.trinity@gmail.com> | 2020-01-02 14:19:35 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-10-04 00:19:38 +0200 |
commit | 9b924522d0549dd67b10e2cbdfc20297dd21e182 (patch) | |
tree | f0fcdf96902b7c497c1bc65db83621a8dfadf43a /src/server/game/Handlers/MiscHandler.cpp | |
parent | a131542855d23022714a97640be1c8d68a741c31 (diff) |
Core/Instances: Delete InstanceSaveMgr and replace most of its uses with new InstanceLockMgr
Diffstat (limited to 'src/server/game/Handlers/MiscHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/MiscHandler.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index fa65c980f93..1bcf20acb93 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -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) |