Пример #1
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");
         }
     }
 }
Пример #2
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 = new List <string>();

            foreach (Player pl in Player.players)
            {
                if ((int)pl.group.Permission <= CommandOtherPerms.GetPerm(this))
                {
                    getpatrol.Add(pl.name);
                }
            }
            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 + "!");
        }
Пример #3
0
        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 + "\"!");
            }
        }
Пример #4
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.");
     }
 }
Пример #5
0
 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");
     }
 }
Пример #6
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 (StreamWriter SW = new StreamWriter(newsFile))
                {
                    SW.WriteLine("News have not been created. Put News in '" + newsFile + "'.");
                }
                return;
            }
            string[] strArray = File.ReadAllLines(newsFile);
            if (message == "")
            {
                for (int j = 0; j < strArray.Length; j++)
                {
                    Player.SendMessage(p, strArray[j]);
                }
            }
            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;
                }
                else
                {
                    Player player = Player.Find(split[0]);
                    if (player == null)
                    {
                        Player.SendMessage(p, "Could not find player \"" + split[0] + "\"!"); return;
                    }
                    for (int l = 0; l < strArray.Length; l++)
                    {
                        Player.SendMessage(player, strArray[l]);
                    }
                    Player.SendMessage(p, "The News were successfully sent to " + player.name + ".");
                    return;
                }
            }
        }
Пример #7
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");
     }
 }
Пример #8
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)");
             }
         }
     }
 }
Пример #9
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 + "\"!");
            }
        }
Пример #10
0
        public override void Use(Player p, string message)
        {
            int height;
            int radius;

            if (p != null)
            {
                if (p.level.permissionbuild > p.group.Permission)
                {
                    p.SendMessage("You can not edit this map.");
                    return;
                }
                string[] message2 = message.Split(' ');

                #region cones
                if (message2[0].ToLower() == "cone")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return;
                    }
                    if (message2.Length != 3)
                    {
                        goto Help;
                    }

                    try
                    {
                        height  = Convert.ToUInt16(message2[1].Trim());
                        radius  = Convert.ToUInt16(message2[2].Trim());
                        p.BcVar = new int[2] {
                            height, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeCone);

                    return;
                }
                if (message2[0].ToLower() == "hcone")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return;
                    }
                    if (message2.Length != 3)
                    {
                        goto Help;
                    }

                    try
                    {
                        height  = Convert.ToUInt16(message2[1].Trim());
                        radius  = Convert.ToUInt16(message2[2].Trim());
                        p.BcVar = new int[2] {
                            height, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHCone);

                    return;
                }

                if (message2[0].ToLower() == "icone")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return;
                    }
                    if (message2.Length != 3)
                    {
                        goto Help;
                    }

                    try
                    {
                        height  = Convert.ToUInt16(message2[1].Trim());
                        radius  = Convert.ToUInt16(message2[2].Trim());
                        p.BcVar = new int[2] {
                            height, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeICone);

                    return;
                }
                if (message2[0].ToLower() == "hicone")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return;
                    }
                    if (message2.Length != 3)
                    {
                        goto Help;
                    }

                    try
                    {
                        height  = Convert.ToUInt16(message2[1].Trim());
                        radius  = Convert.ToUInt16(message2[2].Trim());
                        p.BcVar = new int[2] {
                            height, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHICone);

                    return;
                }
                #endregion
                #region pyramids
                if (message2[0].ToLower() == "pyramid")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return;
                    }
                    if (message2.Length != 3)
                    {
                        goto Help;
                    }

                    try
                    {
                        height  = Convert.ToUInt16(message2[1].Trim());
                        radius  = Convert.ToUInt16(message2[2].Trim());
                        p.BcVar = new int[2] {
                            height, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangePyramid);

                    return;
                }
                if (message2[0].ToLower() == "hpyramid")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return;
                    }
                    if (message2.Length != 3)
                    {
                        goto Help;
                    }

                    try
                    {
                        height  = Convert.ToUInt16(message2[1].Trim());
                        radius  = Convert.ToUInt16(message2[2].Trim());
                        p.BcVar = new int[2] {
                            height, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHPyramid);

                    return;
                }
                if (message2[0].ToLower() == "ipyramid")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return;
                    }
                    if (message2.Length != 3)
                    {
                        goto Help;
                    }

                    try
                    {
                        height  = Convert.ToUInt16(message2[1].Trim());
                        radius  = Convert.ToUInt16(message2[2].Trim());
                        p.BcVar = new int[2] {
                            height, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeIPyramid);

                    return;
                }
                if (message2[0].ToLower() == "hipyramid")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return;
                    }
                    if (message2.Length != 3)
                    {
                        goto Help;
                    }

                    try
                    {
                        height  = Convert.ToUInt16(message2[1].Trim());
                        radius  = Convert.ToUInt16(message2[2].Trim());
                        p.BcVar = new int[2] {
                            height, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHIPyramid);

                    return;
                }
                #endregion
                #region spheres
                if (message2[0].ToLower() == "sphere")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 3))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); return;
                    }
                    if (message2.Length != 2)
                    {
                        goto Help;
                    }

                    try
                    {
                        radius  = Convert.ToUInt16(message2[1].Trim());
                        p.BcVar = new int[2] {
                            0, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeSphere);

                    return;
                }
                if (message2[0].ToLower() == "hsphere")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 3))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); return;
                    }
                    if (message2.Length != 2)
                    {
                        goto Help;
                    }

                    try
                    {
                        radius  = Convert.ToUInt16(message2[1].Trim());
                        p.BcVar = new int[2] {
                            0, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHSphere);

                    return;
                }
                #endregion
                #region other
                if (message2[0].ToLower() == "volcano")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 4))
                    {
                        Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 4)).name + "+"); return;
                    }
                    if (message2.Length != 3)
                    {
                        goto Help;
                    }

                    try
                    {
                        height  = Convert.ToUInt16(message2[1].Trim());
                        radius  = Convert.ToUInt16(message2[2].Trim());
                        p.BcVar = new int[2] {
                            height, radius
                        };
                    }
                    catch
                    {
                        goto Help;
                    }

                    p.SendMessage("Place a block");
                    p.ClearBlockchange();
                    p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeValcano);

                    return;
                }
                #endregion

