Esempio n. 1
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            //base.acceptInput(verb, args);

            BotClient Client   = TheBotClient;
            string    onlyShow = "";

            args.SetValue("--kill", true);
            bool thread   = args.IsTrue("--thread");
            bool queue    = args.IsTrue("--queue");
            bool all      = args.IsTrue("--all");
            bool current  = args.IsTrue("--current");
            bool movement = args.IsTrue("--movement");
            bool pointing = args.IsTrue("--pointing");

            ThreadCommand.ExecuteRequestProc(args, this);
            if (all)
            {
                current  = true;
                movement = true;
                pointing = true;
            }
            if (current && TheSimAvatar.CurrentAction != null)
            {
                WriteLine("Killing " + TheSimAvatar.CurrentAction);
                TheSimAvatar.CurrentAction = null;
                IncrResult("killed", 1);
            }
            if (movement)
            {
                WriteLine("Killing movement");
                WorldSystem.TheSimAvatar.StopMoving();
            }
            if (pointing)
            {
                Client.ExecuteCommand("pointat", args.CallerAgent, WriteLine, CMDFLAGS.Backgrounded);
            }
            return(Success("Stopped " + base.ResultValue("killed")));
        }
Esempio n. 2
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            //base.acceptInput(verb, args);

            BotClient Client = TheBotClient;
            string onlyShow = "";
            args.SetValue("--kill", true);
            bool thread = args.IsTrue("--thread");
            bool queue = args.IsTrue("--queue");
            bool all = args.IsTrue("--all");
            bool current = args.IsTrue("--current");
            bool movement = args.IsTrue("--movement");
            bool pointing = args.IsTrue("--pointing");

            ThreadCommand.ExecuteRequestProc(args, this);
            if (all)
            {
                current = true;
                movement = true;
                pointing = true;
            }
            if (current && TheSimAvatar.CurrentAction != null)
            {
                WriteLine("Killing " + TheSimAvatar.CurrentAction);
                TheSimAvatar.CurrentAction = null;
                IncrResult("killed", 1);
            }
            if (movement)
            {
                WriteLine("Killing movement");
                WorldSystem.TheSimAvatar.StopMoving();
            }
            if (pointing)
            {
                Client.ExecuteCommand("pointat", args.CallerAgent, WriteLine, CMDFLAGS.Backgrounded);
            }
            return Success("Stopped " + base.ResultValue("killed"));
        }
Esempio n. 3
0
        public static CmdResult ExecuteRequestProc(CmdRequest args, Command cmd)
        {
            if (!args.ContainsKey("to"))
            {
                args.SetValue("to", "verb");
            }

            ;
            if (!cmd.Client.IsLoggedInAndReady)
            {
                return(cmd.Failure("Not yet logged in!"));
            }
            var TheSimAvatar = cmd.WorldSystem.TheSimAvatar;

            if (TheSimAvatar.IsSitting && !TheSimAvatar.IsDrivingVehical)
            {
                cmd.WriteLine("$bot is standing up before moving.");
                TheSimAvatar.StandUp();
                // WriteLine("$bot is sitting, Please stand up to move.");
            }
            SimPosition position;

            if (!args.TryGetValue("to", out position))
            {
                return(cmd.Failure("I don't understand how to move " + args.str));
            }
            if (position == null)
            {
                return(cmd.Failure("Coulnd not resolve location: " + args.str));
            }
            if (!position.IsRegionAttached)
            {
                return(cmd.Failure("!IsRegionAttached: " + position));
            }
            if (position.SimPosition == Vector3.Zero)
            {
                return(cmd.Failure("SimPosition.Zero: " + position));
            }
            Vector3d delta0 = position.GlobalPosition - TheSimAvatar.GlobalPosition;
            Vector3  delta  = new Vector3((float)delta0.X, (float)delta0.Y, (float)delta0.Z);

            float fnd;

            if (args.TryGetValue("dist", out fnd))
            {
                delta.Normalize();
                delta    = delta * fnd;
                position = new SimOffsetPosition(TheSimAvatar, delta);
            }

            MovementProceedure proc;
            bool salientProc = args.TryGetValue("sproc", out proc);

            if (salientProc)
            {
                TheSimAvatar.SalientMovementProceedure = proc;
            }

            if (args.TryGetValue("proc", out proc))
            {
                TheSimAvatar.SimpleMoveToMovementProceedure = proc;
            }

            Vector3d g = position.GlobalPosition;

            TheSimAvatar.SetClient(cmd.TheBotClient);
            if (salientProc)
            {
                return(cmd.Result(string.Format("SalientGoto: {0},{1},{2}", position, g, position.SimPosition),
                                  TheSimAvatar.SalientGoto(position)));
            }
            else
            {
                TheSimAvatar.SetMoveTarget(position, position.GetSizeDistance());
            }
            //Client.Self.AutoPilot(g.X, g.Y, g.Z);
            // MoveThread = new Thread(MoveProc);
            return(cmd.Success(string.Format("SetMoveTarget: {0},{1},{2}", position, g, position.SimPosition)));
        }
