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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user