Esempio n. 1
0
        bool ParseCommand(Player p, string message)
        {
            Command cmd = Command.all.Find(message);

            if (cmd == null)
            {
                return(false);
            }
            cmd.Help(p);
            LevelPermission minPerm = GrpCommands.allowedCommands.Find(C => C.commandName == cmd.name).lowestRank;

            Player.SendMessage(p, "Rank needed: " + GetColoredRank(minPerm));
            PrintAliases(p, cmd);

            CommandPerm[] perms = cmd.AdditionalPerms;
            if (perms == null)
            {
                return(true);
            }

            Player.SendMessage(p, "%TAdditional permissions:");
            for (int i = 0; i < perms.Length; i++)
            {
                var             addition = CommandOtherPerms.Find(cmd, i + 1);
                LevelPermission perm     = (LevelPermission)addition.Permission;
                Player.SendMessage(p, GetColoredRank(perm) + " %S- " + addition.Description);
            }
            return(true);
        }
Esempio n. 2
0
 public override void Help(Player p)
 {
     p.SendMessage("/cd - Command shortcut.");
     p.SendMessage("/countdown join - join the game");
     p.SendMessage("/countdown leave - leave the game");
     p.SendMessage("/countdown goto - goto the countdown map");
     p.SendMessage("/countdown players - view players currently playing");
     {
         if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1))
         {
             p.SendMessage("/countdown rules <send> <all/map/player> - the rules of countdown. with send: all to send to all, map to send to map and have a players name to send to a player");
         }
         else
         {
             p.SendMessage("/countdown rules - view the rules of countdown");
         }
         if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
         {
             p.SendMessage("/countdown download - download the countdown map");
             p.SendMessage("/countdown enable - enable the game");
             p.SendMessage("/countdown disable - disable the game");
             p.SendMessage("/countdown cancel - cancels a game");
             p.SendMessage("/countdown start [speed] [mode] - start the game, speeds are 'slow', 'normal', 'fast', 'extreme' and 'ultimate', modes are 'normal' and 'freeze'");
             p.SendMessage("/countdown reset [all/map] - reset the whole game (all) or only the map (map)");
             p.SendMessage("/countdown tutorial - a tutorial on how to setup countdown");
         }
     }
 }
Esempio n. 3
0
        public static void Append(Player p, string ai, string action, string[] args)
        {
            using (StreamWriter w = new StreamWriter("bots/" + ai, true)) {
                if (action == "")
                {
                    action = "walk";
                }
                if (action.CaselessEq("tp"))
                {
                    action = "teleport";
                }

                BotInstruction ins = BotInstruction.Find(action);
                if (ins == null)
                {
                    Player.Message(p, "Could not find instruction \"" + action + "\""); return;
                }

                var             perms    = CommandOtherPerms.Find("botset");
                LevelPermission killPerm = (LevelPermission)perms.Permission;
                if (ins.Name.CaselessEq("kill") && p.Rank < killPerm)
                {
                    Formatter.MessageNeedMinPerm(p, "toggle a bot's killer instinct.", killPerm);
                    return;
                }
                ins.Output(p, args, w);
            }
        }
        public override void Use(Player p, string message)
        {
            List <string> rules = new List <string>();

            if (!File.Exists("text/rules.txt"))
            {
                File.WriteAllText("text/rules.txt", "No rules entered yet!");
            }
            using (StreamReader r = File.OpenText("text/rules.txt"))
            {
                while (!r.EndOfStream)
                {
                    rules.Add(r.ReadLine());
                }
            }

            Player who = null;

            if (message != "")
            {
                if (p != null || (int)p.group.Permission < CommandOtherPerms.GetPerm(this))
                {
                    Player.SendMessage(p, "You cant send /rules to another player!");
                    return;
                }
                who = Player.Find(message);
            }
            else
            {
                who = p;
            }

            if (who != null)
            {
                who.hasreadrules = true;
                if (who.level == Server.mainLevel && Server.mainLevel.permissionbuild == LevelPermission.Guest)
                {
                    who.SendMessage("You are currently on the guest map where anyone can build");
                }
                who.SendMessage("Server Rules:");
                foreach (string s in rules)
                {
                    who.SendMessage(s);
                }
            }
            else if (p == null && String.IsNullOrEmpty(message))
            {
                Player.SendMessage(null, "Server Rules:");
                foreach (string s in rules)
                {
                    Player.SendMessage(null, s);
                }
            }
            else
            {
                Player.SendMessage(p, "There is no player \"" + message + "\"!");
            }
        }
Esempio n. 5
0
        public override void Use(Player p, string message)
        {
            string[] args = message.Split(' ');
            if (message == "" || args.Length == 1)
            {
                Help(p); return;
            }
            Command cmd = Command.all.Find(args[0]);

            if (cmd == null)
            {
                Player.SendMessage(p, "Could not find command entered"); return;
            }
            if (p != null && !p.group.CanExecute(cmd))
            {
                Player.SendMessage(p, "Your rank cannot use this command."); return;
            }

            LevelPermission perm = Level.PermissionFromName(args[1]);

            if (perm == LevelPermission.Null)
            {
                Player.SendMessage(p, "Could not find rank specified"); return;
            }
            if (p != null && perm > p.group.Permission)
            {
                Player.SendMessage(p, "Cannot set permissions to a rank higher than yours."); return;
            }

            int    otherPermIndex = 0;
            string permName       = "permission";

            if (args.Length == 2)
            {
                GrpCommands.allowedCommands.Find(rA => rA.commandName == cmd.name).lowestRank = perm;
                GrpCommands.Save(GrpCommands.allowedCommands);
                GrpCommands.fillRanks();
            }
            else if (!int.TryParse(args[2], out otherPermIndex))
            {
                Player.SendMessage(p, "\"" + args[2] + "\" is not an integer.");
            }
            else
            {
                CommandOtherPerms.OtherPerms perms = CommandOtherPerms.Find(cmd, otherPermIndex);
                if (perms == null)
                {
                    Player.SendMessage(p, "This command has no additional permission with that number."); return;
                }
                perms.Permission = (int)perm;
                CommandOtherPerms.Save();
                permName = "additional permission " + otherPermIndex;
            }
            Player.GlobalMessage("&d" + cmd.name + "%S's " + permName + " was set to " + Level.PermissionToName(perm));
            Player.SendMessage(p, cmd.name + "'s " + permName + " was set to " + Level.PermissionToName(perm));
        }
Esempio n. 6
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/tnt [small/big/nuke] - Creates exploding TNT (with Physics 3).");
     Player.SendMessage(p, "Big and Nuke TNT is reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+");
     if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
     {
         Player.SendMessage(p, "/tnt allow - Allows the use of tnt server-wide.");
         Player.SendMessage(p, "/tnt disallow - Disallows the use of tnt server-wide.");
     }
 }
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/report [Player] [Reason] - Reports the specified player for the reason/");
     if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this))
     {
         Player.SendMessage(p, "/report check - Checks the reported list!");
         Player.SendMessage(p, "/report view [Player] - View the report on the specified player");
         Player.SendMessage(p, "/report delete [Player] - Delete the report on the specified player");
     }
 }
Esempio n. 8
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "%f/report [Player] [Reason] " + Server.DefaultColor + "- Reports the specified player for the reason");
     if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this))
     {
         Player.SendMessage(p, "%f/report list " + Server.DefaultColor + "- Checks the reported list!");
         Player.SendMessage(p, "%f/report check [Player] " + Server.DefaultColor + "- View the report on the specified player");
         Player.SendMessage(p, "%f/report delete [Player] " + Server.DefaultColor + "- Delete the report on the specified player");
         Player.SendMessage(p, "%f/report clear " + Server.DefaultColor + "- %c!!!Clears all reports!!!");
     }
 }
Esempio n. 9
0
 public override void Use(Player p, string message)
 {
     string[] args = message.Split(' ');
     if (args[0].ToLower() == p.Username.ToLower())
     {
         if (args.Length == 1)
         {
             p.SetName = p.Username;
             p.save();
             Player.GlobalMessage(p.color + p.Username + Server.DefaultColor + "'s name has been reset.");
             return;
         }
         if (Player.CommandHasBadColourCodes(p, message) || args[1].Contains("'"))
         {
             Player.SendMessage(p, "Invalid color codes in name!");
             return;
         }
         p.SetName = args[1];
         p.save();
         Player.GlobalMessage(p.color + p.Username + Server.DefaultColor + " set his/her name to " + p.color + p.SetName);
     }
     else
     {
         if (p != null)
         {
             if (p.group.Permission < (LevelPermission)CommandOtherPerms.GetPerm(this) && !p.isDev)
             {
                 Player.SendMessage(p, "You must be at least a(n) " + Group.findPermInt(CommandOtherPerms.GetPerm(Command.all.Find("setname"))).color + Group.findPermInt(CommandOtherPerms.GetPerm(Command.all.Find("setname"))).name + " to set other player's names.");
                 return;
             }
         }
         Player who = Player.Find(args[0]);
         if (who == null)
         {
             Player.SendMessage(p, "Specified player not found."); return;
         }
         if (args.Length == 1)
         {
             who.SetName = who.Username;
             who.save();
             Player.GlobalMessage(who.color + who.Username + Server.DefaultColor + "'s name has been reset.");
             return;
         }
         if (Player.HasBadColorCodes(args[1]) || Player.HasBadColorCodesTwo(args[1]))
         {
             Player.SendMessage(p, "Invalid color codes in name!");
             return;
         }
         who.SetName = args[1];
         who.save();
         Player.GlobalMessage(who.color + who.Username + Server.DefaultColor + "'s name was set to " + who.color + who.SetName);
     }
 }
