Ejemplo n.º 1
0
        protected override DrawOp GetDrawOp(DrawArgs dArgs)
        {
            AdvDrawOp op = null;

            switch (dArgs.Mode)
            {
            case DrawMode.cone: op = new AdvConeDrawOp(); break;

            case DrawMode.hcone: op = new AdvHollowConeDrawOp(); break;

            case DrawMode.icone: op = new AdvConeDrawOp(true); break;

            case DrawMode.hicone: op = new AdvHollowConeDrawOp(true); break;

            case DrawMode.pyramid: op = new AdvPyramidDrawOp(); break;

            case DrawMode.hpyramid: op = new AdvHollowPyramidDrawOp(); break;

            case DrawMode.ipyramid: op = new AdvPyramidDrawOp(true); break;

            case DrawMode.hipyramid: op = new AdvHollowPyramidDrawOp(true); break;

            case DrawMode.sphere: op = new AdvSphereDrawOp(); break;

            case DrawMode.hsphere: op = new AdvHollowSphereDrawOp(); break;

            case DrawMode.volcano: op = new AdvVolcanoDrawOp(); break;
            }
            if (op == null)
            {
                Help(dArgs.Player); return(null);
            }

            // Validate radius/height when the user first uses the command
            int radius = 0, height = 0;

            string[] args = dArgs.Message.SplitSpaces();
            if ((op.UsesHeight && !CheckTwoArgs(dArgs.Player, ref radius, ref height, args)) ||
                (!op.UsesHeight && !CheckOneArg(dArgs.Player, ref radius, args)))
            {
                return(null);
            }
            return(op);
        }
Ejemplo n.º 2
0
        protected override DrawOp GetDrawOp(DrawArgs dArgs)
        {
            AdvDrawOp op = null;

            switch (dArgs.Mode)
            {
            case DrawMode.cone:   op = new AdvConeDrawOp(); break;

            case DrawMode.hcone:  op = new AdvHollowConeDrawOp(); break;

            case DrawMode.icone:  op = new AdvConeDrawOp(true); break;

            case DrawMode.hicone: op = new AdvHollowConeDrawOp(true); break;

            case DrawMode.pyramid:   op = new AdvPyramidDrawOp(); break;

            case DrawMode.hpyramid:  op = new AdvHollowPyramidDrawOp(); break;

            case DrawMode.ipyramid:  op = new AdvPyramidDrawOp(true); break;

            case DrawMode.hipyramid: op = new AdvHollowPyramidDrawOp(true); break;

            case DrawMode.sphere:  op = new AdvSphereDrawOp(); break;

            case DrawMode.hsphere: op = new AdvHollowSphereDrawOp(); break;

            case DrawMode.volcano: op = new AdvVolcanoDrawOp(); break;
            }
            if (op == null)
            {
                Help(dArgs.Player); return(null);
            }

            AdvDrawMeta meta    = new AdvDrawMeta();
            bool        success = false;

            string[] args = dArgs.Message.SplitSpaces();
            Player   p    = dArgs.Player;

            if (op.UsesHeight)
            {
                if (args.Length < 3)
                {
                    p.Message("You need to provide the radius and the height for the {0}.", args[0]);
                }
                else
                {
                    success = CommandParser.GetInt(p, args[1], "radius", ref meta.radius, 0, 2000) &&
                              CommandParser.GetInt(p, args[2], "height", ref meta.height, 0, 2000);
                }
            }
            else
            {
                if (args.Length < 2)
                {
                    p.Message("You need to provide the radius for the {0}.", args[0]);
                }
                else
                {
                    success = CommandParser.GetInt(p, args[1], "radius", ref meta.radius, 0, 2000);
                }
            }

            if (!success)
            {
                return(null);
            }
            dArgs.Meta = meta;
            return(op);
        }
Ejemplo n.º 3
0
        protected override void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
        {
            RevertAndClearState(p, x, y, z);
            CatchPos cpos = (CatchPos)p.blockchangeObject;

            GetRealBlock(type, extType, p, ref cpos);
            AdvDrawOp op = null;

            switch (cpos.mode)
            {
            case DrawMode.cone:
                op = new AdvConeDrawOp(); break;

            case DrawMode.hcone:
                op = new AdvHollowConeDrawOp(); break;

            case DrawMode.icone:
                op = new AdvConeDrawOp(); op.Invert = true; break;

            case DrawMode.hicone:
                op = new AdvHollowConeDrawOp(); op.Invert = true; break;

            case DrawMode.pyramid:
                op = new AdvPyramidDrawOp(); break;

            case DrawMode.hpyramid:
                op = new AdvHollowPyramidDrawOp(); break;

            case DrawMode.ipyramid:
                op = new AdvPyramidDrawOp(); op.Invert = true; break;

            case DrawMode.hipyramid:
                op = new AdvHollowPyramidDrawOp(); op.Invert = true; break;

            case DrawMode.sphere:
                op = new AdvSphereDrawOp(); op.Invert = true; break;

            case DrawMode.hsphere:
                op = new AdvHollowSphereDrawOp(); op.Invert = true; break;

            case DrawMode.volcano:
                op = new AdvVolcanoDrawOp(); break;

            default:
                Help(p); return;
            }
            string[] args = cpos.message.Split(' ');
            if ((op.UsesHeight && !CheckTwoArgs(p, op, args)) ||
                (!op.UsesHeight && !CheckOneArg(p, op, args)))
            {
                return;
            }

            int   brushOffset = op.UsesHeight ? 3 : 2;
            Brush brush       = GetBrush(p, cpos, brushOffset);

            if (brush == null)
            {
                return;
            }
            if (!DrawOp.DoDrawOp(op, brush, p, new [] { new Vec3U16(x, y, z) }))
            {
                return;
            }
            if (p.staticCommands)
            {
                p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
            }
        }