Exemple #1
0
        public void OnBuffsCommand(BotShell bot, CommandArgs e)
        {
            RichTextWindow buffsWindow = new RichTextWindow(bot);

            buffsWindow.AppendTitle("Class Buffs");
            buffsWindow.AppendLineBreak();

            buffsWindow.AppendCommand("Base Attribute Buffs", "/tell " + this._bot.Character + " basebuffs");
            buffsWindow.AppendLineBreak(2);
            buffsWindow.AppendCommand("Skill Buffs", "/tell " + this._bot.Character + " skillbuffs");

            bot.SendReply(e, " Class Buffs »» ", buffsWindow);
        }
Exemple #2
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 #3
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 #4
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);
                }
            }
        }
        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);
        }
Exemple #6
0
        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);
        }
Exemple #7
0
        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());
        }
Exemple #8
0
        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);
        }
Exemple #9
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            RichTextWindow window = new RichTextWindow(bot);

            // Version Information
            window.AppendTitle("Version Information");

            window.AppendHighlight("Core Version: ");
            window.AppendNormal(BotShell.VERSION + " " + BotShell.BRANCH + " (Build: " + BotShell.BUILD + ")");
            window.AppendLineBreak();

            window.AppendHighlight("AoLib Version: ");
            window.AppendNormal(AoLib.Net.Chat.VERSION + " (Build: " + AoLib.Net.Chat.BUILD + ")");
            window.AppendLineBreak();

            window.AppendHighlight("CLR Version: ");
            window.AppendNormal(Environment.Version.ToString());
            window.AppendLineBreak();

            window.AppendHighlight("Bot Owner: ");
            window.AppendNormal(bot.Admin);
            window.AppendLineBreak(2);

            // Credits
            window.AppendHeader("Credits");
            window.AppendHighlight("Core Developer");
            window.AppendLineBreak();
            window.AppendNormal("- Vhab (rk1)");
            window.AppendLineBreak();
            window.AppendHighlight("Developers");
            window.AppendLineBreak();
            window.AppendNormal("- Iriche (rk1)");
            window.AppendLineBreak();
            window.AppendNormal("- Naturalistic (rk1)");
            window.AppendLineBreak();
            window.AppendNormal("- Tsuyoi (rk1)");
            window.AppendLineBreak();
            window.AppendNormal("- veremit (rk1)");
            window.AppendLineBreak();
            window.AppendHighlight("Contributors");
            window.AppendLineBreak();
            window.AppendNormal("- Toxor (rk2) (aka Techboy)");
            window.AppendLineBreak();
            window.AppendNormal("- Telperion (rk1)");
            window.AppendLineBreak();
            window.AppendNormal("- Moepl (rk1)");
            window.AppendLineBreak();
            window.AppendNormal("- Fayelure (rk1)");
            window.AppendLineBreak();
            window.AppendNormal("- Neksus (rk2)");
            window.AppendLineBreak(2);

            // Statistics
            window.AppendHeader("Statistics");
            window.AppendHighlight("Bot Uptime: ");
            window.AppendNormal(string.Format("{0} Days, {1} Hours, {2} Minutes, {3} Seconds", Math.Floor(bot.Stats.Uptime.TotalDays), bot.Stats.Uptime.Hours, bot.Stats.Uptime.Minutes, bot.Stats.Uptime.Seconds));
            window.AppendLineBreak();

            // Mono doesn't support performance counters
            Type mono = Type.GetType("Mono.Runtime");

            if (mono == null)
            {
                try
                {
                    PerformanceCounter pc = new PerformanceCounter("System", "System Up Time");
                    pc.NextValue();
                    TimeSpan ts = TimeSpan.FromSeconds(pc.NextValue());
                    window.AppendHighlight("Host Uptime: ");
                    window.AppendNormal(string.Format("{0} Days, {1} Hours, {2} Minutes, {3} Seconds", Math.Floor(ts.TotalDays), ts.Hours, ts.Minutes, ts.Seconds));
                    window.AppendLineBreak();
                }
                catch { }
            }

            window.AppendHighlight("Host OS: ");
            window.AppendNormal(Environment.OSVersion.ToString());
            window.AppendLineBreak();

            window.AppendHighlight("Commands Processed: ");
            window.AppendNormal(bot.Stats.Counter_Commands.ToString());
            window.AppendLineBreak();

            window.AppendHighlight("Private Messages Received: ");
            window.AppendNormal(bot.Stats.Counter_PrivateMessages_Received.ToString());
            window.AppendLineBreak();

            window.AppendHighlight("Channel Messages Received: ");
            window.AppendNormal(bot.Stats.Counter_ChannelMessages_Received.ToString());
            window.AppendLineBreak();

            window.AppendHighlight("Private Channel Messages Received: ");
            window.AppendNormal(bot.Stats.Counter_PrivateChannelMessages_Received.ToString());
            window.AppendLineBreak();

            window.AppendHighlight("Private Messages Sent: ");
            window.AppendNormal(bot.Stats.Counter_PrivateMessages_Sent.ToString());
            window.AppendLineBreak();

            window.AppendHighlight("Channel Messages Sent: ");
            window.AppendNormal(bot.Stats.Counter_ChannelMessages_Sent.ToString());
            window.AppendLineBreak();

            window.AppendHighlight("Private Channel Messages Sent: ");
            window.AppendNormal(bot.Stats.Counter_PrivateChannelMessages_Sent.ToString());
            window.AppendLineBreak();

            window.AppendLineBreak();
            window.AppendHeader("Links");
            window.AppendCommand("VhaBot Central", "/start http://www.vhabot.net/");
            window.AppendLineBreak();
            window.AppendCommand("VhaBot Forums", "/start http://forums.vhabot.net/");
            window.AppendLineBreak();
            window.AppendCommand("VhaBot Characters Database", "/start http://characters.vhabot.net/");
            window.AppendLineBreak();
            window.AppendCommand("VhaBot Tools", "/start http://tools.vhabot.net/");

            bot.SendReply(e, "VhaBot " + BotShell.VERSION + " " + BotShell.BRANCH + " - " + BotShell.EDITION + " Edition »» " + window.ToString("More Information"));
        }
