Ejemplo n.º 1
0
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target != null)
         {
             if (!target.hidden)
             {
                 if (p.level != target.level)
                 {
                     target.ChangeLevel(p.level.name);
                 }
                 unchecked
                 {
                     target.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0);
                 }
                 target.SendMessage("You were summoned by " + p.color + p.name + "&e.");
             }
             else
             {
                 p.SendMessage("There is no player \"" + message + "\"!");
             }
         }
         else
         {
             p.SendMessage("There is no player \"" + message + "\"!");
         }
     }
     else
     {
         Help(p);
     }
 }
Ejemplo n.º 2
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                playerList = "";
                foreach (var pl in Player.players)
                {
                    if (pl.hidden && p.Rank >= pl.Rank)
                    {
                        playerList += pl.color + pl.name + "&e, ";
                    }
                }

                if (playerList == "")
                {
                    p.SendMessage("No one is currently hidden.");
                }
                else
                {
                    p.SendMessage("Hidden Players: " + playerList.Trim(trimmings));
                }
            }
            else
            {
                Help(p);
            }
        }
Ejemplo n.º 3
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "") // Exempt or remove from exempt
            {

                // Seperate message string
                //int pos = message.IndexOf(' ');
                string tempName = message.ToLower();

                // If the name is in the file, remove it
                if (Server.griefExempted.Contains(tempName))
                {
                    Server.griefExempted.Remove(tempName);
                    p.SendMessage(tempName + " was " + c.red + "removed" + c.yellow + " from anti-grief exemption");
                }
                else
                {
                    Server.griefExempted.Add(tempName);
                    p.SendMessage(tempName + " was " + c.green + "added" + c.yellow + " to anti-grief exemption");
                }

            }
            else // Return usage
            {
                Help(p);
            }
        }
Ejemplo n.º 4
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     string strPlayers;
     foreach (Map level in Server.levels)
     {
         strPlayers = "";
         foreach (Player pl in Player.players)
         {
             if (!p.hidden || p.Rank > pl.Rank)
             {
                 if (pl.level == level)
                 {
                     strPlayers += pl.color + pl.name + "&e, ";
                 }
             }
         }
         if (strPlayers != "")
         {
             strPlayers = strPlayers.Remove(strPlayers.Length - 4);
         }
         else
         {
             strPlayers = "No players on this level";
         }
         p.SendMessage(player.level.name + ": " + strPlayers);
     }
 }
Ejemplo n.º 5
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message == "")
     {
         if (p.isWhisperChat)
         {
             p.SendMessage("Disable whisper chat before using /opchat"); // Think of maybe disabling it automatically?
         }
         else
         {
             p.isOpChat = !p.isOpChat;
             if (p.isOpChat)
             {
                 p.SendMessage("Operator chat: &aON&e.");
             }
             else
             {
                 p.SendMessage("Operator chat: &cOFF&e.");
             }
         }
     }
     else
     {
         Help(p);
     }
 }
Ejemplo n.º 6
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message == "") // blank name, disable whispering
     {
         if (p.isWhisperChat)
         {
             p.SendMessage("No longer whispering: " + p.whisperTarget + ".");
             p.isWhisperChat = false;
         }
         else
         {
             p.SendMessage("Whisper chat is already disabled.");
         }
     }
     else if (p.isOpChat)
     {
         p.SendMessage("Disable opchat before using /whisper");
     }
     else
     {
         p.isWhisperChat = false;
         Player target = Player.Find(message);
         if (target != null)
         {
             p.whisperTarget = target.name;
             p.isWhisperChat = true;
             p.SendMessage("Now whispering: " + target.color + target.name + "&e.");
         }
         else
         {
             p.SendMessage(LanguageString.NoSuchPlayer);
         }
     }
 }
Ejemplo n.º 7
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                string strModerators = "";
                foreach (var pl in Player.players)
                {
                    if (pl.Rank == GroupEnum.Operator && (!pl.hidden || p.Rank >= pl.Rank))
                    {
                        strModerators += pl.color + pl.name + ", ";
                    }
                }
                if (strModerators == "")
                {
                    strModerators = "No moderators currently online";
                }
                else
                {
                    strModerators = strModerators.Remove(strModerators.Length - 2);
                }

                p.SendMessage("Online Moderators: " + strModerators);
            }
            else
            {
                Help(p);
            }
        }
