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

            type = type < 128 ? p.bindings[type] : type;

            string[] parts = cpos.message.Split(trimChars, 3);
            if (parts.Length < 2)
            {
                Help(p); return;
            }

            byte extTile = 0;
            byte tile    = DrawCmd.GetBlock(p, parts[0], out extTile);

            if (tile == Block.Zero)
            {
                return;
            }
            string brushName = CmdBrush.FindBrush(parts[1]);

            if (brushName == null)
            {
                Player.SendMessage(p, "No brush found with name \"" + parts[1] + "\".");
                Player.SendMessage(p, "Available brushes: " + CmdBrush.AvailableBrushes);
                return;
            }

            string    brushMessage = parts.Length > 2 ? parts[2].ToLower() : "";
            BrushArgs args         = new BrushArgs(p, brushMessage, type, extType);
            Brush     brush        = Brush.Brushes[brushName](args);

            if (brush == null)
            {
                return;
            }

            DrawOp drawOp = null;

            if (ReplaceNot)
            {
                drawOp = new ReplaceNotDrawOp(tile, extTile);
            }
            else
            {
                drawOp = new ReplaceDrawOp(tile, extTile);
            }

            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);
            }
        }
コード例 #2
0
ファイル: CmdTree.cs プロジェクト: Peteys93/MCGalaxy
        static Brush ParseBrush(string brushMsg, Player p, byte type, byte extType)
        {
            string[] parts     = brushMsg.Split(trimChars, 2);
            string   brushName = CmdBrush.FindBrush(parts[0]);

            if (brushName == null)
            {
                Player.SendMessage(p, "No brush found with name \"" + parts[0] + "\".");
                Player.SendMessage(p, "Available brushes: " + CmdBrush.AvailableBrushes);
                return(null);
            }

            string    brushMessage = parts.Length >= 2 ? parts[1].ToLower() : "";
            BrushArgs args         = new BrushArgs(p, brushMessage, type, extType);

            return(Brush.Brushes[brushName](args));
        }