Esempio n. 10
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            message = GetIP(p, message, true);
            if (message == null)
            {
                return;
            }

            IPAddress ip;

            if (!IPAddress.TryParse(message, out ip))
            {
                Player.Message(p, "\"{0}\" is not a valid IP.", message); return;
            }
            if (IPAddress.IsLoopback(ip))
            {
                Player.Message(p, "You cannot IP ban the server."); return;
            }
            if (p != null && p.ip == message)
            {
                Player.Message(p, "You cannot IP ban yourself."); return;
            }
            if (Server.bannedIP.Contains(message))
            {
                Player.Message(p, "{0} is already IP banned.", message); return;
            }
            // Check if IP is shared by any other higher ranked accounts
            if (!CheckIP(p, message))
            {
                return;
            }

            string banner  = p == null ? "(console)" : p.ColoredName;
            string normMsg = String.Format("An IP was &8banned %Sby {0}%S.", banner);
            string opsMsg  = String.Format("{1} was &8IP banned %Sby {0}%S.", banner, message);

            Server.IRC.Say(normMsg, false);
            Server.IRC.Say(opsMsg, true);
            int seeIPperm = CommandOtherPerms.GetPerm(Command.all.Find("whois"));

            Chat.MessageWhere(normMsg, pl => (int)pl.Rank < seeIPperm);
            Chat.MessageWhere(opsMsg, pl => (int)pl.Rank >= seeIPperm);
            Server.s.Log("IP-BANNED: " + message.ToLower() + " by " + banner + ".");

            Server.bannedIP.Add(message);
            Server.bannedIP.Save();
        }
Esempio n. 11
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/eco buy <title/color/rank/map> [title/color/mappreset] [custommapname] - to buy");
     Player.SendMessage(p, "/eco stats [player] - view stats about yourself or [player]");
     Player.SendMessage(p, "/eco info <title/color/rank/map> - view information about buying");
     if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this))
     {
         Player.SendMessage(p, "/eco setup - to setup economy");
         Player.SendMessage(p, "/eco help [buy/stats/info/setup] - get more specific help");
     }
     else
     {
         Player.SendMessage(p, "/eco help [buy/stats/info] - get more specific help");
     }
 }
Esempio n. 12
0
        List <string> FindToPatrol()
        {
            List <string> players = new List <string>();
            int           perm    = CommandOtherPerms.GetPerm(this);

            Player[] online = PlayerInfo.Online.Items;

            foreach (Player p in online)
            {
                if ((int)p.Rank <= perm)
                {
                    players.Add(p.name);
                }
            }
            return(players);
        }
Esempio n. 13
0
        public override void Use(Player p, string message)
        {
            string newsFile = "text/news.txt";

            if (!File.Exists(newsFile) || (File.Exists(newsFile) && File.ReadAllLines(newsFile).Length == -1))
            {
                using (var SW = new StreamWriter(newsFile))
                {
                    SW.WriteLine("News have not been created. Put News in '" + newsFile + "'.");
                }
                return;
            }
            string[] strArray = File.ReadAllLines(newsFile);
            if (message == "")
            {
                foreach (string t in strArray)
                {
                    Player.SendMessage(p, t);
                }
            }
            else
            {
                string[] split = message.Split(' ');
                if (split[0] == "all")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this))
                    {
                        Player.SendMessage(p, "You must be at least " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + " to send this to all players."); return;
                    }
                    for (int k = 0; k < strArray.Length; k++)
                    {
                        Player.GlobalMessage(strArray[k]);
                    }
                    return;
                }
                Player player = Player.Find(split[0]);
                if (player == null)
                {
                    Player.SendMessage(p, "Could not find player \"" + split[0] + "\"!"); return;
                }
                foreach (string t in strArray)
                {
                    Player.SendMessage(player, t);
                }
                Player.SendMessage(p, "The News were successfully sent to " + player.name + ".");
            }
        }
Esempio n. 14
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/warp [name] - warp to that warp");
     Player.SendMessage(p, "/warp list - list all the warps");
     if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1))
     {
         Player.SendMessage(p, "/warp create [name] <player> - create a warp, if a <player> is given, it will be created where they are");
     }
     if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
     {
         Player.SendMessage(p, "/warp delete [name] - delete a warp");
     }
     if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 3))
     {
         Player.SendMessage(p, "/warp move [name] <player> - move a warp, if a <player> is given, it will be created where they are");
     }
 }
Esempio n. 15
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/chatroom - gets a list of all the current rooms");
     Player.SendMessage(p, "/chatroom [room] - gives you details about the room");
     Player.SendMessage(p, "/chatroom join [room] - joins a room");
     Player.SendMessage(p, "/chatroom leave [room] - leaves a room");
     {
         if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1))
         {
             Player.SendMessage(p, "/chatroom create [room] - creates a new room");
         }
         {
             if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 3))
             {
                 Player.SendMessage(p, "/chatroom delete [room] - deletes a room");
             }
             else if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
             {
                 Player.SendMessage(p, "/chatroom delete [room] - deletes a room if all people have left");
             }
         }
         if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 4))
         {
             Player.SendMessage(p, "/chatroom spy [room] - spy on a chatroom");
         }
         if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 5))
         {
             Player.SendMessage(p, "/chatroom forcejoin [player] [room] - forces a player to join a room");
         }
         if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 6))
         {
             Player.SendMessage(p, "/chatroom kick [player] - kicks the player from their current room");
         }
         {
             if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 7))
             {
                 Player.SendMessage(p, "/chatroom globalmessage [message] - sends a global message to all rooms");
             }
             else
             {
                 Player.SendMessage(p, "/chatroom globalmessage [message] - sends a global message to all rooms (limited to 1 every 30 seconds)");
             }
         }
     }
 }
Esempio n. 16
0
        public override void Use(Player p, string message)
        {
            List <string> faq = new List <string>();

            if (!File.Exists("text/faq.txt"))
            {
                File.WriteAllText("text/faq.txt", "Example: What does this server run on? This server runs on &bMCForge");
            }
            using (StreamReader r = File.OpenText("text/faq.txt"))
            {
                while (!r.EndOfStream)
                {
                    faq.Add(r.ReadLine());
                }
            }

            Player who = null;

            if (message != "")
            {
                if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this))
                {
                    Player.SendMessage(p, "You cant send the FAQ to another player!"); return;
                }
                who = Player.Find(message);
            }
            else
            {
                who = p;
            }

            if (who != null)
            {
                who.SendMessage("&cFAQ&f:");
                foreach (string s in faq)
                {
                    who.SendMessage("&f" + s);
                }
            }
            else
            {
                Player.SendMessage(p, "There is no player \"" + message + "\"!");
            }
        }
Esempio n. 17
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            message = CmdBanip.GetIP(p, message, false);
            if (message == null)
            {
                return;
            }

            IPAddress ip;

            if (!IPAddress.TryParse(message, out ip))
            {
                Player.Message(p, "\"{0}\" is not a valid IP.", message); return;
            }
            if (p != null && p.ip == message)
            {
                Player.Message(p, "You cannot un-IP ban yourself."); return;
            }
            if (!Server.bannedIP.Contains(message))
            {
                Player.Message(p, message + " is not a banned IP."); return;
            }

            string unbanner = p == null ? "(console)" : p.ColoredName;
            string normMsg  = String.Format("An IP was &8unbanned %Sby {0}%S.", unbanner);
            string opsMsg   = String.Format("{1} was &8un-IP banned %Sby {0}%S.", unbanner, message);

            Server.IRC.Say(normMsg, false);
            Server.IRC.Say(opsMsg, true);
            int seeIPperm = CommandOtherPerms.GetPerm(Command.all.Find("whois"));

            Chat.MessageWhere(normMsg, pl => (int)pl.Rank < seeIPperm);
            Chat.MessageWhere(opsMsg, pl => (int)pl.Rank >= seeIPperm);
            Server.s.Log("IP-UNBANNED: " + message.ToLower() + " by " + unbanner + ".");

            Server.bannedIP.Remove(message);
            Server.bannedIP.Save();
        }
Esempio n. 18
0
        static void CheckReviewList(Player p)
        {
            Command cmd  = Command.all.Find("review");
            int     perm = CommandOtherPerms.GetPerm(cmd, 1);

            if ((int)p.group.Permission < perm || !p.group.commands.Contains(cmd))
            {
                return;
            }
            int count = Server.reviewlist.Count;

            if (count == 0)
            {
                return;
            }

            string suffix = count == 1 ? " player is " : " players are ";

            p.SendMessage(count + suffix + "waiting for a review. Type %T/review view");
        }
Esempio n. 19
0
        public override void Use(Player p, string message)
        {
            if (!File.Exists("changelog.txt"))
            {
                Player.SendMessage(p, "Unable to find changelog");
                return;
            }

            // Read the changelog but stop reading if it encounters a blank line
            // This is done so that a player will only see the latest changes even if multiple version info exists in the changelog
            // Because of this, its really important that blank lines are ONLY used to separate different versions
            string[] strArray = File.ReadAllLines("changelog.txt").TakeWhile(s => !String.IsNullOrEmpty(s.Trim())).ToArray();
            if (message == "")
            {
                for (int j = 0; j < strArray.Length; j++)
                {
                    Player.SendMessage(p, strArray[j]);
                }
            }
            else
            {
                string[] split = message.Split(' ');
                if (split.Length != 1)
                {
                    Help(p);
                    return;
                }

                if (split[0] == "all")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this))
                    {
                        Player.SendMessage(p, "You must be at least " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + " to send the changelog to all players.");
                        return;
                    }
                    for (int k = 0; k < strArray.Length; k++)
                    {
                        Player.GlobalMessage(strArray[k]);
                    }

                    return;
                }
                else
                {
                    Player player = Player.Find(split[0]);
                    if (player == null)
                    {
                        Player.SendMessage(p, "Could not find player \"" + split[0] + "\"!");
                        return;
                    }

                    Player.SendMessage(player, "Changelog:");

                    for (int l = 0; l < strArray.Length; l++)
                    {
                        Player.SendMessage(player, strArray[l]);
                    }

                    Player.SendMessage(p, "The Changelog was successfully sent to " + player.name + ".");

                    return;
                }
            }
        }
Esempio n. 20
0
 public override void Help(Player p)
 {
     Player.Message(p, "%T/patrol");
     Player.Message(p, "%HTeleports you to a random " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + " or lower");
 }
