mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Commands: New utility command: .list spawnpoints.
(I just needed it for dynspawn follow-up work, really.)
This commit is contained in:
File diff suppressed because one or more lines are too long
8
sql/updates/auth/3.3.5/2017_08_01_00_auth.sql
Normal file
8
sql/updates/auth/3.3.5/2017_08_01_00_auth.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
--
|
||||
DELETE FROM `rbac_permissions` WHERE `id`=866;
|
||||
INSERT INTO `rbac_permissions` (`id`,`name`) VALUES
|
||||
(866, 'Command: list spawnpoints');
|
||||
|
||||
DELETE FROM `rbac_linked_permissions` WHERE `linkedId`=866;
|
||||
INSERT INTO `rbac_linked_permissions` (`id`,`linkedId`) VALUES
|
||||
(196,866);
|
||||
6
sql/updates/world/3.3.5/2017_08_01_00_world.sql
Normal file
6
sql/updates/world/3.3.5/2017_08_01_00_world.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
--
|
||||
DELETE FROM `command` WHERE `name`="list spawnpoints";
|
||||
INSERT INTO `command` (`name`,`permission`,`help`) VALUES
|
||||
('list spawnpoints', 866, 'Syntax: .list spawnpoints
|
||||
|
||||
Lists all spawn points (both creatures and GOs) in the current zone.');
|
||||
@@ -761,16 +761,17 @@ enum RBACPermissions
|
||||
RBAC_PERM_COMMAND_RELOAD_CONVERSATION_TEMPLATE = 853, // not on 3.3.5a
|
||||
RBAC_PERM_COMMAND_DEBUG_CONVERSATION = 854, // not on 3.3.5a
|
||||
RBAC_PERM_COMMAND_DEBUG_PLAY_MUSIC = 855,
|
||||
RBAC_PERM_COMMAND_NPC_SPAWNGROUP = 856, // reserved for dynamic_spawning
|
||||
RBAC_PERM_COMMAND_NPC_DESPAWNGROUP = 857, // reserved for dynamic_spawning
|
||||
RBAC_PERM_COMMAND_GOBJECT_SPAWNGROUP = 858, // reserved for dynamic_spawning
|
||||
RBAC_PERM_COMMAND_GOBJECT_DESPAWNGROUP = 859, // reserved for dynamic_spawning
|
||||
RBAC_PERM_COMMAND_LIST_RESPAWNS = 860, // reserved for dynamic_spawning
|
||||
RBAC_PERM_COMMAND_NPC_SPAWNGROUP = 856,
|
||||
RBAC_PERM_COMMAND_NPC_DESPAWNGROUP = 857,
|
||||
RBAC_PERM_COMMAND_GOBJECT_SPAWNGROUP = 858,
|
||||
RBAC_PERM_COMMAND_GOBJECT_DESPAWNGROUP = 859,
|
||||
RBAC_PERM_COMMAND_LIST_RESPAWNS = 860,
|
||||
RBAC_PERM_COMMAND_GROUP_SET = 861,
|
||||
RBAC_PERM_COMMAND_GROUP_ASSISTANT = 862,
|
||||
RBAC_PERM_COMMAND_GROUP_MAINTANK = 863,
|
||||
RBAC_PERM_COMMAND_GROUP_MAINASSIST = 864,
|
||||
RBAC_PERM_COMMAND_NPC_SHOWLOOT = 865,
|
||||
RBAC_PERM_COMMAND_LIST_SPAWNPOINTS = 866,
|
||||
|
||||
// custom permissions 1000+
|
||||
RBAC_PERM_MAX
|
||||
|
||||
@@ -1281,6 +1281,7 @@ class TC_GAME_API ObjectMgr
|
||||
return nullptr;
|
||||
}
|
||||
void OnDeleteSpawnData(SpawnData const* data);
|
||||
CreatureDataContainer const& GetAllCreatureData() const { return _creatureDataStore; }
|
||||
CreatureData const* GetCreatureData(ObjectGuid::LowType guid) const
|
||||
{
|
||||
CreatureDataContainer::const_iterator itr = _creatureDataStore.find(guid);
|
||||
@@ -1301,6 +1302,7 @@ class TC_GAME_API ObjectMgr
|
||||
if (itr == _creatureLocaleStore.end()) return nullptr;
|
||||
return &itr->second;
|
||||
}
|
||||
GameObjectDataContainer const& GetAllGameObjectData() const { return _gameObjectDataStore; }
|
||||
GameObjectData const* GetGameObjectData(ObjectGuid::LowType guid) const
|
||||
{
|
||||
GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(guid);
|
||||
|
||||
@@ -389,11 +389,11 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
|
||||
|
||||
bool GetAreaInfo(float x, float y, float z, uint32& mogpflags, int32& adtId, int32& rootId, int32& groupId) const;
|
||||
uint32 GetAreaId(float x, float y, float z, bool *isOutdoors = nullptr) const;
|
||||
uint32 GetAreaId(Position const& pos) { return GetAreaId(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
|
||||
uint32 GetAreaId(Position const& pos) const { return GetAreaId(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
|
||||
uint32 GetZoneId(float x, float y, float z) const;
|
||||
uint32 GetZoneId(Position const& pos) { return GetZoneId(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
|
||||
uint32 GetZoneId(Position const& pos) const { return GetZoneId(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
|
||||
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, float x, float y, float z) const;
|
||||
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, Position const& pos) { GetZoneAndAreaId(zoneid, areaid, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
|
||||
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, Position const& pos) const { GetZoneAndAreaId(zoneid, areaid, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
|
||||
|
||||
bool IsOutdoors(float x, float y, float z) const;
|
||||
|
||||
|
||||
@@ -48,12 +48,13 @@ public:
|
||||
{
|
||||
static std::vector<ChatCommand> listCommandTable =
|
||||
{
|
||||
{ "creature", rbac::RBAC_PERM_COMMAND_LIST_CREATURE, true, &HandleListCreatureCommand, "" },
|
||||
{ "item", rbac::RBAC_PERM_COMMAND_LIST_ITEM, true, &HandleListItemCommand, "" },
|
||||
{ "object", rbac::RBAC_PERM_COMMAND_LIST_OBJECT, true, &HandleListObjectCommand, "" },
|
||||
{ "auras", rbac::RBAC_PERM_COMMAND_LIST_AURAS, false, &HandleListAurasCommand, "" },
|
||||
{ "mail", rbac::RBAC_PERM_COMMAND_LIST_MAIL, true, &HandleListMailCommand, "" },
|
||||
{ "respawns", rbac::RBAC_PERM_COMMAND_LIST_MAIL, false, &HandleListRespawnsCommand, "" },
|
||||
{ "creature", rbac::RBAC_PERM_COMMAND_LIST_CREATURE, true, &HandleListCreatureCommand, "" },
|
||||
{ "item", rbac::RBAC_PERM_COMMAND_LIST_ITEM, true, &HandleListItemCommand, "" },
|
||||
{ "object", rbac::RBAC_PERM_COMMAND_LIST_OBJECT, true, &HandleListObjectCommand, "" },
|
||||
{ "auras", rbac::RBAC_PERM_COMMAND_LIST_AURAS, false, &HandleListAurasCommand, "" },
|
||||
{ "mail", rbac::RBAC_PERM_COMMAND_LIST_MAIL, true, &HandleListMailCommand, "" },
|
||||
{ "spawnpoints", rbac::RBAC_PERM_COMMAND_LIST_SPAWNPOINTS, false, &HandleListSpawnPointsCommand, "" },
|
||||
{ "respawns", rbac::RBAC_PERM_COMMAND_LIST_RESPAWNS, false, &HandleListRespawnsCommand, "" },
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
{
|
||||
@@ -644,6 +645,44 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleListSpawnPointsCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
Player const* player = handler->GetSession()->GetPlayer();
|
||||
if (!player)
|
||||
return false;
|
||||
Map const* map = player->GetMap();
|
||||
if (!map)
|
||||
return false;
|
||||
|
||||
LocaleConstant const locale = handler->GetSession()->GetSessionDbcLocale();
|
||||
uint32 const mapId = map->GetId();
|
||||
bool const showAll = map->IsBattlegroundOrArena() || map->IsDungeon();
|
||||
handler->PSendSysMessage("Listing all spawn points in map %u (%s)%s:", mapId, map->GetMapName(), showAll ? "" : " within 5000yd");
|
||||
for (auto const& pair : sObjectMgr->GetAllCreatureData())
|
||||
{
|
||||
SpawnData const& data = pair.second;
|
||||
if (data.spawnPoint.GetMapId() != mapId)
|
||||
continue;
|
||||
CreatureTemplate const* cTemp = sObjectMgr->GetCreatureTemplate(data.id);
|
||||
if (!cTemp)
|
||||
continue;
|
||||
if (showAll || data.spawnPoint.IsInDist2d(player, 5000.0))
|
||||
handler->PSendSysMessage("Type: %u | SpawnId: %u | Entry: %u (%s) | X: %.3f | Y: %.3f | Z: %.3f", uint32(data.type), data.spawnId, data.id, cTemp->Name.c_str(), data.spawnPoint.GetPositionX(), data.spawnPoint.GetPositionY(), data.spawnPoint.GetPositionZ());
|
||||
}
|
||||
for (auto const& pair : sObjectMgr->GetAllGameObjectData())
|
||||
{
|
||||
SpawnData const& data = pair.second;
|
||||
if (data.spawnPoint.GetMapId() != mapId)
|
||||
continue;
|
||||
GameObjectTemplate const* goTemp = sObjectMgr->GetGameObjectTemplate(data.id);
|
||||
if (!goTemp)
|
||||
continue;
|
||||
if (showAll || data.spawnPoint.IsInDist2d(player, 5000.0))
|
||||
handler->PSendSysMessage("Type: %u | SpawnId: %u | Entry: %u (%s) | X: %.3f | Y: %.3f | Z: %.3f", uint32(data.type), data.spawnId, data.id, goTemp->name.c_str(), data.spawnPoint.GetPositionX(), data.spawnPoint.GetPositionY(), data.spawnPoint.GetPositionZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static char const* GetZoneName(uint32 zoneId, LocaleConstant locale)
|
||||
{
|
||||
AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(zoneId);
|
||||
|
||||
Reference in New Issue
Block a user