Ejemplo n.º 8
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            Regex regex = new Regex(@"^([0-9]{1,3}\.){3}[0-9]{1,3}$");
            if (message == "") { if (p != null)Help(p); return; }
            Player who = null;
            who = Player.Find(message);
            if (who != null) { message = who.ip; }
            if (message.Equals("127.0.0.1")) { if (p != null) { p.SendMessage("You can't ip-ban the server!"); } return; }
            if (!regex.IsMatch(message)) { if (p != null)p.SendMessage("Not a valid ip!"); return; }
            if (p != null) { if (p.ip == message) { p.SendMessage("You can't ip-ban yourself.!"); return; } }
            if (Server.bannedIP.Contains(message)) { if (p != null)p.SendMessage(message + " is already ip-banned."); return; }
            Player.GlobalMessage(message + " got &8ip-banned&e!");
            if (p != null)
            { IRCBot.Say("IP-BANNED: " + message.ToLower() + " by " + p.name); }
            else
            { IRCBot.Say("IP-BANNED: " + message.ToLower() + " by console"); }
            Server.bannedIP.Add(message);
            Logger.Log("IP-BANNED: " + message.ToLower());

            List<Player> kickList = new List<Player>();
            foreach (Player pl in Player.players)
            {
                if (message.Equals(pl.ip)) { kickList.Add(pl); }       //Kicks anyone off with matching ip for convinience
            }
            foreach (Player pl in kickList)
            {
                pl.Kick("Kicked by ipban");
            }
        }
Ejemplo n.º 9
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target == null || (target.hidden && p.Rank < target.Rank))
         {
             if (Player.left.ContainsKey(message.ToLower()))
             {
                 string playerName = message.ToLower();
                 string ip = Player.left[playerName];
                 message = "&e" + playerName + " is " + Player.GetColor(playerName) + Player.GetGroup(playerName).Name + "&e.";
                 if (p.Rank >= GroupEnum.Operator)
                 {
                     message += " IP: " + ip + ".";
                 }
                 p.SendChat(p, message);
             }
             else
             {
                 p.SendMessage("No entry found for \"" + message + "\".");
             }
         }
         else
         {
             p.SendMessage(target.color + target.name + "&e is online, use /whois instead.");
         }
     }
     else
     {
         Help(p);
     }
 }
Ejemplo n.º 10
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target == null)
         {
             if (Player.lastSeen.ContainsKey(message.ToLower()))
             {
                 string lastOnline = message + " was last seen on: " + Player.lastSeen[message.ToLower()].ToLongDateString() + " at: " + Player.lastSeen[message.ToLower()].ToShortTimeString() + TimeZone.CurrentTimeZone.ToString();
                 p.SendMessage(lastOnline);
             }
             else
             {
                 p.SendMessage("Player not found!");
             }
         }
         else
         {
             if (target.hidden && p.Rank < target.Rank)
             {
                 p.SendMessage("Player not found!");
             }
             else
             {
                 p.SendMessage(target.name + " is currently playing!");
             }
         }
     }
     else
     {
         Help(p);
     }
 }
Ejemplo n.º 11
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                try
                {
                    if (File.Exists("news.txt"))
                    {
                        List<string> news = new List<string>();
                        StreamReader wm = File.OpenText("news.txt");
                        while (!wm.EndOfStream)
                            news.Add(wm.ReadLine());

                        wm.Close();

                        foreach (string w in news)
                            p.SendMessage(w);
                    }
                    else
                    {
                        p.SendMessage("No news today!");
                    }
                }
                catch
                {
                    Logger.Log("Error reading news.txt");
                }
            }
            else
            {
                Help(p);
            }
        }
