Scripts/Commands: New utility command: .list spawnpoints.
Port From (https://github.com/TrinityCore/TrinityCore/commit/703910d71baa3182c956494465cdd335f5de1d3d)
This commit is contained in:
@@ -570,15 +570,8 @@ namespace Game.Chat.Commands
|
||||
[Command("respawns", RBACPermissions.CommandListRespawns)]
|
||||
static bool HandleListRespawnsCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
// We need a player
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
// And we need a map
|
||||
Map map = player.GetMap();
|
||||
if (map == null)
|
||||
return false;
|
||||
|
||||
uint range = 0;
|
||||
if (!args.Empty())
|
||||
@@ -661,6 +654,44 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("spawnpoints", RBACPermissions.CommandListSpawnpoints)]
|
||||
static bool HandleListSpawnPointsCommand(StringArguments args, CommandHandler handler)
|
||||
{
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Map map = player.GetMap();
|
||||
uint mapId = map.GetId();
|
||||
bool showAll = map.IsBattlegroundOrArena() || map.IsDungeon();
|
||||
handler.SendSysMessage("Listing all spawn points in map %u (%s)%s:", mapId, map.GetMapName(), showAll ? "" : " within 5000yd");
|
||||
|
||||
foreach (var pair in Global.ObjectMgr.GetAllCreatureData())
|
||||
{
|
||||
SpawnData data = pair.Value;
|
||||
if (data.spawnPoint.GetMapId() != mapId)
|
||||
continue;
|
||||
|
||||
CreatureTemplate cTemp = Global.ObjectMgr.GetCreatureTemplate(data.Id);
|
||||
if (cTemp == null)
|
||||
continue;
|
||||
|
||||
if (showAll || data.spawnPoint.IsInDist2d(player, 5000.0f))
|
||||
handler.SendSysMessage($"Type: {data.type} | SpawnId: {data.spawnId} | Entry: {data.Id} ({cTemp.Name}) | X: {data.spawnPoint.GetPositionX():3} | Y: {data.spawnPoint.GetPositionY():3} | Z: {data.spawnPoint.GetPositionZ():3}");
|
||||
}
|
||||
foreach (var pair in Global.ObjectMgr.GetAllGameObjectData())
|
||||
{
|
||||
SpawnData data = pair.Value;
|
||||
if (data.spawnPoint.GetMapId() != mapId)
|
||||
continue;
|
||||
|
||||
GameObjectTemplate goTemp = Global.ObjectMgr.GetGameObjectTemplate(data.Id);
|
||||
if (goTemp == null)
|
||||
continue;
|
||||
|
||||
if (showAll || data.spawnPoint.IsInDist2d(player, 5000.0f))
|
||||
handler.SendSysMessage($"Type: {data.type} | SpawnId: {data.spawnId} | Entry: {data.Id} ({goTemp.name}) | X: {data.spawnPoint.GetPositionX():3} | Y: {data.spawnPoint.GetPositionY():3} | Z: {data.spawnPoint.GetPositionZ():3}");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static string GetZoneName(uint zoneId, Locale locale)
|
||||
{
|
||||
AreaTableRecord zoneEntry = CliDB.AreaTableStorage.LookupByKey(zoneId);
|
||||
|
||||
@@ -3538,6 +3538,7 @@ namespace Game
|
||||
{
|
||||
return _creatureTemplateStorage;
|
||||
}
|
||||
public Dictionary<ulong, CreatureData> GetAllCreatureData() { return creatureDataStorage; }
|
||||
public CreatureData GetCreatureData(ulong guid)
|
||||
{
|
||||
return creatureDataStorage.LookupByKey(guid);
|
||||
@@ -4381,6 +4382,7 @@ namespace Game
|
||||
return _gameObjectQuestItemStorage.LookupByKey(id);
|
||||
}
|
||||
MultiMap<uint, uint> GetGameObjectQuestItemMap() { return _gameObjectQuestItemStorage; }
|
||||
public Dictionary<ulong, GameObjectData> GetAllGameObjectData() { return gameObjectDataStorage; }
|
||||
public GameObjectData GetGameObjectData(ulong guid)
|
||||
{
|
||||
return gameObjectDataStorage.LookupByKey(guid);
|
||||
|
||||
Reference in New Issue
Block a user