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
+7 -1
View File
@@ -1021,7 +1021,13 @@ namespace Framework.Constants
AccountBnetUnlinked = 1216,
AccountBnetNotLinked = 1217,
DisallowTicketsConfig = 1218,
// 1219-1499 - Free
// Guild list (.guild list)
GuildListTitle = 1219,
GuildListHeader = 1220,
GuildListRow = 1221,
GuildListTotal = 1222,
// 1223-1499 - free
// Command Argument Parsers
CmdparserEither = 1500,
@@ -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;
}
}
}
+2
View File
@@ -487,6 +487,8 @@ namespace Game
public void SetNextGuildId(uint Id) { NextGuildId = Id; }
public Dictionary<ulong, Guild> GetGuildStore() { return GuildStore; }
public List<GuildReward> GetGuildRewards() { return guildRewards; }
uint NextGuildId;