Exemple #1
0
 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);
     }
 }
Exemple #2
0
        private void RequestSbState(BotShell bot, string user)
        {
            ShadowbreedState state;

            lock (this.Shadowbreeds)
            {
                if (!this.Shadowbreeds.ContainsKey(user.ToLower()))
                {
                    return;
                }
                state = this.Shadowbreeds[user.ToLower()];
            }

            RichTextWindow window = new RichTextWindow(bot);

            window.AppendTitle("Shadowbreed");

            window.AppendHighlight("Intro");
            window.AppendLineBreak();
            window.AppendNormal("You have been requested to set your Shadowbreed state.");
            window.AppendLineBreak();
            window.AppendNormal("Your current Shadowbreed state is: ");
            window.AppendRawString(this.ColorizeState(state));
            window.AppendLineBreak();
            window.AppendNormal("Please select one of the following states that best suits your situation.");
            window.AppendLineBreak(2);

            window.AppendHighlight("Up ");
            window.AppendNormal("[");
            window.AppendBotCommand("Set", "sb set " + user + " up");
            window.AppendNormal("] ");
            window.AppendLineBreak();
            window.AppendNormal("Your Shadowbreed is up and available to use.");
            window.AppendLineBreak();
            window.AppendNormal("You're alive and present at the raid.");
            window.AppendLineBreak(2);

            window.AppendHighlight("Down ");
            window.AppendNormal("[");
            window.AppendBotCommand("Set", "sb set " + user + " down");
            window.AppendNormal("] ");
            window.AppendLineBreak();
            window.AppendNormal("Your Shadowbreed is not up and can't be used.");
            window.AppendLineBreak();
            window.AppendNormal("You're alive and present at the raid.");
            window.AppendLineBreak(2);

            window.AppendHighlight("Unavailable ");
            window.AppendNormal("[");
            window.AppendBotCommand("Set", "sb set " + user + " unavailable");
            window.AppendNormal("] ");
            window.AppendLineBreak();
            window.AppendNormal("You don't have a Shadowbreed.");
            window.AppendLineBreak();
            window.AppendNormal("Or you're not present at the raid.");

            bot.SendPrivateMessage(user, bot.ColorHighlight + "Please set your Shadowbreed state »» " + window.ToString(), AoLib.Net.PacketQueue.Priority.Urgent, true);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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");
            }
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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");
        }
Exemple #7
0
 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!");
     }
 }
        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);
        }
Exemple #9
0
        private void OnCommandsCommand(BotShell bot, CommandArgs e)
        {
            RichTextWindow window = new RichTextWindow(bot);

            window.AppendTitle("Command Rights");
            foreach (string plugin in bot.Plugins.GetPlugins())
            {
                if (bot.Plugins.GetState(plugin) == PluginState.Loaded)
                {
                    string[] commands = bot.Commands.GetCommands(plugin);
                    if (commands.Length > 0)
                    {
                        PluginLoader loader = bot.Plugins.GetLoader(plugin);
                        window.AppendNormalStart();
                        window.AppendString("[");
                        window.AppendBotCommand("Configure", "commands " + plugin.ToLower());
                        window.AppendString("] ");
                        window.AppendColorEnd();

                        window.AppendHighlight(loader.Name);
                        window.AppendNormal(" (" + commands.Length + " commands)");
                        window.AppendLineBreak();
                    }
                }
            }
            bot.SendReply(e, "Commands »» ", window);
        }
Exemple #10
0
        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);
        }