Ejemplo n.º 12
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                // Toggle OFF
                if (p.BlockAction == 8)
                {
                    p.BlockAction = 0;
                    p.SendMessage("BuildOp mode: &cOFF&e.");
                }
                else // Toggle ON
                {
                    // Disable painting
                    p.painting = false;

                    // Clear all bindings, creates faulty blocks otherwise
                    int bindCount = p.ClearBindings();

                    // Set the block action to buildop
                    p.BlockAction = 8;

                    if (bindCount > 0)
                    {
                        p.SendMessage("Cleared " + bindCount + " block bind(s).");
                    }

                    p.SendMessage("BuildOp Mode: &aON&e. Now Placing op_materials");
                }
            }
            else
            {
                Help(p);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Sends the rules to a target player
        /// </summary>
        /// <param name="target">Target player that rules are being sent to.</param>
        private void SendRules(Player target)
        {
            try
            {
                if (target.level == Server.mainLevel && Server.mainLevel.permissionbuild == LevelPermission.Guest)
                {
                    target.SendMessage("You are currently on the guest map where anyone can build");
                }

                List<string> rules = new List<string>();

                // Read in rules
                StreamReader r = File.OpenText("rules.txt");
                while (!r.EndOfStream)
                    rules.Add(r.ReadLine());
                r.Close();

                // Send the user the rules
                target.SendMessage("Server Rules:");
                foreach (string rule in rules)
                    target.SendMessage(rule);

            }
            catch
            {
                Logger.Log("Error reading rules.txt in SendRules()", LogType.Error);
            }
        }
Ejemplo n.º 14
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                string strOperators = "";
                Player.players.ForEach(delegate(Player pl)
                {
                    if (pl.Rank == GroupEnum.Operator && (!pl.hidden || p.Rank >= pl.Rank))
                    {
                        strOperators += pl.color + pl.name + ", ";
                    }
                });
                if (strOperators == "")
                {
                    strOperators = "No operators currently online";
                }
                else
                {
                    strOperators = strOperators.Remove(strOperators.Length - 2);
                }

                p.SendMessage("Online Operators: " + strOperators);
            }
            else
            {
                Help(p);
            }
        }
Ejemplo n.º 15
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                p.SendMessage("Currently on &b" + p.level.name + "&e X:" + p.level.width.ToString() + " Y:" + p.level.depth.ToString() + " Z:" + p.level.height.ToString());
                switch (p.level.Physics)
                {
                    case Physics.Off:
                        p.SendMessage("Physics is &cOFF&e.");
                        break;

                    case Physics.Normal:
                        p.SendMessage("Physics is &aNormal&e.");
                        break;

                    case Physics.Advanced:
                        p.SendMessage("Physics is &aAdvanced&e.");
                        break;
                }

                p.SendMessage("Build rank = " + Map.PermissionToName(p.level.permissionbuild) + " : Visit rank = " + Map.PermissionToName(p.level.permissionvisit) + ".");
            }
            else
            {
                Help(p);
            }
        }
Ejemplo n.º 16
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "list")
     {
         if (Server.afkset.Contains(p.name))
         {
             Server.afkset.Remove(p.name);
             Player.GlobalMessage("-" + p.group.Color + p.name + "&e- is no longer AFK");
             IRCBot.Say(p.name + " is no longer AFK");
         }
         else
         {
             Server.afkset.Add(p.name);
             Player.GlobalMessage("-" + p.group.Color + p.name + "&e- is AFK " + message);
             IRCBot.Say(p.name + " is AFK " + message);
         }
     }
     else
     {
         // Send list of afk players
         foreach (string s in Server.afkset)
         {
             p.SendMessage(s);
         }
     }
 }
Ejemplo n.º 17
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Player target = Player.Find(message);
         if (target != null)
         {
             if (target.placedBlocks > 0 && target.deletedBlocks > 0)
             {
                 double ratio = ((double)target.placedBlocks / (double)target.deletedBlocks);
                 p.SendMessage(target.name + ": (" + formatRatio(target) + ") (" + target.placedBlocks + "/" + target.deletedBlocks + ")" + " (" + ratio.ToString("N4") + ")");
             }
             else
             {
                 p.SendMessage(target.name + " has not placed/deleted any bricks!");
             }
         }
         else
         {
             p.SendMessage(LanguageString.NoSuchPlayer);
         }
     }
     else
     {
         Help(p);
     }
 }