Esempio n. 4
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     args.SetValue("sproc", MovementProceedure.AStar);
     return(MoveToCommand.ExecuteRequestProc(args, this));
 }
Esempio n. 5
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     args.SetValue("sproc", MovementProceedure.AStar);
     return MoveToCommand.ExecuteRequestProc(args, this);
 }
Esempio n. 6
0
        public static CmdResult ExecuteRequestProc(CmdRequest args, Command cmd)
        {
            if (!args.ContainsKey("to"))
                args.SetValue("to", "verb");

            ;
            if (!cmd.Client.IsLoggedInAndReady)
            {
                return cmd.Failure("Not yet logged in!");
            }
            var TheSimAvatar = cmd.WorldSystem.TheSimAvatar;

            if (TheSimAvatar.IsSitting && !TheSimAvatar.IsDrivingVehical)
            {
                cmd.WriteLine("$bot is standing up before moving.");
                TheSimAvatar.StandUp();
                // WriteLine("$bot is sitting, Please stand up to move.");
            }
            SimPosition position;
            if (!args.TryGetValue("to", out position))
            {
                return cmd.Failure("I don't understand how to move " + args.str);
            }
            if (position == null)
            {
                return cmd.Failure("Coulnd not resolve location: " + args.str);
            }
            if (!position.IsRegionAttached)
            {
                return cmd.Failure("!IsRegionAttached: " + position);
            }
            if (position.SimPosition == Vector3.Zero)
            {
                return cmd.Failure("SimPosition.Zero: " + position);
            }
            Vector3d delta0 = position.GlobalPosition - TheSimAvatar.GlobalPosition;
            Vector3 delta = new Vector3((float) delta0.X, (float) delta0.Y, (float) delta0.Z);

            float fnd;
            if (args.TryGetValue("dist", out fnd))
            {
                delta.Normalize();
                delta = delta*fnd;
                position = new SimOffsetPosition(TheSimAvatar, delta);
            }

            MovementProceedure proc;
            bool salientProc = args.TryGetValue("sproc", out proc);
            if (salientProc)
            {
                TheSimAvatar.SalientMovementProceedure = proc;
            }

            if (args.TryGetValue("proc", out proc))
            {
                TheSimAvatar.SimpleMoveToMovementProceedure = proc;
            }

            Vector3d g = position.GlobalPosition;
            TheSimAvatar.SetClient(cmd.TheBotClient);
            if (salientProc)
            {
                return cmd.Result(string.Format("SalientGoto: {0},{1},{2}", position, g, position.SimPosition),
                                  TheSimAvatar.SalientGoto(position));
            }
            else
            {
                TheSimAvatar.SetMoveTarget(position, position.GetSizeDistance());
            }
            //Client.Self.AutoPilot(g.X, g.Y, g.Z);
            // MoveThread = new Thread(MoveProc);
            return cmd.Success(string.Format("SetMoveTarget: {0},{1},{2}", position, g, position.SimPosition));
        }