mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Commands: Add .guild list GM command to list all guilds (#30930)
This commit is contained in:
@@ -33,6 +33,7 @@ EndScriptData */
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "RBAC.h"
|
||||
#include "Util.h"
|
||||
#include <iomanip>
|
||||
|
||||
#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
|
||||
@@ -56,6 +57,7 @@ public:
|
||||
{ "rank", rbac::RBAC_PERM_COMMAND_GUILD_RANK, true, &HandleGuildRankCommand, "" },
|
||||
{ "rename", rbac::RBAC_PERM_COMMAND_GUILD_RENAME, true, &HandleGuildRenameCommand, "" },
|
||||
{ "info", rbac::RBAC_PERM_COMMAND_GUILD_INFO, true, &HandleGuildInfoCommand, "" },
|
||||
{ "list", rbac::RBAC_PERM_COMMAND_GUILD_INFO, true, &HandleGuildListCommand, "" },
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
{
|
||||
@@ -299,6 +301,37 @@ public:
|
||||
handler->PSendSysMessage(LANG_GUILD_INFO_EXTRA_INFO, guild->GetInfo().c_str()); // Extra Information
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleGuildListCommand(ChatHandler* handler)
|
||||
{
|
||||
std::string_view titleAndSummaryColor = handler->IsConsole() ? ""sv : "|cff00ff00"sv;
|
||||
std::string_view tableHeaderColor = handler->IsConsole() ? ""sv : "|cff00ffff"sv;
|
||||
std::string_view resetColor = handler->IsConsole() ? ""sv : "|r"sv;
|
||||
|
||||
handler->PSendSysMessage(LANG_GUILD_LIST_TITLE, titleAndSummaryColor, resetColor);
|
||||
handler->PSendSysMessage(LANG_GUILD_LIST_HEADER, tableHeaderColor, resetColor);
|
||||
|
||||
GuildMgr::GuildContainer const& guildStore = sGuildMgr->GetGuildStore();
|
||||
|
||||
for (auto const& [id, g] : guildStore)
|
||||
{
|
||||
std::string gmName;
|
||||
if (!sCharacterCache->GetCharacterNameByGuid(g->GetLeaderGUID(), gmName))
|
||||
gmName = "---";
|
||||
|
||||
handler->PSendSysMessage(LANG_GUILD_LIST_ROW,
|
||||
id,
|
||||
g->GetName().c_str(),
|
||||
gmName.c_str(),
|
||||
TimeToTimestampStr(g->GetCreatedDate()).c_str(),
|
||||
g->GetMembersCount(),
|
||||
g->GetBankMoney() / GOLD
|
||||
);
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_GUILD_LIST_TOTAL, titleAndSummaryColor, guildStore.size(), resetColor);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_guild_commandscript()
|
||||
|
||||
Reference in New Issue
Block a user