Exemple #10
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            switch (e.Command)
            {
            case "callers":
                this.OnCallersCommand(bot, e);
                break;

            case "callers add":
                if (e.Args.Length < 1)
                {
                    bot.SendReply(e, "Correct Usage: callers add [username]");
                    break;
                }
                if (bot.GetUserID(e.Args[0]) < 1)
                {
                    bot.SendReply(e, "No such user: "******"That user is already on the callers list");
                        break;
                    }
                    this.Callers.Add(e.Args[0].ToLower());
                }
                bot.SendReply(e, "Added " + HTML.CreateColorString(bot.ColorHeaderHex, e.Args[0]) + " to the callers list");
                this.OnCallersCommand(bot, e);
                break;

            case "callers remove":
                if (e.Args.Length < 1)
                {
                    bot.SendReply(e, "Correct Usage: callers remove [username]");
                    break;
                }
                if (e.Args[0].ToLower() == "all")
                {
                    this.Callers.Clear();
                    bot.SendReply(e, "Clearing the callers list");
                    break;
                }
                lock (this.Callers)
                {
                    if (!this.Callers.Contains(e.Args[0].ToLower()))
                    {
                        bot.SendReply(e, "That user is not on the callers list");
                        break;
                    }
                    this.Callers.Remove(e.Args[0].ToLower());
                }
                bot.SendReply(e, "Removed " + HTML.CreateColorString(bot.ColorHeaderHex, e.Args[0]) + " from the callers list");
                break;

            case "assist":
                if (e.Args.Length < 1)
                {
                    bot.SendReply(e, "Correct Usage: assist [username]");
                    break;
                }
                if (bot.GetUserID(e.Args[0]) < 1)
                {
                    bot.SendReply(e, "No such user: "******"Assist " + assist);
                assistWindow.AppendHighlight("Create Macro: ");
                assistWindow.AppendCommand("Click", "/macro " + assist + " /assist " + assist);
                assistWindow.AppendLineBreak();
                assistWindow.AppendHighlight("Assist: ");
                assistWindow.AppendCommand("Click", "/assist " + assist);
                assistWindow.AppendLineBreak();
                assistWindow.AppendHighlight("Manual Macro: ");
                assistWindow.AppendNormal("/macro assist /assist " + assist);
                assistWindow.AppendLineBreak();
                bot.SendReply(e, "Assist " + assist + " »» " + assistWindow.ToString());
                break;

            case "target":
                if (e.Words.Length < 1)
                {
                    bot.SendReply(e, "Correct Usage: target [target]");
                    break;
                }
                string target = string.Format("{0}::: {1}Assist {3} to Terminate {0}::: {2}{4}", bot.ColorHighlight, HTML.CreateColorStart(RichTextWindow.ColorRed), bot.ColorNormal, e.Sender, e.Words[0]);
                if (e.Type == CommandType.Organization)
                {
                    this.SendMessage(bot, "gc", target);
                }
                else
                {
                    this.SendMessage(bot, "pg", target);
                }
                break;

            case "command":
                if (e.Words.Length < 1)
                {
                    bot.SendReply(e, "Correct Usage: command [command]");
                    break;
                }
                string command = string.Format("{0}::: {1}Raid Command from {3} {0}:::\n¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n    {2}{4}{0}\n______________________________________________", bot.ColorHighlight, HTML.CreateColorStart(RichTextWindow.ColorOrange), bot.ColorNormal, e.Sender, e.Words[0]);
                if (e.Type == CommandType.Organization)
                {
                    this.SendMessage(bot, "gc", command);
                }
                else
                {
                    this.SendMessage(bot, "pg", command);
                }
                break;

            case "order":
                if (e.Words.Length < 1)
                {
                    bot.SendReply(e, "Correct Usage: order [order]");
                    break;
                }
                string order = string.Format("{0}::: {1}Raid Order from {3} {0}::: {2}{4}", bot.ColorHighlight, HTML.CreateColorStart(RichTextWindow.ColorOrange), bot.ColorNormal, e.Sender, e.Words[0]);
                if (e.Type == CommandType.Organization)
                {
                    this.SendMessage(bot, "gc", order);
                }
                else
                {
                    this.SendMessage(bot, "pg", order);
                }
                break;

            case "cd":
                string channel = "pg";
                if (e.Type == CommandType.Organization)
                {
                    channel = "gc";
                }

                if (e.Args.Length > 0)
                {
                    if (e.Args[0].ToLower() == "abort")
                    {
                        if (this.Counting)
                        {
                            this.Abort = true;
                            return;
                        }
                        bot.SendReply(e, "No countdown in progress");
                        return;
                    }
                }
                if (this.Counting)
                {
                    bot.SendReply(e, "Countdown already in progress");
                    return;
                }
                this.Counting = true;
                this.Abort    = false;
                string onThree = string.Empty;
                if (e.Words.Length > 0)
                {
                    onThree = e.Words[0];
                }

                for (int i = 5; i >= 0; i--)
                {
                    if (this.Abort == true)
                    {
                        this.SendMessage(bot, channel, bot.ColorHighlight + "Countdown aborted!");
                        break;
                    }
                    if (i == 0)
                    {
                        this.SendMessage(bot, channel, bot.ColorHighlight + "-- " + HTML.CreateColorString(bot.ColorHeaderHex, "GO") + " --");
                        break;
                    }
                    this.SendMessage(bot, channel, bot.ColorHighlight + "--- " + HTML.CreateColorString(bot.ColorHeaderHex, i.ToString()) + " ---");
                    if (i == 3 && onThree != string.Empty)
                    {
                        this.SendMessage(bot, channel, bot.ColorHighlight + "-- " + HTML.CreateColorString(bot.ColorHeaderHex, onThree));
                    }
                    Thread.Sleep(1000);
                }
                this.Counting = false;
                break;

            case "sb":
                this.OnSbCommand(bot, e);
                break;

            case "sb set":
                if (e.Args.Length < 2)
                {
                    bot.SendReply(e, "Correct Usage: sb adminset [username] [state]");
                    break;
                }
                lock (this.Shadowbreeds)
                {
                    if (!this.Shadowbreeds.ContainsKey(e.Args[0].ToLower()))
                    {
                        bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, e.Args[0]) + " is not on the Shadowbreed list");
                        break;
                    }
                }
                ShadowbreedState state = ShadowbreedState.Unknown;
                try
                {
                    state = (ShadowbreedState)Enum.Parse(typeof(ShadowbreedState), Format.UppercaseFirst(e.Args[1]));
                }
                catch
                {
                    bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, e.Args[1]) + " is not a valid state.");
                    break;
                }
                lock (this.Shadowbreeds)
                    this.Shadowbreeds[e.Args[0].ToLower()] = state;
                bot.SendReply(e, "Shadowbreed state for " + HTML.CreateColorString(bot.ColorHeaderHex, e.Args[0]) + " has been set to " + this.ColorizeState(state));
                break;

            case "sb reset":
                lock (this.Shadowbreeds)
                {
                    this.Shadowbreeds.Clear();
                    bot.SendReply(e, "The Shadowbreed list has been reseted");
                }
                this.OnSbCommand(bot, e);
                break;

            case "sb get":
                List <string> list = new List <string>();
                lock (this.Shadowbreeds)
                {
                    if (this.Shadowbreeds.Count < 1)
                    {
                        bot.SendReply(e, "The Shadowbreeds list is empty");
                        return;
                    }

                    foreach (KeyValuePair <string, ShadowbreedState> kvp in this.Shadowbreeds)
                    {
                        if (kvp.Value == ShadowbreedState.Unknown)
                        {
                            list.Add(Format.UppercaseFirst(kvp.Key));
                        }
                    }
                }
                if (list.Count < 1)
                {
                    bot.SendReply(e, "All Shadowbreed states are known.");
                    return;
                }
                bot.SendReply(e, "Requesting Shadowbreed state from: " + HTML.CreateColorString(bot.ColorHeaderHex, string.Join(", ", list.ToArray())));
                foreach (string user in list)
                {
                    this.RequestSbState(bot, user);
                }
                break;
            }
        }
