Ejemplo n.º 1
0
        public override void Use(Player p, string message)
        {
            message = message.ToLower();
            string[] parts = message.SplitSpaces();

            DrawArgs dArgs = new DrawArgs();

            dArgs.Message = message;
            dArgs.Player  = p;
            dArgs.Mode    = GetMode(parts);
            dArgs.Op      = GetDrawOp(dArgs);
            if (dArgs.Op == null)
            {
                return;
            }

            // Validate the brush syntax is correct
            BrushFactory factory = MakeBrush(dArgs);
            BrushArgs    bArgs   = new BrushArgs(p, dArgs.BrushArgs, dArgs.Block);

            if (!factory.Validate(bArgs))
            {
                return;
            }

            Player.Message(p, PlaceMessage);
            p.MakeSelection(MarksCount, "Selecting region for %S" + dArgs.Op.Name, dArgs, DoDraw);
        }
Ejemplo n.º 2
0
        public override void Use(Player p, string message)
        {
            if (Player.IsSuper(p))
            {
                MessageInGameOnly(p); return;
            }
            message = message.ToLower();
            string[] parts = message.Split(' ');

            DrawArgs dArgs = default(DrawArgs);

            dArgs.Message = message;
            dArgs.Player  = p;
            dArgs.Mode    = GetMode(parts);
            dArgs.Op      = GetDrawOp(dArgs);
            if (dArgs.Op == null)
            {
                return;
            }

            // Validate the brush syntax is correct
            int          offset  = 0;
            BrushFactory factory = BrushFactory.Find(GetBrush(p, dArgs, ref offset));
            BrushArgs    bArgs   = GetBrushArgs(dArgs, offset);

            if (!factory.Validate(bArgs))
            {
                return;
            }

            Player.Message(p, PlaceMessage);
            p.MakeSelection(MarksCount, dArgs, DoDraw);
        }
Ejemplo n.º 3
0
        bool ValidateArgs(Player p, string[] args)
        {
            if (args.Length < 2)
            {
                Help(p); return(false);
            }

            byte extBlock = 0;
            int  block    = DrawCmd.GetBlockIfAllowed(p, args[0], out extBlock);

            if (block == -1)
            {
                return(false);
            }

            BrushFactory factory = BrushFactory.Find(args[1]);

            if (factory == null)
            {
                Player.Message(p, "No brush found with name \"{0}\".", args[1]);
                Player.Message(p, "Available brushes: " + BrushFactory.Available);
                return(false);
            }

            string brushMessage = args.Length > 2 ? args[2] : "";
            byte   held, extHeld;

            held = p.GetActualHeldBlock(out extHeld);
            BrushArgs bArgs = new BrushArgs(p, brushMessage, held, extHeld);

            return(factory.Validate(bArgs));
        }
Ejemplo n.º 4
0
        public override void Use(Player p, string message, CommandData data)
        {
            DrawArgs dArgs = MakeArgs(p, message);

            if (dArgs.Op == null)
            {
                return;
            }

            // Validate the brush syntax is correct
            BrushFactory factory = MakeBrush(dArgs);
            BrushArgs    bArgs   = new BrushArgs(p, dArgs.BrushArgs, dArgs.Block);

            if (!factory.Validate(bArgs))
            {
                return;
            }

            p.Message(PlaceMessage);
            p.MakeSelection(MarksCount, "Selecting " + SelectionType + " for &S" + dArgs.Op.Name, dArgs, DoDraw);
        }