private void OnSecurityCommand(BotShell bot, CommandArgs e) { bot.SendReply(e, "Gathering Data. This can take several minutes. Please stand by..."); RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Invalid ID's / Rerolled Characters"); List <SecurityProcessItem> members = new List <SecurityProcessItem>(); lock (this._database.Connection) { using (IDbCommand command = this._database.Connection.CreateCommand()) { command.CommandText = "SELECT username as name, userID as id, 'Main' as type FROM members UNION SELECT altname, altID, 'Alt' FROM alts ORDER BY name"; IDataReader reader = command.ExecuteReader(); while (reader.Read()) { string username = reader.GetString(0); UInt32 userID = (UInt32)reader.GetInt64(1); string type = reader.GetString(2); members.Add(new SecurityProcessItem(username, userID, type)); } reader.Close(); } } foreach (SecurityProcessItem member in members) { UInt32 realID = bot.GetUserID(member.Username); if (realID == 0) { window.AppendHighlight(member.Username); window.AppendNormalStart(); window.AppendString(" (" + member.Type + ") ("); window.AppendColorString(RichTextWindow.ColorRed, "Deleted"); window.AppendString(") ["); window.AppendBotCommand("Account", "account " + member.Username); window.AppendString("]"); window.AppendColorEnd(); window.AppendLineBreak(); } else if (realID != member.UserID) { window.AppendHighlight(member.Username); window.AppendNormalStart(); window.AppendString(" (Current=" + member.UserID + " Real=" + realID + ") (" + member.Type + ") ("); window.AppendColorString(RichTextWindow.ColorOrange, "Invalid ID"); window.AppendString(") ["); window.AppendBotCommand("Account", "account " + member.Username); window.AppendString("] ["); window.AppendBotCommand("Fix", "security fixid " + member.Username); window.AppendString("]"); window.AppendColorEnd(); window.AppendLineBreak(); } } bot.SendReply(e, "Security Report »» ", window); }
private void OnTeamsCommand(BotShell bot, CommandArgs e) { RichTextWindow window = new RichTextWindow(bot); window.AppendHighlight(":: "); window.AppendColorString(bot.ColorHeaderHex, "Teams"); window.AppendHighlight(" ::"); bool found = false; int currentTeam = -1; int currentMember = 0; using (IDbCommand command = this._database.Connection.CreateCommand()) { command.CommandText = "SELECT username, team, leader FROM teams ORDER BY team, username"; IDataReader reader = command.ExecuteReader(); while (reader.Read()) { string username = Format.UppercaseFirst(reader.GetString(0)); int team = (int)reader.GetInt64(1); bool leader = (reader.GetInt64(2) > 0); if (team != currentTeam) { currentMember = 0; currentTeam = team; window.AppendLineBreak(); window.AppendHighlight(" Team " + team + ": "); } currentMember++; window.AppendNormalStart(); window.AppendString(""); if (leader) { window.AppendColorString(RichTextWindow.ColorRed, username); } else { window.AppendString(username); } window.AppendString(" "); window.AppendColorEnd(); found = true; } reader.Close(); } if (found) { bot.SendReply(e, window.Text); return; } bot.SendReply(e, "There are currently no teams setup"); }
private void OnAuctionCommand(BotShell bot, CommandArgs e) { if (!this._running) { bot.SendReply(e, "There is currently no auction running"); return; } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Auction"); window.AppendHighlight("Item: "); window.AppendNormalStart(); window.AppendRawString(this._item); window.AppendString(" ["); window.AppendBotCommand("Abort", "auction abort"); window.AppendString("]"); window.AppendColorEnd(); window.AppendLineBreak(); window.AppendHighlight("High Bidder: "); if (this._currentBid > 0) { window.AppendNormal(this._bidder); window.AppendLineBreak(); window.AppendHighlight("High Bid: "); window.AppendNormal(this._currentBid.ToString()); } else { window.AppendNormal("N/A"); } window.AppendLineBreak(); double points = this._core.GetPoints(e.Sender); if (points > this._core.MinimumPoints) { window.AppendHighlight("Your Points: "); if (points > this._currentBid) { window.AppendColorString(RichTextWindow.ColorGreen, points.ToString()); } else { window.AppendColorString(RichTextWindow.ColorRed, points.ToString()); } window.AppendLineBreak(); } window.AppendHighlight("Time Left: "); window.AppendNormal(this._timeLeft.ToString() + " seconds"); window.AppendLineBreak(); bot.SendReply(e, "Auction »» ", window); }
public void OnBattleCommand(BotShell bot, CommandArgs e) { try { using (IDbCommand command = this._database.Connection.CreateCommand()) { RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Tower Battle History"); window.AppendLineBreak(); command.CommandText = "SELECT [time], [atkrSide] , [atkrOrg], [atkrName], [defSide], [defOrg], [zone], [xCoord], [yCoord], [LCA] FROM [towerhistory] WHERE victory = 0 ORDER BY [time] DESC LIMIT 10"; IDataReader reader = command.ExecuteReader(); while (reader.Read()) { window.AppendHeader(Format.DateTime(reader.GetInt64(0), FormatStyle.Compact) + " GMT"); if (!reader.IsDBNull(2)) { window.AppendHighlight("Attacker: "); window.AppendColorString(this.sideColorWindow(reader.GetString(3), reader.GetString(1)), reader.GetString(3)); window.AppendNormal(" - ("); window.AppendColorString(this.sideColorWindow(reader.GetString(2), reader.GetString(1)), reader.GetString(2)); window.AppendNormal(")"); window.AppendLineBreak(); } else { WhoisResult whois = XML.GetWhois(reader.GetString(3), bot.Dimension); window.AppendHighlight("Attacker: "); window.AppendColorString(this.sideColorWindow(reader.GetString(3), whois.Stats.Faction), reader.GetString(3)); window.AppendNormal(" - (Unguilded)"); window.AppendLineBreak(); } window.AppendHighlight("Defender: "); window.AppendColorString(this.sideColorWindow(reader.GetString(5), reader.GetString(4)), reader.GetString(5)); window.AppendLineBreak(); window.AppendHighlight("Location: "); window.AppendNormal(reader.GetString(6) + " (x"); window.AppendColorString("FF0000", reader.GetInt64(9).ToString()); window.AppendNormal(" " + reader.GetInt64(7) + "x" + reader.GetInt64(8) + ")"); window.AppendLineBreak(2); } bot.SendReply(e, " Tower Battle Results »» ", window); return; } } catch { bot.SendReply(e, "Error retrieving battle history!"); } }
public void OnVictoryCommand(BotShell bot, CommandArgs e) { try { using (IDbCommand command = this._database.Connection.CreateCommand()) { RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Tower Victory History"); window.AppendLineBreak(); command.CommandText = "SELECT [time], [atkrSide], [atkrOrg], [defSide], [defOrg], [zone] FROM [towerhistory] WHERE victory = 1 ORDER BY [time] DESC LIMIT 10"; IDataReader reader = command.ExecuteReader(); while (reader.Read()) { window.AppendHeader(Format.DateTime(reader.GetInt64(0), FormatStyle.Compact) + " GMT"); if (!reader.IsDBNull(1)) { window.AppendHighlight("Attacker: "); window.AppendColorString(this.sideColorWindow(reader.GetString(2), reader.GetString(1)), reader.GetString(2)); window.AppendLineBreak(); window.AppendHighlight("Defender: "); window.AppendColorString(this.sideColorWindow(reader.GetString(4), reader.GetString(3)), reader.GetString(4)); window.AppendLineBreak(); window.AppendHighlight("Location: "); window.AppendNormal(reader.GetString(5)); window.AppendLineBreak(2); } else { window.AppendColorString(this.sideColor(reader.GetString(4), reader.GetString(3)), reader.GetString(4)); window.AppendNormal(" lost their base in " + reader.GetString(5) + "."); window.AppendLineBreak(2); } } bot.SendReply(e, " Tower Victory Results »» ", window); return; } } catch { bot.SendReply(e, "Error retrieving battle victory history!"); } }
private void OnConfigurationColorCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 2) { bot.SendReply(e, "Usage: configuration color [plugin] [key]"); return; } if (!bot.Configuration.IsRegistered(e.Args[0], e.Args[1])) { bot.SendReply(e, "No such configuration entry"); return; } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle(); bool first = true; string section = e.Args[0].ToLower(); string key = e.Args[1].ToLower(); string command = "configuration set " + section + " " + key + " "; foreach (KeyValuePair <string, string> color in this.Colors) { if (color.Value != string.Empty) { window.AppendString(" "); window.AppendBotCommandStart(command + color.Value, true); window.AppendColorString(color.Value, color.Key); window.AppendCommandEnd(); window.AppendLineBreak(); } else { if (!first) { window.AppendLineBreak(); } window.AppendHeader(color.Key); first = false; } } window.AppendLineBreak(); window.AppendHeader("Other"); window.AppendHighlight("To select a different color not listed above use: "); window.AppendLineBreak(); window.AppendNormal("/tell " + bot.Character + " " + command + "<color hex>"); bot.SendReply(e, "Color Selection »» ", window); }
public void OnPluginsInfoCommand(BotShell bot, CommandArgs e) { PluginLoader info = bot.Plugins.GetLoader(e.Args[1]); if (info == null) { bot.SendReply(e, "Unable to get plugin information"); return; } RichTextWindow infoWindow = new RichTextWindow(bot); infoWindow.AppendTitle("Plugin Information"); infoWindow.AppendHighlight("Name: "); infoWindow.AppendNormal(info.Name); infoWindow.AppendLineBreak(); infoWindow.AppendHighlight("Version: "); infoWindow.AppendNormal(info.Version.ToString()); infoWindow.AppendLineBreak(); infoWindow.AppendHighlight("Author: "); infoWindow.AppendNormal(info.Author); infoWindow.AppendLineBreak(); infoWindow.AppendHighlight("Internal Name: "); infoWindow.AppendNormal(info.InternalName); infoWindow.AppendLineBreak(); if (info.Description != null) { infoWindow.AppendHighlight("Description: "); infoWindow.AppendNormal(info.Description); infoWindow.AppendLineBreak(); } infoWindow.AppendHighlight("State: "); infoWindow.AppendNormal(bot.Plugins.GetState(info.InternalName).ToString()); infoWindow.AppendLineBreak(); if (info.Commands.Length > 0) { infoWindow.AppendHighlight("Commands: "); infoWindow.AppendLineBreak(); bool isLoaded = bot.Plugins.IsLoaded(info.InternalName); lock (info) { foreach (Command command in info.Commands) { infoWindow.AppendNormalStart(); infoWindow.AppendString(" " + Format.UppercaseFirst(command.CommandName)); if (!isLoaded && bot.Commands.Exists(command.CommandName)) { infoWindow.AppendString(" ("); infoWindow.AppendColorString(RichTextWindow.ColorRed, "Conflict with " + bot.Plugins.GetName(bot.Commands.GetInternalName(command.CommandName))); infoWindow.AppendString(")"); } infoWindow.AppendColorEnd(); infoWindow.AppendLineBreak(); } } } if (info.Dependencies.Length > 0) { infoWindow.AppendHighlight("Dependencies: "); infoWindow.AppendLineBreak(); lock (info) { foreach (string dependency in info.Dependencies) { infoWindow.AppendNormalStart(); infoWindow.AppendString(" "); if (bot.Plugins.Exists(dependency)) { infoWindow.AppendString(bot.Plugins.GetName(dependency)); infoWindow.AppendString(" ("); if (bot.Plugins.IsLoaded(dependency)) { infoWindow.AppendColorString(RichTextWindow.ColorGreen, "Loaded"); } else { infoWindow.AppendColorString(RichTextWindow.ColorOrange, "Not Loaded"); } infoWindow.AppendString(") ["); infoWindow.AppendCommand("Info", "plugins info " + dependency); infoWindow.AppendString("]"); } else { infoWindow.AppendString(dependency + " ("); infoWindow.AppendColorString(RichTextWindow.ColorRed, "Not Found"); infoWindow.AppendString(")"); } infoWindow.AppendColorEnd(); infoWindow.AppendLineBreak(); } } } bot.SendReply(e, "Plugin Information »» " + infoWindow.ToString()); }
private void OnWhoisCommand(BotShell bot, CommandArgs e, AoLib.Net.Server dimension, Boolean showDimension) { if (!showDimension && dimension == AoLib.Net.Server.Test) { bot.SendReply(e, "The whois command is not available on the test server."); return; } if (dimension == bot.Dimension) { if (bot.GetUserID(e.Args[0]) < 100) { bot.SendReply(e, "No such user: "******": "); } error += "Unable to gather information on that user " + this.TimeoutError; bot.SendReply(e, error); return; } RichTextWindow window = new RichTextWindow(bot); StringBuilder builder = new StringBuilder(); if (showDimension) { builder.Append(HTML.CreateColorString(bot.ColorHeaderHex, dimension.ToString() + ": ")); } builder.Append(String.Format("{0} (Level {1}", whois.Name.Nickname, whois.Stats.Level)); window.AppendTitle(whois.Name.ToString()); window.AppendHighlight("Breed: "); window.AppendNormal(whois.Stats.Breed); window.AppendLineBreak(); window.AppendHighlight("Gender: "); window.AppendNormal(whois.Stats.Gender); window.AppendLineBreak(); window.AppendHighlight("Profession: "); window.AppendNormal(whois.Stats.Profession); window.AppendLineBreak(); window.AppendHighlight("Level: "); window.AppendNormal(whois.Stats.Level.ToString()); window.AppendLineBreak(); if (whois.Stats.DefenderLevel != 0) { window.AppendHighlight("Defender Rank: "); window.AppendNormal(String.Format("{0} ({1})", whois.Stats.DefenderRank, whois.Stats.DefenderLevel)); window.AppendLineBreak(); builder.Append(" / Defender Rank " + whois.Stats.DefenderLevel); } if (dimension == bot.Dimension) { window.AppendHighlight("Status: "); UInt32 userid = bot.GetUserID(whois.Name.Nickname); OnlineState state = bot.FriendList.IsOnline(userid); switch (state) { case OnlineState.Online: window.AppendColorString(RichTextWindow.ColorGreen, "Online"); break; case OnlineState.Offline: window.AppendColorString(RichTextWindow.ColorRed, "Offline"); Int64 seen = bot.FriendList.Seen(whois.Name.Nickname); if (seen > 0) { window.AppendLineBreak(); window.AppendHighlight("Last Seen: "); window.AppendNormal(Format.DateTime(seen, FormatStyle.Compact)); } break; default: window.AppendColorString(RichTextWindow.ColorOrange, "Unknown"); break; } window.AppendLineBreak(); } builder.Append(")"); builder.Append(String.Format(" is a {0} {1}", whois.Stats.Faction, whois.Stats.Profession)); window.AppendHighlight("Alignment: "); window.AppendNormal(whois.Stats.Faction); window.AppendLineBreak(); if (whois.InOrganization) { window.AppendHighlight("Organization: "); window.AppendNormal(whois.Organization.Name); window.AppendLineBreak(); window.AppendHighlight("Organization Rank: "); window.AppendNormal(whois.Organization.Rank); window.AppendLineBreak(); builder.AppendFormat(", {0} of {1}", whois.Organization.Rank, whois.Organization.Name); } window.AppendHighlight("Last Updated: "); window.AppendNormal(whois.LastUpdated); window.AppendLineBreak(2); if (dimension == bot.Dimension) { window.AppendHeader("Options"); window.AppendCommand("Add to Friendlist", "/cc addbuddy " + whois.Name.Nickname); window.AppendLineBreak(); window.AppendCommand("Remove from Friendlist", "/cc rembuddy " + whois.Name.Nickname); window.AppendLineBreak(); window.AppendBotCommand("Character History", "history " + whois.Name.Nickname); window.AppendLineBreak(); if (whois.Organization != null && whois.Organization.Name != null) { window.AppendBotCommand("Organization Information", "organization " + whois.Name.Nickname); window.AppendLineBreak(); } window.AppendLineBreak(); } window.AppendHeader("Links"); window.AppendCommand("Official Character Website", "/start " + string.Format(this.CharWebsite, (int)dimension, whois.Name.Nickname)); window.AppendLineBreak(); if (whois.Organization != null && whois.Organization.Name != null) { window.AppendCommand("Official Organization Website", "/start " + string.Format(this.OrgWebsite, (int)dimension, whois.Organization.ID)); window.AppendLineBreak(); } window.AppendCommand("Auno's Character Website", "/start " + string.Format(this.CharAunoWebsite, (int)dimension, whois.Name.Nickname)); window.AppendLineBreak(); if (whois.Organization != null && whois.Organization.Name != null) { window.AppendCommand("Auno's Organization Website", "/start " + string.Format(this.OrgAunoWebsite, (int)dimension, whois.Organization.Name.Replace(' ', '+'))); window.AppendLineBreak(); } builder.Append(" »» " + window.ToString("More Information")); bot.SendReply(e, builder.ToString()); }
private void OnTeamsAdminCommand(BotShell bot, CommandArgs e) { List <string> seen = new List <string>(); List <int> teams = new List <int>(); using (IDbCommand command = this._database.Connection.CreateCommand()) { command.CommandText = "SELECT team FROM teams GROUP BY team"; IDataReader reader = command.ExecuteReader(); while (reader.Read()) { teams.Add((int)reader.GetInt64(0)); } reader.Close(); } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Teams Manager"); window.AppendCommand("Display Teams", "/g " + bot.Character + " " + bot.CommandSyntax + "teams"); window.AppendLineBreak(); window.AppendBotCommand("Refresh Manager", "teams admin"); window.AppendLineBreak(); window.AppendBotCommand("Clear Teams", "teams clear"); window.AppendLineBreak(); int currentTeam = -1; int currentMember = 0; using (IDbCommand command = this._database.Connection.CreateCommand()) { command.CommandText = "SELECT username, team, leader FROM teams ORDER BY team, username"; IDataReader reader = command.ExecuteReader(); while (reader.Read()) { string username = Format.UppercaseFirst(reader.GetString(0)); seen.Add(username); int team = (int)reader.GetInt64(1); bool leader = (reader.GetInt64(2) > 0); if (team != currentTeam) { currentMember = 0; currentTeam = team; window.AppendLineBreak(); window.AppendHeader("Team " + team); } currentMember++; WhoisResult whois = XML.GetWhois(username, bot.Dimension); if (whois != null && whois.Success) { window.AppendHighlight(Format.Whois(whois, FormatStyle.Compact)); } else { window.AppendHighlight(username); } window.AppendNormalStart(); if (leader) { window.AppendString(" ("); window.AppendColorString(RichTextWindow.ColorRed, "Leader"); window.AppendString(")"); } foreach (int tm in teams) { if (tm == team) { continue; } window.AppendString(" ["); window.AppendBotCommand(tm.ToString(), "teams set " + username + " " + tm); window.AppendString("]"); } if (!leader) { window.AppendString(" ["); window.AppendBotCommand("Leader", "teams leader " + username + " " + team); window.AppendString("]"); } window.AppendString(" ["); window.AppendBotCommand("Remove", "teams remove " + username); window.AppendString("]"); window.AppendString(" ["); window.AppendBotCommand("New Team", "teams start " + username); window.AppendString("]"); window.AppendColorEnd(); window.AppendLineBreak(); } reader.Close(); } window.AppendLineBreak(); window.AppendHeader("Looking for Team"); int lft = 0; List <string> list = new List <string>(); foreach (Friend user in bot.PrivateChannel.List().Values) { list.Add(user.User); } // If 'Raid :: Core' is loaded, fetch the lft list from there List <string> raiders = new List <string>(); if (bot.Plugins.IsLoaded("raidcore")) { try { ReplyMessage reply = bot.SendPluginMessageAndWait(this.InternalName, "raidcore", "GetActiveRaiders", 100); if (reply != null && reply.Args.Length > 0) { raiders = new List <string>((string[])reply.Args); } } catch { } } // Sort LFT list SortedDictionary <string, SortedDictionary <string, WhoisResult> > sorted = new SortedDictionary <string, SortedDictionary <string, WhoisResult> >(); foreach (string member in list) { WhoisResult whois = XML.GetWhois(member, bot.Dimension); if (whois == null || !whois.Success) { whois = null; } if (!sorted.ContainsKey(whois.Stats.Profession)) { sorted.Add(whois.Stats.Profession, new SortedDictionary <string, WhoisResult>()); } sorted[whois.Stats.Profession].Add(member, whois); } // Display LFT list foreach (KeyValuePair <string, SortedDictionary <string, WhoisResult> > kvp in sorted) { window.AppendHighlight(kvp.Key); window.AppendLineBreak(); foreach (KeyValuePair <string, WhoisResult> member in kvp.Value) { if (seen.Contains(member.Key)) { continue; } window.AppendNormalStart(); window.AppendString("- "); if (member.Value != null && member.Value.Success) { window.AppendString(Format.Whois(member.Value, FormatStyle.Compact)); } else { window.AppendString(member.Key); } if (raiders.Contains(member.Key)) { window.AppendString(" ["); window.AppendColorString(RichTextWindow.ColorGreen, "R"); window.AppendString("]"); } foreach (int tm in teams) { window.AppendString(" ["); window.AppendBotCommand(tm.ToString(), "teams set " + member.Key + " " + tm); window.AppendString("]"); } window.AppendString(" ["); window.AppendBotCommand("New Team", "teams start " + member.Key); window.AppendString("]"); window.AppendColorEnd(); window.AppendLineBreak(); lft++; } window.AppendLineBreak(); } if (lft == 0) { window.AppendHighlight("None"); } bot.SendReply(e, "Teams Manager »» ", window); }
private void OnForumCommand(BotShell bot, CommandArgs e) { string username = e.Sender; if (e.Args.Length > 0) { username = Format.UppercaseFirst(e.Args[0]); } ForumAccount account = this.GetAccount(username); if (account == null) { bot.SendReply(e, "Unable to locate " + HTML.CreateColorString(bot.ColorHeaderHex, username + "'s") + " forum account"); return; } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle(username + "'s Forum Account"); window.AppendHighlight("Name: "); window.AppendNormal(account.Realname); window.AppendLineBreak(); window.AppendHighlight("Primary Group: "); if (account.PrimaryGroup != string.Empty) { window.AppendNormal(account.PrimaryGroup); } else { window.AppendNormal("N/A"); } window.AppendLineBreak(); window.AppendHighlight("E-mail Address: "); window.AppendNormal(account.Email); window.AppendLineBreak(); window.AppendHighlight("Post Count: "); window.AppendNormal(account.Posts.ToString()); if (account.Rank != string.Empty) { window.AppendNormal(" (" + account.Rank + ")"); } window.AppendLineBreak(); window.AppendHighlight("Epeen: "); window.AppendNormal(account.Karma.ToString()); window.AppendLineBreak(); window.AppendHighlight("Enabled: "); if (account.Enabled) { window.AppendColorString(RichTextWindow.ColorGreen, "Yes"); } else { window.AppendColorString(RichTextWindow.ColorRed, "No"); if (username == e.Sender) { window.AppendNormal(" ["); window.AppendBotCommand("Activate", "forum activate"); window.AppendNormal("]"); } } window.AppendLineBreak(); window.AppendHighlight("Registered On: "); window.AppendNormal(Format.DateTime(account.Registered, FormatStyle.Medium)); window.AppendLineBreak(); if (account.Seen > 0) { window.AppendHighlight("Last Seen: "); TimeSpan span = TimeStamp.ToDateTime(TimeStamp.Now) - TimeStamp.ToDateTime(account.Seen); window.AppendNormal(Format.Time(span, FormatStyle.Large) + " ago"); window.AppendLineBreak(); } if (account.Groups.Count > 0) { window.AppendLineBreak(); window.AppendHeader("Additional Groups"); foreach (string group in account.Groups.Values) { window.AppendHighlight(group); window.AppendLineBreak(); } } bot.SendReply(e, username + "'s Forum Account »» " + window.ToString()); }
private void OnAdminsCommand(BotShell bot, CommandArgs e) { SortedDictionary <string, UserLevel> members = bot.Users.GetUsers(); List <string> chars = new List <string>(); RichTextWindow window = new RichTextWindow(bot); RichTextWindow superadmins = new RichTextWindow(bot); RichTextWindow admins = new RichTextWindow(bot); RichTextWindow leaders = new RichTextWindow(bot); int adminCount = 0; foreach (KeyValuePair <string, UserLevel> member in members) { RichTextWindow tmp = null; switch (member.Value) { case UserLevel.SuperAdmin: tmp = superadmins; break; case UserLevel.Admin: tmp = admins; break; case UserLevel.Leader: tmp = leaders; break; default: continue; } chars.Add(member.Key.ToLower()); tmp.AppendHighlightStart(); tmp.AppendString(member.Key); tmp.AppendString(" is "); if (bot.FriendList.IsOnline(member.Key) == OnlineState.Online) { tmp.AppendColorString(RichTextWindow.ColorGreen, "Online"); } else { tmp.AppendColorString(RichTextWindow.ColorRed, "Offline"); } tmp.AppendColorEnd(); tmp.AppendLineBreak(); if (!bot.FriendList.IsFriend(member.Key)) { bot.FriendList.Add(this.InternalName, member.Key); } foreach (string alt in bot.Users.GetAlts(member.Key)) { chars.Add(alt.ToLower()); tmp.AppendNormalStart(); tmp.AppendString("- " + Format.UppercaseFirst(alt)); tmp.AppendString(" is "); if (bot.FriendList.IsOnline(alt) == OnlineState.Online) { tmp.AppendColorString(RichTextWindow.ColorGreen, "Online"); } else { tmp.AppendColorString(RichTextWindow.ColorRed, "Offline"); } tmp.AppendColorEnd(); tmp.AppendLineBreak(); if (!bot.FriendList.IsFriend(alt)) { bot.FriendList.Add(this.InternalName, alt); } } adminCount++; } foreach (string friend in bot.FriendList.List(this.InternalName)) { if (!chars.Contains(friend.ToLower())) { bot.FriendList.Remove(this.InternalName, friend); } } window.AppendTitle("Super Admins"); window.AppendRawString(superadmins.Text); window.AppendLineBreak(); window.AppendHeader("Admins"); window.AppendRawString(admins.Text); window.AppendLineBreak(); window.AppendHeader("Leaders"); window.AppendRawString(leaders.Text); window.AppendLineBreak(); bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, adminCount.ToString()) + " Admins »» ", window); }
public RichTextWindow GetAltsWindow(BotShell bot, string user) { string main = bot.Users.GetMain(user); string[] alts = bot.Users.GetAlts(main); if (alts.Length < 1) { return(null); } RichTextWindow window = new RichTextWindow(bot); List <string> characters = new List <string>(); characters.Add(main); foreach (string alt in alts) { characters.Add(alt); } window.AppendTitle(); foreach (string character in characters) { window.AppendHeader(Format.UppercaseFirst(character)); window.AppendHighlight("Status: "); if (bot.FriendList.IsOnline(character) == OnlineState.Online) { window.AppendColorString(RichTextWindow.ColorGreen, "Online"); } else { window.AppendColorString(RichTextWindow.ColorRed, "Offline"); window.AppendLineBreak(); window.AppendHighlight("Last Seen: "); Int64 seen = bot.FriendList.Seen(character); if (seen > 1) { window.AppendNormal(Format.DateTime(seen, FormatStyle.Large) + " GMT"); } else { window.AppendNormal("N/A"); } } window.AppendLineBreak(); window.AppendHighlight("User Level: "); window.AppendNormal(bot.Users.GetUser(character).ToString()); window.AppendLineBreak(); WhoisResult whois = XML.GetWhois(character, bot.Dimension); if (whois != null && whois.Success) { window.AppendHighlight("Profession: "); window.AppendNormal(whois.Stats.Profession); window.AppendLineBreak(); window.AppendHighlight("Level: "); window.AppendNormal(whois.Stats.Level.ToString()); if (whois.Stats.DefenderLevel > 0) { window.AppendNormal(" / " + whois.Stats.DefenderLevel); } window.AppendLineBreak(); if (whois.InOrganization) { window.AppendHighlight("Organization: "); window.AppendNormal(whois.Organization.Name); window.AppendLineBreak(); window.AppendHighlight("Rank: "); window.AppendNormal(whois.Organization.Rank); window.AppendLineBreak(); } } window.AppendLineBreak(); } return(window); }
private void OnNewsID(BotShell bot, CommandArgs e) { double d; if (e.Args.Length == 0) { bot.SendReply(e, "Correct Usage: news id [id]"); return; } if (double.TryParse(e.Args[0], System.Globalization.NumberStyles.Integer, _cultureInfo, out d) == true) { try { using (IDbCommand command = this._database.Connection.CreateCommand()) { command.CommandText = "SELECT [news_name], [news_sticky] FROM [news] WHERE [news_id] = " + e.Args[0]; IDataReader reader = command.ExecuteReader(); if (reader.Read()) { if ((reader.GetString(0) == e.Sender || bot.Users.Authorized(e.Sender, UserLevel.Admin)) && e.Type == CommandType.Tell) { RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("News Options"); window.AppendHighlight("Sticky: "); if (reader.GetInt64(1) == 1) { window.AppendColorString(RichTextWindow.ColorGreen, "Enabled"); window.AppendNormal(" ["); window.AppendBotCommand("Disable", "news sticky " + e.Args[0] + " 0"); window.AppendNormal("]"); } else { window.AppendColorString(RichTextWindow.ColorOrange, "Disabled"); window.AppendNormal(" ["); window.AppendBotCommand("Enable", "news sticky " + e.Args[0] + " 1"); window.AppendNormal("]"); } window.AppendLineBreak(2); window.AppendHeader("Icon"); if (reader.GetInt64(1) == 1) { window.AppendNormal("There are no icons available for sticky posts"); } else { int counter = 0; foreach (string Icon in _iconList) { window.AppendBotCommandStart("news icon " + e.Args[0] + " " + counter.ToString()); window.AppendImage(Icon); window.AppendLinkEnd(); window.AppendNormal(" "); counter = counter + 1; } } bot.SendReply(e, "News Options »» ", window); return; } else { bot.SendReply(e, "You don't own this news post"); return; } } else { bot.SendReply(e, "No such news post"); return; } } } catch { bot.SendReply(e, "Error during news fetching. Please try again later"); return; } } bot.SendReply(e, "Invalid ID"); }
private void OnServerCommand(BotShell bot, CommandArgs e) { bot.SendReply(e, "Server Status »» Gathering Data..."); ServerStatusResult server = XML.GetServerStatus(); if (server == null || server.Dimensions == null) { bot.SendReply(e, "Unable to gather server information " + this.TimeoutError); return; } ServerStatusResult_Dimension dimension = server.GetDimension(bot.Dimension); RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Server Information"); window.AppendHighlight("Server Manager: "); if (dimension.ServerManager.Online) { window.AppendColorString(RichTextWindow.ColorGreen, "Online"); } else { window.AppendColorString(RichTextWindow.ColorRed, "Offline"); } window.AppendLineBreak(); window.AppendHighlight("Client Manager: "); if (dimension.ClientManager.Online) { window.AppendColorString(RichTextWindow.ColorGreen, "Online"); } else { window.AppendColorString(RichTextWindow.ColorRed, "Offline"); } window.AppendLineBreak(); window.AppendHighlight("Chat Server: "); if (dimension.ChatServer.Online) { window.AppendColorString(RichTextWindow.ColorGreen, "Online"); } else { window.AppendColorString(RichTextWindow.ColorRed, "Offline"); } window.AppendLineBreak(2); window.AppendHeader("Alignment"); window.AppendHighlight("Clan: "); window.AppendNormal(dimension.Distribution.Clan.Percent + "%"); window.AppendLineBreak(); window.AppendHighlight("Neutral: "); window.AppendNormal(dimension.Distribution.Neutral.Percent + "%"); window.AppendLineBreak(); window.AppendHighlight("Omni: "); window.AppendNormal(dimension.Distribution.Omni.Percent + "%"); window.AppendLineBreak(2); foreach (ServerStatusResult_Playfield pf in dimension.Playfields) { bool skip = false; foreach (string arg in e.Args) { if (!pf.Name.ToLower().Contains(arg.ToLower())) { skip = true; } } if (skip) { continue; } switch (pf.Status) { case PlayfieldStatus.Online: window.AppendImage("GFX_GUI_FRIENDLIST_STATUS_GREEN"); break; default: window.AppendImage("GFX_GUI_FRIENDLIST_STATUS_RED"); break; } window.AppendNormalStart(); window.AppendString(" "); window.AppendColorStart(RichTextWindow.ColorGreen); double players = 0; while (players <= pf.Players && players <= 8 && pf.Players != 0) { players += 0.5; window.AppendString("l"); } window.AppendColorEnd(); while (players <= 8) { players += 0.5; window.AppendString("l"); } window.AppendString(" "); window.AppendColorEnd(); window.AppendHighlight(pf.Name); window.AppendNormal(string.Format(" (ID: {0} Players: {1}%)", pf.ID, pf.Players)); window.AppendLineBreak(); } bot.SendReply(e, "Server Status »» ", window); }
private void OnRaidListCommand(BotShell bot, CommandArgs e) { if (!this._core.Running) { bot.SendReply(e, "There is currently no raid active"); return; } RaidCore.Raider[] raiders = this._core.GetRaiders(); if (raiders.Length == 0) { bot.SendReply(e, "There is currently nobody on the raid"); return; } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Raiders List"); SortedDictionary <string, Dictionary <RaidCore.Raider, WhoisResult> > sorted = new SortedDictionary <string, Dictionary <RaidCore.Raider, WhoisResult> >(); foreach (RaidCore.Raider raider in raiders) { WhoisResult whois = XML.GetWhois(raider.Character, bot.Dimension); if (whois == null || !whois.Success) { whois = new WhoisResult(); whois.Name = new WhoisResult_Name(); whois.Name.Nickname = raider.Character; whois.Stats = new WhoisResult_Stats(); whois.Stats.Level = 0; whois.Stats.Profession = "Unknown"; whois.Stats.DefenderLevel = 0; } if (!sorted.ContainsKey(whois.Stats.Profession)) { sorted.Add(whois.Stats.Profession, new Dictionary <RaidCore.Raider, WhoisResult>()); } sorted[whois.Stats.Profession].Add(raider, whois); } foreach (KeyValuePair <string, Dictionary <RaidCore.Raider, WhoisResult> > kvp in sorted) { window.AppendHighlight(kvp.Key); window.AppendLineBreak(); foreach (KeyValuePair <RaidCore.Raider, WhoisResult> raider in kvp.Value) { window.AppendNormalStart(); window.AppendString("- " + raider.Key.Character); if (raider.Key.Main != raider.Key.Character) { window.AppendString(" (" + raider.Key.Main + ")"); } if (raider.Value.Stats.Profession != "Unknown") { window.AppendString(" (L " + raider.Value.Stats.Level + "/" + raider.Value.Stats.DefenderLevel + ")"); } if (!raider.Key.OnRaid) { window.AppendString(" ("); window.AppendColorString(RichTextWindow.ColorRed, "Inactive"); window.AppendString(")"); } window.AppendString(" ["); window.AppendCommand("Check", "/assist " + raider.Key.Character); window.AppendString("] ["); window.AppendBotCommand("Kick", "raid kick " + raider.Key.Character); window.AppendString("] "); window.AppendColorEnd(); window.AppendLineBreak(true); } window.AppendLineBreak(); } bot.SendReply(e, "Raiders List »» ", window); }
public override void OnCommand(BotShell bot, CommandArgs e) { if (e.Args.Length == 0) { bot.SendReply(e, "Usage: breed [breed]"); return; } else { foreach (BreedStats Breed in Breeds) { foreach (string Name in Breed.Name) { if (Name.ToLower() == e.Args[0].ToLower()) { /* * Strength - ### / ### * Agility - ### / ### * Stamina - ### / ### * Intelligence - ### / ### * Sense - ### / ### * Psychic - ### / ### * * NanoCost% - ##% * HP / BodyDev - # */ RichTextWindow window = new RichTextWindow(bot); window.AppendTitle(Breed.Name[0]); window.AppendLineBreak(); window.AppendHighlight("Breed Caps - (Normal Caps / Shadow Level Caps)"); window.AppendLineBreak(2); window.AppendColorString(this.StatColor(Breed.ColorStr), "Strength"); window.AppendNormal(" - " + Breed.MinStr + " / " + Breed.MaxStr); window.AppendLineBreak(); window.AppendColorString(this.StatColor(Breed.ColorAgil), "Agility"); window.AppendNormal(" - " + Breed.MinAgil + " / " + Breed.MaxAgil); window.AppendLineBreak(); window.AppendColorString(this.StatColor(Breed.ColorSta), "Stamina"); window.AppendNormal(" - " + Breed.MinSta + " / " + Breed.MaxSta); window.AppendLineBreak(); window.AppendColorString(this.StatColor(Breed.ColorInt), "Intelligence"); window.AppendNormal(" - " + Breed.MinInt + " / " + Breed.MaxInt); window.AppendLineBreak(); window.AppendColorString(this.StatColor(Breed.ColorSen), "Sense"); window.AppendNormal(" - " + Breed.MinSen + " / " + Breed.MaxSen); window.AppendLineBreak(); window.AppendColorString(this.StatColor(Breed.ColorPsy), "Psychic"); window.AppendNormal(" - " + Breed.MinPsy + " / " + Breed.MaxPsy); window.AppendLineBreak(2); window.AppendHighlight("NanoCost%"); window.AppendNormal(" - " + Breed.NanoCap + "%"); window.AppendLineBreak(); window.AppendHighlight("HP / BodyDev"); window.AppendNormal(" - " + Breed.HPPerBD); bot.SendReply(e, Breed.Name[0] + " Stats »» ", window); return; } } } bot.SendReply(e, "No results found for \"" + e.Words[0] + "\"!"); return; } }
public void OnBaseBuffsCommand(BotShell bot, CommandArgs e) { RichTextWindow baseBuffsWindow = new RichTextWindow(bot); baseBuffsWindow.AppendTitle("Base Attribute Buffs"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorOrange, ">> Buffs listed in the same color do not stack with one another. <<"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendHighlight("Strength"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Enforcer"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorRed, " * +5 to +27 - Essence of <...> (5-47 NCU)"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorGreen, " * +54 - Imp. Essence of Behemoth (56 NCU, Level 215)"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorGreen, " * +40 - Prodigious Strength (42 NCU)"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Martial Artist"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorGreen, " * +25 - Muscle Booster (22 NCU)"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorGreen, " * +12 - Muscle Stim (7 NCU)"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Doctor"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorGreen, " * +10 - Enlarge (12 NCU)"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorGreen, " * +20 - Iron Circle (26 NCU)"); baseBuffsWindow.AppendLineBreak(3); baseBuffsWindow.AppendHighlight("Agility"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Agent"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendNormal(" * +25 - Feline Grace (17 NCU)"); baseBuffsWindow.AppendLineBreak(3); baseBuffsWindow.AppendHighlight("Stamina"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Enforcer"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorRed, " * +5 to +27 - Essence of <...> (5-47 NCU)"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorGreen, " * +54 - Imp. Essence of Behemoth (56 NCU, Level 215)"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Doctor"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorGreen, " * +10 - Enlarge (12 NCU)"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendColorString(RichTextWindow.ColorGreen, " * +20 - Iron Circle (26 NCU)"); baseBuffsWindow.AppendLineBreak(3); baseBuffsWindow.AppendHighlight("Intelligence"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Nano-Technician"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendNormal(" * +20 - Neuronal Stimulator (7 NCU)"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Bureaucrat"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendNormal(" * +3 - Imp. Cut Red Tape (29 NCU)"); baseBuffsWindow.AppendLineBreak(3); baseBuffsWindow.AppendHighlight("Sense"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Agent"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendNormal(" * +15 - Enhanced Senses (9 NCU)"); baseBuffsWindow.AppendLineBreak(3); baseBuffsWindow.AppendHighlight("Psychic"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Nano-Technician"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendNormal(" * +20 - Neuronal Stimulator (7 NCU)"); baseBuffsWindow.AppendLineBreak(2); baseBuffsWindow.AppendNormal(" Bureaucrat"); baseBuffsWindow.AppendLineBreak(); baseBuffsWindow.AppendNormal(" * +3 - Imp. Cut Red Tape (29 NCU)"); bot.SendReply(e, " Base Attribute Buffs »» ", baseBuffsWindow); }
public void OnAutomemberCommand(BotShell bot, CommandArgs e) { RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Automated Membership"); window.AppendHighlight("Enabled: "); if (this._enabled) { window.AppendColorString(RichTextWindow.ColorGreen, "Yes"); } else { window.AppendColorString(RichTextWindow.ColorRed, "No"); } window.AppendLineBreak(); window.AppendHighlight("Add to guestlist: "); if (this._guestlist) { window.AppendColorString(RichTextWindow.ColorGreen, "Yes"); } else { window.AppendColorString(RichTextWindow.ColorRed, "No"); } window.AppendLineBreak(); if (this._factions.Count > 0) { window.AppendHighlight("Factions: "); window.AppendNormal(string.Join(", ", this._factions.ToArray())); window.AppendLineBreak(); } if (this._levels.Count > 0) { window.AppendHighlight("Levels: "); window.AppendNormal(string.Join(", ", this.ToStringArray(this._levels))); window.AppendLineBreak(); } if (this._defenderRanks.Count > 0) { window.AppendHighlight("Defender Ranks: "); window.AppendNormal(string.Join(", ", this.ToStringArray(this._defenderRanks))); window.AppendLineBreak(); } if (this._professions.Count > 0) { window.AppendHighlight("Professions: "); window.AppendNormal(string.Join(", ", this._professions.ToArray())); window.AppendLineBreak(); } if (this._breeds.Count > 0) { window.AppendHighlight("Breeds: "); window.AppendNormal(string.Join(", ", this._breeds.ToArray())); window.AppendLineBreak(); } if (this._genders.Count > 0) { window.AppendHighlight("Genders: "); window.AppendNormal(string.Join(", ", this._genders.ToArray())); window.AppendLineBreak(); } bot.SendReply(e, "Automated Membership »» ", window); }
public void BuildList(BotShell bot, string[] users, ref RichTextWindow window, ref int results, string profs) { if (window == null) { return; } if (users.Length == 0) { return; } SortedDictionary <string, SortedDictionary <string, WhoisResult> > list = new SortedDictionary <string, SortedDictionary <string, WhoisResult> >(); Dictionary <string, WhoisResult> whoisResults = new Dictionary <string, WhoisResult>(); foreach (string user in users) { if (user == null || user == string.Empty) { continue; } string header; WhoisResult whois = XML.GetWhois(user, bot.Dimension); if (profs != null && profs != string.Empty) { if (whois == null || whois.Stats == null) { continue; } if (!whois.Stats.Profession.StartsWith(profs, StringComparison.CurrentCultureIgnoreCase)) { continue; } } if (whois != null && whois.Stats != null) { if (this.DisplayMode == "Level") { header = whois.Stats.Level.ToString(); } else { header = whois.Stats.Profession; } if (!whoisResults.ContainsKey(user.ToLower())) { whoisResults.Add(user.ToLower(), whois); } } else if (this.DisplayMode == "Level") { header = "0"; } else { header = "Unknown"; } if (this.DisplayMode == "Alphabetical") { header = user.ToUpper().ToCharArray()[0].ToString(); } if (!list.ContainsKey(header)) { list.Add(header, new SortedDictionary <string, WhoisResult>()); } list[header].Add(user, whois); } results = 0; foreach (KeyValuePair <string, SortedDictionary <string, WhoisResult> > prof in list) { if (this.DisplayHeaders == "Text") { window.AppendHighlight(prof.Key); window.AppendLineBreak(); } else if (this.DisplayHeaders == "Icons") { window.AppendImage("GFX_GUI_FRIENDLIST_SPLITTER"); window.AppendLineBreak(); window.AppendIcon(Icons[prof.Key]); window.AppendHighlight(prof.Key); window.AppendLineBreak(); window.AppendImage("GFX_GUI_FRIENDLIST_SPLITTER"); window.AppendLineBreak(); } foreach (KeyValuePair <string, WhoisResult> user in prof.Value) { // Name window.AppendNormalStart(); window.AppendString(" "); int level = 0; int ailevel = 0; string name = Format.UppercaseFirst(user.Key); // Level if (user.Value != null && user.Value.Stats != null) { level = user.Value.Stats.Level; ailevel = user.Value.Stats.DefenderLevel; } if (level < 10) { window.AppendColorString("000000", "00"); } else if (level < 100) { window.AppendColorString("000000", "0"); } window.AppendString(level + " "); if (ailevel < 10) { window.AppendColorString("000000", "0"); } window.AppendColorString(RichTextWindow.ColorGreen, ailevel + " "); window.AppendString(name); // Organization bool displayOrganization = false; if (this.DisplayOrganization == "Always") { displayOrganization = true; } if (this.DisplayOrganization == "Foreign") { displayOrganization = true; if (bot.InOrganization && whoisResults.ContainsKey(name.ToLower()) && whoisResults[name.ToLower()].InOrganization && bot.Organization == whoisResults[name.ToLower()].Organization.Name) { displayOrganization = false; } } if (displayOrganization) { if (!whoisResults.ContainsKey(name.ToLower())) { window.AppendString(" (Unknown)"); } else if (whoisResults[name.ToLower()].InOrganization) { window.AppendString(" (" + whoisResults[name.ToLower()].Organization.ToString() + ")"); } else { window.AppendString(" (Not Guilded)"); } } // Rank if (this.DisplayRanks) { UserLevel userLevel = bot.Users.GetUser(name); if (userLevel > UserLevel.Member) { window.AppendString(" ("); window.AppendColorString(RichTextWindow.ColorRed, bot.Users.GetUser(name).ToString()); window.AppendString(")"); } } // Alts if (this.DisplayAlts) { string main = bot.Users.GetMain(name); string[] alts = bot.Users.GetAlts(main); if (alts.Length > 0) { window.AppendString(" :: "); if (main == name) { window.AppendBotCommand("Alts", "alts " + main); } else { window.AppendBotCommand(main + "'s Alts", "alts " + main); } } } // Afk if (this.DisplayAfk) { lock (this.Afk) { if (this.Afk.ContainsKey(name)) { window.AppendString(" :: "); window.AppendColorString(RichTextWindow.ColorRed, "AFK"); } } } window.AppendColorEnd(); window.AppendLineBreak(); results++; } if (this.DisplayHeaders == "Text" || this.DisplayHeaders == "Icons") { window.AppendLineBreak(); } } if (this.DisplayHeaders == "Off") { window.AppendLineBreak(); } }
private void OnConfigurationDisplayCommand(BotShell bot, CommandArgs e) { string internalName = e.Args[0].ToLower(); if (!bot.Plugins.Exists(internalName)) { bot.SendReply(e, "No such plugin!"); return; } ConfigurationEntry[] entires = bot.Configuration.List(internalName); if (entires.Length < 1) { bot.SendReply(e, "This plugin has no settings to configure"); return; } RichTextWindow window = new RichTextWindow(bot); PluginLoader loader = bot.Plugins.GetLoader(internalName); window.AppendTitle("Configuration"); foreach (ConfigurationEntry entry in entires) { window.AppendHighlight(entry.Name + ": "); window.AppendNormalStart(); string command = "configuration set " + internalName + " " + entry.Key.ToLower(); switch (entry.Type) { case ConfigType.String: string value1 = bot.Configuration.GetString(entry.Section, entry.Key, (string)entry.DefaultValue); if (entry.Values != null && entry.Values.Length > 0) { window.AppendMultiBox(command, value1, entry.StringValues); } else { window.AppendString(value1 + " ["); window.AppendCommand("Edit", "/text /tell " + bot.Character + " " + command + " [text]"); window.AppendString("]"); } break; case ConfigType.Integer: string value2 = bot.Configuration.GetInteger(entry.Section, entry.Key, (int)entry.DefaultValue).ToString(); if (entry.Values != null && entry.Values.Length > 0) { window.AppendMultiBox(command, value2, entry.StringValues); } else { window.AppendString(value2 + " ["); window.AppendCommand("Edit", "/text /tell " + bot.Character + " " + command + " [number]"); window.AppendString("]"); } break; case ConfigType.Boolean: string value3 = "Off"; if (bot.Configuration.GetBoolean(entry.Section, entry.Key, (bool)entry.DefaultValue)) { value3 = "On"; } window.AppendMultiBox(command, value3, "On", "Off"); break; case ConfigType.Username: string value4 = bot.Configuration.GetUsername(entry.Section, entry.Key, (string)entry.DefaultValue); window.AppendString(value4 + " ["); window.AppendCommand("Edit", "/text /tell " + bot.Character + " " + command + " [username]"); window.AppendString("]"); break; case ConfigType.Date: DateTime value5 = bot.Configuration.GetDate(entry.Section, entry.Key, (DateTime)entry.DefaultValue); window.AppendString(value5.ToString("dd/MM/yyyy") + " ["); window.AppendCommand("Edit", "/text /tell " + bot.Character + " " + command + " [dd]/[mm]/[yyyy]"); window.AppendString("]"); break; case ConfigType.Time: TimeSpan value6 = bot.Configuration.GetTime(entry.Section, entry.Key, (TimeSpan)entry.DefaultValue); window.AppendString(string.Format("{0:00}:{1:00}:{2:00}", Math.Floor(value6.TotalHours), value6.Minutes, value6.Seconds) + " ["); window.AppendCommand("Edit", "/text /tell " + bot.Character + " " + command + " [hh]:[mm]:[ss]"); window.AppendString("]"); break; case ConfigType.Dimension: string value7 = bot.Configuration.GetDimension(entry.Section, entry.Key, (Server)entry.DefaultValue).ToString(); window.AppendMultiBox(command, value7, Server.RubiKa.ToString(), Server.Test.ToString()); break; case ConfigType.Color: string value8 = bot.Configuration.GetColor(entry.Section, entry.Key, (string)entry.DefaultValue); window.AppendColorString(value8, value8); window.AppendString(" ["); window.AppendBotCommand("Edit", "configuration color " + internalName + " " + entry.Key.ToLower()); window.AppendString("]"); break; case ConfigType.Password: string value9 = bot.Configuration.GetPassword(entry.Section, entry.Key, (string)entry.DefaultValue); for (int i = 0; i < value9.Length; i++) { window.AppendString("*"); } window.AppendString(" ["); window.AppendCommand("Edit", "/text /tell " + bot.Character + " " + command + " [password]"); window.AppendString("]"); break; case ConfigType.Custom: string value10 = bot.Configuration.GetCustom(entry.Section, entry.Key); if (value10 != null) { window.AppendRawString(value10); } break; } window.AppendString(" ["); window.AppendBotCommand("Default", "configuration reset " + internalName + " " + entry.Key.ToLower()); window.AppendString("]"); window.AppendColorEnd(); window.AppendLineBreak(); } bot.SendReply(e, "Configuration »» " + loader.Name + " »» ", window); }
private void OnRaidLogs(BotShell bot, CommandArgs e) { Dictionary <string, string> colors = new Dictionary <string, string>(); colors.Add("raid", RichTextWindow.ColorOrange); colors.Add("raiders", "FF4500"); colors.Add("credits", "ADFF2F"); colors.Add("points", "00FFFF"); colors.Add("auction", "A52A2A"); int max = 250; RaidCore.LogEntry[] logs = new RaidCore.LogEntry[0]; string title; if (e.Args.Length > 0) { try { // Try if it's a raid ID logs = this._core.GetLogs(0, Convert.ToInt32(e.Args[0])); title = logs.Length + " Log Entries on Raid #" + Convert.ToInt32(e.Args[0]); } catch { // No raid ID, player maybe? e.Args[0] = bot.Users.GetMain(e.Args[0]); logs = this._core.GetLogs(0, e.Args[0]); title = logs.Length + " Log Entries for " + Format.UppercaseFirst(e.Args[0]); } } else { // No arguments, let's just fetch the last entries logs = this._core.GetLogs(max); title = logs.Length + " Last Log Entries"; } if (logs.Length == 0) { bot.SendReply(e, "No log entries found"); return; } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle(title); foreach (RaidCore.LogEntry log in logs) { window.AppendHighlight("[" + log.Time.ToString("dd/MM/yyyy hh:mm:ss") + "] "); window.AppendNormalStart(); if (log.RaidID > 0) { window.AppendString("["); window.AppendColorString(colors["raid"], "Raid #" + log.RaidID); window.AppendString("] "); } window.AppendString("["); if (colors.ContainsKey(log.Type.ToLower())) { window.AppendColorString(colors[log.Type.ToLower()], Format.UppercaseFirst(log.Type)); } else { window.AppendString(Format.UppercaseFirst(log.Type)); } window.AppendString("] "); window.AppendString(log.Message); if (log.Admin != null && log.Admin != string.Empty) { window.AppendString(" (Admin: " + log.Admin + ")"); } window.AppendColorEnd(); window.AppendLineBreak(); } bot.SendReply(e, title + " »» ", window); }
private void OnHelpDisplayCommand(BotShell bot, CommandArgs e) { string command = e.Words[0]; command = bot.Commands.GetMainCommand(command); if (!bot.Commands.Exists(command) || !bot.Commands.GetRights(command).Help) { bot.SendReply(e, "No such help topic"); return; } PluginLoader loader = bot.Plugins.GetLoader(bot.Commands.GetInternalName(command)); CommandRights rights = bot.Commands.GetRights(command); UserLevel level = bot.Users.GetUser(e.Sender); RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Information"); window.AppendHighlight("Command: "); window.AppendNormal(Format.UppercaseFirst(command)); window.AppendLineBreak(); window.AppendHighlight("Plugin: "); window.AppendNormal(loader.ToString()); window.AppendLineBreak(); window.AppendHighlight("Private Message Access: "); if (level >= rights.PrivateMessage) { window.AppendColorString(RichTextWindow.ColorGreen, rights.PrivateMessage.ToString()); } else { window.AppendColorString(RichTextWindow.ColorRed, rights.PrivateMessage.ToString()); } window.AppendLineBreak(); window.AppendHighlight("Private Channel Access: "); if (level >= rights.PrivateChannel) { window.AppendColorString(RichTextWindow.ColorGreen, rights.PrivateChannel.ToString()); } else { window.AppendColorString(RichTextWindow.ColorRed, rights.PrivateChannel.ToString()); } window.AppendLineBreak(); window.AppendHighlight("Organization Access: "); if (level >= rights.Organization) { window.AppendColorString(RichTextWindow.ColorGreen, rights.Organization.ToString()); } else { window.AppendColorString(RichTextWindow.ColorRed, rights.Organization.ToString()); } window.AppendLineBreak(2); window.AppendHeader("Help"); window.AppendHighlightStart(); string help = bot.Commands.GetHelp(command); if (help == null || help.Trim() == string.Empty) { window.AppendString("No additional help available for this command"); } else { window.AppendRawString(help); } window.AppendColorEnd(); bot.SendReply(e, "VhaBot Help »» " + Format.UppercaseFirst(command) + " »» ", window); }
private void OnHistoryCommand(BotShell bot, CommandArgs e) { if (bot.GetUserID(e.Args[0]) < 100) { bot.SendReply(e, "No such user: "******"'s History »» Gathering Data..."); HistoryResult history = XML.GetHistory(e.Args[0].ToLower(), bot.Dimension); if (history == null || history.Items == null) { bot.SendReply(e, "Unable to gather information on that user " + this.TimeoutError); return; } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Auno.org Player History"); window.AppendHighlight("Character: "); window.AppendNormal(Format.UppercaseFirst(e.Args[0])); window.AppendLineBreak(); window.AppendHighlight("Entries: "); window.AppendNormal(history.Items.Length.ToString()); window.AppendLineBreak(); window.AppendHighlight("URL: "); window.AppendNormal(string.Format(this.CharAunoWebsite, (int)bot.Dimension, e.Args[0].ToLower())); window.AppendLineBreak(2); window.AppendHighlightStart(); window.AppendString("Date "); window.AppendString("LVL "); window.AppendString("DR "); window.AppendColorString("000000", "'"); window.AppendString("Faction "); window.AppendString("Organization"); window.AppendColorEnd(); window.AppendLineBreak(); foreach (HistoryResult_Entry entry in history.Items) { window.AppendNormalStart(); window.AppendString(entry.Date); window.AppendHighlight(" | "); window.AppendString(entry.Level.ToString("000")); window.AppendHighlight(" | "); window.AppendString(entry.DefenderLevel.ToString("00")); window.AppendHighlight(" | "); switch (entry.Faction.ToLower()) { case "clan": window.AppendString("Clan "); break; case "omni": window.AppendString("Omni "); break; case "neutral": window.AppendString("Neutral"); break; default: window.AppendString("Unknown"); break; } window.AppendHighlight(" | "); if (entry.Organization != null && entry.Organization != String.Empty) { window.AppendString(entry.Rank); window.AppendString(" of "); window.AppendString(entry.Organization); } window.AppendColorEnd(); window.AppendLineBreak(); } bot.SendReply(e, Format.UppercaseFirst(e.Args[0]) + "'s History »» ", window); }