Help:
                Help(p);
                return;
            }
            Player.SendMessage(p, "This command can only be used in-game!");
        }
Пример #11
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"); }
        }
Пример #12
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); }
        }
Пример #13
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.");
 }
Пример #14
0
        public override void Use(Player p, string message)
        {
            try
            {
                if (message == "")
                {
                    Help(p); return;
                }
                bool stealth = false; bool totalBan = false;
                if (message[0] == '#')
                {
                    if (p == null)
                    {
                        message = message.Remove(0, 1).Trim();
                        stealth = true;
                        Server.s.Log("Stealth Ban Attempted by Console");
                    }
                    else
                    {
                        message = message.Remove(0, 1).Trim();
                        stealth = true;
                        Server.s.Log("Stealth Ban Attempted by " + p.name);
                    }
                }
                else if (message[0] == '@')
                {
                    if (p == null)
                    {
                        message = message.Remove(0, 1).Trim();
                        stealth = true;
                        Server.s.Log("Total Ban Attempted by Console");
                    }
                    else
                    {
                        totalBan = true;
                        message  = message.Remove(0, 1).Trim();
                        Server.s.Log("Total Ban Attempted by " + p.name);
                    }
                }
                string reason = "-";
                if (message.Split(' ').Length > 1)
                {
                    reason = message;
                    string newreason  = reason.Remove(0, reason.Split(' ')[0].Length + 1);
                    int    removetrim = newreason.Length + 1;
                    string newmessage = message.Remove(message.Length - removetrim, removetrim);
                    reason  = newreason;
                    message = newmessage;
                }
                if (reason == "-")
                {
                    reason = "&c-";
                }
                reason = reason.Replace(" ", "%20");
                Player who = Player.Find(message);

                if (who == null)
                {
                    if (!Player.ValidName(message))
                    {
                        Player.SendMessage(p, "Invalid name \"" + message + "\".");
                        return;
                    }
                    if (Server.devs.Contains(message.ToLower()))
                    {
                        Player.SendMessage(p, "You can't ban a MCForge Developer!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to ban a MCForge Developer!");
                        }
                        else
                        {
                            Player.GlobalMessage(Server.DefaultColor + "The Console attempted to ban a MCForge Developer!");
                        }
                        return;
                    }
                    Group foundGroup = Group.findPlayerGroup(message);

                    if ((int)foundGroup.Permission >= CommandOtherPerms.GetPerm(this))
                    {
                        Player.SendMessage(p, "You can't ban a " + foundGroup.name + "!");
                        return;
                    }
                    if (foundGroup.Permission == LevelPermission.Banned)
                    {
                        Player.SendMessage(p, message + " is already banned.");
                        return;
                    }
                    if (p != null && foundGroup.Permission >= p.group.Permission)
                    {
                        Player.SendMessage(p, "You cannot ban a person ranked equal or higher than you.");
                        return;
                    }
                    string oldgroup = foundGroup.name.ToString();
                    foundGroup.playerList.Remove(message);
                    foundGroup.playerList.Save();
                    if (p != null)
                    {
                        Player.GlobalMessage(message + " &f(offline)" + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + ".");
                    }
                    else
                    {
                        Player.GlobalMessage(message + " &f(offline)" + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by console.");
                    }
                    Group.findPerm(LevelPermission.Banned).playerList.Add(message);
                    Ban.Banplayer(p, message, reason, stealth, oldgroup);
                }
                else
                {
                    if (!Player.ValidName(who.name))
                    {
                        Player.SendMessage(p, "Invalid name \"" + who.name + "\".");
                        return;
                    }
                    if (Server.devs.Contains(who.name.ToLower()))
                    {
                        Player.SendMessage(p, "You can't ban an MCForge Developer!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to ban an MCForge Developer!");
                        }
                        else
                        {
                            Player.GlobalMessage(Server.DefaultColor + "The Console attempted to ban an MCForge Developer!");
                        }
                        return;
                    }
                    if ((int)who.group.Permission >= CommandOtherPerms.GetPerm(this))
                    {
                        Player.SendMessage(p, "You can't ban a " + who.group.name + "!");
                        return;
                    }
                    if (who.group.Permission == LevelPermission.Banned)
                    {
                        Player.SendMessage(p, message + " is already banned.");
                        return;
                    }
                    if (p != null && who.group.Permission >= p.group.Permission)
                    {
                        Player.SendMessage(p, "You cannot ban a person ranked equal or higher than you.");
                        return;
                    }
                    string oldgroup = who.group.name.ToString();
                    who.group.playerList.Remove(message);
                    who.group.playerList.Save();

                    if (p != null)
                    {
                        if (stealth)
                        {
                            Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " was STEALTH &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "!");
                        }
                        else
                        {
                            Player.GlobalMessage(who.color + who.name + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + "!");
                        }
                    }
                    else
                    {
                        if (stealth)
                        {
                            Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " was STEALTH &8banned" + Server.DefaultColor + " by console.");
                        }
                        else
                        {
                            Player.GlobalMessage(who.color + who.name + Server.DefaultColor + " was &8banned" + Server.DefaultColor + " by console.");
                        }
                    }
                    who.group = Group.findPerm(LevelPermission.Banned);
                    who.color = who.group.color;
                    Player.GlobalDie(who, false);
                    Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
                    Group.findPerm(LevelPermission.Banned).playerList.Add(who.name);
                    Ban.Banplayer(p, who.name, reason, stealth, oldgroup);
                }
                Group.findPerm(LevelPermission.Banned).playerList.Save();

                if (p != null)
                {
                    Server.IRC.Say(message + " was banned by " + p.name + ".");
                    Server.s.Log("BANNED: " + message.ToLower() + " by " + p.name);
                }
                else
                {
                    Server.IRC.Say(message + " was banned by console.");
                    Server.s.Log("BANNED: " + message.ToLower() + " by console.");
                }

                if (totalBan == true)
                {
                    Command.all.Find("undo").Use(p, message + " 0");
                    Command.all.Find("banip").Use(p, "@ " + message);
                }
            }
            catch (Exception e) { Server.ErrorLog(e); }
        }
