Ejemplo n.º 1
0
 // Grab the first position
 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 = new CatchPos();
     bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
     p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
 }
Ejemplo n.º 2
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            int number = message.Split(' ').Length;
            if (number != 2) { Help(p); return; }

            int pos = message.IndexOf(' ');
            string t = message.Substring(0, pos).ToLower();
            string t2 = message.Substring(pos + 1).ToLower();
            byte type = Block.Byte(t);
            if (type == 255) { p.SendMessage("There is no block \"" + t + "\"."); return; }
            byte type2 = Block.Byte(t2);
            if (type2 == 255) { p.SendMessage("There is no block \"" + t2 + "\"."); return; }

            CatchPos cpos = new CatchPos(); cpos.type2 = type2; cpos.type = type;
            cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            p.SendMessage("Place two blocks to determine the edges.");
            p.ClearBlockchange();
            p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
Ejemplo n.º 3
0
        // Code to run when used by a player
        public override void Use(Player p, string message)
        {
            // Clear previously ignored blocks
            for (int i = 0; i < ignoreList.Length - 1; i++)
            {
                ignoreList[i] = 255;
            }
            int counter = 0;
            CatchPos cpos = new CatchPos(); cpos.solid = SolidType.solid; unchecked { cpos.type = (byte)-1; }
            cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
            if (message != "")
            {
                // Here we can use the same principle as searching through opMats.
                // This function ignores op_material for security reasons.
                // This function also ignores any non-doorifiable block (ie: air, water, lava...etc)
                message = message.ToLower();
                message = " " + message;  // Add the whitespace back to work with the ignore list code below

                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);
        }
Ejemplo n.º 4
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     // Clear previously ignored blocks
     for (int i = 0; i < ignoreList.Length - 1; i++)
     {
         ignoreList[i] = 255;
     }
     int counter = 0;
     CatchPos cpos = new CatchPos(); cpos.solid = SolidType.solid; unchecked { cpos.type = (byte)-1; }
     cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
     if (message != "")
     {
         message = message.ToLower();
         message = " " + message;
         for (int i = 0; i < opMats.opBlocks.Length; i++)
         {
             if ((message.Contains(" " + Block.Name(opMats.opBlocks[i]))) || (message.Contains(" " + Block.Name(opMats.regBlocks[i]))))
             {
                 ignoreList[counter] = opMats.opBlocks[i];
                 counter += 1;
                 if (counter > ignoreList.Length - 1)
                 {
                     break;
                 }
             }
         }
         if (message.Contains("all"))   // Add spaces before an after?  Block might contain "all" in the future
         {   // User used "all"
             Blockchange2(p, p.level.width, p.level.depth, p.level.height, type);
             return;
         }
     }
     // Code will only be reached if user message doesn't contain "all"
     p.SendMessage("Place two blocks to determine the edges.");
     p.ClearBlockchange();
     p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
 }
Ejemplo n.º 5
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     int number = message.Split(' ').Length;
     if (number > 2) { Help(p); return; }
     if (number == 2)
     {
         int pos = message.IndexOf(' ');
         string t = message.Substring(0, pos).ToLower();
         string s = message.Substring(pos + 1).ToLower();
         byte type = Block.Byte(t);
         if (type == 255) { p.SendMessage("There is no block \"" + t + "\"."); return; }
         SolidType solid;
         if (s == "solid") { solid = SolidType.solid; }
         else if (s == "hollow") { solid = SolidType.hollow; }
         else { Help(p); return; }
         CatchPos cpos = new CatchPos(); cpos.solid = solid; cpos.type = type;
         cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
     }
     else if (message != "")
     {
         SolidType solid = SolidType.solid;
         message = message.ToLower();
         byte type; unchecked { type = (byte)-1; }
         if (message == "solid") { solid = SolidType.solid; }
         else if (message == "hollow") { solid = SolidType.hollow; }
         else
         {
             byte t = Block.Byte(message);
             if (t == 255) { p.SendMessage("There is no block \"" + t + "\"."); return; }
             type = t;
         } CatchPos cpos = new CatchPos(); cpos.solid = solid; cpos.type = type;
         cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
     }
     else
     {
         CatchPos cpos = new CatchPos(); cpos.solid = SolidType.solid; unchecked { cpos.type = (byte)-1; }
         cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
     }
     p.SendMessage("Place two blocks to determine the edges.");
     p.ClearBlockchange();
     p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
 }
Ejemplo n.º 6
0
 // Code to run when used by a player
 public override void Use(Player p, string message)
 {
     int number = message.Split(' ').Length;
     if (number > 2) { Help(p); return; }
     // example, /cuboid op_white walls
     if (number == 2)
     {
         int pos = message.IndexOf(' ');
         string t = message.Substring(0, pos).ToLower();
         string s = message.Substring(pos + 1).ToLower();
         byte type = Block.Byte(t);
         if (type == 255) { p.SendMessage("There is no block \"" + t + "\"."); return; }
         if (Server.advbuilders.Contains(p.name))
         {
             if (!Block.Placable(type) && !Block.AdvPlacable(type)) { p.SendMessage("Your not allowed to place that."); return; }
         }
         SolidType solid;
         if (s == "solid") { solid = SolidType.solid; }
         else if (s == "hollow") { solid = SolidType.hollow; }
         else if (s == "walls") { solid = SolidType.walls; }
         else { Help(p); return; }
         CatchPos cpos = new CatchPos(); cpos.solid = solid; cpos.type = type;
         cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
     }
     // Example, /cuboid op_white
     // Example, /cuboid walls
     else if (message != "")
     {
         SolidType solid = SolidType.solid;
         message = message.ToLower();
         byte type; unchecked { type = (byte) -1; }
         if (message == "solid") { solid = SolidType.solid; }
         else if (message == "hollow") { solid = SolidType.hollow; }
         else if (message == "walls") { solid = SolidType.walls; }
         else
         {
             byte t = Block.Byte(message);
             if (t == 255) { p.SendMessage("There is no block \"" + message + "\"."); return; }
             if (p.Rank == GroupEnum.AdvBuilder)
             {
                 if (!Block.Placable(t) && !Block.AdvPlacable(t)) { p.SendMessage("Your not allowed to place that."); return; }
             }
             type = t;
         } CatchPos cpos = new CatchPos(); cpos.solid = solid; cpos.type = type;
         cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
     }
     // Example, /cuboid
     // Take currently held block
     else
     {
         CatchPos cpos = new CatchPos(); cpos.solid = SolidType.solid; unchecked { cpos.type = (byte) -1; }
         cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos;
     }
     p.SendMessage("Place two blocks to determine the edges.");
     p.ClearBlockchange();
     p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
 }