Ejemplo n.º 18
0
                for (int i = 0; i < opMats.doorBlocks.Length; i++)
                {
                    if ((message.Contains(" " + Block.Name(opMats.doorBlocks[i]))) || (message.Contains(" " + Block.Name(opMats.regBlocks[i]))))
                    {
                        ignoreList[counter] = opMats.doorBlocks[i];
                        counter += 1;
                        if (counter > ignoreList.Length - 1)
                        {
                            break;
                        }
                    }
                }
            } // Not allowing user to use "all" because turning a map into door_material would be pointless
              // User can still manually do it by placing blocks.
            p.SendMessage("Place two blocks to determine the edges.");
            p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
       
        public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z); //get the tile type of first set and set that to byte b
            p.SendBlockchange(x, y, z, b);
            CatchPos bp = (CatchPos)p.blockchangeObject;
            bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
        }
        public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z);
            p.SendBlockchange(x, y, z, b);
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            unchecked { if (cpos.type != (byte)-1) { type = cpos.type; } }
            List<Pos> buffer = new List<Pos>();
            switch (cpos.solid)
            {
                case SolidType.solid:
                    if (!Server.operators.Contains(p.name))
                    {
                        int attemptedLimit = (Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z));
                        if (attemptedLimit > p.group.CuboidLimit && p.group.CuboidLimit != 0) //OPERATOR door LIMIT, same as cuboid
                        {
                            p.SendMessage("You're trying to convert " + attemptedLimit + " blocks.");
                            p.SendMessage("Your block limit is " + p.group.CuboidLimit.ToString() + " blocks. Build in stages.");
                            return;
                        }
                    }
                    buffer.Capacity = Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z);
                    for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
                        for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
                            for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
                                /*if (p.level.GetTile(xx, yy, zz) != type) {*/
                                BufferAdd(buffer, xx, yy, zz); //}
                    break;
            }

            p.SendMessage("Converting " + buffer.Count.ToString() + " blocks into door_material.");
Ejemplo n.º 19
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                string[] parameters = message.Split(' '); // Grab the parameters from the player's message
                if (parameters.Length == 5) // make sure there are 5 params
                {
                    switch (parameters[4])
                    {
                        case "flat":
                        case "pixel":
                        case "island":
                        case "mountains":
                        case "ocean":
                        case "forest":

                            break;

                        default:
                            p.SendMessage("Valid types: island, mountains, forest, ocean, flat, pixel"); return;
                    }

                    string name = parameters[0];
                    // create a new level...
                    try
                    {
                        Map lvl = new Map(name,
                                              Convert.ToUInt16(parameters[1]),
                                              Convert.ToUInt16(parameters[2]),
                                              Convert.ToUInt16(parameters[3]),
                                              parameters[4]);
                        lvl.changed = true;
                    }
                    finally
                    {
                        GC.Collect();
                        GC.WaitForPendingFinalizers();

                    }
                    Player.GlobalMessage("Map " + name + " created");
                }
                else
                {
                    p.SendMessage("Not enough parameters! <name> <x> <y> <z> <type>");
                }
            }
            else
            {
                Help(p);
            }
            if (Properties.ValidString(message, " "))
            {

            }
            else
            {
                p.SendMessage("Please use an alphanumerical characters only!");
            }
        }
Ejemplo n.º 20
0
 public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
 {
     p.ClearBlockchange();
     byte b = p.level.GetTile(x, y, z);
     p.SendBlockchange(x, y, z, b);
     CatchPos bp = (CatchPos)p.blockchangeObject;
     bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
     p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
 }
Ejemplo n.º 21
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "" || message.Split(' ').Length != 2)
            {
                Player target = Player.Find(message.Split(' ')[0]);
                string levelName = message.Split(' ')[1];
                bool blnLevelLoaded = false;

                if (target == null)
                {
                    p.SendMessage("FAILED - No such player!");
                }
                else if (target.Rank >= p.Rank)
                {
                    p.SendMessage("You cannnot send a player who is an equal or greater rank than yourself");
                }
                else
                {
                    foreach (Level l in Server.levels)
                    {
                        if (l.name == levelName)
                        {
                            if (target.level.name != levelName)
                            {
                                target.SendMessage(p.name + " has sent you to " + levelName);
                                Command.all.Find("goto").Use(target, levelName);
                                blnLevelLoaded = true;
                                break;
                            }
                            else
                            {
                                p.SendMessage("Player is already on that level!");
                                blnLevelLoaded = true;
                                break;
                            }
                        }
                    }
                    if (!blnLevelLoaded)
                    {
                        DirectoryInfo di = new DirectoryInfo("levels/");
                        FileInfo[] fi = di.GetFiles("*.lvl");
                        foreach (FileInfo file in fi)
                        {
                            if (file.Name.Replace(".lvl", "").ToLower() == levelName.ToLower())
                            {
                                p.SendMessage("That Level is not loaded yet!");
                            }
                        }
                        p.SendMessage("No such level!");
                    }
                }
            }
            else
            {
                Help(p);
            }
        }
