Example #1
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Player.SendMessage(p, "You"); return;
            }
            if (p == null)
            {
                Player.SendMessage(p, "This command can only be used in-game!"); return;
            }

            if (p.muted)
            {
                Player.SendMessage(p, "You are currently muted and cannot use this command."); return;
            }
            if (Server.chatmod && !p.voice)
            {
                Player.SendMessage(p, "Chat moderation is on, you cannot emote."); return;
            }

            if (Server.worldChat)
            {
                Player.GlobalChat(p, p.color + "*" + p.name + " " + message, false);
            }
            else
            {
                Player.GlobalChatLevel(p, p.color + "*" + p.name + " " + message, false);
            }
            //IRCBot.Say("*" + p.name + " " + message);
            Server.IRC.Say("*" + p.name + " " + message);
        }
Example #2
0
        public override void Use(Player p, string message)
        {
            if (p.cmdTimer == true)
            {
                Player.SendMessage(p, "Can only have one timer at a time. Use /abort to cancel your previous timer."); return;
            }

            System.Timers.Timer messageTimer = new System.Timers.Timer(5000);
            if (message == "")
            {
                Help(p); return;
            }

            int TotalTime = 0;

            try
            {
                TotalTime = int.Parse(message.Split(' ')[0]);
                message   = message.Substring(message.IndexOf(' ') + 1);
            }
            catch
            {
                TotalTime = 60;
            }

            if (TotalTime > 300)
            {
                Player.SendMessage(p, "Cannot have more than 5 minutes in a timer"); return;
            }

            Player.GlobalChatLevel(p, Server.DefaultColor + "Timer lasting for " + TotalTime + " seconds has started.", false);
            TotalTime = (int)(TotalTime / 5);

            Player.GlobalChatLevel(p, Server.DefaultColor + message, false);

            p.cmdTimer            = true;
            messageTimer.Elapsed += delegate
            {
                TotalTime--;
                if (TotalTime < 1 || p.cmdTimer == false)
                {
                    Player.SendMessage(p, "Timer ended.");
                    messageTimer.Stop();
                }
                else
                {
                    Player.GlobalChatLevel(p, Server.DefaultColor + message, false);
                    Player.GlobalChatLevel(p, "Timer has " + (TotalTime * 5) + " seconds remaining.", false);
                }
            };

            messageTimer.Start();
        }
Example #3
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }

            try
            {
                if (message.Split(' ').Length == 1)
                {
                    PlayerBot pB = PlayerBot.Find(message);
                    try { pB.Waypoints.Clear(); }
                    catch { }
                    pB.kill   = false;
                    pB.hunt   = false;
                    pB.AIName = "";
                    Player.SendMessage(p, pB.color + pB.name + Server.DefaultColor + "'s AI was turned off.");
                    Server.s.Log(pB.name + "'s AI was turned off.");
                    return;
                }
                else if (message.Split(' ').Length != 2)
                {
                    Help(p); return;
                }

                PlayerBot Pb = PlayerBot.Find(message.Split(' ')[0]);
                if (Pb == null)
                {
                    Player.SendMessage(p, "Could not find specified Bot"); return;
                }
                string foundPath = message.Split(' ')[1].ToLower();

                if (foundPath == "hunt")
                {
                    Pb.hunt = !Pb.hunt;
                    try { Pb.Waypoints.Clear(); }
                    catch { }
                    Pb.AIName = "";
                    if (p != null)
                    {
                        Player.GlobalChatLevel(p, Pb.color + Pb.name + Server.DefaultColor + "'s hunt instinct: " + Pb.hunt, false);
                    }
                    Server.s.Log(Pb.name + "'s hunt instinct: " + Pb.hunt);
                    return;
                }
                else if (foundPath == "kill")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this))
                    {
                        Player.SendMessage(p, "Only a " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ may toggle killer instinct."); return;
                    }
                    Pb.kill = !Pb.kill;
                    if (p != null)
                    {
                        Player.GlobalChatLevel(p, Pb.color + Pb.name + Server.DefaultColor + "'s kill instinct: " + Pb.kill, false);
                    }
                    Server.s.Log(Pb.name + "'s kill instinct: " + Pb.kill);
                    return;
                }

                if (!File.Exists("bots/" + foundPath))
                {
                    Player.SendMessage(p, "Could not find specified AI."); return;
                }

                string[] foundWay = File.ReadAllLines("bots/" + foundPath);

                if (foundWay[0] != "#Version 2")
                {
                    Player.SendMessage(p, "Invalid file version. Remake"); return;
                }

                PlayerBot.Pos newPos = new PlayerBot.Pos();
                try { Pb.Waypoints.Clear(); Pb.currentPoint = 0; Pb.countdown = 0; Pb.movementSpeed = 12; }
                catch { }

                try
                {
                    foreach (string s in foundWay)
                    {
                        if (s != "" && s[0] != '#')
                        {
                            bool skip = false;
                            newPos.type = s.Split(' ')[0];
                            switch (s.Split(' ')[0].ToLower())
                            {
                            case "walk":
                            case "teleport":
                                newPos.x    = Convert.ToUInt16(s.Split(' ')[1]);
                                newPos.y    = Convert.ToUInt16(s.Split(' ')[2]);
                                newPos.z    = Convert.ToUInt16(s.Split(' ')[3]);
                                newPos.rotx = Convert.ToByte(s.Split(' ')[4]);
                                newPos.roty = Convert.ToByte(s.Split(' ')[5]);
                                break;

                            case "wait":
                            case "speed":
                                newPos.seconds = Convert.ToInt16(s.Split(' ')[1]); break;

                            case "nod":
                            case "spin":
                                newPos.seconds  = Convert.ToInt16(s.Split(' ')[1]);
                                newPos.rotspeed = Convert.ToInt16(s.Split(' ')[2]);
                                break;

                            case "linkscript":
                                newPos.newscript = s.Split(' ')[1]; break;

                            case "reset":
                            case "jump":
                            case "remove": break;

                            default: skip = true; break;
                            }
                            if (!skip)
                            {
                                Pb.Waypoints.Add(newPos);
                            }
                        }
                    }
                }
                catch { Player.SendMessage(p, "AI file corrupt."); return; }

                Pb.AIName = foundPath;
                if (p != null)
                {
                    Player.GlobalChatLevel(p, Pb.color + Pb.name + Server.DefaultColor + "'s AI is now set to " + foundPath, false);
                }
                Server.s.Log(Pb.name + "'s AI was set to " + foundPath);
            }
            catch { Player.SendMessage(p, "Error"); return; }
        }