private void OnMassCommand(BotShell bot, CommandArgs e, bool invite) { if (e.Words.Length < 1) { bot.SendReply(e, "Correct Usage: " + e.Command + " [message]"); return; } string[] members = this.GetOnlineMembers(); if (invite) { bot.SendReply(e, "Sending out an mass invite to " + HTML.CreateColorString(bot.ColorHeaderHex, members.Length.ToString()) + " members"); } else { bot.SendReply(e, "Sending out an announcement to " + HTML.CreateColorString(bot.ColorHeaderHex, members.Length.ToString()) + " members"); } string message = bot.ColorHighlight + "Message from " + HTML.CreateColorString(bot.ColorHeaderHex, e.Sender) + " »» " + bot.ColorNormal + e.Words[0]; foreach (string member in members) { if (invite && !bot.PrivateChannel.IsOn(member)) { bot.PrivateChannel.Invite(member); } } foreach (string member in members) { bot.SendPrivateMessage(bot.GetUserID(member), message, AoLib.Net.PacketQueue.Priority.Low, true); } }
private void OnRaffleStopCommand(BotShell bot, CommandArgs e) { if (!this._running) { bot.SendReply(e, "There is no raffle to finish"); return; } lock (this._joined) { bot.SendReply(e, "You have ended the raffle"); if (this._joined.Count == 0) { bot.SendPrivateChannelMessage(bot.ColorHighlight + "The raffle has ended without any winners"); } else { string[] keys = new string[this._joined.Keys.Count]; this._joined.Keys.CopyTo(keys, 0); Random random = new Random(); int winner = random.Next(0, keys.Length); bot.SendPrivateChannelMessage(bot.ColorHeader + this._joined[keys[winner]] + bot.ColorHighlight + " has won the raffle for " + bot.ColorHeader + this._item); } this._running = false; this._item = null; this._realItem = null; this._admin = null; this._joined.Clear(); } }
public void OnAfkCommand(BotShell bot, CommandArgs e) { lock (this.Afk) { if (this.Afk.ContainsKey(e.Sender)) { this.Afk.Remove(e.Sender); bot.SendReply(e, "You are no longer marked AFK"); return; } } string afkmsg = ""; if (e.Args.Length < 1) { afkmsg = "AFK"; } else { afkmsg = e.Words[0]; } lock (this.Afk) { this.Afk.Add(e.Sender, afkmsg); } bot.SendReply(e, "You are now AFK"); }
private void OnIsCommand(BotShell bot, CommandArgs e) { foreach (string username in e.Args) { UInt32 userid = bot.GetUserID(username); OnlineState state = bot.FriendList.IsOnline(userid); if (state == OnlineState.Timeout) { bot.SendReply(e, "Request timed out. Please try again later"); return; } if (state == OnlineState.Unknown) { bot.SendReply(e, "No such user: "******"Online"); if (state == OnlineState.Offline) { append = HTML.CreateColorString(RichTextWindow.ColorRed, "Offline"); Int64 seen = bot.FriendList.Seen(username); if (seen > 1) { append += " and was last seen online at " + HTML.CreateColorString(bot.ColorHeaderHex, Format.DateTime(seen, FormatStyle.Large) + " GMT"); } } bot.SendReply(e, String.Format("{0} is currently {1}", Format.UppercaseFirst(username), append)); } }
private void OnRosterResetCommand(BotShell bot, CommandArgs e) { if (e.Args.Length > 0) { if (e.Args[0].ToLower() == "confirm") { this._database.ExecuteNonQuery("DELETE FROM members"); bot.SendReply(e, "Roster list cleared"); return; } } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Clear Cached Roster List"); window.AppendNormal("Warning! This will clear the local roster list!"); window.AppendLineBreak(); window.AppendNormal("This list is used to determine changes in the organization's member list."); window.AppendLineBreak(); window.AppendNormal("Clearing this list will NOT remove any members from the bot!"); window.AppendLineBreak(); window.AppendNormal("After clearing this list, the next roster update will see every member of the organization as a new member."); window.AppendLineBreak(); window.AppendNormal("Resetting the cached roster list can be used to resolve some sync issues but may also leave 'ghost' members behind."); window.AppendLineBreak(); window.AppendNormal("Use this command with caution!"); window.AppendLineBreak(2); window.AppendBotCommand("Reset List Now", "roster reset confirm"); bot.SendReply(e, "Roster Reset »» " + window.ToString()); }
private void OnAltsAdminRemoveCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 1) { bot.SendReply(e, "Correct Usage: alts admin remove [alt]"); return; } string alt = Format.UppercaseFirst(e.Args[0]); if (bot.GetUserID(alt) < 1) { bot.SendReply(e, "No such user: "******" is not an alt"); } if (bot.Users.GetUser(bot.Users.GetMain(alt)) > bot.Users.GetUser(e.Sender)) { bot.SendReply(e, "You can't remove alts from a user that outranks you!"); return; } bot.Users.RemoveAlt(alt); bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, alt) + " has been removed as your alt"); }
private void OnSecurityFixidCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 1) { bot.SendReply(e, "Correct Usage: security fixid [username]"); return; } string username = Config.EscapeString(Format.UppercaseFirst(e.Args[0])); UInt32 userID = bot.GetUserID(username); if (userID < 1) { bot.SendReply(e, "No such user: "******"UPDATE alts SET altID = " + userID + " WHERE altname = '" + username + "'"); bot.SendReply(e, "Updated " + HTML.CreateColorString(bot.ColorHeaderHex, username + "'s") + " character id to " + HTML.CreateColorString(bot.ColorHeaderHex, userID.ToString())); return; } if (this._host.IsMember(username)) { this._database.ExecuteNonQuery("UPDATE members SET userID = " + userID + " WHERE username = '******'"); bot.SendReply(e, "Updated " + HTML.CreateColorString(bot.ColorHeaderHex, username + "'s") + " character id to " + HTML.CreateColorString(bot.ColorHeaderHex, userID.ToString())); return; } bot.SendReply(e, "Unable to fix " + HTML.CreateColorString(bot.ColorHeaderHex, username)); }
private void OnNewsSticky(BotShell bot, CommandArgs e) { double d; if (e.Args.Length < 2) { bot.SendReply(e, "Correct Usage: news sticky [id] [sticky]"); return; } if (double.TryParse(e.Args[0], System.Globalization.NumberStyles.Integer, _cultureInfo, out d) == true && double.TryParse(e.Args[1], System.Globalization.NumberStyles.Integer, _cultureInfo, out d) == true) { if (Convert.ToInt32(e.Args[1]) == 0 || Convert.ToInt32(e.Args[1]) == 1) { try { using (IDbCommand command = this._database.Connection.CreateCommand()) { command.CommandText = "UPDATE [news] SET [news_sticky] = " + e.Args[1] + " WHERE [news_id] = " + e.Args[0]; command.ExecuteNonQuery(); bot.SendReply(e, "News sticky updated"); return; } } catch { bot.SendReply(e, "Error during news updating. Please try again later"); return; } } bot.SendReply(e, "Invalid sticky ID"); return; } bot.SendReply(e, "Invalid input"); return; }
private void OnQuoteAddCommand(BotShell bot, CommandArgs e) { if (e.Args.Length > 0) { try { int id = 0; using (IDbCommand command = this._database.Connection.CreateCommand()) { command.CommandText = "INSERT INTO [quotes] (quote, contributor) VALUES ('" + Config.EscapeString(e.Words[0].Replace("\\n", "\n")) + "', '" + e.Sender + "')"; command.ExecuteNonQuery(); command.CommandText = "SELECT [id] FROM [quotes] WHERE quote = '" + Config.EscapeString(e.Words[0].Replace("\\n", "\n")) + "'"; IDataReader reader = command.ExecuteReader(); if (reader.Read()) { id = (int)reader.GetInt64(0); } reader.Close(); } bot.SendReply(e, "Your quote has been added as #" + id); return; } catch { bot.SendReply(e, "Error adding quote."); return; } } else { bot.SendReply(e, "Correct Usage: quote add [quote]"); return; } }
private void OnTeamsLeaderCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 2) { bot.SendReply(e, "Correct Usage: teams set [username] [team]"); return; } string username = Format.UppercaseFirst(e.Args[0]); if (bot.GetUserID(username) < 100) { bot.SendReply(e, "No such user: "******"Invalid Team: " + HTML.CreateColorString(bot.ColorHeaderHex, e.Args[1])); return; } this._database.ExecuteNonQuery("DELETE FROM teams WHERE username = '******'"); this._database.ExecuteNonQuery("UPDATE teams SET leader = 0 WHERE team = " + team); this._database.ExecuteNonQuery(string.Format("INSERT INTO teams (username, team, leader) VALUES ('{0}', {1}, 1)", username, team)); bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, username) + " is now the leader of team " + HTML.CreateColorString(bot.ColorHeaderHex, team.ToString())); bot.SendPrivateChannelMessage(bot.ColorHighlight + HTML.CreateColorString(bot.ColorHeaderHex, username) + " is now leader of team " + HTML.CreateColorString(bot.ColorHeaderHex, team.ToString())); }
private void OnPointsRemoveCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 2) { bot.SendReply(e, "Correct Usage: points remove [username] [amount]"); return; } string raider = Format.UppercaseFirst(bot.Users.GetMain(e.Args[0])); double amount = 0; try { amount = Convert.ToDouble(e.Args[1].Replace(".", ",")); } catch { } if (amount < 0.1) { bot.SendReply(e, "You need to remove at least 0,1 point"); return; } double points = this._core.GetPoints(raider); if (points < this._core.MinimumPoints) { bot.SendReply(e, "Unable to remove points from " + HTML.CreateColorString(bot.ColorHeaderHex, raider)); return; } this._core.RemovePoints(raider, amount); bot.SendReply(e, "You have removed " + HTML.CreateColorString(bot.ColorHeaderHex, amount.ToString()) + " points. " + HTML.CreateColorString(bot.ColorHeaderHex, raider) + " now has " + HTML.CreateColorString(bot.ColorHeaderHex, this._core.GetPoints(raider).ToString()) + " points"); this._core.Log(raider, e.Sender, this.InternalName, "points", e.Sender + " has removed " + amount + " points from " + raider + " (Total Points: " + this._core.GetPoints(raider) + ")"); }
public override void OnCommand(BotShell bot, CommandArgs e) { if (!bot.FriendList.IsFriend("notify", e.Sender)) { bot.SendReply(e, "You're required to be on the notify list before using this action"); return; } switch (e.Command) { case "logon": if (e.Args.Length < 1) { bot.SendReply(e, "Correct Usage: logon [message]"); return; } this._database.ExecuteNonQuery("REPLACE INTO logon VALUES('" + e.Sender + "', " + TimeStamp.Now + ", '" + HTML.UnescapeString(e.Words[0]) + "')"); bot.SendReply(e, "Your logon message has set"); break; case "logon clear": this._database.ExecuteNonQuery("DELETE FROM logon WHERE Username = '******'"); bot.SendReply(e, "Your logon message has been cleared"); break; } }
private void OnTeamsRemoveCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 1) { bot.SendReply(e, "Correct Usage: teams remove [username]"); return; } string username = Format.UppercaseFirst(e.Args[0]); if (bot.GetUserID(username) < 100) { bot.SendReply(e, "No such user: "******"SELECT * FROM teams WHERE username = '******'"; IDataReader reader = command.ExecuteReader(); if (!reader.Read()) { reader.Close(); bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, username) + " is not on any team"); return; } reader.Close(); } this._database.ExecuteNonQuery("DELETE FROM teams WHERE username = '******'"); bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, username) + " has been removed from the team"); bot.SendPrivateChannelMessage(bot.ColorHighlight + HTML.CreateColorString(bot.ColorHeaderHex, username) + " has been removed from the team"); }
public void OnLevelCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 1) { bot.SendReply(e, "Correct Usage: level [level]"); return; } foreach (VhLevels_Levels_Entry entry in this.GetLevels().Entries) { if (entry.Level.ToString() == e.Args[0]) { string message = ""; message = "L " + entry.Level + ": "; message += "Team " + entry.TeamMin + "-" + entry.TeamMax + " | "; message += "PvP " + entry.PvpMin + "-" + entry.PvpMax + " | "; message += entry.Experience; if (entry.Level > 200) { message += " SK"; } else { message += " XP"; } message += " | "; message += "Missions "; message += string.Join(", ", entry.Missions.ToArray()); bot.SendReply(e, message); return; } } bot.SendReply(e, "Invalid level specified"); }
private void OnRaidUnbanCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 1) { bot.SendReply(e, "Correct Usage: raid unban [username]"); return; } string character = Format.UppercaseFirst(e.Args[0]); if (bot.GetUserID(character) < 100) { bot.SendReply(e, "No such user: "******" is not banned from this raid"); return; } character = this._bans[main].Character; this._bans.Remove(main); bot.SendPrivateMessage(character, this._bot.ColorHighlight + "Your access to the raid has been restored by " + HTML.CreateColorString(bot.ColorHeaderHex, e.Sender)); bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, character) + " has been unbanned from the raid"); this._core.Log(character, e.Sender, this.InternalName, "bans", string.Format("{0} has been unbanned from the raid", character)); } }
private void OnTasksAddCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 2) { bot.SendReply(e, "Correct Usage: tasks add [username] [task]"); return; } string username = Format.UppercaseFirst(e.Args[0]); if (bot.GetUserID(username) < 100) { bot.SendReply(e, "No such user: "******" isn't online right now"); return; } string task = e.Words[1]; this._database.ExecuteNonQuery("DELETE FROM tasks WHERE username = '******'"); this._database.ExecuteNonQuery(string.Format("INSERT INTO tasks (username, task) VALUES ('{0}', '{1}')", username, Config.EscapeString(task))); bot.SendReply(e, "You have assigned a task to " + HTML.CreateColorString(bot.ColorHeaderHex, username)); bot.SendPrivateChannelMessage(bot.ColorHighlight + HTML.CreateColorString(bot.ColorHeaderHex, e.Sender) + " has assigned " + HTML.CreateColorString(bot.ColorHeaderHex, username) + " the following task: " + HTML.CreateColorString(bot.ColorHeaderHex, task)); bot.SendPrivateMessage(username, bot.ColorHighlight + HTML.CreateColorString(bot.ColorHeaderHex, e.Sender) + " has assigned you the following task: " + HTML.CreateColorString(bot.ColorHeaderHex, task)); }
private void OnAltsCommand(BotShell bot, CommandArgs e) { string username = ""; if (e.Args.Length < 1) { //{ // bot.SendReply(e, "Correct Usage: " + e.Command + " [username]"); // return; //} username = e.Sender; } else { username = e.Args[0]; } if (bot.GetUserID(username) < 1) { bot.SendReply(e, "No such user: "******" doesn't have any alts"); return; } bot.SendReply(e, main + "'s characters »» ", window); }
private void OnRaidHistoryExtendedCommand(BotShell bot, CommandArgs e) { int id = -1; try { id = Convert.ToInt32(e.Args[0]); } catch { } if (id < 0) { bot.SendReply(e, "Invalid RaidID"); return; } RaidCore.Raider[] raiders = this._core.GetRaiders(id); if (raiders.Length == 0) { bot.SendReply(e, "There are no raiders listed under that RaidID"); return; } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Raiders on Raid #" + id); foreach (RaidCore.Raider raider in raiders) { window.AppendHighlight(raider.Character); window.AppendNormalStart(); if (raider.Character != raider.Main) { window.AppendString(" (Main: " + raider.Main + ")"); } window.AppendString(" (" + Math.Round((float)raider.Activity / 60, 1) + " minutes)"); window.AppendString(" (" + Format.DateTime(raider.JoinTime, FormatStyle.Compact) + " GMT)"); window.AppendColorEnd(); window.AppendLineBreak(); } bot.SendReply(e, "Raiders on Raid #" + id + " »» ", window); }
private void OnQuoteRemoveCommand(BotShell bot, CommandArgs e) { if (e.Args.Length > 0) { int id = 0; if (int.TryParse(e.Args[0], out id)) { try { this._database.ExecuteNonQuery("DELETE FROM [quotes] WHERE [id] = " + id); bot.SendReply(e, "Quote deleted."); return; } catch { bot.SendReply(e, "Invalid quote ID."); return; } } else { bot.SendReply(e, "Correct Usage: quote remove [id]"); return; } } else { bot.SendReply(e, "Correct Usage: quote remove [id]"); return; } }
private void OnRaidCreditsCommand(BotShell bot, CommandArgs e) { int type = -1; if (e.Args.Length < 1 || !Int32.TryParse(e.Args[0], out type)) { bot.SendReply(e, "Correct Usage: raid credits [type]"); return; } lock (this._database.Connection) { using (IDbCommand command = this._database.Connection.CreateCommand()) { command.CommandText = "SELECT name, credits FROM credits_types WHERE type = " + type; IDataReader reader = command.ExecuteReader(); if (reader.Read()) { int credits = reader.GetInt32(1); string name = reader.GetString(0); this.CreditsType = type; this._core.Locked = false; bot.SendReply(e, "The following raid credits type has been selected: " + HTML.CreateColorString(bot.ColorHeaderHex, name)); bot.SendPrivateChannelMessage(bot.ColorHighlight + HTML.CreateColorString(bot.ColorHeaderHex, name) + " credits have been selected and the raid has been " + HTML.CreateColorString(RichTextWindow.ColorGreen, "unlocked")); } else { bot.SendReply(e, "Invalid raid credits type"); } reader.Close(); } } }
private void OnConfigurationCommand(BotShell bot, CommandArgs e) { string[] plugins = bot.Configuration.ListRegisteredPlugins(); if (plugins == null || plugins.Length == 0) { bot.SendReply(e, "No configuration entries registered"); return; } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Configuration"); foreach (string plugin in plugins) { PluginLoader loader = bot.Plugins.GetLoader(plugin); window.AppendNormalStart(); window.AppendString("["); window.AppendBotCommand("Configure", "configuration " + plugin.ToLower()); window.AppendString("] "); window.AppendColorEnd(); window.AppendHighlight(loader.Name); window.AppendNormal(" (" + bot.Configuration.List(plugin).Length + " settings)"); window.AppendLineBreak(); } bot.SendReply(e, "Configuration »» ", window); }
private void OnGlyphsLeaveCommand(BotShell bot, CommandArgs e) { string username = bot.Users.GetMain(e.Sender); lock (this._raffleMains) { if (!this._raffleMains.Contains(username)) { bot.SendReply(e, "You haven't joined the raffle"); return; } } lock (this._raffleJoined) { foreach (KeyValuePair <int, List <string> > kvp in this._raffleJoined) { if (kvp.Value.Contains(e.Sender)) { kvp.Value.Remove(e.Sender); lock (this._raffleMains) this._raffleMains.Remove(username); bot.SendReply(e, "You have left the raffle"); return; } } } bot.SendReply(e, "Unable to remove you from the raffle. Maybe you joined with a different character?"); return; }
private void OnRaidBansCommand(BotShell bot, CommandArgs e) { if (!this._core.Running) { bot.SendReply(e, "There is currently no raid active"); return; } lock (this._bans) { if (this._bans.Count < 1) { bot.SendReply(e, "Nobody is banned from the raid"); return; } RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("Raid Bans"); foreach (KeyValuePair <string, Raider> kvp in this._bans) { TimeSpan ts = (new TimeSpan(0, kvp.Value.Duration, 0)) - (DateTime.Now - kvp.Value.Time); window.AppendHighlight(Math.Floor(ts.TotalMinutes).ToString("##00") + ":" + ts.Seconds.ToString("00")); window.AppendNormal(" - "); window.AppendHighlight(kvp.Value.Character + " "); if (kvp.Value.Character != kvp.Key) { window.AppendNormal("(Main: " + kvp.Key + ") "); } window.AppendNormal("["); window.AppendBotCommand("Unban", "raid unban " + kvp.Key); window.AppendNormal("]"); window.AppendLineBreak(); } bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, this._bans.Count.ToString()) + " Raid Bans »» ", window); } }
private void OnRandomCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 2) { bot.SendReply(e, "Correct Usage: random [name] [name] [[name]]..."); return; } string[] looters = e.Args; string[] lootOrder = new string[e.Args.Length]; string output = ""; for (int iter1 = 0; iter1 < e.Args.Length; iter1++) { lootOrder[iter1] = this._random.Next(0, 10000000).ToString(); } Array.Sort(lootOrder, looters); for (int iter2 = 0; iter2 < e.Args.Length; iter2++) { output = output + " " + (iter2 + 1).ToString() + ":" + looters[iter2]; } lock (this._results) { int verify = this.GetNextVerifyNumber(); string reply = "Random order: " + HTML.CreateColorString(bot.ColorHeaderHex, output); this._results.Add(verify, new Verify(e.Sender, reply)); bot.SendReply(e, reply + ". To verify this use: " + HTML.CreateColorString(bot.ColorHeaderHex, "/tell " + bot.Character + " verify " + verify)); } }
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 OnMotd(BotShell bot, CommandArgs e) { if (string.IsNullOrEmpty(this._message)) { bot.SendReply(e, "There is currently no MOTD set"); } else { bot.SendReply(e, "Message of the day: " + bot.ColorNormal + this._message); } }
private void OnCreditsResetCommand(BotShell bot, CommandArgs e) { if (e.Args.Length > 0 && e.Args[0].ToLower() == "confirm") { this._database.ExecuteNonQuery("DELETE FROM credits"); bot.SendReply(e, "The raid credits have been reset"); this._core.Log(e.Sender, e.Sender, this.InternalName, "credits", string.Format("{0} has reset the raid credits", e.Sender)); return; } bot.SendReply(e, "This command will reset the raid credits of ALL raiders. If you wish to continue use: " + HTML.CreateColorString(bot.ColorHeaderHex, "credits reset confirm")); }
private void OnGlyphsCommand(BotShell bot, CommandArgs e) { RichTextWindow window = new RichTextWindow(bot); window.AppendTitle(); string raffle = string.Empty; bool empty = true; lock (this._items) { foreach (KeyValuePair <int, string> kvp in this._items) { window.AppendHeader(kvp.Value); int i = 0; lock (this._database.Connection) { using (IDbCommand command = this._database.Connection.CreateCommand()) { command.CommandText = "SELECT id, looter, time FROM glyphs WHERE item = " + kvp.Key + " AND visible = 'true'"; IDataReader reader = command.ExecuteReader(); while (reader.Read()) { i++; window.AppendNormal(Format.DateTime(reader.GetInt64(2), FormatStyle.Compact) + " "); window.AppendHighlight(reader.GetString(1)); window.AppendLineBreak(); empty = false; } reader.Close(); } } if (i == 0) { window.AppendHighlight("None"); window.AppendLineBreak(); } window.AppendLineBreak(); raffle += " " + i; } } if (!empty) { window.AppendHeader("Options"); window.AppendBotCommand("Start Raffle", "glyphs raffle" + raffle); window.AppendLineBreak(); window.AppendBotCommand("Clear List", "glyphs clear"); bot.SendReply(e, "Glyphs List »» ", window); } else { bot.SendReply(e, "The glyphs list is current empty"); } }
private void OnHelpCommand(BotShell bot, CommandArgs e) { RichTextWindow window = new RichTextWindow(bot); window.AppendTitle("VhaBot Help"); bool found = false; foreach (string plugin in bot.Plugins.GetPlugins()) { if (bot.Plugins.IsLoaded(plugin)) { string[] commands = bot.Commands.GetCommands(plugin); List <string> helpCommands = new List <string>(); foreach (string command in commands) { CommandRights rights = bot.Commands.GetRights(command); if (rights.Help && !rights.IsAlias) { helpCommands.Add(command); } } helpCommands.Sort(); if (helpCommands.Count > 0) { PluginLoader loader = bot.Plugins.GetLoader(plugin); window.AppendHighlight(loader.Name); window.AppendLineBreak(); window.AppendNormalStart(); int i = 0; foreach (string command in helpCommands) { window.AppendBotCommand(Format.UppercaseFirst(command), "help " + command); i++; if (i < helpCommands.Count) { window.AppendString(", "); } } window.AppendColorEnd(); window.AppendLineBreak(2); found = true; } } } if (found) { bot.SendReply(e, "VhaBot Help »» ", window); } else { bot.SendReply(e, "No help available"); } }
private void OnRaidReconnectCommand(BotShell bot, CommandArgs e) { this.RebuildConnection(false); if (this._connection != null) { bot.SendReply(e, "Restored the connection to the Raid Database"); } else { bot.SendReply(e, "Could not restore the connection to the Raid Database"); } }