Exemple #11
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            RichTextWindow window = new RichTextWindow(bot);

            window.AppendTitle("Clien Lag Tweak");
            window.AppendLineBreak();
            window.AppendHighlight("Environment and Visual (No Zoning Required)");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option ShowAllNames 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option ShowAllNames 0");
            window.AppendNormal(" Character names show over head");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option SimpleClouds 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option SimpleClouds 0");
            window.AppendNormal(" Display Simple Clouds ");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option RealisticClouds 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option RealisticClouds 0");
            window.AppendNormal(" Display Realistic Clouds ");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option RealisticMoons 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option RealisticMoons 0");
            window.AppendNormal(" Display Realistic Moons");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option StarRotation 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option StarRotation 0");
            window.AppendNormal(" Star rotation at night");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option Wildlife 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option Wildlife 0");
            window.AppendNormal(" Show wildlife");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option IsSpaceShipsShown 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option IsSpaceShipsShown 0");
            window.AppendNormal(" Show Sace Ships");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option Shadows 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option Shadows 0");
            window.AppendNormal(" Show Ground Shadows");
            window.AppendLineBreak(2);
            window.AppendHighlight("Environment and Visual (Zoning Required)");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option BuffsFX 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option BuffsFX 0");
            window.AppendNormal(" Show Buff Effects");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option EnvironmentFX 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option EnvironmentFX 0");
            window.AppendNormal(" Show Environment Effects");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option MuzzleFlashFX 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option MuzzleFlashFX 0");
            window.AppendNormal(" Show Muzzle Flash");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option NanoEffectFX 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option NanoEffectFX 0");
            window.AppendNormal(" Show Nano Effects (Calms, Damage Shields, etc.)");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option TracersFX 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option TracersFX 0");
            window.AppendNormal(" Show Tracers");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option OthersFX 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option OthersFX 0");
            window.AppendNormal(" Show Others Effects");
            window.AppendLineBreak(2);
            window.AppendHighlight("Audio Settings (No Zoning Required)");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option SoundOnOff 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option SoundOnOff 0");
            window.AppendNormal(" Sound Master ");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option SoundFXOn 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option SoundFXOn 0");
            window.AppendNormal(" Sound Effects");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option MusicOn 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option MusicOn 0");
            window.AppendNormal(" Music");
            window.AppendLineBreak();
            window.AppendCommand("Enable", "/option VoiceSndFxOn 1");
            window.AppendNormal("  ");
            window.AppendCommand("Disable", "/option VoiceSndFxOn 0");
            window.AppendNormal(" Voices");
            window.AppendLineBreak(2);
            window.AppendHighlight("View Distance Settings (No Zoning Required)");
            window.AppendLineBreak();
            window.AppendCommand("Min", "/option ViewDistance 0.05");
            window.AppendNormal("  ");
            window.AppendCommand("Low", "/option ViewDistance 0.30");
            window.AppendNormal("  ");
            window.AppendCommand("Medium", "/option ViewDistance 0.50");
            window.AppendNormal("  ");
            window.AppendCommand("High", "/option ViewDistance 0.75");
            window.AppendNormal("  ");
            window.AppendCommand("Max", "/option ViewDistance 1");
            window.AppendNormal(" View Distance");
            window.AppendLineBreak();
            window.AppendCommand("Min", "/CharDist 5");
            window.AppendNormal("  ");
            window.AppendCommand("Low", "/CharDist 30");
            window.AppendNormal("  ");
            window.AppendCommand("Medium", "/CharDist 50");
            window.AppendNormal("  ");
            window.AppendCommand("High", "/CharDist 75");
            window.AppendNormal("  ");
            window.AppendCommand("Max", "/CharDist 100");
            window.AppendNormal(" Character View Distance");
            window.AppendLineBreak(2);
            bot.SendReply(e, " Lag Tweak »» ", window);
        }
