Core/Instances: Delete InstanceSaveMgr and replace most of its uses with new InstanceLockMgr
Port From (https://github.com/TrinityCore/TrinityCore/commit/9b924522d0549dd67b10e2cbdfc20297dd21e182)
This commit is contained in:
@@ -354,25 +354,36 @@ namespace Game
|
||||
if (!teleported)
|
||||
{
|
||||
WorldSafeLocsEntry entranceLocation = null;
|
||||
InstanceSave instanceSave = player.GetInstanceSave(at.target_mapId);
|
||||
if (instanceSave != null)
|
||||
MapRecord mapEntry = CliDB.MapStorage.LookupByKey(at.target_mapId);
|
||||
if (mapEntry.Instanceable())
|
||||
{
|
||||
// Check if we can contact the instancescript of the instance for an updated entrance location
|
||||
Map map = Global.MapMgr.FindMap(at.target_mapId, player.GetInstanceSave(at.target_mapId).GetInstanceId());
|
||||
if (map)
|
||||
uint targetInstanceId = Global.MapMgr.FindInstanceIdForPlayer(at.target_mapId, _player);
|
||||
if (targetInstanceId != 0)
|
||||
{
|
||||
InstanceMap instanceMap = map.ToInstanceMap();
|
||||
if (instanceMap != null)
|
||||
Map map = Global.MapMgr.FindMap(at.target_mapId, targetInstanceId);
|
||||
if (map != null)
|
||||
{
|
||||
InstanceScript instanceScript = instanceMap.GetInstanceScript();
|
||||
if (instanceScript != null)
|
||||
entranceLocation = Global.ObjectMgr.GetWorldSafeLoc(instanceScript.GetEntranceLocation());
|
||||
InstanceMap instanceMap = map.ToInstanceMap();
|
||||
if (instanceMap)
|
||||
{
|
||||
InstanceScript instanceScript = instanceMap.GetInstanceScript();
|
||||
if (instanceScript != null)
|
||||
entranceLocation = Global.ObjectMgr.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 == null)
|
||||
entranceLocation = Global.ObjectMgr.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();
|
||||
InstanceLock instanceLock = Global.InstanceLockMgr.FindActiveInstanceLock(instanceOwnerGuid, new MapDb2Entries(mapEntry, Global.DB2Mgr.GetDownscaledMapDifficultyData(at.target_mapId, ref difficulty)));
|
||||
if (instanceLock != null)
|
||||
entranceLocation = Global.ObjectMgr.GetWorldSafeLoc(instanceLock.GetData().EntranceWorldSafeLocId);
|
||||
}
|
||||
}
|
||||
|
||||
if (entranceLocation != null)
|
||||
|
||||
Reference in New Issue
Block a user