Example #1
0
 /// <summary>
 /// Here we run the command and evaluate the parameters
 /// </summary>
 public override void RunCommand(IrcClient client, ProtoIrcMessage message)
 {
     if (message.Source != "#principia")
     {
         QIRC.SendMessage(client, "This command can only be used in #principia.", message.User, message.Source);
         return;
     }
     if (!File.Exists(Constants.Paths.settings + "principia.txt"))
         File.Create(Constants.Paths.settings + "principia.txt");
     String[] builds = File.ReadAllLines(Constants.Paths.settings + "principia.txt");
     if (builds.Count(s => s.StartsWith("Win64:")) == 1)
         QIRC.SendMessage(client, builds.First(s => s.StartsWith("Win64: ")).Remove(0, "Win64: ".Length), message.User, message.Source, true);
     else
         QIRC.SendMessage(client, "There seems to be no build for Win64!", message.User, message.Source, true);
 }
Example #2
0
        /// <summary>
        /// Here we run the command and evaluate the parameters
        /// </summary>
        public override void RunCommand(IrcClient client, ProtoIrcMessage message)
        {
            if (!message.IsChannelMessage)
                return;

            if (client.Channels[message.Source].Users.Contains("teabot"))
            {
                String[] words = Words.words.Split('\n');
                Boolean noTea = new Random().Next(0, 100) == 1;
                Func<String, Boolean> predicate = s => s.Contains("te") || s.Contains("ti") || s.Contains("ty");
                String[] select = words.Where(s => noTea ? !predicate(s) : predicate(s)).ToArray();
                String word = select[new Random().Next(0, select.Length)];
                QIRC.SendMessage(client, "teabot: " + word, message.User, message.Source, true);
            }
            else
            {
                QIRC.SendMessage(client, "No teabot!", message.User, message.Source);
            }
        }