Esempio n. 21
0
        public override void Use(Player p, string message)
        {
            if (p == null) { Player.SendMessage(p, "This command can only be used in-game"); return; }
            string[] command = message.ToLower().Split(' ');
            string par0 = String.Empty;
            string par1 = String.Empty;
            string par2 = String.Empty;
            try
            {
                par0 = command[0];
                par1 = command[1];
                par2 = command[2];
            }
            catch { }
            if (par0 == "list" || par0 == "view" || par0 == "l" || par0 == "v")
            {
                Player.SendMessage(p, "Warps:");
                foreach (Warp.Wrp wr in Warp.Warps)
                {
                    if (Level.Find(wr.lvlname) != null)
                    {
                        Player.SendMessage(p, wr.name + " : " + wr.lvlname);
                        Thread.Sleep(300); // I feel this is needed so that if there are a lot of warps, they do not immediatly go off the screen!
                    }
                }
                return;
            }

            if (par0 == "create" || par0 == "add" || par0 == "c" || par0 == "a")
            {
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1))
                {
                    if (par1 == null) { Player.SendMessage(p, "You didn't specify a name for the warp!"); return; }
                    if (Warp.WarpExists(par1)) { Player.SendMessage(p, "Warp has already been created!!"); return; }
                    {
                        if (par2 == null) { Warp.AddWarp(par1, p); }
                        else { Warp.AddWarp(par1, Player.Find(par2)); }
                    }
                    {
                        if (Warp.WarpExists(par1))
                        {
                            Player.SendMessage(p, "Warp created!");
                            return;
                        }
                        else
                        {
                            Player.SendMessage(p, "Warp creation failed!!");
                            return;
                        }
                    }
                }
                else { Player.SendMessage(p, "You can't use that because you aren't a" + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; }
            }

            if (par0 == "delete" || par0 == "remove" || par0 == "d" || par0 == "r")
            {
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
                {
                    if (par1 == null) { Player.SendMessage(p, "You didn't specify a warp to delete!"); return; }
                    if (!Warp.WarpExists(par1)) { Player.SendMessage(p, "Warp doesn't exist!!"); return; }
                    {
                        Warp.DeleteWarp(par1);
                    }
                    {
                        if (!Warp.WarpExists(par1))
                        {
                            Player.SendMessage(p, "Warp deleted!");
                            return;
                        }
                        else
                        {
                            Player.SendMessage(p, "Warp deletion failed!!");
                            return;
                        }
                    }
                }
                else { Player.SendMessage(p, "You can't use that because you aren't a" + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; }
            }

            if (par0 == "move" || par0 == "change" || par0 == "edit" || par0 == "m" || par0 == "e")
            {
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 3))
                {
                    if (par1 == null) { Player.SendMessage(p, "You didn't specify a warp to be moved!"); return; }
                    if (!Warp.WarpExists(par1)) { Player.SendMessage(p, "Warp doesn't exist!!"); return; }
                    {
                        if (par2 == null) { Warp.MoveWarp(par1, p); }
                        else { Warp.MoveWarp(par1, Player.Find(par2)); }
                    }
                    {
                        if (Warp.WarpExists(par1))
                        {
                            Player.SendMessage(p, "Warp moved!");
                            return;
                        }
                        else
                        {
                            Player.SendMessage(p, "Warp moving failed!!");
                            return;
                        }
                    }
                }
                else { Player.SendMessage(p, "You can't use that because you aren't a " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); return; }
            }

            else
            {
                if (Warp.WarpExists(par0) == true)
                {
                    Warp.Wrp w = new Warp.Wrp();
                    w = Warp.GetWarp(par0);
                    Level lvl = Level.Find(w.lvlname);
                    if (lvl != null)
                    {
                        if (p.level != lvl)
                        {
                            if (lvl.permissionvisit > p.group.Permission) { Player.SendMessage(p, "Sorry, you aren't a high enough rank to visit the map that that warp is on."); return; }
                            Command.all.Find("goto").Use(p, lvl.name);
                            while (p.Loading) { Thread.Sleep(250); }
                        }
                        unchecked { p.SendPos((byte)-1, w.x, w.y, w.z, w.rotx, w.roty); }
                        return;
                    }
                    else
                    {
                        Player.SendMessage(p, "The level that that warp is on (" + w.lvlname + ") either no longer exists or is currently unloaded");
                        return;
                    }
                }
                else
                {
                    Player.SendMessage(p, "That is not a command addition or a warp");
                    return;
                }
            }
        }
Esempio n. 22
0
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                Help(p);
                return;
            }
            if (p == null)
            {
                Player.SendMessage(p, "Are you stupid? =S You can't use this in the console!");
                return;
            }
            List <string> getpatrol = (from pl in Player.players where (int)[email protected] <= CommandOtherPerms.GetPerm(this) select pl.name).ToList();

            if (getpatrol.Count <= 0)
            {
                Player.SendMessage(p, "There must be at least one guest online to use this command!");
                return;
            }
            Random random = new Random();
            int    index  = random.Next(getpatrol.Count);
            string value  = getpatrol[index];
            Player who    = Player.Find(value);

            Command.all.Find("tp").Use(p, who.name);
            Player.SendMessage(p, "You are now visiting " + who.color + who.name + "!");
        }
Esempio n. 23
0
        public override void Use(Player p, string message)
        {
            Player who = null;

            if (message == "")
            {
                who = p; message = p.name;
            }
            else
            {
                who = Player.Find(message);
            }
            if (who != null && !who.hidden)
            {
                int    number     = who.achievementnumbers.Split(',').Length - 1;
                string storedTime = Convert.ToDateTime(DateTime.Now.Subtract(who.timeLogged).ToString()).ToString("HH:mm:ss");
                if (number >= Server.s.amountofachievements)
                {
                    Player.SendMessage(p, c.gold + "-------------------------------------------");
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.gold + "Name:", who.color + who.name, c.gold + "Rank:", who.group.color + who.group.name));
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.gold + "Logins:", c.teal + who.totalLogins, c.gold + "Time:", c.teal + who.time.Split(' ')[0] + "d" + who.time.Split(' ')[1] + "h" + who.time.Split(' ')[2] + "m"));
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.gold + "Online:", c.teal + storedTime, c.gold + "FirstLogin: "******"yyyy-MM-dd")));
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.gold + "Survived:", c.lime + who.roundssurvived, c.gold + "Infected:", c.red + who.playersinfected));
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.gold + "MaxSurvived: ", c.green + who.maximumsurvived, c.gold + "MaxInfected: ", c.maroon + who.maximuminfected));
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.gold + "Wealth:", c.teal + who.money, c.gold + "Team:", who.teamcolor + who.teamname));
                    bool skip = false;
                    if (p != null)
                    {
                        if ((int)p.group.Permission <= CommandOtherPerms.GetPerm(this))
                        {
                            skip = true;
                        }
                    }
                    if (!skip)
                    {
                        string givenIP;
                        if (Server.bannedIP.Contains(who.ip))
                        {
                            givenIP = "&8" + who.ip + ", which is banned";
                        }
                        else
                        {
                            givenIP = who.ip;
                        }
                        Player.SendMessage(p, c.gold + "IP: " + c.blue + givenIP);

                        /*
                         * if (!Player.IPInPrivateRange(givenIP))
                         * {
                         *  string location = Player.GetIPLocation(givenIP);
                         *  Player.SendMessage(p, c.gold +  "From: " + c.blue + location);
                         * }   */
                    }
                    Player.SendMessage(p, c.gold + "-------------------------------------------");
                }
                else
                {
                    Player.SendMessage(p, c.white + "-------------------------------------------");
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.white + "Name:", who.color + who.name, c.white + "Rank:", who.group.color + who.group.name));
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.white + "Logins:", c.teal + who.totalLogins, c.white + "Time:", c.teal + who.time.Split(' ')[0] + "d" + who.time.Split(' ')[1] + "h" + who.time.Split(' ')[2] + "m"));
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.white + "Online:", c.teal + storedTime, c.white + "FirstLogin: "******"yyyy-MM-dd")));
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.white + "Survived:", c.lime + who.roundssurvived, c.white + "Infected:", c.red + who.playersinfected));
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.white + "MaxSurvived: ", c.green + who.maximumsurvived, c.white + "MaxInfected: ", c.maroon + who.maximuminfected));
                    Player.SendMessage(p, String.Format("{0,-13}{1,-15}{2,-12}{3,-15}", c.white + "Wealth:", c.teal + who.money, c.white + "Team:", who.teamcolor + who.teamname));
                    bool skip = false;
                    if (p != null)
                    {
                        if ((int)p.group.Permission <= CommandOtherPerms.GetPerm(this))
                        {
                            skip = true;
                        }
                    }
                    if (!skip)
                    {
                        string givenIP;
                        if (Server.bannedIP.Contains(who.ip))
                        {
                            givenIP = "&8" + who.ip + ", which is banned";
                        }
                        else
                        {
                            givenIP = who.ip;
                        }
                        Player.SendMessage(p, c.white + "IP: " + c.blue + givenIP);

                        /*
                         * if (!Player.IPInPrivateRange(givenIP))
                         * {
                         *  string location = Player.GetIPLocation(givenIP);
                         *  Player.SendMessage(p, c.white +  "From: " + c.blue + location);
                         * }   */
                    }
                    Player.SendMessage(p, c.white + "-------------------------------------------");
                }
            }
            else
            {
                Player.SendMessage(p, "\"" + message + "\" is offline! Using /whowas instead."); Command.all.Find("whowas").Use(p, message);
            }
        }
