mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 17:49:10 +00:00
feat(Scripts/Commands): Implement debug zonestats command (#23249)
This commit is contained in:
@@ -100,7 +100,8 @@ public:
|
||||
{ "dummy", HandleDebugDummyCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "mapdata", HandleDebugMapDataCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "boundary", HandleDebugBoundaryCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "visibilitydata", HandleDebugVisibilityDataCommand, SEC_ADMINISTRATOR, Console::No }
|
||||
{ "visibilitydata", HandleDebugVisibilityDataCommand, SEC_ADMINISTRATOR, Console::No },
|
||||
{ "zonestats", HandleDebugZoneStatsCommand, SEC_MODERATOR, Console::Yes}
|
||||
};
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
@@ -1434,6 +1435,31 @@ public:
|
||||
handler->PSendSysMessage("Zone wide visible objects in zone: {}", zoneWideVisibleObjectsInZone);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebugZoneStatsCommand(ChatHandler* handler, Optional<PlayerIdentifier> playerTarget)
|
||||
{
|
||||
if (!playerTarget)
|
||||
playerTarget = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
|
||||
if (!playerTarget)
|
||||
{
|
||||
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player* player = playerTarget->GetConnectedPlayer();
|
||||
|
||||
if (!player)
|
||||
{
|
||||
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 zoneId = player->GetZoneId();
|
||||
AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(zoneId);
|
||||
handler->PSendSysMessage("Player count in zone {} ({}): {}.", zoneId, (zoneEntry ? zoneEntry->area_name[LOCALE_enUS] : "<unknown>"), player->GetMap()->GetPlayerCountInZone(zoneId));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_debug_commandscript()
|
||||
|
||||
Reference in New Issue
Block a user