Core/Maps: Replace some Instanceable() checks with IsDungeon()

Port From (https://github.com/TrinityCore/TrinityCore/commit/8466894d816f484f30cdbe47b980a142870c955e)
This commit is contained in:
hondacrx
2022-07-20 21:38:47 -04:00
parent e7bb4745e0
commit 732609fd87
7 changed files with 23 additions and 25 deletions
@@ -454,7 +454,7 @@ namespace Game.Maps
{
Log.outDebug(LogFilter.Maps, "InstanceSaveMgr._ResetInstance {0}, {1}", mapid, instanceId);
Map map = Global.MapMgr.CreateBaseMap(mapid);
if (!map.Instanceable())
if (!map.IsDungeon())
return;
var pair = m_instanceSaveById.Find(instanceId);
@@ -464,12 +464,9 @@ namespace Game.Maps
DeleteInstanceFromDB(instanceId); // even if save not loaded
Map iMap = ((MapInstanced)map).FindInstanceMap(instanceId);
if (iMap != null && iMap.IsDungeon())
((InstanceMap)iMap).Reset(InstanceResetMethod.RespawnDelay);
if (iMap != null)
{
((InstanceMap)iMap).Reset(InstanceResetMethod.RespawnDelay);
iMap.DeleteRespawnTimes();
iMap.DeleteCorpseData();
}
+3 -3
View File
@@ -82,7 +82,7 @@ namespace Game.Maps
if (GetId() != mapId || player == null)
return null;
Map map;
Map map = null;
uint newInstanceId; // instanceId of the resulting map
if (IsBattlegroundOrArena())
@@ -106,7 +106,7 @@ namespace Game.Maps
}
}
}
else if(!IsGarrison())
else if(IsDungeon())
{
InstanceBind pBind = player.GetBoundInstance(GetId(), player.GetDifficultyID(GetEntry()));
InstanceSave pSave = pBind != null ? pBind.save : null;
@@ -162,7 +162,7 @@ namespace Game.Maps
map = CreateInstance(newInstanceId, null, diff, player.GetTeamId());
}
}
else
else if (IsGarrison())
{
newInstanceId = (uint)player.GetGUID().GetCounter();
map = FindInstanceMap(newInstanceId);
+6 -7
View File
@@ -278,12 +278,11 @@ namespace Game.Entities
foreach (var pair in i_maps)
{
Map map = pair.Value;
if (!map.Instanceable())
if (!map.IsDungeon())
continue;
var maps = ((MapInstanced)map).GetInstancedMaps();
foreach (var imap in maps)
if (imap.Value.IsDungeon())
ret++;
ret += (uint)maps.Count;
}
return ret;
}
@@ -297,12 +296,12 @@ namespace Game.Entities
foreach (var pair in i_maps)
{
Map map = pair.Value;
if (!map.Instanceable())
if (!map.IsDungeon())
continue;
var maps = ((MapInstanced)map).GetInstancedMaps();
foreach (var imap in maps)
if (imap.Value.IsDungeon())
ret += (uint)imap.Value.GetPlayers().Count;
ret += (uint)imap.Value.GetPlayers().Count;
}
return ret;
}