コード例 #1
0
        void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
        {
            CatchPos cpos = (CatchPos)p.blockchangeObject;

            RevertAndClearState(p, x, y, z);
            int       offX = p.copyoffset[0] + x, offY = p.copyoffset[1] + y, offZ = p.copyoffset[2] + z;
            CopyState state = p.CopyBuffer;

            if (state.X != state.OriginX)
            {
                offX -= (state.Width - 1);
            }
            if (state.Y != state.OriginY)
            {
                offY -= (state.Height - 1);
            }
            if (state.Z != state.OriginZ)
            {
                offZ -= (state.Length - 1);
            }

            DrawOp op;

            if (cpos.message == "")
            {
                op = new SimplePasteDrawOp();
                ((SimplePasteDrawOp)op).CopyState = p.CopyBuffer;
            }
            else
            {
                op = new PasteDrawOp();
                ((PasteDrawOp)op).CopyState = p.CopyBuffer;
                string[] args = cpos.message.Split(' ');
                if (args[0].CaselessEq("not"))
                {
                    ((PasteDrawOp)op).Exclude = ReplaceBrush.GetBlocks(p, 1, args.Length, args);
                }
                else
                {
                    ((PasteDrawOp)op).Include = ReplaceBrush.GetBlocks(p, 0, args.Length, args);
                }
            }

            if (!DrawOp.DoDrawOp(op, null, p, (ushort)offX, (ushort)offY, (ushort)offZ, 0, 0, 0))
            {
                return;
            }
            if (p.staticCommands)
            {
                p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
            }
        }
コード例 #2
0
ファイル: ReplaceCmd.cs プロジェクト: Peteys93/MCGalaxy
        public override void Use(Player p, string message)
        {
            ushort x2 = (ushort)(p.level.Width - 1);
            ushort y2 = (ushort)(p.level.Height - 1);
            ushort z2 = (ushort)(p.level.Length - 1);

            BrushArgs args  = new BrushArgs(p, message.ToLower(), 0, 0);
            Brush     brush = ReplaceBrush.Process(args);

            if (brush == null)
            {
                return;
            }

            DrawOp drawOp = new CuboidDrawOp();

            if (!DrawOp.DoDrawOp(drawOp, brush, p, 0, 0, 0, x2, y2, z2))
            {
                return;
            }
            Player.SendMessage(p, "&4/replaceall finished!");
        }
コード例 #3
0
ファイル: ReplaceCmd.cs プロジェクト: Peteys93/MCGalaxy
        void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
        {
            RevertAndClearState(p, x, y, z);
            CatchPos  cpos  = (CatchPos)p.blockchangeObject;
            BrushArgs args  = new BrushArgs(p, cpos.message, type, extType);
            Brush     brush = ReplaceNot ? ReplaceNotBrush.Process(args) : ReplaceBrush.Process(args);

            if (brush == null)
            {
                return;
            }

            DrawOp drawOp = new CuboidDrawOp();

            if (!DrawOp.DoDrawOp(drawOp, brush, p, cpos.x, cpos.y, cpos.z, x, y, z))
            {
                return;
            }
            if (p.staticCommands)
            {
                p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
            }
        }