Esempio n. 24
0
        public override void Use(Player p, string message)
        {
            if (p == null)
            {
                Server.s.Log("'null' or console tried to use '/chatroom', This command is limited to ingame, sorry!!");
                return;
            }

            string[] command = message.ToLower().Split(' ');
            string   par0    = String.Empty;
            string   par1    = String.Empty;
            string   par2    = String.Empty;
            string   par3    = String.Empty;

            try
            {
                par0 = command[0];
                par1 = command[1];
                par2 = command[2];
                par3 = command[3];
            }
            catch { }

            if (message == null || par0 == null || message.Trim() == "" || par0.Trim() == "")
            {
                if (Server.Chatrooms.Count == 0)
                {
                    Player.SendMessage(p, "There are currently no rooms");
                    return;
                }
                else
                {
                    Player.SendMessage(p, "The current rooms are:");
                    foreach (string room in Server.Chatrooms)
                    {
                        Player.SendMessage(p, room);
                    }
                    return;
                }
            }
            else if (par0 == "join")
            {
                if (Server.Chatrooms.Contains(par1))
                {
                    if (p.spyChatRooms.Contains(par1))
                    {
                        Player.SendMessage(p, "The chat room '" + par1 + "' has been removed from your spying list because you are joining the room.");
                        p.spyChatRooms.Remove(par1);
                    }
                    Player.SendMessage(p, "You've joined the chat room '" + par1 + "'");
                    Player.ChatRoom(p, p.color + p.name + Server.DefaultColor + " has joined your chat room", false, par1);
                    p.Chatroom = par1;
                    return;
                }
                else
                {
                    Player.SendMessage(p, "Sorry, '" + par1 + "' is not a chat room");
                    return;
                }
            }
            else if (par0 == "leave")
            {
                Player.SendMessage(p, "You've left the chat room '" + p.Chatroom + "'");
                Player.ChatRoom(p, p.color + p.name + Server.DefaultColor + " has left the chat room", false, p.Chatroom);
                Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " has left their chat room " + p.Chatroom);
                p.Chatroom = null;
                return;
            }
            else if (par0 == "create" || par0 == "make")
            {
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1))
                {
                    if (Server.Chatrooms.Contains(par1))
                    {
                        Player.SendMessage(p, "Sorry, '" + par1 + "' already exists");
                        return;
                    }
                    else
                    {
                        Server.Chatrooms.Add(par1);
                        Player.GlobalMessage("The chat room '" + par1 + "' has been created");
                        return;
                    }
                }
                else
                {
                    Player.SendMessage(p, "Sorry, You aren't a high enough rank to do that");
                    return;
                }
            }
            else if (par0 == "delete" || par0 == "remove")
            {
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 3))
                {
                    if (Server.Chatrooms.Contains(par1))
                    {
                        Player.GlobalMessage(par1 + " is being deleted");
                        if (p.Chatroom == par1)
                        {
                            Command.all.Find("chatroom").Use(p, "leave");
                        }
                        Server.Chatrooms.Remove(par1);
                        foreach (Player pl in Player.players)
                        {
                            if (pl.Chatroom == par1)
                            {
                                pl.Chatroom = null;
                                Player.SendMessage(pl, "You've left the room '" + par1 + "' because it is being deleted");
                            }
                            if (pl.spyChatRooms.Contains(par1))
                            {
                                pl.spyChatRooms.Remove(par1);
                                pl.SendMessage("Stopped spying on chat room '" + par1 + "' because it is being deleted by: " + p.color + p.name);
                            }
                        }
                        Player.GlobalMessage("The chatroom '" + par1 + "' has been " + (par0 + "d"));
                        Player.SendMessage(p, (par0 + "d ") + " room '" + par1 + "'");
                        return;
                    }
                    else
                    {
                        Player.SendMessage(p, "Sorry, '" + par1 + "' doesn't exist");
                        return;
                    }
                }
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
                {
                    if (Server.Chatrooms.Contains(par1))
                    {
                        foreach (Player pl in Player.players)
                        {
                            if (pl != p)
                            {
                                if (pl.Chatroom == par1)
                                {
                                    Player.SendMessage(p, "Sorry, someone else is in the room");
                                    return;
                                }
                            }
                        }
                        if (p.Chatroom == par1)
                        {
                            Command.all.Find("chatroom").Use(p, "leave");
                        }
                        Server.Chatrooms.Remove(par1);
                        foreach (Player pl in Player.players)
                        {
                            if (pl.spyChatRooms.Contains(par1))
                            {
                                pl.spyChatRooms.Remove(par1);
                                pl.SendMessage("Stopped spying on chat room '" + par1 + "' because it is being deleted by: " + p.color + p.name);
                            }
                        }
                        Player.SendMessage(p, (par0 + "d ") + " room '" + par1 + "'");
                    }
                    else
                    {
                        Player.SendMessage(p, "Sorry, '" + par1 + "' doesn't exist");
                        return;
                    }
                }
                else
                {
                    Player.SendMessage(p, "Sorry, You aren't a high enough rank to do that");
                    return;
                }
            }
            else if (par0 == "spy")
            {
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 4))
                {
                    if (Server.Chatrooms.Contains(par1))
                    {
                        if (p.Chatroom != par1)
                        {
                            if (p.spyChatRooms.Contains(par1))
                            {
                                Player.SendMessage(p, "'" + par1 + "' is already on your spying list!!");
                                return;
                            }
                            else
                            {
                                p.spyChatRooms.Add(par1);
                                Player.SendMessage(p, "'" + par1 + "' has been added to your chat room spying list");
                                return;
                            }
                        }
                        else
                        {
                            Player.SendMessage(p, "Sorry, you can't spy on your own room");
                            return;
                        }
                    }
                    else
                    {
                        Player.SendMessage(p, "Sorry, '" + par1 + "' isn't a room");
                        return;
                    }
                }
                else
                {
                    Player.SendMessage(p, "Sorry, '" + par0 + "' Wasn't a correct command addition and it wasn't a room. Sorry");
                    return;
                }
            }
            else if (par0 == "forcejoin") //[player] [room]
            {
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 5))
                {
                    Player pl = Player.Find(par1);
                    if (pl == null)
                    {
                        Player.SendMessage(p, "Sorry, '" + par1 + "' isn't a player");
                        return;
                    }
                    if (!Server.Chatrooms.Contains(par2))
                    {
                        Player.SendMessage(p, "Sorry, '" + par2 + " isn't a room");
                        return;
                    }
                    if (pl.group.Permission >= p.group.Permission)
                    {
                        Player.SendMessage(p, "Sorry, You can't do that to someone of higher or equal rank");
                        return;
                    }
                    else
                    {
                        if (Server.Chatrooms.Contains(par2))
                        {
                            if (pl.spyChatRooms.Contains(par2))
                            {
                                Player.SendMessage(pl, "The chat room '" + par2 + "' has been removed from your spying list because you are force joining the room '" + par2 + "'");
                                pl.spyChatRooms.Remove(par2);
                            }
                            Player.SendMessage(pl, "You've been forced to join the chat room '" + par2 + "'");
                            Player.ChatRoom(pl, pl.color + pl.name + Server.DefaultColor + " has force joined your chat room", false, par2);
                            pl.Chatroom = par2;
                            Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " has been forced to join the chatroom '" + par2 + "' by you");
                            return;
                        }
                    }
                }
                else
                {
                    Player.SendMessage(p, "Sorry, You aren't a high enough rank to do that");
                    return;
                }
            }
            else if (par0 == "kick" || par0 == "forceleave")
            {
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 6))
                {
                    Player pl = Player.Find(par1);
                    if (pl == null)
                    {
                        Player.SendMessage(p, "Sorry, '" + par1 + "' isn't a player");
                        return;
                    }
                    if (pl.group.Permission >= p.group.Permission)
                    {
                        Player.SendMessage(p, "Sorry, You can't do that to someone of higher or equal rank");
                        return;
                    }
                    else
                    {
                        Player.SendMessage(pl, "You've been kicked from the chat room '" + pl.Chatroom + "'");
                        Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " has been kicked from the chat room '" + pl.Chatroom + "'");
                        Player.ChatRoom(pl, pl.color + pl.name + Server.DefaultColor + " has been kicked from your chat room", false, pl.Chatroom);
                        pl.Chatroom = null;
                    }
                }
                else
                {
                    Player.SendMessage(p, "Sorry, You aren't a high enough rank to do that");
                    return;
                }
            }
            else if (par0 == "globalmessage" || par0 == "global" || par0 == "all")
            {
                string globalmessage = message.Replace(par0 + " ", "");
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 7))
                {
                    Player.GlobalChatRoom(p, globalmessage, true);
                    return;
                }
                else
                {
                    if (p.lastchatroomglobal.AddSeconds(30) < DateTime.Now)
                    {
                        Player.GlobalChatRoom(p, globalmessage, true);
                        p.lastchatroomglobal = DateTime.Now;
                        return;
                    }
                    else
                    {
                        Player.SendMessage(p, "Sorry, You must wait 30 seconds inbetween each global chatroom message!!");
                        return;
                    }
                }
            }
            else if (par0 == "help")
            {
                Help(p);
                return;
            }
            else if (Server.Chatrooms.Contains(par0))
            {
                Player.SendMessage(p, "Players in '" + par0 + "' :");
                foreach (Player pl in Player.players)
                {
                    if (pl.Chatroom == par0)
                    {
                        Player.SendMessage(p, pl.color + pl.name);
                    }
                }
                return;
            }
            else
            {
                Player.SendMessage(p, "Sorry, '" + par0 + "' Wasn't a correct command addition and it wasn't a room. Sorry");
                Help(p);
                return;
            }
        }