Ejemplo n.º 22
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            //p.SendMessage("Sorry this command is temporarily disabled");

            if (message != "" && message.Split(' ').Length <= 2)
            {
                int pos = message.IndexOf(' ');
                if (pos != -1)
                {
                    Player target = Player.Find(message.Substring(0, pos));
                    if (target == null)
                    {
                        p.SendMessage("There is no player \"" + message.Substring(0, pos) + "\"!");
                    }
                    else
                    {

                        string color = c.Parse(message.Substring(pos + 1));
                        if (color == "")
                        {
                            p.SendMessage("There is no color \"" + message + "\".");
                        }
                        else if (color == target.color)
                        {
                            p.SendMessage(target.name + " already has that color.");
                        }
                        else
                        {
                            Player.GlobalChat(target, target.color + "*" + FormatName(target.name) + " color changed to " + color + c.Name(color) + "&e.", false);
                            target.color = color;

                            Player.GlobalDie(target, false);
                            Player.GlobalSpawn(target, target.pos[0], target.pos[1], target.pos[2], target.rot[0], target.rot[1], false);
                        }
                    }
                }
                else
                {
                    string color = c.Parse(message);
                    if (color == "") { p.SendMessage("There is no color \"" + message + "\"."); }
                    else if (color == p.color) { p.SendMessage("You already have that color."); }
                    else
                    {
                        Player.GlobalChat(p, p.color + "*" + FormatName(p.name) +
                                          " color changed to " + color +
                                          c.Name(color) + "&e.", false);
                        p.color = color; Player.GlobalDie(p, false);
                        Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                    }
                }
            }
            else
            {
                Help(p);
            }
        }
Ejemplo n.º 23
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message == "")
            {

                // Check for clones
                foreach (Player pl in Player.players)
                {
                    foreach (Player pl1 in Player.players)
                    {
                        if (pl.ip == pl1.ip && pl.name != pl1.name)     //If same IP found on another player
                        {
                            if (!clones.ContainsKey(pl.ip))     //If the key does not exist yet
                            {
                                clones.Add(pl.ip, new List<string>());
                                clones[pl.ip].Add(pl.name);
                                clones[pl.ip].Add(pl1.name);    //add playername to the list
                            }
                            else
                            {
                                if (!clones[pl.ip].Contains(pl1.name))
                                {
                                    clones[pl.ip].Add(pl1.name);
                                }
                            }
                        }
                    }
                }

                // List clones
                if (clones.Count > 0)
                {
                    p.SendMessage("Clones have been found!");
                    foreach (KeyValuePair<string, List<string>> kvp in clones)
                    {
                        string players = "";
                        foreach (string s in kvp.Value)
                        {
                            Player fplayer = Player.Find(s);
                            players += fplayer.color + s + "&e, ";
                        }
                        p.SendMessage(kvp.Key + ": " + players.Trim(trimmings));
                    }
                    clones.Clear();
                }
                else
                {
                    p.SendMessage("No Clones Found");
                }
            }
            else
            {
                Help(p);
            }
        }
Ejemplo n.º 24
0
 // Command usage help
 public override void Help(Player p)
 {
     if (p.Rank < GroupEnum.Moderator)
     {
         p.SendMessage("/rules - Displays server rules");
     }
     else
     {
         p.SendMessage("/rules [player]- Displays server rules to a player");
     }
 }
Ejemplo n.º 25
0
        public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            byte b = p.level.GetTile(x, y, z);
            p.SendBlockchange(x, y, z, b);
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            unchecked { if (cpos.type != (byte)-1) { type = cpos.type; } }
            List<Pos> buffer = new List<Pos>();
            switch (cpos.solid)
            {
                case SolidType.solid:
                    if (!Server.operators.Contains(p.name))
                    {
                        int attemptedLimit = Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z);
                        if (attemptedLimit > p.group.CuboidLimit && p.group.CuboidLimit != 0) //OPERATOR unlock LIMIT, same as cuboid
                        {
                            p.SendMessage("You're trying to unlock " + attemptedLimit + " blocks.");
                            p.SendMessage("Your block limit is " + p.group.CuboidLimit.ToString() + " blocks. Build in stages.");
                            return;
                        }
                    }
                    buffer.Capacity = Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z);
                    for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
                        for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
                            for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
                                /*if (p.level.GetTile(xx, yy, zz) != type) {*/
                                BufferAdd(buffer, xx, yy, zz); //}
                    break;
            }

            p.SendMessage("Unlocking " + buffer.Count.ToString() + " blocks.");

            // Disable physics before changing the blocks
            Physics physicsSetting = p.level.Physics;
            p.level.Physics = Physics.Off;
            p.level.ClearPhysics();

            buffer.ForEach(delegate(Pos pos)
            {
                byte bl = p.level.GetTile(pos.x, pos.y, pos.z); //Get the block that is there at the moment
                if (opMats.opBlocks.Contains(bl))  // if the block is op_material
                {

                    if (!ignoreList.Contains(bl)) // if the block is not being ignored
                    {
                        p.level.Blockchange(p, pos.x, pos.y, pos.z, (byte)Block.convertOp(bl)); // send converted reg_material
                    }
                }
            });
            //p.level.Blockchange(p, pos.x, pos.y, pos.z, (byte)(Block.lavastill));
            p.level.Physics = physicsSetting;
            p.SendMessage("Unlocking complete.");
        }