Exemple #11
0
 private void StartedEvent(object sender, EventArgs e)
 {
     if (this.CreditsEnabled)
     {
         if (!this._core.Locked)
         {
             this._core.Locked = true;
             //this._bot.SendPrivateChannelMessage(this._bot.ColorHighlight + "The raid has been " + HTML.CreateColorString(RichTextWindow.ColorRed, "locked") + " pending raid credits type selection");
         }
         this.CreditsType = -1;
         RichTextWindow window = new RichTextWindow(this._bot);
         window.AppendTitle("Raid Credits Selection");
         window.AppendHighlight("The raid credits system has been enabled.");
         window.AppendLineBreak();
         window.AppendHighlight("Please select which type of raid credits should be used for this raid.");
         window.AppendLineBreak(2);
         lock (this._database.Connection)
         {
             using (IDbCommand command = this._database.Connection.CreateCommand())
             {
                 command.CommandText = "SELECT type, name, description, credits FROM credits_types";
                 IDataReader reader = command.ExecuteReader();
                 while (reader.Read())
                 {
                     window.AppendHeader(reader.GetString(1));
                     window.AppendHighlight(reader.GetString(2));
                     window.AppendLineBreak();
                     window.AppendNormal("[");
                     window.AppendBotCommand("Select", "raid credits " + reader.GetInt32(0));
                     window.AppendNormal("]");
                     window.AppendLineBreak(2);
                 }
                 reader.Close();
             }
         }
         window.AppendHeader("No Credits");
         window.AppendHighlight("Selecting this option will cause no raid credits to be charged this raid.");
         window.AppendLineBreak();
         window.AppendHighlight("This option is useful for unannounced or unplanned raids.");
         window.AppendLineBreak();
         window.AppendNormal("[");
         window.AppendBotCommand("Select", "raid unlock");
         window.AppendNormal("]");
         window.AppendLineBreak(2);
         this._bot.SendPrivateChannelMessage(this._bot.ColorHighlight + "Please select raid credits type »» " + window.ToString());
     }
 }
Exemple #12
0
        private void OnCallersCommand(BotShell bot, CommandArgs e)
        {
            if (this.Callers.Count < 1)
            {
                bot.SendReply(e, "There are no assigned callers");
                return;
            }
            RichTextWindow callersWindow = new RichTextWindow(bot);

            callersWindow.AppendTitle("Callers");
            string assistAll = string.Empty;

            lock (this.Callers)
            {
                foreach (string caller in this.Callers)
                {
                    callersWindow.AppendHighlight(Format.UppercaseFirst(caller));
                    callersWindow.AppendNormalStart();
                    callersWindow.AppendString(" [");
                    callersWindow.AppendCommand("Assist", "/assist " + caller);
                    callersWindow.AppendString("] [");
                    callersWindow.AppendCommand("Macro", "/macro " + caller + " /assist " + caller);
                    callersWindow.AppendString("] [");
                    callersWindow.AppendBotCommand("Remove", "callers remove " + caller);
                    callersWindow.AppendString("]");
                    callersWindow.AppendColorEnd();
                    callersWindow.AppendLineBreak();
                    assistAll += "/assist " + caller + "\\n ";
                }
            }
            callersWindow.AppendLineBreak();
            callersWindow.AppendHeader("Options");
            callersWindow.AppendHighlight("Assist All: ");
            callersWindow.AppendCommand("Click", assistAll.Substring(0, assistAll.Length - 3));
            callersWindow.AppendLineBreak();
            callersWindow.AppendHighlight("Assist All Macro: ");
            callersWindow.AppendNormal("/macro assist " + assistAll.Substring(0, assistAll.Length - 3));
            callersWindow.AppendLineBreak();
            callersWindow.AppendHighlight("Clear List: ");
            callersWindow.AppendBotCommand("Click", "callers remove all");
            bot.SendReply(e, "Callers »» ", callersWindow);
        }
Exemple #13
0
        public void OnPluginsOverviewCommand(BotShell bot, CommandArgs e)
        {
            RichTextWindow window = new RichTextWindow(bot);

            window.AppendTitle();
            string[] plugins = bot.Plugins.GetPlugins();
            foreach (string plugin in plugins)
            {
                if (bot.Plugins.GetState(plugin) == PluginState.Core)
                {
                    continue;
                }

                PluginLoader info = bot.Plugins.GetLoader(plugin);
                window.AppendHeader(info.Name + " v" + info.Version);

                if (!string.IsNullOrEmpty(info.Description))
                {
                    window.AppendHighlight("Description: ");
                    window.AppendNormal(info.Description);
                    window.AppendLineBreak();
                }

                window.AppendHighlight("Author: ");
                window.AppendNormal(info.Author);
                window.AppendLineBreak();

                window.AppendHighlight("Commands: ");
                List <string> commands = new List <string>();
                foreach (Command command in info.Commands)
                {
                    if (!command.IsAlias)
                    {
                        commands.Add(Format.UppercaseFirst(command.CommandName));
                    }
                }
                window.AppendNormal(string.Join(", ", commands.ToArray()));

                window.AppendLineBreak(2);
            }
            bot.SendReply(e, "Plugins Overview »» ", window);
        }