Пример #15
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;
                }
            }
        }
Пример #16
0
        int MAX = -1; // This is the value changed to MAX in the Undo list, and used to allow everything undone.

        public override void Use(Player p, string message)
        {
            byte b; long seconds = -2; Player who = null; Player.UndoPos Pos; int CurrentPos = 0; bool undoPhysics = false; string whoName = String.Empty;

            if (p != null)
            {
                p.RedoBuffer.Clear();
            }

            if (message == "")
            {
                if (p == null)
                {
                    Player.SendMessage(null, "Console doesn't have an undo buffer.");
                    return;
                }
                else
                {
                    message = p.name.ToLower() + " 30";
                }
            }

            try {
                if (message.Split(' ').Length > 1)
                {
                    whoName     = message.Split(' ')[0];
                    who         = message.Split(' ')[0].ToLower() == "physics" ? null : Player.Find(message.Split(' ')[0]);
                    undoPhysics = message.Split(' ')[0].ToLower() == "physics";
                    message     = message.Split(' ')[1].ToLower();
                }
                else
                {
                    who         = (p == null || message.ToLower() == "physics") ? null : p;
                    undoPhysics = message.ToLower() == "physics";
                }
                //If user is undoing him/herself, then all is go.
                //If user is undoing someone else, then restrictions are used.
                if (p == who)
                {
                    seconds = ((message.ToLower() != "all") ? long.Parse(message) : int.MaxValue);
                }
                else
                {
                    seconds = getAllowed(p, message.ToLower());
                }
            } catch {
                Player.SendMessage(p, "Invalid seconds, or you're unable to use /xundo. Using 30 seconds."); //only run if seconds is an invalid number
                seconds = 30;
            }

            //At this point, we know the number is valid, and allowed for the particular person's group.
            if (who != null)
            {
                if (p != null)
                {
                    if (who.group.Permission > p.group.Permission && who != p)
                    {
                        Player.SendMessage(p, "Cannot undo a user of higher or equal rank"); return;
                    }
                    if (who != p && (int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1))
                    {
                        Player.SendMessage(p, "Only an " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+ may undo other people's actions"); return;
                    }
                }

                for (CurrentPos = who.UndoBuffer.Count - 1; CurrentPos >= 0; --CurrentPos)
                {
                    try {
                        Pos = who.UndoBuffer[CurrentPos];
                        Level foundLevel = Level.FindExact(Pos.mapName);
                        b = foundLevel.GetTile(Pos.x, Pos.y, Pos.z);
                        if (Pos.timePlaced.AddSeconds(seconds) >= DateTime.Now)
                        {
                            if (b == Pos.newtype || Block.Convert(b) == Block.water || Block.Convert(b) == Block.lava)
                            {
                                foundLevel.Blockchange(Pos.x, Pos.y, Pos.z, Pos.type, true);

                                Pos.newtype = Pos.type; Pos.type = b;
                                if (p != null)
                                {
                                    p.RedoBuffer.Add(Pos);
                                }
                                who.UndoBuffer.RemoveAt(CurrentPos);
                            }
                        }
                        else
                        {
                            break;
                        }
                    } catch { }
                }

                if (p == who)
                {
                    Player.SendMessage(p, "Undid your actions for the past &b" + seconds + Server.DefaultColor + " seconds.");
                }
                else
                {
                    Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + "'s actions for the past &b" + seconds + " seconds were undone.", false);
                    // Also notify console
                    Server.s.Log(who.name + "'s actions for the past " + seconds + " seconds were undone.");
                }
                return;
            }
            else if (undoPhysics)
            {
                if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2))
                {
                    Player.SendMessage(p, "Reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return;
                }
                if (!p.group.CanExecute(Command.all.Find("physics")))
                {
                    Player.SendMessage(p, "You can only undo physics if you can use them."); return;
                }

                Command.all.Find("physics").Use(p, "0");
                Level.UndoPos uP;
                ushort        x, y, z;

                if (p.level.UndoBuffer.Count != Server.physUndo)
                {
                    for (CurrentPos = p.level.currentUndo; CurrentPos >= 0; CurrentPos--)
                    {
                        try {
                            uP = p.level.UndoBuffer[CurrentPos];
                            b  = p.level.GetTile(uP.location);
                            if (uP.timePerformed.AddSeconds(seconds) >= DateTime.Now)
                            {
                                if (b == uP.newType || Block.Convert(b) == Block.water || Block.Convert(b) == Block.lava)
                                {
                                    p.level.IntToPos(uP.location, out x, out y, out z);
                                    p.level.Blockchange(p, x, y, z, uP.oldType, true);
                                }
                            }
                            else
                            {
                                break;
                            }
                        } catch { }
                    }
                }
                else
                {
                    for (CurrentPos = p.level.currentUndo; CurrentPos != p.level.currentUndo + 1; CurrentPos--)
                    {
                        try {
                            if (CurrentPos < 0)
                            {
                                CurrentPos = p.level.UndoBuffer.Count - 1;
                            }
                            uP = p.level.UndoBuffer[CurrentPos];
                            b  = p.level.GetTile(uP.location);
                            if (uP.timePerformed.AddSeconds(seconds) >= DateTime.Now)
                            {
                                if (b == uP.newType || Block.Convert(b) == Block.water || Block.Convert(b) == Block.lava)
                                {
                                    p.level.IntToPos(uP.location, out x, out y, out z);
                                    p.level.Blockchange(p, x, y, z, uP.oldType, true);
                                }
                            }
                            else
                            {
                                break;
                            }
                        } catch { }
                    }
                }

                Player.GlobalMessage("Physics were undone &b" + seconds + Server.DefaultColor + " seconds");
                // Also notify console
                Player.SendMessage(null, "Physics were undone &b" + seconds + Server.DefaultColor + " seconds");
            }
            else     // Here, who == null, meaning the user specified is offline
            {
                if (p != null)
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1))
                    {
                        Player.SendMessage(p, "Reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return;
                    }
                    // ^^^ is using the same as the 1st other permission for the this command because the only difference is that this is for offline players so it might aswell be the same!!
                }

                bool FoundUser = false;

                try {
                    DirectoryInfo di;
                    string[]      fileContent;

                    if (p != null)
                    {
                        p.RedoBuffer.Clear();
                    }

                    if (Directory.Exists("extra/undo/" + whoName.ToLower()))
                    {
                        di = new DirectoryInfo("extra/undo/" + whoName.ToLower());

                        for (int i = di.GetFiles("*.undo").Length - 1; i >= 0; i--)
                        {
                            fileContent = File.ReadAllText("extra/undo/" + whoName.ToLower() + "/" + i + ".undo").Split(' ');
                            if (!undoBlah(fileContent, seconds, p))
                            {
                                break;
                            }
                        }
                        FoundUser = true;
                    }

                    if (Directory.Exists("extra/undoPrevious/" + whoName.ToLower()))
                    {
                        di = new DirectoryInfo("extra/undoPrevious/" + whoName.ToLower());

                        for (int i = di.GetFiles("*.undo").Length - 1; i >= 0; i--)
                        {
                            fileContent = File.ReadAllText("extra/undoPrevious/" + whoName.ToLower() + "/" + i + ".undo").Split(' ');
                            if (!undoBlah(fileContent, seconds, p))
                            {
                                break;
                            }
                        }
                        FoundUser = true;
                    }

                    if (FoundUser)
                    {
                        Player.GlobalMessage(Server.FindColor(whoName) + whoName + Server.DefaultColor + "'s actions for the past &b" + seconds + Server.DefaultColor + " seconds were undone.");
                        // Also notify console
                        Server.s.Log(whoName + "'s actions for the past " + seconds + " seconds were undone.");
                    }
                    else
                    {
                        Player.SendMessage(p, "Could not find player specified.");
                    }
                } catch (Exception e) {
                    Server.ErrorLog(e);
                }
            }
        }