Esempio n. 25
0
        public override void Use(Player p, string message)
        {
            try
            {
                if (message == "")
                {
                    Help(p); return;
                }

                if (message.IndexOf(' ') == -1)
                {
                    if (File.Exists("extra/copy/" + message + ".copy"))
                    {
                        Player.SendMessage(p, "File: &f" + message + Server.DefaultColor + " already exists.  Delete first");
                        return;
                    }
                    else
                    {
                        Player.SendMessage(p, "Storing: " + message);
                        File.Create("extra/copy/" + message + ".copy").Dispose();
                        using (StreamWriter sW = File.CreateText("extra/copy/" + message + ".copy"))
                        {
                            sW.WriteLine("Saved by: " + p.name + " at " + DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss "));
                            for (int k = 0; k < p.CopyBuffer.Count; k++)
                            {
                                sW.WriteLine(p.CopyBuffer[k].x + " " + p.CopyBuffer[k].y + " " + p.CopyBuffer[k].z + " " + p.CopyBuffer[k].type);
                            }
                        }
                        using (StreamWriter sW = File.AppendText("extra/copy/index.copydb"))
                        {
                            sW.WriteLine(message + " " + p.name);
                        }
                    }
                }
                else
                {
                    if (message.Split(' ')[0] == "delete")
                    {
                        message = message.Split(' ')[1];
                        list.Clear();
                        foreach (string s in File.ReadAllLines("extra/copy/index.copydb"))
                        {
                            CopyOwner cO = new CopyOwner();
                            cO.file = s.Split(' ')[0];
                            cO.name = s.Split(' ')[1];
                            list.Add(cO);
                        }
                        CopyOwner result = list.Find(
                            delegate(CopyOwner cO) {
                            return(cO.file == message);
                        }
                            );

                        if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this) || result.name == p.name)
                        {
                            if (File.Exists("extra/copy/" + message + ".copy"))
                            {
                                try
                                {
                                    if (File.Exists("extra/copyBackup/" + message + ".copy"))
                                    {
                                        File.Delete("extra/copyBackup/" + message + ".copy");
                                    }
                                    File.Move("extra/copy/" + message + ".copy", "extra/copyBackup/" + message + ".copy");
                                }
                                catch { }
                                Player.SendMessage(p, "File &f" + message + Server.DefaultColor + " has been deleted.");
                                list.Remove(result);
                                File.Create("extra/copy/index.copydb").Dispose();
                                using (StreamWriter sW = File.CreateText("extra/copy/index.copydb"))
                                {
                                    foreach (CopyOwner cO in list)
                                    {
                                        sW.WriteLine(cO.file + " " + cO.name);
                                    }
                                }
                            }
                            else
                            {
                                Player.SendMessage(p, "File does not exist.");
                            }
                        }
                        else
                        {
                            Player.SendMessage(p, "You must be an " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ or file owner to delete a save.");
                            return;
                        }
                    }
                    else
                    {
                        Help(p); return;
                    }
                }
            }
            catch (Exception e) { Server.ErrorLog(e); }
        }
Esempio n. 26
0
        public override void Use(Player p, string message)
        {
            if (p == null)
            {
                Player.SendMessage(p, "This command can not be used in console!");
                return;
            }
            if (message == "")
            {
                Help(p);
                return;
            }
            int length = message.Split(' ').Length;

            try
            {
                switch (message.Split()[0])
                {
                case "list":
                    if (length == 1 && (int)p.group.Permission >= CommandOtherPerms.GetPerm(this))
                    {
                        if (!Directory.Exists("extra/reported"))
                        {
                            Directory.CreateDirectory("extra/reported");
                        }
                        bool       foundone = false;
                        FileInfo[] fi       = new DirectoryInfo("extra/reported").GetFiles("*.txt");
                        Player.SendMessage(p, "The following players have been reported:");
                        foreach (FileInfo file in fi)
                        {
                            foundone = true;
                            var parsed = file.Name.Replace(".txt", "");
                            Player.SendMessage(p, "- %c" + parsed);
                        }
                        if (foundone)
                        {
                            Player.SendMessage(p, "Use %f/report check [Player] " + Server.DefaultColor + "to view report info.");
                            Player.SendMessage(p, "Use %f/report delete [Player] " + Server.DefaultColor + "to delete a report");
                        }
                        else
                        {
                            Player.SendMessage(p, "%cNo reports were found!");
                        }
                    }
                    else
                    {
                        Player.SendMessage(p, "%cYou cannot use 'list' as a report name!");
                    }
                    break;

                case "view":
                case "read":
                case "check":
                    if (message.Split().Length == 2 && (int)p.group.Permission >= CommandOtherPerms.GetPerm(this))
                    {
                        if (!File.Exists("extra/reported/" + message.Split()[1] + ".txt"))
                        {
                            Player.SendMessage(p, "%cThe player you specified has not been reported!");
                            return;
                        }
                        var readtext = File.ReadAllText("extra/reported/" + message.Split()[1] + ".txt");
                        Player.SendMessage(p, readtext);
                    }
                    else
                    {
                        Player.SendMessage(p, "%cYou cannot use 'check' as a report name! ");
                    }
                    break;

                case "delete":
                case "remove":
                    if (message.Split().Length == 2 && (int)p.group.Permission >= CommandOtherPerms.GetPerm(this))
                    {
                        string msg = message.Split()[1];
                        if (!File.Exists("extra/reported/" + msg + ".txt"))
                        {
                            Player.SendMessage(p, "%cThe player you specified has not been reported!");
                            return;
                        }
                        if (!Directory.Exists("extra/reportedbackups"))
                        {
                            Directory.CreateDirectory("extra/reportedbackups");
                        }
                        if (File.Exists("extra/reportedbackups/" + msg + ".txt"))
                        {
                            File.Delete("extra/reportedbackups/" + msg + ".txt");
                        }
                        File.Move("extra/reported/" + msg + ".txt", "extra/reportedbackups/" + msg + ".txt");
                        Player.SendMessage(p, "%a" + msg + "'s report has been deleted.");
                        Player.GlobalMessageOps(p.prefix + p.color + p.name + Server.DefaultColor + " deleted " + msg + "'s report.");
                        Server.s.Log(msg + "'s report has been deleted by " + p.name);
                    }
                    else
                    {
                        Player.SendMessage(p, "%cYou cannot use 'delete' as a report name! ");
                    }
                    break;

                case "clear":
                    if (length == 1 && (int)p.group.Permission >= CommandOtherPerms.GetPerm(this))
                    {
                        if (!Directory.Exists("extra/reported"))
                        {
                            Directory.CreateDirectory("extra/reported");
                        }
                        FileInfo[] fi = new DirectoryInfo("extra/reported").GetFiles("*.txt");
                        foreach (FileInfo file in fi)
                        {
                            if (File.Exists("extra/reportedbackups/" + file.Name))
                            {
                                File.Delete("extra/reportedbackups/" + file.Name);
                            }
                            file.MoveTo("extra/reportedbackups/" + file.Name);
                        }
                        Player.SendMessage(p, "%aYou have cleared all reports!");
                        Player.GlobalMessageOps(p.prefix + p.name + "%c cleared ALL reports!");
                        Server.s.Log(p.name + " cleared ALL reports!");
                    }
                    else
                    {
                        Player.SendMessage(p, "%cYou cannot use 'clear' as a report name! ");
                    }
                    break;

                default:
                    string msg1 = "";
                    string msg2 = "";
                    try
                    {
                        msg1 = message.Substring(0, message.IndexOf(' ')).ToLower();
                        msg2 = message.Substring(message.IndexOf(' ') + 1).ToLower();
                    }
                    catch { return; }
                    if (File.Exists("extra/reported/" + msg1 + ".txt"))
                    {
                        File.WriteAllText("extra/reported/" + msg1 + "(2).txt", msg2 + " - Reported by " + p.name + "." + " DateTime: " + DateTime.Now);
                        Player.SendMessage(p, "%aYour report has been sent, it should be viewed when an operator is online!");
                        break;
                    }
                    if (File.Exists("extra/reported/" + msg1 + "(2).txt"))
                    {
                        Player.SendMessage(p, "%cThe player you've reported has already been reported 2 times! Please wait patiently untill an OP+ has reviewed the reports!");
                        break;
                    }
                    if (!Directory.Exists("extra/reported"))
                    {
                        Directory.CreateDirectory("extra/reported");
                    }
                    File.WriteAllText("extra/reported/" + msg1 + ".txt", msg2 + " - Reported by " + p.name + "." + " DateTime: " + DateTime.Now);
                    Player.SendMessage(p, "%aYour report has been sent, it should be viewed when an operator is online!");
                    Player.GlobalMessageOps(p.prefix + p.name + Server.DefaultColor + " has made a report, view it with %f/report list ");
                    break;
                }
            }
            catch (Exception e) { Server.ErrorLog(e); }
        }