Exemple #12
0
        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());
        }
Exemple #13
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            switch (e.Command)
            {
            case "irc":
                RichTextWindow window = new RichTextWindow(bot);

                string password = "";
                for (int i = 0; i < this.Password.Length; i++)
                {
                    password += "*";
                }

                window.AppendTitle("SimpleIRC Configuration");
                window.AppendHighlight("Server: ");
                window.AppendNormal(this.Server);
                window.AppendLineBreak();

                window.AppendHighlight("Port: ");
                window.AppendNormal(this.Port.ToString());
                window.AppendLineBreak();

                window.AppendHighlight("Nickname: ");
                window.AppendNormal(this.Nickname);
                window.AppendLineBreak();

                window.AppendHighlight("Channel: ");
                window.AppendNormal(this.Channel);
                window.AppendLineBreak();

                window.AppendHighlight("Password: "******"Auto Start: ");
                if (this.Bot.Configuration.GetBoolean(this.InternalName, "autostart", false))
                {
                    window.AppendNormal("On");
                }
                else
                {
                    window.AppendNormal("Off");
                }
                window.AppendLineBreak();

                window.AppendHighlight("Color: ");
                window.AppendNormal(this.GuildColor);
                window.AppendLineBreak();

                window.AppendHighlight("Relay Mode: ");
                window.AppendNormal(this.RelayMode);
                window.AppendLineBreak();

                window.AppendHighlight("AO->IRC Connect Syntax: ");
                window.AppendNormal(this.ConnectSyntaxAo);
                window.AppendLineBreak();

                window.AppendHighlight("IRC->AO Connect Syntax: ");
                window.AppendNormal(this.ConnectSyntaxIrc);
                window.AppendLineBreak();

                window.AppendHighlight("Reconnect Delay: ");
                window.AppendNormal(this.ConnectDelay.ToString());
                window.AppendLineBreak();

                window.AppendHighlight("Message Cap: ");
                window.AppendNormal(this.MessageCap.ToString());

                window.AppendLineBreak(2);

                window.AppendHighlight("Control: ");
                window.AppendCommand("Start", "/tell " + this.Bot.Character + " irc start");
                window.AppendNormal(" / ");
                window.AppendCommand("Stop", "/tell " + this.Bot.Character + " irc stop");

                this.Bot.SendReply(e, "IRC »» " + window.ToString());
                break;

            case "irc start":
                this.StartLink();
                this.Bot.SendReply(e, "Starting SimpleIRC");
                break;

            case "irc stop":
                this.Bot.SendReply(e, "Stopping SimpleIRC");
                this.StopLink();
                break;

            case "irc restart":
                this.Bot.SendReply(e, "Stopping SimpleIRC");
                this.StopLink();
                this.StartLink();
                this.Bot.SendReply(e, "Starting SimpleIRC");
                break;

            case "irc raw":
                if (e.Args.Length > 0)
                {
                    string raw = string.Join(" ", e.Args);
                    this.IRC.Sender.Raw(raw);
                    this.Bot.SendReply(e, "Executed Raw Command");
                }
                else
                {
                    this.Bot.SendReply(e, "Invalid Command");
                }
                break;

            case "say":
                if (e.Args.Length > 1)
                {
                    string message = string.Join(" ", e.Args, 1, e.Args.Length - 1);
                    switch (e.Args[0].ToLower())
                    {
                    case "both":
                    case "all":
                        this.IRC.Sender.PublicMessage(this.Channel, message);
                        if (this.RelayMode == "guild" || this.RelayMode == "both")
                        {
                            this.Bot.SendOrganizationMessage(message);
                        }
                        if (this.RelayMode == "guest" || this.RelayMode == "both")
                        {
                            this.Bot.SendPrivateChannelMessage(message);
                        }
                        return;

                    case "guild":
                        this.Bot.SendOrganizationMessage(message);
                        return;

                    case "private":
                    case "guest":
                        this.Bot.SendPrivateChannelMessage(message);
                        return;

                    case "irc":
                        this.IRC.Sender.PublicMessage(this.Channel, message);
                        return;

                    default:
                        break;
                    }
                }
                this.Bot.SendReply(e, "Invalid target! Valid targets are: all, guild, guest, irc");
                break;
            }
        }