Пример #17
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;
            }
        }
Пример #18
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)
            {
                Player.SendMessage(p, who.color + who.name + Server.DefaultColor + " is on &b" + who.level.name);
                Player.SendMessage(p, who.color + who.prefix + who.name + Server.DefaultColor + " has :");
                Player.SendMessage(p, "> > the rank of " + who.group.color + who.group.name);
                try
                {
                    if (!Group.Find("Nobody").commands.Contains("pay") && !Group.Find("Nobody").commands.Contains("give") && !Group.Find("Nobody").commands.Contains("take"))
                    {
                        Player.SendMessage(p, "> > &a" + who.money + Server.DefaultColor + " " + Server.moneys);
                    }
                }
                catch { }
                Player.SendMessage(p, "> > &cdied &a" + who.overallDeath + Server.DefaultColor + " times");
                Player.SendMessage(p, "> > &bmodified &a" + who.overallBlocks + " &eblocks &eand &a" + who.loginBlocks + " &ewere changed &9since logging in&e.");
                string storedTime = Convert.ToDateTime(DateTime.Now.Subtract(who.timeLogged).ToString()).ToString("HH:mm:ss");
                Player.SendMessage(p, "> > time spent on server: " + who.time.Split(' ')[0] + " Days, " + who.time.Split(' ')[1] + " Hours, " + who.time.Split(' ')[2] + " Minutes, " + who.time.Split(' ')[3] + " Seconds.");
                Player.SendMessage(p, "> > been logged in for &a" + storedTime);
                Player.SendMessage(p, "> > first logged into the server on &a" + who.firstLogin.ToString("yyyy-MM-dd") + " at " + who.firstLogin.ToString("HH:mm:ss"));
                Player.SendMessage(p, "> > logged in &a" + who.totalLogins + Server.DefaultColor + " times, &c" + who.totalKicked + Server.DefaultColor + " of which ended in a kick.");
                Player.SendMessage(p, "> > " + Awards.awardAmount(who.name) + " awards");

                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, "> > the IP of " + givenIP);
                    if (Server.useWhitelist)
                    {
                        if (Server.whiteList.Contains(who.name))
                        {
                            Player.SendMessage(p, "> > Player is &fWhitelisted");
                        }
                    }
                    if (Server.devs.Contains(who.name.ToLower()))
                    {
                        Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Developer");
                    }
                }
            }
            else
            {
                Player.SendMessage(p, "\"" + message + "\" is offline! Using /whowas instead."); Command.all.Find("whowas").Use(p, message);
            }
        }