Exemple #14
0
 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!");
     }
 }
Exemple #15
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            switch (e.Command)
            {
            case "gates":
                TimeSpan       time   = this.GetTimeLeft();
                DateTime       now    = DateTime.Now.ToUniversalTime();
                RichTextWindow window = new RichTextWindow(bot);
                window.AppendTitle("Outzone Gates Opening Times");
                DateTime next = now.AddSeconds(time.TotalSeconds);
                for (int i = 0; i < 14; i++)
                {
                    window.AppendHighlight(next.ToString("dd/MM/yyyy HH:mm:ss") + " GMT ");
                    TimeSpan span = next - now;
                    window.AppendNormal(string.Format("({0:00}:{1:00}:{2:00} from now)", Math.Floor(span.TotalHours), span.Minutes, span.Seconds));
                    window.AppendLineBreak();
                    next = next.AddSeconds(this.Cycle);
                }
                string result = string.Empty;
                int    last   = this.Cycle - (int)time.TotalSeconds;
                if (last < (60 * 2))
                {
                    result = "Unicorn Gatekeeper is currently opening the Outzones gates";
                }
                else if (last < (60 * 12))
                {
                    result = "The Outzones gates are currently open";
                }
                else
                {
                    result = "Unicorn Gatekeeper will open the Outzones gates in " + HTML.CreateColorString(bot.ColorHeaderHex, string.Format("{0} hours, {1} minutes and {2} seconds", time.Hours, time.Minutes, time.Seconds));
                }
                bot.SendReply(e, result + " »» " + window.ToString());
                break;

            case "gates get":
                if (this.FetchWebTime(bot))
                {
                    bot.SendReply(e, "Synchronized the Outzones gates timer");
                }
                else
                {
                    bot.SendReply(e, "Unable to synchronize the Outzones gates timer. Please try again later");
                }
                break;

            case "gates reset":
                bot.Configuration.SetInteger(this.InternalName, "gatetime", (Int32)TimeStamp.Now);
                this.LoadSettings(bot);
                bot.SendReply(e, "The Outzones gates timer has been reset");
                break;
            }
        }
Exemple #16
0
        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");
            }
        }
Exemple #17
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            switch (e.Command)
            {
            case "announce":
            case "mass":
                bool invite = (e.Command == "mass");
                if (e.Words.Length < 1)
                {
                    bot.SendReply(e, "Correct Usage: " + e.Command + " [message]");
                    return;
                }
                string message = e.Words[0].Trim();
                string group   = bot.Configuration.GetString(this._client.InternalName, "group", bot.Character);
                bot.SendReply(e, "Contacting the Vhanet announce system. Please stand by...");

                int           messageID;
                MessageResult messageResult;
                messageResult = bot.SendRemotePluginMessage(this.InternalName, "vhanet@rubika", "VhanetMassInviteHost", "announce", out messageID, group, bot.Character, e.Sender, message);

                if (messageResult != MessageResult.Success)
                {
                    bot.SendReply(e, "Unable to contact the Vhanet announce system. Return code was: " + HTML.CreateColorString(bot.ColorHeaderHex, messageResult.ToString()));
                    return;
                }
                ReplyMessage messageReply = bot.GetReplyMessage(messageID, 60000);
                if (messageReply == null)
                {
                    bot.SendReply(e, "Didn't receive a reply from the Vhanet announce system");
                    return;
                }
                string[] members = (string[])messageReply.Args[0];
                if (invite)
                {
                    List <string> massed = new List <string>();
                    foreach (string member in members)
                    {
                        if (!bot.PrivateChannel.IsOn(member))
                        {
                            bot.PrivateChannel.Invite(member);
                            massed.Add(member);
                        }
                    }
                    RichTextWindow window = new RichTextWindow(bot);
                    window.AppendTitle("Members");
                    window.AppendHighlight(string.Join(", ", massed.ToArray()));
                    bot.SendReply(e, "Sending out an mass invite to " + HTML.CreateColorString(bot.ColorHeaderHex, massed.Count.ToString()) + " members »» ", window);
                }
                break;
            }
        }
