mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-19 08:30:34 +01:00
Core/Commands: implement .pvpstats command
Shows number of battleground victories in the last 7 days Closes #13460
This commit is contained in:
@@ -79,6 +79,7 @@ public:
|
||||
{ "pinfo", rbac::RBAC_PERM_COMMAND_PINFO, true, &HandlePInfoCommand, "", NULL },
|
||||
{ "playall", rbac::RBAC_PERM_COMMAND_PLAYALL, false, &HandlePlayAllCommand, "", NULL },
|
||||
{ "possess", rbac::RBAC_PERM_COMMAND_POSSESS, false, &HandlePossessCommand, "", NULL },
|
||||
{ "pvpstats", rbac::RBAC_PERM_COMMAND_PVPSTATS, true, &HandlePvPstatsCommand, "", NULL },
|
||||
{ "recall", rbac::RBAC_PERM_COMMAND_RECALL, false, &HandleRecallCommand, "", NULL },
|
||||
{ "repairitems", rbac::RBAC_PERM_COMMAND_REPAIRITEMS, true, &HandleRepairitemsCommand, "", NULL },
|
||||
{ "respawn", rbac::RBAC_PERM_COMMAND_RESPAWN, false, &HandleRespawnCommand, "", NULL },
|
||||
@@ -101,6 +102,35 @@ public:
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandlePvPstatsCommand(ChatHandler * handler, char const* /*args*/)
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PVPSTATS_FACTIONS_OVERALL);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 horde_victories = fields[1].GetUInt32();
|
||||
|
||||
if (!(result->NextRow()))
|
||||
return false;
|
||||
|
||||
fields = result->Fetch();
|
||||
uint32 alliance_victories = fields[1].GetUInt32();
|
||||
|
||||
handler->PSendSysMessage(LANG_PVPSTATS, alliance_victories, horde_victories);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
handler->PSendSysMessage(LANG_PVPSTATS_DISABLED);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDevCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
|
||||
Reference in New Issue
Block a user