Пример #19
0
        public override void Use(Player p, string message)
        {
            CatchPos cpos;

            if (message == "")
            {
                p.ZoneCheck = true;
                Player.SendMessage(p, "Place a block where you would like to check for zones.");
                return;
            }
            else if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1))
            {
                Player.SendMessage(p, "Reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+");
                return;
            }

            if (message.IndexOf(' ') == -1)
            {
                if (p.canBuild == true)        //Checks if player can build there
                {
                    switch (message.ToLower()) //If true - they can delete the zone
                    {
                    case "del":
                        p.zoneDel = true;
                        Player.SendMessage(p, "Place a block where you would like to delete a zone.");
                        return;

                    default:
                        Help(p);
                        return;
                    }
                }
                else //if they cant, it warns them, the ops and logs it on the server!
                {
                    Player.SendMessage(p, "You can't delete a zone which is above your rank!");
                    Player.GlobalMessageOps(p.name + " tried to delete a zone that is above their rank!");
                    Server.s.Log(p.name + " tried to delete a zone that is above their rank!");
                    return;
                }
            }


            if (message.ToLower() == "del all")
            {
                if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2))
                {
                    Player.SendMessage(p, "Only a " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+ may delete all zones at once");
                    return;
                }
                else
                {
                    for (int i = 0; i < p.level.ZoneList.Count; i++)
                    {
                        Level.Zone Zn = p.level.ZoneList[i];
                        if (Server.useMySQL)
                        {
                            MySQL.executeQuery("DELETE FROM `Zone" + p.level.name + "` WHERE Owner='" + Zn.Owner + "' AND SmallX='" + Zn.smallX + "' AND SMALLY='" + Zn.smallY + "' AND SMALLZ='" + Zn.smallZ + "' AND BIGX='" + Zn.bigX + "' AND BIGY='" + Zn.bigY + "' AND BIGZ='" + Zn.bigZ + "'");
                        }
                        else
                        {
                            SQLite.executeQuery("DELETE FROM `Zone" + p.level.name + "` WHERE Owner='" + Zn.Owner + "' AND SmallX='" + Zn.smallX + "' AND SMALLY='" + Zn.smallY + "' AND SMALLZ='" + Zn.smallZ + "' AND BIGX='" + Zn.bigX + "' AND BIGY='" + Zn.bigY + "' AND BIGZ='" + Zn.bigZ + "'");
                        }

                        Player.SendMessage(p, "Zone deleted for &b" + Zn.Owner);
                        p.level.ZoneList.Remove(p.level.ZoneList[i]);
                        if (i == p.level.ZoneList.Count)
                        {
                            Player.SendMessage(p, "Finished removing all zones"); return;
                        }
                        i--;
                    }
                }
            }


            if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 3))
            {
                Player.SendMessage(p, "Setting zones is reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name); return;
            }

            if (Group.Find(message.Split(' ')[1]) != null)
            {
                message = message.Split(' ')[0] + " grp" + Group.Find(message.Split(' ')[1]).name;
            }

            if (message.Split(' ')[0].ToLower() == "add")
            {
                Player foundPlayer = Player.Find(message.Split(' ')[1]);
                if (foundPlayer == null)
                {
                    cpos.Owner = message.Split(' ')[1].ToString();
                }
                else
                {
                    cpos.Owner = foundPlayer.name;
                }
            }
            else
            {
                Help(p); return;
            }

            if (!Player.ValidName(cpos.Owner))
            {
                Player.SendMessage(p, "INVALID NAME."); return;
            }

            cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;

            Player.SendMessage(p, "Place two blocks to determine the edges.");
            Player.SendMessage(p, "Zone for: &b" + cpos.Owner + ".");
            p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
Пример #20
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

                Pb.AIName = foundPath;
                if (p != null)
                {
                    Player.GlobalChatLevel(p, Pb.color + Pb.name + Server.DefaultColor + "'s AI is now set to " + foundPath, false);
                }
                Server.s.Log(Pb.name + "'s AI was set to " + foundPath);
            }
            catch { Player.SendMessage(p, "Error"); return; }
        }