Exemple #18
0
        private void OnMembersCommand(BotShell bot, CommandArgs e)
        {
            SortedDictionary <string, UserLevel> members = bot.Users.GetUsers();
            RichTextWindow window = new RichTextWindow(bot);

            window.AppendTitle("Members");
            foreach (KeyValuePair <string, UserLevel> member in members)
            {
                window.AppendHighlight(member.Key);
                window.AppendNormal(" (" + member.Value + ")");
                window.AppendLineBreak();
            }
            bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, members.Count.ToString()) + " Members »» ", window);
        }
Exemple #19
0
        private void OnBansCommand(BotShell bot, CommandArgs e)
        {
            Ban[]          bans   = bot.Bans.List();
            RichTextWindow window = new RichTextWindow(bot);

            window.AppendTitle("Bans");
            foreach (Ban ban in bans)
            {
                window.AppendHighlight(ban.Character);
                window.AppendNormal(" (By " + ban.AddedBy + " on " + Format.DateTime(ban.AddedOn, FormatStyle.Compact) + ")");
                window.AppendLineBreak();
            }
            bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, bans.Length.ToString()) + " Bans »» ", window);
        }
Exemple #20
0
 public override void OnCommand(BotShell bot, CommandArgs e)
 {
     if (e.Items.Length < 1)
     {
         bot.SendReply(e, "Correct Usage: bio [bio material]");
         return;
     }
     foreach (AoItem match in e.Items)
     {
         if (this._clumps.ContainsKey(match.HighID))
         {
             string name = "QL " + match.QL + " " + this._clumps[match.HighID].Clump;
             if (this._clumps[match.HighID].Weapons.Count > 0)
             {
                 double hql = Math.Floor((match.QL * 1.1));
                 if (hql > 300)
                 {
                     hql = 300;
                 }
                 RichTextWindow window = new RichTextWindow(bot);
                 window.AppendTitle("Kyr'Ozch Weapons");
                 window.AppendHighlight("The following weapons can be created using your " + name + ":");
                 window.AppendLineBreak();
                 foreach (VhBioWeapon weapon in this._clumps[match.HighID].Weapons)
                 {
                     if (weapon.HighQL >= hql && weapon.LowQL <= hql)
                     {
                         window.AppendNormal("- ");
                         window.AppendItem("Kyr'Ozch " + weapon.Name + " - Type " + this._clumps[match.HighID].Type, weapon.LowID, weapon.HighID, Convert.ToInt32(hql));
                         window.AppendLineBreak();
                     }
                 }
                 bot.SendReply(e, name + " (" + this._clumps[match.HighID].Description + ")" + " »» ", window);
             }
             else
             {
                 bot.SendReply(e, name + " (" + this._clumps[match.HighID].Description + ")");
             }
         }
         else if (match.Name == "Solid Clump of Kyr'Ozch Bio-Material")
         {
             bot.SendReply(e, "Unable to identify your " + HTML.CreateColorString(bot.ColorHeaderHex, match.Name));
         }
         else
         {
             bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, match.Name) + " doesn't look like a " + HTML.CreateColorString(bot.ColorHeaderHex, "Solid Clump of Kyr'Ozch Bio-Material"));
         }
     }
 }