Example #3
0
        /// <summary>
        /// Here we run the command and evaluate the parameters
        /// </summary>
        public override void RunCommand(IrcClient client, ProtoIrcMessage message)
        {
            String msg = message.Message;
            if (StartsWithParam("add", message.Message))
            {
                String type = StripParam("add", ref msg);
                if (type == "wpn")
                {
                    if (weapons.Contains(msg))
                        QIRC.SendMessage(client, "Weapon already added!", message.User, message.Source);
                    else
                    {
                        weapons.Add(msg);
                        QIRC.SendMessage(client, "Weapon added!", message.User, message.Source);
                    }
                }
                else if (type == "adj")
                {
                    if (adjectives.Contains(msg))
                        QIRC.SendMessage(client, "Adjective already added!", message.User, message.Source);
                    else
                    {
                        adjectives.Add(msg);
                        QIRC.SendMessage(client, "Adjective added!", message.User, message.Source);
                    }
                }
                else
                {
                    QIRC.SendMessage(client, "Invalid type", message.User, message.Source);
                }
                return;
            }
            if (StartsWithParam("remove", message.Message))
            {
                String type = StripParam("remove", ref msg);
                if (type == "wpn")
                {
                    if (!weapons.Contains(msg))
                        QIRC.SendMessage(client, "Weapon doesn't exist!", message.User, message.Source);
                    else
                    {
                        weapons.Remove(msg);
                        QIRC.SendMessage(client, "Weapon removed!", message.User, message.Source);
                    }
                }
                else if (type == "adj")
                {
                    if (!adjectives.Contains(msg))
                        QIRC.SendMessage(client, "Adjective doesn't exist!", message.User, message.Source);
                    else
                    {
                        adjectives.Remove(msg);
                        QIRC.SendMessage(client, "Adjective removed!", message.User, message.Source);
                    }
                }
                else
                {
                    QIRC.SendMessage(client, "Invalid type", message.User, message.Source);
                }
                return;
            }
            if (StartsWithParam("stats", message.Message))
            {
                Int32 weaponsnum = weapons.Count;
                Int32 adjsnum = adjectives.Count;
                Int64 combospossible = (weaponsnum) + (weaponsnum * adjsnum) + (4 * weaponsnum * weaponsnum * adjsnum) + (weaponsnum * adjsnum * adjsnum) + (4 * weaponsnum * weaponsnum * adjsnum * adjsnum);
                QIRC.SendMessage(client, $"Total weapons: {weaponsnum}. Total adjectives: {adjsnum}. Total possible combinations: {combospossible}.", message.User, message.Source);
                return;
            }
            Random r = new Random();
            String name = String.IsNullOrWhiteSpace(message.Message) ? message.User : message.Message;
            String weapon = weapons[r.Next(0, weapons.Count)];
            String adjective = adjectives[r.Next(0, adjectives.Count)];

            Int32 extraweapon = r.Next(0, 20); // roll a d20; if it comes up 1-4, do something silly with an extra weapon entry.
            if (extraweapon == 1) // weapon/weapon hybrid
                weapon += "/" + weapons[r.Next(0, weapons.Count)] + " hybrid";
            if (extraweapon == 2) // weapon with a weapon attachment
            {
                String wpn2 = weapons[r.Next(0, weapons.Count)];
                if (new[] {"a", "e", "i", "o", "u"}.Contains(wpn2.ToLower().Substring(0, 1)) && wpn2.ToLower().Substring(0, 2) != "eu")
                    weapon += " with an ";
                else
                    weapon += " with a ";
                weapon += wpn2 + " attachment";
            }
            if (extraweapon == 3) // weapon-like weapon
            {
                String wpn2 = weapons[r.Next(0, weapons.Count)];
                if (!wpn2.Contains(" "))
                    weapon = wpn2 + "-like " + weapon;
            }
            if (extraweapon == 4) // weapon which strongly/vaguely resembles a weapon
            {
                String wpn2 = weapons[r.Next(0, weapons.Count)];
                if (r.Next(0, 2) == 0) // pick strong/vague resemblance with a coin toss
                {
                    if (new[] {"a", "e", "i", "o", "u"}.Contains(wpn2.ToLower().Substring(0, 1)) && wpn2.ToLower().Substring(0, 2) != "eu")
                        weapon += " which vaguely resembles an " + wpn2;
                    else
                        weapon += " which vaguely resembles a " + wpn2;
                }
                else
                {
                    if (new[] {"a", "e", "i", "o", "u"}.Contains(wpn2.ToLower().Substring(0, 1)) && wpn2.ToLower().Substring(0, 2) != "eu")
                        weapon += " which strongly resembles an " + wpn2;
                    else
                        weapon += " which strongly resembles a " + wpn2;
                }
            }
            if (r.Next(0, 11) == 4) // roll a d10, if it comes up 4, give up on adjectives and return a plain old weapon.
                adjective = ""; // why 4? I don't know, go ask a psychologist. (And I dont know too)
            else
            {
                if (!adjective.EndsWith(">"))
                    adjective += " ";
                else
                    adjective = adjective.Substring(0, adjective.Length - 1);

                if (r.Next(0, 6) == 3) // roll a d5, if it comes up 3, use more adjectives! I do realize that this is actually a d6 because of that 0...
                {
                    String extraadj = adjectives[r.Next(0, adjectives.Count)]; // ...but I don't really care, to be honest.
                    if (!extraadj.EndsWith(">"))
                        extraadj += " ";
                    else
                        extraadj = adjective.Substring(0, adjective.Length - 1);

                    if (adjective.Length > 3) // more stuff. mostly a/an detection.
                    {
                        if (adjective.EndsWith(" a ") && new[] {"a", "e", "i", "o", "u"}.Contains(extraadj.ToLower().Substring(0, 1)) && extraadj.ToLower().Substring(0, 2) != "eu")
                            adjective = adjective.Substring(0, adjective.Length - 1) + "n ";
                    }
                    adjective += extraadj;
                }
            }
            if (adjective.Length > 3) // more stuff. mostly a/an detection.
            {
                if (adjective.EndsWith(" a ") && new[] {"a", "e", "i", "o", "u"}.Contains(weapon.ToLower().Substring(0, 1)) && weapon.ToLower().Substring(0, 2) != "eu")
                    adjective = adjective.Substring(0, adjective.Length - 1) + "n ";
            }
            weapon = adjective + weapon;
            if (new[] {"a", "e", "i", "o", "u"}.Contains(weapon.ToLower().Substring(0, 1)) && weapon.ToLower().Substring(0, 2) != "eu")
                weapon = "an " + weapon;
            else
                weapon = "a " + weapon;
            QIRC.SendAction(client, $"gives {name} {weapon}", message.Source);
        }
Example #4
0
 /// <summary>
 /// Here we run the command and evaluate the parameters
 /// </summary>
 public override void RunCommand(IrcClient client, ProtoIrcMessage message)
 {
     QIRC.SendMessage(client, "Win32 is no longer supported. Please use the x64 build, available through !win64, or get a new bird.", message.User, message.Source, true);
 }