Пример #21
0
        public override void Use(Player p, string message)
        {
            if (message.Split(' ').Length > 1)
            {
                Help(p); return;
            }

            if (p.BlockAction == 13 || p.BlockAction == 14)
            {
                if (p.allowTnt == false)
                {
                    Player.SendMessage(p, "Tnt usage is not allowed at the moment!");
                    return;
                }

                p.BlockAction = 0; Player.SendMessage(p, "TNT mode is now &cOFF" + Server.DefaultColor + ".");
            }
            else if (message.ToLower() == "small" || message == "")
            {
                if (p.allowTnt == true)
                {
                    p.BlockAction = 13; Player.SendMessage(p, "TNT mode is now &aON" + Server.DefaultColor + ".");
                    return;
                }
                Player.SendMessage(p, "Tnt usage is not allowed at the moment!");
                return;
            }
            else if (message.ToLower() == "big")
            {
                if (p.allowTnt == false)
                {
                    Player.SendMessage(p, "Tnt usage is not allowed at the moment!");
                    return;
                }
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1))
                {
                    p.BlockAction = 14; Player.SendMessage(p, "TNT (Big) mode is now &aON" + Server.DefaultColor + ".");
                }
                else
                {
                    Player.SendMessage(p, "This mode is reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+");
                }
            }
            else if (message.ToLower() == "allow")
            {
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
                {
                    p.allowTnt = true;
                    Player.SendMessage(p, "&cTnt usage has now been enabled!");
                    return;
                }
                Player.SendMessage(p, "You must be " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+ to use this command.");
                return;
            }
            else if (message.ToLower() == "disallow")
            {
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
                {
                    p.allowTnt = false;
                    Player.SendMessage(p, "&cTnt usage has now been disabled!");
                    return;
                }
                Player.SendMessage(p, "You must be " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+ to use this command.");
                return;
            }
            else if (message.ToLower() == "nuke")
            {
                if (p.allowTnt == false)
                {
                    Player.SendMessage(p, "Tnt usage is not allowed at the moment!");
                    return;
                }
                if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 3))
                {
                    p.BlockAction = 15; Player.SendMessage(p, "TNT (Nuke) mode is now &aON" + Server.DefaultColor + ".");
                }
                else
                {
                    Player.SendMessage(p, "This mode is reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+");
                }
            }
            else
            {
                Help(p);
            }

            p.painting = false;
        }