Exemple #21
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            RaidCore.Raider[] raiders = this._core.GetActiveRaiders();
            int    i      = 0;
            int    ii     = 0;
            string assist = string.Empty;

            if (raiders.Length == 0)
            {
                bot.SendReply(e, "There's nobody on the raid to check");
                return;
            }
            foreach (RaidCore.Raider raider in raiders)
            {
                assist += "/assist " + raider.Character + " \\n ";
                i++;
                ii++;
                if (i == 100 || raiders.Length == ii)
                {
                    RichTextWindow window = new RichTextWindow(bot);
                    window.AppendTitle("Raid Check");
                    window.AppendHighlight("This command will execute a /assist command on all raiders currently present in the raid");
                    window.AppendLineBreak();
                    window.AppendHighlight("If the player is present it won't display anything if they are in combat and if they're not in combat it will display 'Target is not in a fight'");
                    window.AppendLineBreak();
                    window.AppendHighlight("If the player isn't present it will display 'Can't find target >player<'");
                    window.AppendLineBreak(2);
                    window.AppendNormal("[");
                    window.AppendCommand("Check all Raiders", assist);
                    window.AppendNormal("]");
                    i      = 0;
                    assist = string.Empty;
                    bot.SendReply(e, "Raid Check »» ", window);
                }
            }
        }
Exemple #22
0
        public void OnLinksCommand(BotShell bot, CommandArgs e)
        {
            RichTextWindow window = new RichTextWindow(bot);

            window.AppendTitle();
            int links = 0;

            using (IDbCommand command = this._database.Connection.CreateCommand())
            {
                command.CommandText = "SELECT id, category, link, description FROM links ORDER BY category, description";
                IDataReader reader       = command.ExecuteReader();
                string      lastCategory = "";
                while (reader.Read())
                {
                    int    id          = reader.GetInt32(0);
                    string category    = reader.GetString(1);
                    string link        = reader.GetString(2);
                    string description = reader.GetString(3);
                    if (category != lastCategory)
                    {
                        if (links > 0)
                        {
                            window.AppendLineBreak();
                        }
                        window.AppendHeader(category);
                        lastCategory = category;
                    }
                    window.AppendHighlight(description);
                    window.AppendNormalStart();
                    window.AppendString(" [");
                    window.AppendCommand("Visit", "/start " + link);
                    window.AppendString("] [");
                    window.AppendBotCommand("Remove", "links remove " + id);
                    window.AppendString("]");
                    window.AppendColorEnd();
                    window.AppendLineBreak();
                    links++;
                }
            }
            if (links > 0)
            {
                bot.SendReply(e, "Links and Bookmarks »» ", window);
            }
            else
            {
                bot.SendReply(e, "There are currently no links in the database");
            }
        }
Exemple #23
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            Int32              cycle  = 7 + 7 + 7;
            string             today  = string.Empty;
            DateTimeFormatInfo dtfi   = new CultureInfo("en-US", false).DateTimeFormat;
            RichTextWindow     window = new RichTextWindow(bot);

            window.AppendTitle("Beast Days");

            for (int i = 0; i < cycle; i++)
            {
                Int64 current           = TimeStamp.Now + ((24 * 60 * 60) * i);
                Int64 secondsSinceStart = current - TimeStamp.FromDateTime(new DateTime(2006, 10, 23));
                Int64 seconds           = secondsSinceStart % (cycle * (24 * 60 * 60));
                Int64 day = (seconds / (24 * 60 * 60)) + 1;

                string type = string.Empty;
                if (day <= 7)
                {
                    type = HTML.CreateColorString(RichTextWindow.ColorBlue, "Omni");
                }
                else if (day > 7 && day <= 14)
                {
                    type = HTML.CreateColorString(RichTextWindow.ColorGreen, "FFA");
                }
                else if (day > 14)
                {
                    type = HTML.CreateColorString(RichTextWindow.ColorOrange, "Clan");
                }

                if (type == string.Empty)
                {
                    continue;
                }

                if (i == 0)
                {
                    today = type;
                }

                window.AppendHighlight(TimeStamp.ToDateTime(current).ToString("[dd/MM/yyyy]", dtfi));
                window.AppendNormal(TimeStamp.ToDateTime(current).ToString(" dddd: ", dtfi));
                window.AppendRawString(type);
                window.AppendLineBreak();
            }

            bot.SendReply(e, "Today is " + today + " day »» " + window.ToString());
        }
        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);
        }