Ejemplo n.º 26
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     if (message == "")
         {
             p.level.Save();
             p.SendMessage("Map \"" + p.level.name + "\" saved.");
         }
         else
         {
             Help(p);
         }
 }
Ejemplo n.º 27
0
 // Code to run when used by a player
 public override void Use(Player p,string message)
 {
     if (p.HasBlockchange())
     {
         p.SendMessage("There is no action to abort.");
     }
     else
     {
         p.ClearBlockchange();
         p.SendMessage("Action aborted.");
     }
 }
Ejemplo n.º 28
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            if (message != "")
            {
                Player target = Player.Find(message);
                if (target != null)
                {
                    if (target.Rank == GroupEnum.Banned)
                    {
                        target.Loading = true;
                        ushort x = p.pos[0];
                        ushort y = p.pos[1];
                        ushort z = p.pos[2];
                        byte rotX = p.rot[0];
                        byte rotY = p.rot[1];

                        //who.SendMotd(); who.SendMap();

                        target.ClearBlockchange();
                        target.BlockAction = 0;
                        target.SendMotd();
                        target.SendMap();

                        unchecked
                        {
                            target.SendPos((byte)-1, x, y, z,
                                rotX,
                                rotY);
                        }

                        target.SendMessage("Oops, looks like all your greifing was for nothing!");
                        p.SendMessage("Map revealed for: " + target.color + target.name);
                        Player.GlobalMessageOps("-" + p.color + p.name + "&e just revealed the map to: " + target.color + target.name);
                        target.Loading = false;
                        GC.Collect();
                        GC.WaitForPendingFinalizers();
                    }
                    else
                    {
                        p.SendMessage("Player is not banned!");
                    }
                }
                else
                {
                    p.SendMessage("There is no player \"" + message + "\"!");
                }
            }
            else
            {
                Help(p);
            }
        }
Ejemplo n.º 29
0
 // Code to run when used by a player
 public override void Use(Player p,string message)
 {
     if (message == "")
     {
         p.SendMessage("Break/build a block to display information.");
         p.ClearBlockchange();
         p.Blockchange += new Player.BlockchangeEventHandler(Blockchange);
     }
     else
     {
         Help(p);
     }
 }
Ejemplo n.º 30
0
        // Code to run when used by a player
        public override void Use(Player p,string message)
        {
            bool blnLevelFound = false;
            Level targetLevel = null;
            if (message != "")
            {
                message = message.ToLower();
                if (p.level.name.ToLower() != message)
                {
                    foreach (Level level in Server.levels)
                    {
                        if (level.name.ToLower() == message)
                        {
                            targetLevel = level;
                            blnLevelFound = true;
                            break;
                        }
                    }
                    if (blnLevelFound)
                    {
                        if (targetLevel.PlayerCanVisit(p))
                        {
                            p.ChangeLevel(targetLevel);
                            if (!p.hidden)
                            {
                                Player.GlobalChat(p, p.color + "*" + p.name + "&e went to \"" + p.level.name + "\".", false);
                            }
                        }
                        else
                        {
                            p.SendMessage("You do not have perimssion to visit this level");
                        }
                    }
                    else
                    {
                        // Level either not found or non-existant

                        p.SendMessage("There is no level \"" + message + "\" loaded.");
                    }

                }
                else
                {
                    p.SendMessage("You are already on that level!");
                }
            }
            else
            {
                Help(p);
            }
        }