Пример #22
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/patrol - Teleports you to a random " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + " or lower");
 }
Пример #23
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;
            }
        }
Пример #24
0
        public override void Use(Player p, string message)
        {
            if (p == null)
            {
                Player.SendMessage(p, "This command can not be used in console!");
                return;
            }
            int number = message.Split(' ').Length;

            if (message == "")
            {
                Help(p);
                return;
            }
            if (number == 1)
            {
                if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this))
                {
                    Player.SendMessage(p, "You need to be a " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ to do that!");
                    return;
                }
                if (message.ToLower() == "check")
                {
                    if (!Directory.Exists("extra/reported"))
                    {
                        Directory.CreateDirectory("extra/reported");
                    }
                    bool          foundone = false;
                    DirectoryInfo di       = new DirectoryInfo("extra/reported");
                    FileInfo[]    fi       = di.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, "- " + parsed);
                    }
                    if (foundone == true)
                    {
                        Player.SendMessage(p, "Use /report view [Player] to view the reason and the reporter.");
                        Player.SendMessage(p, "Use /report remove [Player] to remove the report on a player.");
                    }
                    else
                    {
                        Player.SendMessage(p, "No reports were found!");
                        return;
                    }
                    return;
                }
            }


            if (number >= 2)
            {
                int    pos  = message.IndexOf(' ');
                string msg1 = message.Substring(0, pos).ToLower();
                string msg2 = message.Substring(pos + 1).ToLower();
                if (msg1.ToLower() == "view")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this))
                    {
                        Player.SendMessage(p, "You need to be a " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ to do that!");
                        return;
                    }
                    if (!File.Exists("extra/reported/" + msg2 + ".txt"))
                    {
                        Player.SendMessage(p, "The player you specified has not been reported!");
                        return;
                    }
                    var readtext = File.ReadAllText("extra/reported/" + msg2 + ".txt");
                    Player.SendMessage(p, readtext);
                    return;
                }
                if (msg1.ToLower() == "delete")
                {
                    if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this))
                    {
                        Player.SendMessage(p, "You need to be a " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ to do that!");
                        return;
                    }
                    if (!File.Exists("extra/reported/" + msg2 + ".txt"))
                    {
                        Player.SendMessage(p, "The player you specified has not been reported!");
                        return;
                    }
                    if (!Directory.Exists("extra/reportedbackups"))
                    {
                        Directory.CreateDirectory("extra/reportedbackups");
                    }
                    if (File.Exists("extra/reportedbackups/" + msg2 + ".txt"))
                    {
                        File.Delete("extra/reportedbackups/" + msg2 + ".txt");
                    }
                    File.Move("extra/reported/" + msg2 + ".txt", "extra/reportedbackups/" + msg2 + ".txt");
                    Player.SendMessage(p, msg2 + "'s report has been deleted.");
                    Server.s.Log(msg2 + "'s report has been deleted by " + p.name);
                    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, "Your report has been sent, it should be viewed when an operator is next online!");
                    return;
                }
                if (File.Exists("extra/reported/" + msg1 + "(2).txt"))
                {
                    File.WriteAllText("extra/reported/" + msg1 + "(3).txt", msg2 + " - Reported by " + p.name + "." + " DateTime: " + DateTime.Now);
                    Player.SendMessage(p, "Your report has been sent, it should be viewed when an operator is next online!");
                    return;
                }
                if (File.Exists("extra/reported/" + msg1 + "(3).txt"))
                {
                    Player.SendMessage(p, "The player you have reported has already been reported 3 times! Please wait patiently or come back when an op is online!");
                    return;
                }
                File.WriteAllText("extra/reported/" + msg1 + ".txt", msg2 + " - Reported by " + p.name + "." + " DateTime: " + DateTime.Now);
                Player.SendMessage(p, "Your report has been sent, it should be viewed when an operator is next online!");
            }
        }