Esempio n. 27
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                message = p.level.name;
            }

            Level foundLevel;

            if (message.IndexOf(' ') == -1)
            {
                foundLevel = Level.Find(message);
                if (foundLevel == null)
                {
                    if (p != null)
                    {
                        foundLevel = p.level;
                    }
                }
                else
                {
                    gettinginfo = true;
                    Player.SendMessage(p, "MOTD: &b" + foundLevel.motd);
                    Player.SendMessage(p, "Finite mode: " + FoundCheck(foundLevel, foundLevel.finite));
                    Player.SendMessage(p, "Random flow: " + FoundCheck(foundLevel, foundLevel.randomFlow));
                    Player.SendMessage(p, "Animal AI: " + FoundCheck(foundLevel, foundLevel.ai));
                    Player.SendMessage(p, "Edge water: " + FoundCheck(foundLevel, foundLevel.edgeWater));
                    Player.SendMessage(p, "Grass growing: " + FoundCheck(foundLevel, foundLevel.GrassGrow));
                    Player.SendMessage(p, "Tree growing: " + FoundCheck(foundLevel, foundLevel.growTrees));
                    Player.SendMessage(p, "Leaf decay: " + FoundCheck(foundLevel, foundLevel.leafDecay));
                    Player.SendMessage(p, "Physics speed: &b" + foundLevel.speedPhysics);
                    Player.SendMessage(p, "Physics overload: &b" + foundLevel.overload);
                    Player.SendMessage(p, "Survival death: " + FoundCheck(foundLevel, foundLevel.Death) + "(Fall: " + foundLevel.fall + ", Drown: " + foundLevel.drown + ")");
                    Player.SendMessage(p, "Killer blocks: " + FoundCheck(foundLevel, foundLevel.Killer));
                    Player.SendMessage(p, "Unload: " + FoundCheck(foundLevel, foundLevel.unload));
                    Player.SendMessage(p, "Load on /goto: " + FoundCheck(foundLevel, foundLevel.loadOnGoto));
                    Player.SendMessage(p, "Auto physics: " + FoundCheck(foundLevel, foundLevel.rp));
                    Player.SendMessage(p, "Instant building: " + FoundCheck(foundLevel, foundLevel.Instant));
                    Player.SendMessage(p, "RP chat: " + FoundCheck(foundLevel, !foundLevel.worldChat));
                    Player.SendMessage(p, "Guns: " + FoundCheck(foundLevel, foundLevel.guns));
                    gettinginfo = false;
                    return;
                }
            }
            else
            {
                foundLevel = Level.Find(message.Split(' ')[0]);

                if (foundLevel == null || message.Split(' ')[0].ToLower() == "ps" || message.Split(' ')[0].ToLower() == "rp")
                {
                    foundLevel = p.level;
                }
                else
                {
                    message = message.Substring(message.IndexOf(' ') + 1);
                }
            }

            if (p != null)
            {
                if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this))
                {
                    Player.SendMessage(p, "Setting map options is reserved to " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+"); return;
                }
            }

            string foundStart;

            if (message.IndexOf(' ') == -1)
            {
                foundStart = message.ToLower();
            }
            else
            {
                foundStart = message.Split(' ')[0].ToLower();
            }

            try
            {
                if (foundLevel == null)
                {
                    Player.SendMessage(p, "derp");
                }
                switch (foundStart)
                {
                case "theme": foundLevel.theme = message.Substring(message.IndexOf(' ') + 1); foundLevel.ChatLevel("Map theme: &b" + foundLevel.theme); break;

                case "finite": foundLevel.finite = !foundLevel.finite; foundLevel.ChatLevel("Finite mode: " + FoundCheck(foundLevel, foundLevel.finite)); if (p == null)
                    {
                        Player.SendMessage(p, "Finite mode: " + FoundCheck(foundLevel, foundLevel.finite, true));
                    }
                    break;

                case "ai": foundLevel.ai = !foundLevel.ai; foundLevel.ChatLevel("Animal AI: " + FoundCheck(foundLevel, foundLevel.ai)); if (p == null)
                    {
                        Player.SendMessage(p, "Animal AI: " + FoundCheck(foundLevel, foundLevel.ai, true));
                    }
                    break;

                case "edge": foundLevel.edgeWater = !foundLevel.edgeWater; foundLevel.ChatLevel("Edge water: " + FoundCheck(foundLevel, foundLevel.edgeWater)); if (p == null)
                    {
                        Player.SendMessage(p, "Edge water: " + FoundCheck(foundLevel, foundLevel.edgeWater, true));
                    }
                    break;

                case "grass": foundLevel.GrassGrow = !foundLevel.GrassGrow; foundLevel.ChatLevel("Growing grass: " + FoundCheck(foundLevel, foundLevel.GrassGrow)); if (p == null)
                    {
                        Player.SendMessage(p, "Growing grass: " + FoundCheck(foundLevel, foundLevel.GrassGrow, true));
                    }
                    break;

                case "ps":
                case "physicspeed":
                    if (int.Parse(message.Split(' ')[1]) < 10)
                    {
                        Player.SendMessage(p, "Cannot go below 10"); return;
                    }
                    foundLevel.speedPhysics = int.Parse(message.Split(' ')[1]);
                    foundLevel.ChatLevel("Physics speed: &b" + foundLevel.speedPhysics);
                    break;

                case "overload":
                    if (int.Parse(message.Split(' ')[1]) < 500)
                    {
                        Player.SendMessage(p, "Cannot go below 500 (default is 1500)"); return;
                    }
                    if (p != null && p.group.Permission < LevelPermission.Admin && int.Parse(message.Split(' ')[1]) > 2500)
                    {
                        Player.SendMessage(p, "Only SuperOPs may set higher than 2500"); return;
                    }
                    foundLevel.overload = int.Parse(message.Split(' ')[1]);
                    foundLevel.ChatLevel("Physics overload: &b" + foundLevel.overload);
                    break;

                case "motd":
                    if (message.Split(' ').Length == 1)
                    {
                        foundLevel.motd = "ignore";
                    }
                    else
                    {
                        foundLevel.motd = message.Substring(message.IndexOf(' ') + 1);
                    }
                    foundLevel.ChatLevel("Map MOTD: &b" + foundLevel.motd);
                    break;

                case "death": foundLevel.Death = !foundLevel.Death; foundLevel.ChatLevel("Survival death: " + FoundCheck(foundLevel, foundLevel.Death)); if (p == null)
                    {
                        Player.SendMessage(p, "Survival death: " + FoundCheck(foundLevel, foundLevel.Death, true));
                    }
                    break;

                case "killer": foundLevel.Killer = !foundLevel.Killer; foundLevel.ChatLevel("Killer blocks: " + FoundCheck(foundLevel, foundLevel.Killer)); if (p == null)
                    {
                        Player.SendMessage(p, "Killer blocks: " + FoundCheck(foundLevel, foundLevel.Killer, true));
                    }
                    break;

                case "fall": foundLevel.fall = int.Parse(message.Split(' ')[1]); foundLevel.ChatLevel("Fall distance: &b" + foundLevel.fall); break;

                case "drown": foundLevel.drown = int.Parse(message.Split(' ')[1]) * 10; foundLevel.ChatLevel("Drown time: &b" + (foundLevel.drown / 10)); break;

                case "unload": foundLevel.unload = !foundLevel.unload; foundLevel.ChatLevel("Auto unload: " + FoundCheck(foundLevel, foundLevel.unload)); if (p == null)
                    {
                        Player.SendMessage(p, "Auto unload: " + FoundCheck(foundLevel, foundLevel.unload, true));
                    }
                    break;

                case "rp":
                case "restartphysics": foundLevel.rp = !foundLevel.rp; foundLevel.ChatLevel("Auto physics: " + FoundCheck(foundLevel, foundLevel.rp)); if (p == null)
                    {
                        Player.SendMessage(p, "Auto physics: " + FoundCheck(foundLevel, foundLevel.rp, true));
                    }
                    break;

                case "instant":
                    if (p != null && p.group.Permission < LevelPermission.Admin)
                    {
                        Player.SendMessage(p, "This is reserved for Super+"); return;
                    }
                    foundLevel.Instant = !foundLevel.Instant; foundLevel.ChatLevel("Instant building: " + FoundCheck(foundLevel, foundLevel.Instant)); if (p == null)
                    {
                        Player.SendMessage(p, "Instant building: " + FoundCheck(foundLevel, foundLevel.Instant, true));
                    }
                    break;

                case "chat":
                    foundLevel.worldChat = !foundLevel.worldChat; foundLevel.ChatLevel("RP chat: " + FoundCheck(foundLevel, !foundLevel.worldChat)); if (p == null)
                    {
                        Player.SendMessage(p, "RP chat: " + FoundCheck(foundLevel, !foundLevel.worldChat, true));
                    }
                    break;

                case "load":
                case "autoload":
                case "loadongoto":
                    foundLevel.loadOnGoto = !foundLevel.loadOnGoto; foundLevel.ChatLevel("Load on /goto: " + FoundCheck(foundLevel, foundLevel.loadOnGoto)); if (p == null)
                    {
                        Player.SendMessage(p, "Load on /goto: " + FoundCheck(foundLevel, foundLevel.loadOnGoto, true));
                    }
                    break;

                case "leaf":
                case "leafdecay":
                    foundLevel.leafDecay = !foundLevel.leafDecay; foundLevel.ChatLevel("Leaf decay: " + FoundCheck(foundLevel, foundLevel.leafDecay)); if (p == null)
                    {
                        Player.SendMessage(p, "Leaf decay: " + FoundCheck(foundLevel, foundLevel.leafDecay, true));
                    }
                    break;

                case "flow":
                case "randomflow":
                    foundLevel.randomFlow = !foundLevel.randomFlow; foundLevel.ChatLevel("Random flow: " + FoundCheck(foundLevel, foundLevel.randomFlow)); if (p == null)
                    {
                        Player.SendMessage(p, "Random flow: " + FoundCheck(foundLevel, foundLevel.randomFlow, true));
                    }
                    break;

                case "tree":
                case "growtrees":
                    foundLevel.growTrees = !foundLevel.growTrees; foundLevel.ChatLevel("Tree growing: " + FoundCheck(foundLevel, foundLevel.growTrees)); if (p == null)
                    {
                        Player.SendMessage(p, "Tree growing: " + FoundCheck(foundLevel, foundLevel.growTrees, true));
                    }
                    break;

                default:
                    Player.SendMessage(p, "Could not find option entered.");
                    return;
                }
                foundLevel.changed = true;
                if (p != null && p.level != foundLevel)
                {
                    Player.SendMessage(p, "/map finished!");
                }
            }
            catch { Player.SendMessage(p, "INVALID INPUT"); }
        }
