Some cleanups. (might break build for scripts as they are a WIP)
This commit is contained in:
@@ -117,7 +117,7 @@ namespace Game.Entities
|
||||
/// <returns>the right instance for the object, based on its InstanceId</returns>
|
||||
public Map CreateMap(uint mapId, Player player)
|
||||
{
|
||||
if (!player)
|
||||
if (player == null)
|
||||
return null;
|
||||
|
||||
var entry = CliDB.MapStorage.LookupByKey(mapId);
|
||||
@@ -138,7 +138,7 @@ namespace Game.Entities
|
||||
return null;
|
||||
|
||||
map = FindMap_i(mapId, newInstanceId);
|
||||
if (!map)
|
||||
if (map == null)
|
||||
{
|
||||
Battleground bg = player.GetBattleground();
|
||||
if (bg != null)
|
||||
@@ -169,7 +169,7 @@ namespace Game.Entities
|
||||
{
|
||||
// Try finding instance id for normal dungeon
|
||||
if (!entries.MapDifficulty.HasResetSchedule())
|
||||
newInstanceId = group ? group.GetRecentInstanceId(mapId) : player.GetRecentInstanceId(mapId);
|
||||
newInstanceId = group != null ? group.GetRecentInstanceId(mapId) : player.GetRecentInstanceId(mapId);
|
||||
|
||||
// If not found or instance is not a normal dungeon, generate new one
|
||||
if (newInstanceId == 0)
|
||||
@@ -188,10 +188,10 @@ namespace Game.Entities
|
||||
map = null;
|
||||
}
|
||||
|
||||
if (!map)
|
||||
if (map == null)
|
||||
{
|
||||
map = CreateInstance(mapId, newInstanceId, instanceLock, difficulty, player.GetTeamId(), group);
|
||||
if (group)
|
||||
if (group != null)
|
||||
group.SetRecentInstance(mapId, instanceOwnerGuid, newInstanceId);
|
||||
else
|
||||
player.SetRecentInstance(mapId, newInstanceId);
|
||||
@@ -201,7 +201,7 @@ namespace Game.Entities
|
||||
{
|
||||
newInstanceId = (uint)player.GetGUID().GetCounter();
|
||||
map = FindMap_i(mapId, newInstanceId);
|
||||
if (!map)
|
||||
if (map == null)
|
||||
map = CreateGarrison(mapId, newInstanceId, player);
|
||||
}
|
||||
else
|
||||
@@ -211,11 +211,11 @@ namespace Game.Entities
|
||||
newInstanceId = (uint)player.GetTeamId();
|
||||
|
||||
map = FindMap_i(mapId, newInstanceId);
|
||||
if (!map)
|
||||
if (map == null)
|
||||
map = CreateWorldMap(mapId, newInstanceId);
|
||||
}
|
||||
|
||||
if (map)
|
||||
if (map != null)
|
||||
i_maps[(map.GetId(), map.GetInstanceId())] = map;
|
||||
|
||||
return map;
|
||||
@@ -242,13 +242,13 @@ namespace Game.Entities
|
||||
Difficulty difficulty = group != null ? group.GetDifficultyID(entry) : player.GetDifficultyID(entry);
|
||||
MapDb2Entries entries = new(entry, Global.DB2Mgr.GetDownscaledMapDifficultyData(mapId, ref difficulty));
|
||||
|
||||
ObjectGuid instanceOwnerGuid = group ? group.GetRecentInstanceOwner(mapId) : player.GetGUID();
|
||||
ObjectGuid instanceOwnerGuid = group != null ? group.GetRecentInstanceOwner(mapId) : player.GetGUID();
|
||||
InstanceLock instanceLock = Global.InstanceLockMgr.FindActiveInstanceLock(instanceOwnerGuid, entries);
|
||||
uint newInstanceId = 0;
|
||||
if (instanceLock != null)
|
||||
newInstanceId = instanceLock.GetInstanceId();
|
||||
else if (!entries.MapDifficulty.HasResetSchedule()) // Try finding instance id for normal dungeon
|
||||
newInstanceId = group ? group.GetRecentInstanceId(mapId) : player.GetRecentInstanceId(mapId);
|
||||
newInstanceId = group != null ? group.GetRecentInstanceId(mapId) : player.GetRecentInstanceId(mapId);
|
||||
|
||||
if (newInstanceId == 0)
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user