Core/Maps: Removed MapInstanced - no longer neccessary for grid data reference counting (moved to TerrainInfo)
Port From (https://github.com/TrinityCore/TrinityCore/commit/fbe0b8efebca3bc2662b477bdf45627f9783d6c2)
This commit is contained in:
@@ -575,19 +575,24 @@ namespace Game.Chat
|
||||
[Command("loadcells", RBACPermissions.CommandDebug, true)]
|
||||
static bool HandleDebugLoadCellsCommand(CommandHandler handler, uint? mapId, uint? tileX, uint? tileY)
|
||||
{
|
||||
Map map = null;
|
||||
if (mapId.HasValue)
|
||||
map = Global.MapMgr.FindBaseNonInstanceMap(mapId.Value);
|
||||
else
|
||||
{
|
||||
Player player = handler.GetPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
// Fallback to player's map if no map has been specified
|
||||
map = player.GetMap();
|
||||
}
|
||||
Global.MapMgr.DoForAllMapsWithMapId(mapId.Value, map => HandleDebugLoadCellsCommandHelper(handler, map, tileX, tileY));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = handler.GetPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
// Fallback to player's map if no map has been specified
|
||||
return HandleDebugLoadCellsCommandHelper(handler, player.GetMap(), tileX, tileY);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleDebugLoadCellsCommandHelper(CommandHandler handler, Map map, uint? tileX, uint? tileY)
|
||||
{
|
||||
if (!map)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -205,8 +205,8 @@ namespace Game.Chat.Commands
|
||||
else
|
||||
player.SaveRecallPosition(); // save only in non-flight case
|
||||
|
||||
Map map = Global.MapMgr.CreateBaseMap(mapId);
|
||||
float z = Math.Max(map.GetStaticHeight(PhasingHandler.EmptyPhaseShift, x, y, MapConst.MaxHeight), map.GetWaterLevel(PhasingHandler.EmptyPhaseShift, x, y));
|
||||
TerrainInfo terrain = Global.TerrainMgr.LoadTerrain(mapId);
|
||||
float z = Math.Max(terrain.GetStaticHeight(PhasingHandler.EmptyPhaseShift, x, y, MapConst.MaxHeight), terrain.GetWaterLevel(PhasingHandler.EmptyPhaseShift, x, y));
|
||||
|
||||
player.TeleportTo(mapId, x, y, z, player.GetOrientation());
|
||||
return true;
|
||||
@@ -352,8 +352,8 @@ namespace Game.Chat.Commands
|
||||
else
|
||||
player.SaveRecallPosition(); // save only in non-flight case
|
||||
|
||||
Map map = Global.MapMgr.CreateBaseMap(mapId);
|
||||
z = Math.Max(map.GetStaticHeight(PhasingHandler.EmptyPhaseShift, x, y, MapConst.MaxHeight), map.GetWaterLevel(PhasingHandler.EmptyPhaseShift, x, y));
|
||||
TerrainInfo terrain = Global.TerrainMgr.LoadTerrain(mapId);
|
||||
z = Math.Max(terrain.GetStaticHeight(PhasingHandler.EmptyPhaseShift, x, y, MapConst.MaxHeight), terrain.GetWaterLevel(PhasingHandler.EmptyPhaseShift, x, y));
|
||||
|
||||
player.TeleportTo(mapId, x, y, z, 0.0f);
|
||||
return true;
|
||||
@@ -398,8 +398,8 @@ namespace Game.Chat.Commands
|
||||
handler.SendSysMessage(CypherStrings.InvalidTargetCoord, x, y, mapId);
|
||||
return false;
|
||||
}
|
||||
Map map = Global.MapMgr.CreateBaseMap(mapId);
|
||||
z = Math.Max(map.GetStaticHeight(PhasingHandler.EmptyPhaseShift, x, y, MapConst.MaxHeight), map.GetWaterLevel(PhasingHandler.EmptyPhaseShift, x, y));
|
||||
TerrainInfo terrain = Global.TerrainMgr.LoadTerrain(mapId);
|
||||
z = Math.Max(terrain.GetStaticHeight(PhasingHandler.EmptyPhaseShift, x, y, MapConst.MaxHeight), terrain.GetWaterLevel(PhasingHandler.EmptyPhaseShift, x, y));
|
||||
}
|
||||
|
||||
return DoTeleport(handler, new Position(x, y, z.Value, o.Value), mapId);
|
||||
@@ -427,10 +427,10 @@ namespace Game.Chat.Commands
|
||||
x /= 100.0f;
|
||||
y /= 100.0f;
|
||||
|
||||
Map map = Global.MapMgr.CreateBaseMap(zoneEntry.ContinentID);
|
||||
TerrainInfo terrain = Global.TerrainMgr.LoadTerrain(zoneEntry.ContinentID);
|
||||
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());
|
||||
handler.SendSysMessage(CypherStrings.InvalidZoneMap, areaId, areaEntry.AreaName[handler.GetSessionDbcLocale()], terrain.GetId(), terrain.GetMapName());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -446,7 +446,7 @@ namespace Game.Chat.Commands
|
||||
else
|
||||
player.SaveRecallPosition(); // save only in non-flight case
|
||||
|
||||
float z = Math.Max(map.GetStaticHeight(PhasingHandler.EmptyPhaseShift, x, y, MapConst.MaxHeight), map.GetWaterLevel(PhasingHandler.EmptyPhaseShift, x, y));
|
||||
float z = Math.Max(terrain.GetStaticHeight(PhasingHandler.EmptyPhaseShift, x, y, MapConst.MaxHeight), terrain.GetWaterLevel(PhasingHandler.EmptyPhaseShift, x, y));
|
||||
|
||||
player.TeleportTo(zoneEntry.ContinentID, x, y, z, player.GetOrientation());
|
||||
return true;
|
||||
|
||||
@@ -72,27 +72,17 @@ namespace Game.Chat.Commands
|
||||
bool liveFound = false;
|
||||
|
||||
// Get map (only support base map from console)
|
||||
Map thisMap;
|
||||
Map thisMap = null;
|
||||
if (handler.GetSession() != null)
|
||||
thisMap = handler.GetSession().GetPlayer().GetMap();
|
||||
else
|
||||
thisMap = Global.MapMgr.FindBaseNonInstanceMap(mapId);
|
||||
|
||||
// If map found, try to find active version of this creature
|
||||
if (thisMap)
|
||||
{
|
||||
var creBounds = thisMap.GetCreatureBySpawnIdStore().LookupByKey(guid);
|
||||
if (!creBounds.Empty())
|
||||
{
|
||||
foreach (var creature in creBounds)
|
||||
{
|
||||
if (handler.GetSession())
|
||||
handler.SendSysMessage(CypherStrings.CreatureListChat, guid, guid, cInfo.Name, x, y, z, mapId, creature.GetGUID().ToString(), creature.IsAlive() ? "*" : " ");
|
||||
else
|
||||
handler.SendSysMessage(CypherStrings.CreatureListConsole, guid, cInfo.Name, x, y, z, mapId, creature.GetGUID().ToString(), creature.IsAlive() ? "*" : " ");
|
||||
}
|
||||
liveFound = true;
|
||||
}
|
||||
foreach (var creature in creBounds)
|
||||
handler.SendSysMessage(CypherStrings.CreatureListChat, guid, guid, cInfo.Name, x, y, z, mapId, creature.GetGUID().ToString(), creature.IsAlive() ? "*" : " ");
|
||||
liveFound = !creBounds.Empty();
|
||||
}
|
||||
|
||||
if (!liveFound)
|
||||
@@ -422,27 +412,17 @@ namespace Game.Chat.Commands
|
||||
bool liveFound = false;
|
||||
|
||||
// Get map (only support base map from console)
|
||||
Map thisMap;
|
||||
Map thisMap = null;
|
||||
if (handler.GetSession() != null)
|
||||
thisMap = handler.GetSession().GetPlayer().GetMap();
|
||||
else
|
||||
thisMap = Global.MapMgr.FindBaseNonInstanceMap(mapId);
|
||||
|
||||
// If map found, try to find active version of this object
|
||||
if (thisMap)
|
||||
{
|
||||
var goBounds = thisMap.GetGameObjectBySpawnIdStore().LookupByKey(guid);
|
||||
if (!goBounds.Empty())
|
||||
{
|
||||
foreach (var go in goBounds)
|
||||
{
|
||||
if (handler.GetSession())
|
||||
handler.SendSysMessage(CypherStrings.GoListChat, guid, entry, guid, gInfo.name, x, y, z, mapId, go.GetGUID(), go.IsSpawned() ? "*" : " ");
|
||||
else
|
||||
handler.SendSysMessage(CypherStrings.GoListConsole, guid, gInfo.name, x, y, z, mapId, go.GetGUID(), go.IsSpawned() ? "*" : " ");
|
||||
}
|
||||
liveFound = true;
|
||||
}
|
||||
foreach (var go in goBounds)
|
||||
handler.SendSysMessage(CypherStrings.GoListChat, guid, entry, guid, gInfo.name, x, y, z, mapId, go.GetGUID().ToString(), go.IsSpawned() ? "*" : " ");
|
||||
liveFound = !goBounds.Empty();
|
||||
}
|
||||
|
||||
if (!liveFound)
|
||||
|
||||
Reference in New Issue
Block a user