Esempio n. 28
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            if (p == null)
            {
                Server.s.Log("'null' or console tried to use /countdown. This command is limited to ingame, sorry!!");
                return;
            }

            string[] command = message.ToLower().Split(' ');
            string   par0    = String.Empty;
            string   par1    = String.Empty;
            string   par2    = String.Empty;
            string   par3    = String.Empty;

            try
            {
                par0 = command[0];
                par1 = command[1];
                par2 = command[2];
                par3 = command[3];
            }
            catch { }

            if (par0 == "help")
            {
                Command.all.Find("help").Use(p, "countdown");
                return;
            }

            if (par0 == "goto")
            {
                try
                {
                    Command.all.Find("goto").Use(p, "countdown");
                }
                catch
                {
                    Player.SendMessage(p, "Countdown level not loaded");
                    return;
                }
            }

            else if (par0 == "join")
            {
                switch (CountdownGame.gamestatus)
                {
                case CountdownGameStatus.Disabled:
                    Player.SendMessage(p, "Sorry - Countdown isn't enabled yet");
                    return;

                case CountdownGameStatus.Enabled:
                    if (!CountdownGame.players.Contains(p))
                    {
                        CountdownGame.players.Add(p);
                        Player.SendMessage(p, "You've joined the Countdown game!!");
                        Player.GlobalMessage(p.name + " has joined Countdown!!");
                        if (p.level != CountdownGame.mapon)
                        {
                            Player.SendMessage(p, "You can type '/countdown goto' to goto the countdown map!!");
                        }
                        p.playerofcountdown = true;
                    }
                    else
                    {
                        Player.SendMessage(p, "Sorry, you have already joined!!, to leave please type /countdown leave");
                        return;
                    }
                    break;

                case CountdownGameStatus.AboutToStart:
                    Player.SendMessage(p, "Sorry - The game is about to start");
                    return;;

                case CountdownGameStatus.InProgress:
                    Player.SendMessage(p, "Sorry - The game is already in progress.");
                    return;

                case CountdownGameStatus.Finished:
                    Player.SendMessage(p, "Sorry - The game has finished. Get an op to reset it.");
                    return;
                }
            }

            else if (par0 == "leave")
            {
                if (CountdownGame.players.Contains(p))
                {
                    switch (CountdownGame.gamestatus)
                    {
                    case CountdownGameStatus.Disabled:
                        Player.SendMessage(p, "Sorry - Countdown isn't enabled yet");
                        return;

                    case CountdownGameStatus.Enabled:
                        CountdownGame.players.Remove(p);
                        CountdownGame.playersleftlist.Remove(p);
                        Player.SendMessage(p, "You've left the game.");
                        p.playerofcountdown = false;
                        break;

                    case CountdownGameStatus.AboutToStart:
                        Player.SendMessage(p, "Sorry - The game is about to start");
                        return;;

                    case CountdownGameStatus.InProgress:
                        Player.SendMessage(p, "Sorry - you are in a game that is in progress, please wait till its finished or till you've died.");
                        return;

                    case CountdownGameStatus.Finished:
                        CountdownGame.players.Remove(p);
                        if (CountdownGame.playersleftlist.Contains(p))
                        {
                            CountdownGame.playersleftlist.Remove(p);
                        }
                        p.playerofcountdown = false;
                        Player.SendMessage(p, "You've left the game.");
                        break;
                    }
                }
                else if (!(CountdownGame.playersleftlist.Contains(p)) && CountdownGame.players.Contains(p))
                {
                    CountdownGame.players.Remove(p);
                    Player.SendMessage(p, "You've left the game.");
                }
                else
                {
                    Player.SendMessage(p, "You haven't joined the game yet!!");
                    return;
                }
            }

            else if (par0 == "players")
            {
                switch (CountdownGame.gamestatus)
                {
                case CountdownGameStatus.Disabled:
                    Player.SendMessage(p, "The game has not been enabled yet.");
                    return;

                case CountdownGameStatus.Enabled:
                    Player.SendMessage(p, "Players who have joined:");
                    foreach (Player plya in CountdownGame.players)
                    {
                        Player.SendMessage(p, plya.color + plya.name);
                    }
                    break;

                case CountdownGameStatus.AboutToStart:
                    Player.SendMessage(p, "Players who are about to play:");
                    foreach (Player plya in CountdownGame.players)
                    {
                        {
                            Player.SendMessage(p, plya.color + plya.name);
                        }
                    }
                    break;

                case CountdownGameStatus.InProgress:
                    Player.SendMessage(p, "Players left playing:");
                    foreach (Player plya in CountdownGame.players)
                    {
                        {
                            if (CountdownGame.playersleftlist.Contains(plya))
                            {
                                Player.SendMessage(p, plya.color + plya.name + Server.DefaultColor + " who is &aIN");
                            }
                            else
                            {
                                Player.SendMessage(p, plya.color + plya.name + Server.DefaultColor + " who is &cOUT");
                            }
                        }
                    }
                    break;

                case CountdownGameStatus.Finished:
                    Player.SendMessage(p, "Players who were playing:");
                    foreach (Player plya in CountdownGame.players)
                    {
                        Player.SendMessage(p, plya.color + plya.name);
                    }
                    break;
                }
            }

            else if (par0 == "rules")
            {
                if (String.IsNullOrEmpty(par1))
                {
                    Player.SendMessage(p, "The aim of the game is to stay alive the longest.");
                    Player.SendMessage(p, "Don't fall in the lava!!");
                    Player.SendMessage(p, "Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disappering.");
                    Player.SendMessage(p, "The last person alive will win!!");
                }

                else if (par1 == "send")
                {
                    if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1))
                    {
                        if (par2 == "all")
                        {
                            Player.GlobalMessage("Countdown Rules being sent to everyone by " + p.color + p.name + ":");
                            Player.GlobalMessage("The aim of the game is to stay alive the longest.");
                            Player.GlobalMessage("Don't fall in the lava!!");
                            Player.GlobalMessage("Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disappering.");
                            Player.GlobalMessage("The last person alive will win!!");
                            Player.SendMessage(p, "Countdown rules sent to everyone");
                        }
                        else if (par2 == "map")
                        {
                            Player.GlobalMessageLevel(p.level, "Countdown Rules being sent to " + p.level.name + " by " + p.color + p.name + ":");
                            Player.GlobalMessageLevel(p.level, "The aim of the game is to stay alive the longest.");
                            Player.GlobalMessageLevel(p.level, "Don't fall in the lava!!");
                            Player.GlobalMessageLevel(p.level, "Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disappering.");
                            Player.GlobalMessageLevel(p.level, "The last person alive will win!!");
                            Player.SendMessage(p, "Countdown rules sent to: " + p.level.name);
                        }
                    }
                    else if (!String.IsNullOrEmpty(par2))
                    {
                        Player who = Player.Find(par2);
                        if (who == null)
                        {
                            Player.SendMessage(p, "That wasn't an online player.");
                            return;
                        }
                        else if (who == p)
                        {
                            Player.SendMessage(p, "You can't send rules to yourself, use '/countdown rules' to send it to your self!!");
                            return;
                        }
                        else if (p.group.Permission < who.group.Permission)
                        {
                            Player.SendMessage(p, "You can't send rules to someone of a higher rank than yourself!!");
                            return;
                        }
                        else
                        {
                            Player.SendMessage(who, "Countdown rules sent to you by " + p.color + p.name);
                            Player.SendMessage(who, "The aim of the game is to stay alive the longest.");
                            Player.SendMessage(who, "Don't fall in the lava!!");
                            Player.SendMessage(who, "Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disawhowhoering.");
                            Player.SendMessage(who, "The last person alive will win!!");
                            Player.SendMessage(p, "Countdown rules sent to: " + who.color + who.name);
                        }
                    }
                    else
                    {
                        Player.SendMessage(p, par1 + " wasn't a correct parameter.");
                        return;
                    }
                }
            }

            else if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
            {
                if (par0 == "download")
                {
                    try
                    {
                        using (WebClient WEB = new WebClient())
                        {
                            WEB.DownloadFile("http://db.tt/R0x1MFS", "levels/countdown.lvl");
                            Player.SendMessage(p, "Downloaded map, now loading map and sending you to it.");
                        }
                    }
                    catch
                    {
                        Player.SendMessage(p, "Sorry, Downloading Failed. PLease try again later");
                        return;
                    }
                    Command.all.Find("load").Use(p, "countdown");
                    Command.all.Find("goto").Use(p, "countdown");
                    Thread.Sleep(1000);
                    // Sleep for a bit while they load
                    while (p.Loading)
                    {
                        Thread.Sleep(250);
                    }
                    p.level.permissionbuild = LevelPermission.Nobody;
                    p.level.motd            = "Welcome to the Countdown map!!!! -hax";
                    ushort x = System.Convert.ToUInt16(8);
                    ushort y = System.Convert.ToUInt16(23);
                    ushort z = System.Convert.ToUInt16(17);
                    x *= 32; x += 16;
                    y *= 32; y += 32;
                    z *= 32; z += 16;
                    unchecked { p.SendPos((byte)-1, x, y, z, p.rot[0], p.rot[1]); }
                }

                else if (par0 == "enable")
                {
                    if (CountdownGame.gamestatus == CountdownGameStatus.Disabled)
                    {
                        try
                        {
                            Command.all.Find("load").Use(null, "countdown");
                            CountdownGame.mapon      = Level.Find("countdown");
                            CountdownGame.gamestatus = CountdownGameStatus.Enabled;
                            Player.GlobalMessage("Countdown has been enabled!!");
                        }
                        catch
                        {
                            Player.SendMessage(p, "Failed, have you downloaded the map yet??");
                        }
                    }
                    else
                    {
                        Player.SendMessage(p, "A Game is either already enabled or is already progress");
                        return;
                    }
                }

                else if (par0 == "disable")
                {
                    if (CountdownGame.gamestatus == CountdownGameStatus.AboutToStart || CountdownGame.gamestatus == CountdownGameStatus.InProgress)
                    {
                        Player.SendMessage(p, "Sorry, a game is currently in progress - please wait till its finished or use '/countdown cancel' to cancel the game");
                        return;
                    }
                    else if (CountdownGame.gamestatus == CountdownGameStatus.Disabled)
                    {
                        Player.SendMessage(p, "Already disabled!!");
                        return;
                    }
                    else
                    {
                        foreach (Player pl in CountdownGame.players)
                        {
                            Player.SendMessage(pl, "The countdown game was disabled.");
                        }
                        CountdownGame.gamestatus  = CountdownGameStatus.Disabled;
                        CountdownGame.playersleft = 0;
                        CountdownGame.playersleftlist.Clear();
                        CountdownGame.players.Clear();
                        CountdownGame.squaresleft.Clear();
                        CountdownGame.Reset(p, true);
                        Player.SendMessage(p, "Countdown Disabled");
                        return;
                    }
                }

                else if (par0 == "cancel")
                {
                    if (CountdownGame.gamestatus == CountdownGameStatus.AboutToStart || CountdownGame.gamestatus == CountdownGameStatus.InProgress)
                    {
                        CountdownGame.cancel = true;
                        Thread.Sleep(1500);
                        Player.SendMessage(p, "Countdown has been canceled");
                        CountdownGame.gamestatus = CountdownGameStatus.Enabled;
                        return;
                    }
                    else
                    {
                        if (CountdownGame.gamestatus == CountdownGameStatus.Disabled)
                        {
                            Player.SendMessage(p, "The game is disabled!!");
                            return;
                        }
                        else
                        {
                            foreach (Player pl in CountdownGame.players)
                            {
                                Player.SendMessage(pl, "The countdown game was canceled");
                            }
                            CountdownGame.gamestatus  = CountdownGameStatus.Enabled;
                            CountdownGame.playersleft = 0;
                            CountdownGame.playersleftlist.Clear();
                            CountdownGame.players.Clear();
                            CountdownGame.squaresleft.Clear();
                            CountdownGame.Reset(null, true);
                            return;
                        }
                    }
                }

                else if (par0 == "start" || par0 == "play")
                {
                    if (CountdownGame.gamestatus == CountdownGameStatus.Enabled)
                    {
                        if (CountdownGame.players.Count >= 2)
                        {
                            CountdownGame.playersleftlist = CountdownGame.players;
                            CountdownGame.playersleft     = CountdownGame.players.Count;
                            switch (par1)
                            {
                            case "slow":
                                CountdownGame.speed     = 800;
                                CountdownGame.speedtype = "slow";
                                break;

                            case "normal":
                                CountdownGame.speed     = 650;
                                CountdownGame.speedtype = "normal";
                                break;

                            case "fast":
                                CountdownGame.speed     = 500;
                                CountdownGame.speedtype = "fast";
                                break;

                            case "extreme":
                                CountdownGame.speed     = 300;
                                CountdownGame.speedtype = "extreme";
                                break;

                            case "ultimate":
                                CountdownGame.speed     = 150;
                                CountdownGame.speedtype = "ultimate";
                                break;

                            default:
                                p.SendMessage("You didn't specify a speed, resorting to 'normal'");
                                goto case "normal";     //More efficient
                            }
                            if (par2 == null || par2.Trim() == "")
                            {
                                CountdownGame.freezemode = false;
                            }
                            else
                            {
                                if (par2 == "freeze" || par2 == "frozen")
                                {
                                    CountdownGame.freezemode = true;
                                }
                                else
                                {
                                    CountdownGame.freezemode = false;
                                }
                            }
                            CountdownGame.GameStart(p);
                        }
                        else
                        {
                            Player.SendMessage(p, "Sorry, there aren't enough players to play.");
                            return;
                        }
                    }
                    else
                    {
                        Player.SendMessage(p, "Either a game is already in progress or it hasn't been enabled");
                        return;
                    }
                }

                else if (par0 == "reset")
                {
                    switch (CountdownGame.gamestatus)
                    {
                    case CountdownGameStatus.Disabled:
                        Player.SendMessage(p, "Please enable countdown first.");
                        return;

                    case CountdownGameStatus.AboutToStart:
                        Player.SendMessage(p, "Sorry - The game is about to start");
                        return;

                    case CountdownGameStatus.InProgress:
                        Player.SendMessage(p, "Sorry - The game is already in progress.");
                        return;

                    default:
                        Player.SendMessage(p, "Reseting");
                        if (par1 == "map")
                        {
                            CountdownGame.Reset(p, false);
                        }
                        else if (par1 == "all")
                        {
                            CountdownGame.Reset(p, true);
                        }
                        else
                        {
                            Player.SendMessage(p, "Please specify whether it is 'map' or 'all'");
                            return;
                        }
                        break;
                    }
                }

                else if (par0 == "tutorial")
                {
                    p.SendMessage("First, download the map using /countdown download");
                    p.SendMessage("Next, type /countdown enable to enable the game mode");
                    p.SendMessage("Next, type /countdown join to join the game and tell other players to join aswell");
                    p.SendMessage("When some people have joined, type /countdown start [speed] to start it");
                    p.SendMessage("[speed] can be 'ultimate', 'extreme', 'fast', 'normal' or 'slow'");
                    p.SendMessage("When you are done, type /countdown reset [map/all]");
                    p.SendMessage("use map to reset only the map and all to reset everything.");
                    return;
                }
            }
            else
            {
                p.SendMessage("Sorry, you aren't a high enough rank or that wasn't a correct command addition.");
                return;
            }
        }