Пример #25
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.");
                 */
            }
        }
Пример #26
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            Player pl = Player.Find(message);

            if (pl != null && !pl.hidden)
            {
                Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " is online, using /whois instead.");
                Command.all.Find("whois").Use(p, message);
                return;
            }

            if (message.IndexOf("'") != -1)
            {
                Player.SendMessage(p, "Cannot parse request."); return;
            }

            string FoundRank = Group.findPlayer(message.ToLower());

            DataTable playerDb = Server.useMySQL ? MySQL.fillData("SELECT * FROM Players WHERE Name='" + message + "'") : SQLite.fillData("SELECT * FROM Players WHERE Name='" + message + "'");

            if (playerDb.Rows.Count == 0)
            {
                Player.SendMessage(p, Group.Find(FoundRank).color + message + Server.DefaultColor + " has the rank of " + Group.Find(FoundRank).color + FoundRank); return;
            }

            Player.SendMessage(p, Group.Find(FoundRank).color + playerDb.Rows[0]["Title"] + " " + message + Server.DefaultColor + " has :");
            Player.SendMessage(p, "> > the rank of " + Group.Find(FoundRank).color + FoundRank);
            try
            {
                if (!Group.Find("Nobody").commands.Contains("pay") && !Group.Find("Nobody").commands.Contains("give") && !Group.Find("Nobody").commands.Contains("take"))
                {
                    Player.SendMessage(p, "> > &a" + playerDb.Rows[0]["Money"] + Server.DefaultColor + " " + Server.moneys);
                }
            }
            catch { }
            Player.SendMessage(p, "> > &cdied &a" + playerDb.Rows[0]["TotalDeaths"] + Server.DefaultColor + " times");
            Player.SendMessage(p, "> > &bmodified &a" + playerDb.Rows[0]["totalBlocks"] + " &eblocks.");
            Player.SendMessage(p, "> > was last seen on &a" + playerDb.Rows[0]["LastLogin"]);
            Player.SendMessage(p, "> > " + TotalTime(playerDb.Rows[0]["TimeSpent"].ToString()));
            Player.SendMessage(p, "> > first logged into the server on &a" + playerDb.Rows[0]["FirstLogin"]);
            Player.SendMessage(p, "> > logged in &a" + playerDb.Rows[0]["totalLogin"] + Server.DefaultColor + " times, &c" + playerDb.Rows[0]["totalKicked"] + Server.DefaultColor + " of which ended in a kick.");
            Player.SendMessage(p, "> > " + Awards.awardAmount(message) + " awards");

            bool skip = false;

            if (p != null)
            {
                if ((int)p.group.Permission <= CommandOtherPerms.GetPerm(this))
                {
                    skip = true;
                }
            }

            if (!skip)
            {
                if (Server.bannedIP.Contains(playerDb.Rows[0]["IP"].ToString()))
                {
                    playerDb.Rows[0]["IP"] = "&8" + playerDb.Rows[0]["IP"] + ", which is banned";
                }
                Player.SendMessage(p, "> > the IP of " + playerDb.Rows[0]["IP"]);
                if (Server.useWhitelist)
                {
                    if (Server.whiteList.Contains(message.ToLower()))
                    {
                        Player.SendMessage(p, "> > Player is &fWhitelisted");
                    }
                }
                if (Server.devs.Contains(message.ToLower()))
                {
                    Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Developer");
                }
            }
            playerDb.Dispose();
        }