diff --git a/Source/Game/Chat/Commands/GoCommands.cs b/Source/Game/Chat/Commands/GoCommands.cs index d0f65ce2c..75b883e44 100644 --- a/Source/Game/Chat/Commands/GoCommands.cs +++ b/Source/Game/Chat/Commands/GoCommands.cs @@ -424,17 +424,16 @@ namespace Game.Chat.Commands AreaTableRecord zoneEntry = areaEntry.ParentAreaID != 0 ? CliDB.AreaTableStorage.LookupByKey(areaEntry.ParentAreaID) : areaEntry; Cypher.Assert(zoneEntry != null); + x /= 100.0f; + y /= 100.0f; + Map map = Global.MapMgr.CreateBaseMap(zoneEntry.ContinentID); - if (map.Instanceable()) + if (!Global.DB2Mgr.Zone2MapCoordinates(areaEntry.ParentAreaID != 0 ? areaEntry.ParentAreaID : areaId, ref x, ref y)) { handler.SendSysMessage(CypherStrings.InvalidZoneMap, areaId, areaEntry.AreaName[handler.GetSessionDbcLocale()], map.GetId(), map.GetMapName()); return false; } - x /= 100.0f; - y /= 100.0f; - - Global.DB2Mgr.Zone2MapCoordinates(areaEntry.ParentAreaID != 0 ? areaEntry.ParentAreaID : areaId, ref x, ref y); if (!GridDefines.IsValidMapCoord(zoneEntry.ContinentID, x, y)) { handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, zoneEntry.ContinentID); diff --git a/Source/Game/Chat/Commands/MiscCommands.cs b/Source/Game/Chat/Commands/MiscCommands.cs index 4842955d2..8c84123de 100644 --- a/Source/Game/Chat/Commands/MiscCommands.cs +++ b/Source/Game/Chat/Commands/MiscCommands.cs @@ -1816,7 +1816,7 @@ namespace Game.Chat if (!target.GetMap().IsBattlegroundOrArena()) target.SetBattlegroundEntryPoint(); } - else if (map.Instanceable()) + else if (map.IsDungeon()) { Map targetMap = target.GetMap(); diff --git a/Source/Game/DataStorage/DB2Manager.cs b/Source/Game/DataStorage/DB2Manager.cs index 6043137b2..1b2d6b3de 100644 --- a/Source/Game/DataStorage/DB2Manager.cs +++ b/Source/Game/DataStorage/DB2Manager.cs @@ -2299,11 +2299,11 @@ namespace Game.DataStorage return true; } - public void Zone2MapCoordinates(uint areaId, ref float x, ref float y) + public bool Zone2MapCoordinates(uint areaId, ref float x, ref float y) { AreaTableRecord areaEntry = AreaTableStorage.LookupByKey(areaId); if (areaEntry == null) - return; + return false; foreach (var assignment in _uiMapAssignmentByArea[(int)UiMapSystem.World].LookupByKey(areaId)) { @@ -2314,8 +2314,11 @@ namespace Game.DataStorage float tmpX = (x - assignment.UiMax.X) / (assignment.UiMin.X - assignment.UiMax.X); x = assignment.Region[0].X + tmpY * (assignment.Region[1].X - assignment.Region[0].X); y = assignment.Region[0].Y + tmpX * (assignment.Region[1].Y - assignment.Region[0].Y); - break; + + return true; } + + return false; } public void Map2ZoneCoordinates(int areaId, ref float x, ref float y) diff --git a/Source/Game/Maps/Instances/InstanceSaveManager.cs b/Source/Game/Maps/Instances/InstanceSaveManager.cs index b18a7fbb1..6c9023603 100644 --- a/Source/Game/Maps/Instances/InstanceSaveManager.cs +++ b/Source/Game/Maps/Instances/InstanceSaveManager.cs @@ -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(); } diff --git a/Source/Game/Maps/Instances/MapInstance.cs b/Source/Game/Maps/Instances/MapInstance.cs index 11be403f7..05f80d87f 100644 --- a/Source/Game/Maps/Instances/MapInstance.cs +++ b/Source/Game/Maps/Instances/MapInstance.cs @@ -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); diff --git a/Source/Game/Maps/MapManager.cs b/Source/Game/Maps/MapManager.cs index 5dd295cde..37c697f55 100644 --- a/Source/Game/Maps/MapManager.cs +++ b/Source/Game/Maps/MapManager.cs @@ -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; } diff --git a/Source/Game/Weather/WeatherManager.cs b/Source/Game/Weather/WeatherManager.cs index 4a15b2f8b..d9d979084 100644 --- a/Source/Game/Weather/WeatherManager.cs +++ b/Source/Game/Weather/WeatherManager.cs @@ -156,7 +156,7 @@ namespace Game string[] seasonName = { "spring", "summer", "fall", "winter" }; - Log.outError(LogFilter.Server, "Generating a change in {0} weather for zone {1}.", seasonName[season], m_zone); + Log.outInfo(LogFilter.Server, "Generating a change in {0} weather for zone {1}.", seasonName[season], m_zone); if ((u < 60) && (m_intensity < 0.33333334f)) // Get fair {