Exemple #14
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            int ql_chk = -1;

            if (e.Args.Length < 1 || e.Args.Length > 2)
            {
                bot.SendReply(e, "Correct Usage: aiarmor [[ql]] [armor type]");
                return;
            }
            else if (e.Args.Length == 1)
            {
                ql        = 300;
                armortype = e.Args[0].ToLower();
            }
            else if (!int.TryParse(e.Args[0], out ql_chk) || ql_chk < 1 || ql_chk > 300)
            {
                bot.SendReply(e, "Correct Usage: aiarmor [[ql]] [armor type]");
                return;
            }
            else
            {
                double num;
                bool   isNum = double.TryParse(e.Args[0], out num);
                if (isNum)
                {
                    ql = Convert.ToInt32(e.Args[0]);
                }
                else
                {
                    bot.SendReply(e, "Correct Usage: aiarmor [[ql]] [armor type]");
                    return;
                }
                armortype = e.Args[1].ToLower();
            }
            bool realAibot = false;

            foreach (string test in allowedArgs)
            {
                if (armortype.Equals(test))
                {
                    realAibot = true;
                }
            }
            if (!realAibot)
            {
                bot.SendReply(e, "Correct Usage: aiarmor [[ql]] [armor type]");
                return;
            }

            src_ql = (int)Math.Ceiling(ql * 0.8);
            // Ai Armor
            AoItem arithmetic = new AoItem("Arithmetic", 246559, 246560, 300, "256314");
            AoItem enduring   = new AoItem("Enduring", 246579, 246580, 300, "256344");
            AoItem observant  = new AoItem("Observant", 246591, 246592, 300, "256338");
            AoItem spiritual  = new AoItem("Spiritual", 246599, 246600, 300, "256332");
            AoItem strong     = new AoItem("Strong", 246615, 246616, 300, "256362");
            AoItem supple     = new AoItem("Supple", 246621, 246622, 300, "256296");

            if (armortype.Length == 2)
            {
                // Combined Ai Armor
                AoItem cc = new AoItem("Combined Commando's", 246659, 246659, ql, "256308");
                AoItem cm = new AoItem("Combined Mercenary's", 246637, 246638, ql, "256356");
                AoItem co = new AoItem("Combined Officer's", 246671, 246672, ql, "256320");
                AoItem cp = new AoItem("Combined Paramedic's", 246647, 246648, ql, "256350");
                AoItem cs = new AoItem("Combined Scout's", 246683, 246684, ql, "256326");
                AoItem ss = new AoItem("Combined Sharpshooter's", 246695, 246696, ql, "256302");
                switch (armortype)
                {
                case "cc":
                    result = cc;
                    source = strong;
                    target = supple;
                    break;

                case "cm":
                    result = cm;
                    source = strong;
                    target = enduring;
                    break;

                case "co":
                    result = co;
                    source = spiritual;
                    target = arithmetic;
                    break;

                case "cp":
                    result = cp;
                    source = spiritual;
                    target = enduring;
                    break;

                case "cs":
                    result = cs;
                    source = observant;
                    target = arithmetic;
                    break;

                case "ss":
                    result = ss;
                    source = observant;
                    target = supple;
                    break;

                default:
                    return;
                }

                RichTextWindow window = new RichTextWindow(bot);
                window.AppendTitle("Building process for quality " + ql + " " + result.Name);
                window.AppendLineBreak();
                window.AppendHighlight("Result:\n");
                window.AppendItemStart(result.LowID, result.HighID, ql);
                window.AppendIcon(Convert.ToInt32(result.Raw));
                window.AppendLineBreak();
                window.AppendString(result.Name);
                window.AppendItemEnd();
                window.AppendLineBreak(2);
                window.AppendHighlight("Source:\n");
                window.AppendItemStart(source.LowID, source.HighID, src_ql);
                window.AppendIcon(Convert.ToInt32(source.Raw));
                window.AppendLineBreak();
                window.AppendString(source.Name);
                window.AppendItemEnd();
                window.AppendLineBreak();
                window.AppendCommand("Tradeskill process for this item", "/tell " + bot.Character + " aiarmor " + src_ql + " " + source.Name);
                window.AppendLineBreak(2);
                window.AppendHighlight("Target:\n");
                window.AppendItemStart(target.LowID, target.HighID, ql);
                window.AppendIcon(Convert.ToInt32(target.Raw));
                window.AppendLineBreak();
                window.AppendString(target.Name);
                window.AppendItemEnd();
                window.AppendLineBreak();
                window.AppendCommand("Tradeskill process for this item", "/tell " + bot.Character + " aiarmor " + ql + " " + target.Name);

                bot.SendReply(e, result.Name + " »» ", window);
            }
            else
            {
                RichTextWindow window = new RichTextWindow(bot);
                window.AppendTitle("Building process for ql" + ql + " " + armortype);
                window.AppendNormal("You need the following items to build " + armortype + " Armor:\n");
                window.AppendNormal("- Kyr'Ozch Viralbots\n");
                window.AppendNormal("- Kyr'Ozch Atomic Re-Structulazing Tool\n");
                window.AppendNormal("- Solid Clump of Kyr'Ozch Biomaterial\n");
                window.AppendNormal("- Arithmetic / Strong / Enduring / Spiritual / Observant / Supple Viralbots\n\n");
                // Step 1
                window.AppendHighlight("Step 1:\n");
                window.AppendItemStart(247113, 247114, src_ql);
                window.AppendIcon(100330);
                window.AppendLineBreak();
                window.AppendNormal("Kyr'Ozch Viralbots");
                window.AppendItemEnd();
                window.AppendNormal(" (Drops off Alien City Generals)\n\t\t\t+\n");
                window.AppendItemStart(247099, 247099, 100);
                window.AppendIcon(247098);
                window.AppendLineBreak();
                window.AppendNormal("Kyr'Ozch Atomic Re-Structuralizing Tool");
                window.AppendItemEnd();
                window.AppendNormal(" (Drops off every Alien)\n\t\t\t=\n");
                window.AppendItemStart(247118, 247119, src_ql);
                window.AppendIcon(100331);
                window.AppendLineBreak();
                window.AppendNormal("Memory-Wiped Kyr'Ozch Viralbots");
                window.AppendItemEnd();
                window.AppendLineBreak();
                window.AppendHighlight("Required Skills:\n");
                window.AppendNormal("- " + (ql * 4.5) + " Computer Literacy\n");
                window.AppendNormal("- " + (ql * 4.5) + " Nano Programming\n\n");
                // Step 2
                window.AppendHighlight("Step 2:\n");
                window.AppendItemStart(161699, 161699, 1);
                window.AppendIcon(99279);
                window.AppendLineBreak();
                window.AppendNormal("Nano Programming Interface");
                window.AppendItemEnd();
                window.AppendNormal("\n\t\t\t+\n");
                window.AppendItemStart(247118, 247119, src_ql);
                window.AppendIcon(100331);
                window.AppendLineBreak();
                window.AppendNormal("Memory-Wiped Kyr'Ozch Viralbots");
                window.AppendItemEnd();
                window.AppendNormal("\n\t\t\t=\n");
                window.AppendItemStart(247120, 247121, src_ql);
                window.AppendIcon(100334);
                window.AppendLineBreak();
                window.AppendNormal("Formatted Kyr'Ozch Viralbots");
                window.AppendItemEnd();
                window.AppendLineBreak();
                window.AppendHighlight("Required Skills:\n");
                window.AppendNormal("- " + (ql * 6) + " Nano Programming\n\n");
                // Step 3
                window.AppendHighlight("Step 3:\n");
                window.AppendItemStart(247100, 247100, 100);
                window.AppendIcon(247097);
                window.AppendLineBreak();
                window.AppendNormal("Kyr'Ozch Structural Analyzer");
                window.AppendItemEnd();
                window.AppendNormal("\n\t\t\t+\n");
                window.AppendItemStart(247102, 247103, ql);
                window.AppendIcon(247101);
                window.AppendLineBreak();
                window.AppendNormal("ql" + ql + " Solid Clump of Kyr'Ozch Biomaterial");
                window.AppendItemEnd();
                window.AppendNormal(" (Drops off every Alien)\n\t\t\t=\n");
                window.AppendItemStart(247108, 247109, ql);
                window.AppendIcon(255705);
                window.AppendLineBreak();
                window.AppendNormal("ql" + ql + " Mutated Kyr'Ozch Biomaterial");
                window.AppendItemEnd();
                window.AppendNormal(" or\n");
                window.AppendItemStart(247106, 247107, ql);
                window.AppendIcon(255705);
                window.AppendLineBreak();
                window.AppendNormal("ql" + ql + " Pristine Kyr'Ozch Biomaterial");
                window.AppendItemEnd();
                window.AppendLineBreak();
                window.AppendHighlight("Required Skills:\n");
                window.AppendNormal("- " + (ql * 4.5) + " Chemistry (for Pristine)\n");
                window.AppendNormal("- " + (ql * 7) + " Chemistry (for Mutated)\n\n");
                //Step 4
                window.AppendHighlight("Step 4:\n");
                window.AppendItemStart(247108, 247109, ql);
                window.AppendIcon(255705);
                window.AppendLineBreak();
                window.AppendNormal("ql" + ql + " Mutated Kyr'Ozch Biomaterial");
                window.AppendItemEnd();
                window.AppendNormal(" or\n");
                window.AppendItemStart(247106, 247107, ql);
                window.AppendIcon(255705);
                window.AppendLineBreak();
                window.AppendNormal("ql" + ql + " Pristine Kyr'Ozch Biomaterial");
                window.AppendItemEnd();
                window.AppendNormal("\n\t\t\t+\n");
                window.AppendItemStart(247110, 247110, 100);
                window.AppendIcon(255705);
                window.AppendLineBreak();
                window.AppendNormal("Uncle Bazzit's Generic Nano Solvent");
                window.AppendItemEnd();
                window.AppendLineBreak();
                window.AppendNormal(" (Can be bought in Bazzit Shop in MMD)\n\t\t\t=\n");
                window.AppendItemStart(247111, 247112, ql);
                window.AppendIcon(247115);
                window.AppendLineBreak();
                window.AppendNormal("Generic Kyr'Ozch DNA Soup");
                window.AppendItemEnd();
                window.AppendLineBreak();
                window.AppendHighlight("Required Skills:\n");
                window.AppendNormal("- " + (ql * 4.5) + " Chemistry (for Pristine)\n");
                window.AppendNormal("- " + (ql * 7) + " Chemistry (for Mutated)\n\n");
                //Step 5
                window.AppendHighlight("Step 5:\n");
                window.AppendItemStart(247111, 247112, ql);
                window.AppendIcon(247115);
                window.AppendLineBreak();
                window.AppendNormal("Generic Kyr'Ozch DNA Soup");
                window.AppendItemEnd();
                window.AppendNormal("\n\t\t\t+\n");
                window.AppendItemStart(247123, 247123, 100);
                window.AppendIcon(247122);
                window.AppendLineBreak();
                window.AppendNormal("Essential Human DNA");
                window.AppendItemEnd();
                window.AppendLineBreak();
                window.AppendNormal(" (Can be bought in Bazzit Shop in MMD)\n\t\t\t=\n");
                window.AppendItemStart(247124, 247125, ql);
                window.AppendIcon(247116);
                window.AppendLineBreak();
                window.AppendNormal("DNA Cocktail");
                window.AppendItemEnd();
                window.AppendLineBreak();
                window.AppendHighlight("Required Skills:\n");
                window.AppendNormal("- " + (ql * 6) + " Pharma Tech\n\n");
                //Step 6
                window.AppendHighlight("Step 6:\n");
                window.AppendItemStart(247120, 247121, ql);
                window.AppendIcon(100334);
                window.AppendLineBreak();
                window.AppendNormal("Formatted Kyr'Ozch Viralbots");
                window.AppendItemEnd();
                window.AppendNormal("\n\t\t\t+\n");
                window.AppendItemStart(247124, 247125, ql);
                window.AppendIcon(247116);
                window.AppendLineBreak();
                window.AppendNormal("DNA Cocktail");
                window.AppendItemEnd();
                window.AppendNormal("\n\t\t\t=\n");
                window.AppendItemStart(247126, 247127, ql);
                window.AppendIcon(247117);
                window.AppendLineBreak();
                window.AppendNormal("Kyr'Ozch Formatted Viralbot Solution");
                window.AppendItemEnd();
                window.AppendLineBreak();
                window.AppendHighlight("Required Skills:\n");
                window.AppendNormal("- " + (ql * 6) + " Pharma Tech\n\n");
                //Step 7
                window.AppendHighlight("Step 7:\n");
                window.AppendItemStart(247126, 247127, ql);
                window.AppendIcon(247117);
                window.AppendLineBreak();
                window.AppendNormal("Kyr'Ozch Formatted Viralbot Solution");
                window.AppendItemEnd();
                window.AppendNormal("\n\t\t\t+\n");
                window.AppendItemStart(247163, 247163, 1);
                window.AppendIcon(245924);
                window.AppendLineBreak();
                window.AppendNormal("Basic Vest");
                window.AppendItemEnd();
                window.AppendNormal("\n\t\t\t=\n");
                window.AppendItemStart(247172, 247173, ql);
                window.AppendIcon(245924);
                window.AppendLineBreak();
                window.AppendNormal("Formatted Viralbot Vest");
                window.AppendItemEnd();
                window.AppendLineBreak(2);
                //Step 8
                window.AppendHighlight("Step 8:\n");
                window.AppendIcon(100337);
                window.AppendLineBreak();
                switch (armortype)
                {
                case "arithmetic":
                    window.AppendItem("QL " + src_ql + " Arithmetic Lead Viralbots", 247144, 247145, src_ql);
                    break;

                case "supple":
                    window.AppendItem("QL " + src_ql + " Supple Lead Viralbots", 247140, 247141, src_ql);
                    break;

                case "enduring":
                    window.AppendItem("QL " + src_ql + " Enduring Lead Viralbots", 247136, 247137, src_ql);
                    break;

                case "observant":
                    window.AppendItem("QL " + src_ql + " Observant Lead Viralbots", 247142, 247143, src_ql);
                    break;

                case "strong":
                    window.AppendItem("QL " + src_ql + " Strong Lead Viralbots", 247138, 247139, src_ql);
                    break;

                case "spiritual":
                    window.AppendItem("QL " + src_ql + " Spiritual Lead Viralbots", 247146, 247147, src_ql);
                    break;
                }
                window.AppendNormal(" (Rare drop off Alien City Generals)");
                window.AppendNormal("\n\t\t\t+\n");
                window.AppendItemStart(247172, 247173, ql);
                window.AppendIcon(245924);
                window.AppendLineBreak();
                window.AppendNormal("Formatted Viralbot Vest");
                window.AppendItemEnd();
                window.AppendNormal("\n\t\t\t=\n");
                switch (armortype)
                {
                case "arithmetic":
                    window.AppendItemStart(arithmetic.LowID, arithmetic.HighID, ql);
                    window.AppendIcon(Convert.ToInt32(arithmetic.Raw));
                    window.AppendLineBreak();
                    window.AppendString(arithmetic.Name + " Body Armor");
                    window.AppendItemEnd();
                    window.AppendLineBreak();
                    break;

                case "supple":
                    window.AppendItemStart(supple.LowID, supple.HighID, ql);
                    window.AppendIcon(Convert.ToInt32(supple.Raw));
                    window.AppendLineBreak();
                    window.AppendString(supple.Name + " Body Armor");
                    window.AppendItemEnd();
                    window.AppendLineBreak();
                    break;

                case "enduring":
                    window.AppendItemStart(enduring.LowID, enduring.HighID, ql);
                    window.AppendIcon(Convert.ToInt32(enduring.Raw));
                    window.AppendLineBreak();
                    window.AppendString(enduring.Name + " Body Armor");
                    window.AppendItemEnd();
                    window.AppendLineBreak();
                    break;

                case "observant":
                    window.AppendItemStart(observant.LowID, observant.HighID, ql);
                    window.AppendIcon(Convert.ToInt32(observant.Raw));
                    window.AppendLineBreak();
                    window.AppendString(observant.Name + " Body Armor");
                    window.AppendItemEnd();
                    window.AppendLineBreak();
                    break;

                case "strong":
                    window.AppendItemStart(strong.LowID, strong.HighID, ql);
                    window.AppendIcon(Convert.ToInt32(strong.Raw));
                    window.AppendLineBreak();
                    window.AppendString(strong.Name + " Body Armor");
                    window.AppendItemEnd();
                    window.AppendLineBreak();
                    break;

                case "spiritual":
                    window.AppendItemStart(spiritual.LowID, spiritual.HighID, ql);
                    window.AppendIcon(Convert.ToInt32(spiritual.Raw));
                    window.AppendLineBreak();
                    window.AppendString(spiritual.Name + " Body Armor");
                    window.AppendItemEnd();
                    window.AppendLineBreak();
                    break;
                }
                window.AppendHighlight("Required Skills:\n");
                window.AppendNormal("- " + (ql * 6) + " Psychology\n\n");

                bot.SendReply(e, "Building process for " + armortype + " »» ", window);
            }
        }