Esempio n. 29
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                message = p.name;
            }
            Level lvl;

            string[] text = new string[2];
            text[0] = "";
            text[1] = "";
            try
            {
                text[0] = message.Split(' ')[0].ToLower();
                text[1] = message.Split(' ')[1].ToLower();
            }
            catch { }
            {
                if (p != null && p.level != null)
                {
                    lvl = p.level;
                }
                else
                {
                    lvl = Level.Find(text[1]);
                    if (lvl == null)
                    {
                        Player.SendMessage(p, "Level not found!");
                        return;
                    }
                }
            }
            if (text[0].ToLower() == "all")
            {
                if (p != null && (int)p.group.Permission < CommandOtherPerms.GetPerm(this))
                {
                    Player.SendMessage(p, "Reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+"); return;
                }

                foreach (Player who in Player.players.ToArray())
                {
                    if (who.level == lvl)
                    {
                        who.Loading = true;
                        foreach (Player pl in Player.players.ToArray())
                        {
                            if (who.level == pl.level && who != pl)
                            {
                                who.SendDie(pl.id);
                            }
                        }
                        foreach (PlayerBot b in PlayerBot.playerbots.ToArray())
                        {
                            if (who.level == b.level)
                            {
                                who.SendDie(b.id);
                            }
                        }

                        Player.GlobalDie(who, true);
                        who.SendUserMOTD(); who.SendMap();

                        ushort x = (ushort)((0.5 + who.level.spawnx) * 32);
                        ushort y = (ushort)((1 + who.level.spawny) * 32);
                        ushort z = (ushort)((0.5 + who.level.spawnz) * 32);

                        if (!who.hidden)
                        {
                            Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true);
                        }
                        else
                        {
                            unchecked { who.SendPos((byte)-1, x, y, z, who.level.rotx, who.level.roty); }
                        }

                        foreach (Player pl in Player.players.ToArray())
                        {
                            if (pl.level == who.level && who != pl && !pl.hidden)
                            {
                                who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]);
                            }
                        }

                        foreach (PlayerBot b in PlayerBot.playerbots.ToArray())
                        {
                            if (b.level == who.level)
                            {
                                who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
                            }
                        }

                        who.Loading = false;

                        if (p != null && !p.hidden)
                        {
                            who.SendMessage("&bMap reloaded by " + p.name);
                        }
                        if (p != null && p.hidden)
                        {
                            who.SendMessage("&bMap reloaded");
                        }
                        Player.SendMessage(p, "&4Finished reloading for " + who.name);

                        /*
                         * foreach (Player pl in Player.players) if (who.level == pl.level && who != pl) who.SendDie(pl.id);
                         * foreach (PlayerBot b in PlayerBot.playerbots) if (who.level == b.level) who.SendDie(b.id);
                         * Player.GlobalDie(who, true);
                         *
                         * who.SendMap();
                         *
                         * ushort x = (ushort)((0.5 + who.level.spawnx) * 32);
                         * ushort y = (ushort)((1 + who.level.spawny) * 32);
                         * ushort z = (ushort)((0.5 + who.level.spawnz) * 32);
                         *
                         * Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true);
                         *
                         * foreach (Player pl in Player.players)
                         *      if (pl.level == who.level && who != pl && !pl.hidden)
                         *              who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]);
                         *
                         * foreach (PlayerBot b in PlayerBot.playerbots)
                         *      if (b.level == who.level)
                         *              who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
                         *
                         * who.SendMessage("Map reloaded.");
                         */
                    }
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
            else
            {
                Player who = Player.Find(text[0]);
                if (who == null)
                {
                    Player.SendMessage(p, "Could not find player."); return;
                }
                else if (who.group.Permission > p.group.Permission && p != who)
                {
                    Player.SendMessage(p, "Cannot reload the map of someone higher than you."); return;
                }

                who.Loading = true;
                foreach (Player pl in Player.players.ToArray())
                {
                    if (who.level == pl.level && who != pl)
                    {
                        who.SendDie(pl.id);
                    }
                }
                foreach (PlayerBot b in PlayerBot.playerbots.ToArray())
                {
                    if (who.level == b.level)
                    {
                        who.SendDie(b.id);
                    }
                }

                Player.GlobalDie(who, true);
                who.SendUserMOTD(); who.SendMap();

                ushort x = (ushort)((0.5 + who.level.spawnx) * 32);
                ushort y = (ushort)((1 + who.level.spawny) * 32);
                ushort z = (ushort)((0.5 + who.level.spawnz) * 32);

                if (!who.hidden)
                {
                    Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true);
                }
                else
                {
                    unchecked { who.SendPos((byte)-1, x, y, z, who.level.rotx, who.level.roty); }
                }

                foreach (Player pl in Player.players.ToArray())
                {
                    if (pl.level == who.level && who != pl && !pl.hidden)
                    {
                        who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]);
                    }
                }

                foreach (PlayerBot b in PlayerBot.playerbots.ToArray())
                {
                    if (b.level == who.level)
                    {
                        who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
                    }
                }

                who.Loading = false;
                GC.Collect();
                GC.WaitForPendingFinalizers();

                who.SendMessage("&bMap reloaded by " + p.name);
                Player.SendMessage(p, "&4Finished reloading for " + who.name);

                /*
                 * foreach (Player pl in Player.players) if (who.level == pl.level && who != pl) who.SendDie(pl.id);
                 * foreach (PlayerBot b in PlayerBot.playerbots) if (who.level == b.level) who.SendDie(b.id);
                 * Player.GlobalDie(who, true);
                 *
                 * who.SendMap();
                 *
                 * ushort x = (ushort)((0.5 + who.level.spawnx) * 32);
                 * ushort y = (ushort)((1 + who.level.spawny) * 32);
                 * ushort z = (ushort)((0.5 + who.level.spawnz) * 32);
                 *
                 * Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true);
                 *
                 * foreach (Player pl in Player.players)
                 *      if (pl.level == who.level && who != pl && !pl.hidden)
                 *              who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]);
                 *
                 * foreach (PlayerBot b in PlayerBot.playerbots)
                 *      if (b.level == who.level)
                 *              who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
                 *
                 * who.SendMessage("Map reloaded.");
                 */
            }
        }
Esempio n. 30
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/store <filename> - Stores your copied item to the server as <filename>.");
     Player.SendMessage(p, "/store delete <filename> - Deletes saved copy file.  Only " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ and file creator may delete.");
 }