Exemple #25
0
        private void CreateSelectLine(BotShell bot, ref RichTextWindow window, string command)
        {
            CommandRights rights = bot.Commands.GetRights(command);

            command = command.Replace(" ", "_");
            this.CreateSelectPanel(ref window, rights.PrivateMessage, "commands set " + command + " tell");
            window.AppendString(" ");
            this.CreateSelectPanel(ref window, rights.PrivateChannel, "commands set " + command + " pg");
            window.AppendString(" ");
            this.CreateSelectPanel(ref window, rights.Organization, "commands set " + command + " org");
            window.AppendHighlight(" " + Format.UppercaseFirst(command.Replace("_", " ")));

            window.AppendNormalStart();
            window.AppendString(" [");
            window.AppendBotCommand("Reset", "commands reset " + command);
            window.AppendString("]");
            window.AppendColorEnd();
        }
Exemple #26
0
        private void OnPointsTopCommand(BotShell bot, CommandArgs e)
        {
            Dictionary <string, double> points = this._core.GetAllPoints();
            int            i      = 1;
            RichTextWindow window = new RichTextWindow(bot);

            window.AppendTitle("Top 20 Raid Points");
            foreach (KeyValuePair <string, double> kvp in points)
            {
                if (i > 20)
                {
                    break;
                }
                window.AppendHighlight(Math.Floor(kvp.Value) + " ");
                window.AppendNormal(Format.UppercaseFirst(kvp.Key));
                window.AppendLineBreak();
                i++;
            }
            bot.SendReply(e, "Top 20 Raid Points »» ", window);
        }
Exemple #27
0
        public void OnTimersCommand(BotShell bot, CommandArgs e)
        {
            lock (this._timers)
            {
                // If the user's level is higher than the required level he can see all timers
                bool all = false;
                if (bot.Users.GetUser(bot.Users.GetMain(e.Sender)) > bot.Commands.GetRight("timers", e.Type))
                {
                    all = true;
                }

                // Format output
                int            count  = 0;
                RichTextWindow window = new RichTextWindow(bot);
                window.AppendTitle("Active Timers");
                foreach (CachedTimer timer in this._timers.Values)
                {
                    if (!all)
                    {
                        if (timer.Owner != e.Sender && timer.Source != "pg" && timer.Source != "gc")
                        {
                            continue;
                        }
                    }
                    count++;
                    TimeSpan remaining = timer.End - DateTime.UtcNow;
                    window.AppendHighlight(Format.Time(remaining, FormatStyle.Medium));
                    window.AppendNormal(" #" + timer.ID + " - " + timer.Description + " (" + timer.Owner + ")");
                    window.AppendLineBreak();
                }
                if (count > 0)
                {
                    bot.SendReply(e, "Timers »» ", window);
                }
                else
                {
                    bot.SendReply(e, "There are currently no timers active");
                }
            }
        }
Exemple #28
0
        private void OnTasksCommand(BotShell bot, CommandArgs e)
        {
            string         message = "Tasks";
            RichTextWindow window  = new RichTextWindow(bot);

            window.AppendTitle("Tasks");
            bool found = false;

            using (IDbCommand command = this._database.Connection.CreateCommand())
            {
                command.CommandText = "SELECT username, task FROM tasks ORDER BY username";
                IDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    found = true;
                    window.AppendHighlight(reader.GetString(0) + ": ");
                    window.AppendNormal(reader.GetString(1).Trim() + " [");
                    window.AppendBotCommand("Remove", "tasks remove " + reader.GetString(0));
                    window.AppendNormal("]");
                    window.AppendLineBreak();
                    if (e.Sender == reader.GetString(0))
                    {
                        message = "You have been assigned the following task: " + HTML.CreateColorString(bot.ColorHeaderHex, reader.GetString(1));
                    }
                }
                reader.Close();
            }
            if (!found)
            {
                bot.SendReply(e, "No tasks assigned");
            }
            else
            {
                bot.SendReply(e, message + " »» ", window);
            }
        }
Exemple #29
0
        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 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);
        }