Core/Commands: Add .guild list GM command to list all guilds

Port From (https://github.com/TrinityCore/TrinityCore/commit/0ed0e66ee00c5cf0ca48c6f8e5b10bf26ef15eb1)
This commit is contained in:
Hondacrx
2025-08-27 23:16:11 -04:00
parent 869af17b23
commit af5bde1bea
3 changed files with 40 additions and 1 deletions
@@ -206,5 +206,36 @@ namespace Game.Chat
handler.SendSysMessage(CypherStrings.GuildInfoExtraInfo, guild.GetInfo()); // Extra Information
return true;
}
[Command("info", RBACPermissions.CommandGuildInfo, true)]
static bool HandleGuildListCommand(CommandHandler handler)
{
string titleAndSummaryColor = handler.IsConsole() ? "" : "|cff00ff00";
string tableHeaderColor = handler.IsConsole() ? "" : "|cff00ffff";
string resetColor = handler.IsConsole() ? "" : "|r";
handler.SendSysMessage(CypherStrings.GuildListTitle, titleAndSummaryColor, resetColor);
handler.SendSysMessage(CypherStrings.GuildListHeader, tableHeaderColor, resetColor);
var guildStore = Global.GuildMgr.GetGuildStore();
foreach (var (id, g) in guildStore)
{
if (!Global.CharacterCacheStorage.GetCharacterNameByGuid(g.GetLeaderGUID(), out string gmName))
gmName = "---";
handler.SendSysMessage(CypherStrings.GuildListRow,
id,
g.GetName(),
gmName,
Time.GetTimeString(g.GetCreatedDate()),
g.GetMembersCount(),
g.GetBankMoney() / MoneyConstants.Gold
);
}
handler.SendSysMessage(CypherStrings.GuildListTotal, titleAndSummaryColor, guildStore.Count, resetColor);
return true;
}
}
}