public override CmdResult ExecuteRequest(CmdRequest args)
        {
            BotClient Client = TheBotClient;

            if (Client.IsLoggedInAndReady)
            {
                return(Success("Already logged in"));
            }
            {
                string value;
                if (args.TryGetValue("first", out value))
                {
                    Client.BotLoginParams.FirstName = value;
                }
                if (args.TryGetValue("last", out value))
                {
                    Client.BotLoginParams.LastName = value;
                }
                if (args.TryGetValue("pass", out value))
                {
                    Client.BotLoginParams.Password = value;
                }
                if (args.TryGetValue("loginuri", out value))
                {
                    Radegast.GridManager gm = new GridManager();
                    gm.LoadGrids();
                    string url  = value;
                    string find = url.ToLower();
                    foreach (var grid in gm.Grids)
                    {
                        if (find == grid.Name.ToLower() || find == grid.ID.ToLower())
                        {
                            url = grid.LoginURI;
                        }
                    }
                    Client.BotLoginParams.URI = url;
                }
                if (args.TryGetValue("location", out value))
                {
                    Client.BotLoginParams.Start = value;
                }
                if (!Client.Network.Connected && !Client.Network.LoginMessage.StartsWith("Logging"))
                {
                    Client.Settings.LOGIN_SERVER = TheBotClient.BotLoginParams.URI;
                    // ClientManager.SingleInstance.config.simURL; // "http://127.0.0.1:8002/";
                    ///                    Client.Network.Login(Client.BotLoginParams.FirstName, Client.BotLoginParams.LastName, Client.BotLoginParams.Password, "OnRez", "UNR");
                    WriteLine("$bot beginning login");
                    Client.Login();
                    WriteLine("$bot started login");
                }
                else
                {
                    return(Success("$bot is already logged in."));
                }
            }
            return(Success("loging in..."));
        }
示例#2
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length == 0)
            {
                return(ShowUsage());
            }
            SimObject o;

            if (!args.TryGetValue("target", out o))
            {
                return(Failure(string.Format("Cant find {0}", args.str)));
            }
            bool      isObject    = !(o is SimAvatar);
            UUID      target      = o.ID;
            Primitive currentPrim = o.Prim;

            if (currentPrim == null)
            {
                return(Failure(string.Format("No Prim localId for {0}", args.str)));
            }
            Primitive.ObjectProperties props = o.Properties;
            WorldObjects.EnsureSelected(currentPrim, WorldSystem.GetSimulator(currentPrim));
            if (props == null)
            {
                return(Failure("no props on " + o + " yet try again"));
            }
            GridClient client = TheBotClient;
            string     strA;

            if (!args.TryGetValue("ammount", out strA))
            {
                return(Success(string.Format("saletype {0} {1} {2}", o.ID, props.SalePrice, props.SaleType)));
            }
            int amount;

            strA = strA.Replace("$", "").Replace("L", "");
            if (!int.TryParse(strA, out amount))
            {
                return(Failure("Cant determine amount from: " + strA));
            }
            SaleType saletype;

            if (!args.TryGetValue("saletype", out saletype))
            {
                saletype = SaleType.Original;
                //return Failure("Cant determine SaleType: " + strA);
            }

            WriteLine("Setting Ammount={0} SaleType={1} for {2}", saletype, amount, o);
            TheBotClient.Objects.SetSaleInfo(WorldSystem.GetSimulator(currentPrim), currentPrim.LocalID, saletype,
                                             amount);

            return(Success(Name + " on " + o));
        }
示例#3
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     BotClient Client = TheBotClient;
     if (Client.IsLoggedInAndReady) return Success("Already logged in");
     {
         string value;
         if (args.TryGetValue("first", out value))
         {
             Client.BotLoginParams.FirstName = value;
         }
         if (args.TryGetValue("last", out value))
         {
             Client.BotLoginParams.LastName = value;
         }
         if (args.TryGetValue("pass", out value))
         {
             Client.BotLoginParams.Password = value;
         }
         if (args.TryGetValue("loginuri", out value))
         {
             Radegast.GridManager gm = new GridManager();
             gm.LoadGrids();
             string url = value;
             string find = url.ToLower();
             foreach (var grid in gm.Grids)
             {
                 if (find == grid.Name.ToLower() || find == grid.ID.ToLower())
                 {
                     url = grid.LoginURI;
                 }
             }
             Client.BotLoginParams.URI = url;
         }
         if (args.TryGetValue("location", out value))
         {
             Client.BotLoginParams.Start = value;
         }
         if (!Client.Network.Connected && !Client.Network.LoginMessage.StartsWith("Logging"))
         {
             Client.Settings.LOGIN_SERVER = TheBotClient.BotLoginParams.URI;
                 // ClientManager.SingleInstance.config.simURL; // "http://127.0.0.1:8002/";
             ///                    Client.Network.Login(Client.BotLoginParams.FirstName, Client.BotLoginParams.LastName, Client.BotLoginParams.Password, "OnRez", "UNR");
             WriteLine("$bot beginning login");
             Client.Login();
             WriteLine("$bot started login");
         }
         else
             return Success("$bot is already logged in.");
     }
     return Success("loging in...");
 }
示例#4
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 2)
                return ShowUsage();
            string str = Parser.Rejoin(args, 0);
            int argcount;
            float maxSeconds;
            if (!args.TryGetValue("seconds", out maxSeconds))
            {
                maxSeconds = 60000;
            }
            SimPosition pos;
            if (!args.TryGetValue("position", out pos))
            {
                return Failure(String.Format("Cannot {0} to {1}", Name, String.Join(" ", args)));
            }

            DateTime waitUntil = DateTime.Now.Add(TimeSpan.FromSeconds(maxSeconds));
            double maxDistance = pos.GetSizeDistance();
            if (maxDistance < 1) maxDistance = 1;

            bool MadIt = false;
            while (waitUntil > DateTime.Now)
            {
                var gp1 = pos.GlobalPosition;
                var gp2 = TheSimAvatar.GlobalPosition;
                if (Math.Abs(gp1.Z - gp2.Z) < 2) gp1.Z = gp2.Z;
                // do it antyways
                gp1.Z = gp2.Z;
                double cdist = Vector3d.Distance(gp1, gp2);
                if (cdist <= maxDistance)
                {
                    MadIt = true;
                    break;
                }
                else
                {
                    Thread.Sleep(100);
                }
            }
            if (MadIt)
            {
                return Success(string.Format("SUCCESS {0}", str));
            }
            else
            {
                return Failure("FAILED " + str);
            }
        }
示例#5
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length > 0)
            {
                try
                {
                    string treeName = args[0].Trim(new char[] {' '});
                    Tree tree = (Tree) 0;
                    if (!args.TryGetValue("tree", out tree))
                    {
                        object value;
                        int argsUsed;
                        if (TryEnumParse(typeof (Tree), args, 0, out argsUsed, out value))
                        {
                            tree = (Tree) value;
                        }
                    }

                    Vector3 treePosition = GetSimPosition();
                    treePosition.Z += 3.0f;
                    Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
                    Client.Objects.AddTree(Client.Network.CurrentSim, size,
                                           Quaternion.Identity, treePosition, tree, TheBotClient.GroupID, false);

                    return Success("Attempted to rez a " + treeName + " tree");
                }
                catch (Exception e)
                {
                    return Failure("" + e);
                }
            }
            return ShowUsage();
        }
示例#6
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     string verb = args.CmdName;
     // base.acceptInput(verb, args);
     UUID primID = UUID.Zero;
     SimActor TheSimAvatar = this.TheSimAvatar;
     if (verb == "stop-following")
     {
         // SimPosition ap = TheSimAvatar.ApproachPosition;
         if (TheSimAvatar.CurrentAction is MoveToLocation)
         {
             TheSimAvatar.CurrentAction = null;
         }
         TheSimAvatar.SetMoveTarget(null, 10);
         TheSimAvatar.StopMoving();
     }
     SimPosition position;
     if (!args.TryGetValue("target", out position))
     {
         return Failure("$bot don't know who " + args.GetString("target") + " is.");
     }
     {
         if (position != null)
         {
             String str = "" + Client + " start to follow " + position + ".";
             WriteLine(str);
             // The thread that accepts the Client and awaits messages
             TheSimAvatar.CurrentAction = new FollowerAction(TheSimAvatar, position);
             return Success("$bot started following " + position);
         }
     }
     {
         return Success("$bot ApproachPosition: " + TheSimAvatar.CurrentAction);
     }
 }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            List <SimObject> PS;

            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                return(Failure("Cannot find objects from " + args.GetString("targets")));
            }
            {
                int nfound = 0;
                foreach (var prim in PS)
                {
                    Client.Self.SendTeleportLure(prim.ID);
                    AddSuccess(Name + ": " + prim);
                    nfound++;
                }
                if (nfound > 0)
                {
                    return(Success(Name + " found: " + nfound + " object/agent(s)"));
                }
            }
            string user = args.str;
            UUID   id   = WorldSystem.GetUserID(user);

            if (id == UUID.Zero)
            {
                return(Failure("Cannot find " + user));
            }
            Client.Self.SendTeleportLure(id);
            return(Success("teleport Lure sent to " + user));
        }
示例#8
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            bool moveInsteadOfCopy = args.IsTrue("--move");

            if (!args.ContainsKey("items") || !args.ContainsKey("to"))
            {
                return(ShowUsage());
            }
            int argsUsed;
            List <SimObject> allTargets;

            if (!args.TryGetValue("to", out allTargets))
            {
                return(Failure("Cannot find avatar/objects 'to' give to"));
            }

            Success("Going to give to " + allTargets.Count + " avatar/objects");

            var man   = Client.BotInventory;
            var found = man.FindAll(args.GetProperty("items"), false,
                                    inventoryName => Failure("No inventory item named " + inventoryName + " found."));

            int given = 0;

            foreach (var dest in allTargets)
            {
                foreach (InventoryBase item in found)
                {
                    GiveAll(man, item, dest, moveInsteadOfCopy);
                }
            }
            return(SuccessOrFailure());
        }
示例#9
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            bool moveInsteadOfCopy = args.IsTrue("--move");
            if (!args.ContainsKey("items") || !args.ContainsKey("to"))
            {
                return ShowUsage();
            }
            int argsUsed;
            List<SimObject> allTargets;
            if (!args.TryGetValue("to", out allTargets))
            {
                return Failure("Cannot find avatar/objects 'to' give to");
            }

            Success("Going to give to " + allTargets.Count + " avatar/objects");

            var man = Client.BotInventory;
            var found = man.FindAll(args.GetProperty("items"), false,
                                    inventoryName => Failure("No inventory item named " + inventoryName + " found."));

            int given = 0;
            foreach (var dest in allTargets)
            {
                foreach (InventoryBase item in found)
                {
                    GiveAll(man, item, dest, moveInsteadOfCopy);
                }
            }
            return SuccessOrFailure();
        }
示例#10
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length == 0)
            {
                return ShowUsage();
            }

            List<SimObject> PS;
            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                return Failure("Cannot find objects from " + args.GetString("targets"));
            }
            foreach (var o in PS)
            {
                //SimObject o = WorldSystem.GetSimObject(currentPrim);
                Primitive.ObjectProperties Properties = o.Properties;
                if (Properties == null)
                {
                    Failure("Still waiting on properties for " + o);
                    continue;
                }
                GridClient client = TheBotClient;
                client.Objects.BuyObject(o.GetSimulator(), o.LocalID, Properties.SaleType,
                                         Properties.SalePrice, client.Self.ActiveGroup,
                                         client.Inventory.FindFolderForType(AssetType.Object));
                AddSuccess(Name + " on " + o);
            }
            return SuccessOrFailure();
        }
示例#11
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage(); // " siton UUID";

            int argsUsed;
            SimPosition pos;
            if (!args.TryGetValue("on", out pos))
            {
                sittingOnGround = WorldSystem.TheSimAvatar.SitOnGround();
                return !sittingOnGround
                           ? Failure("$bot did not yet sit on the ground.")
                           : Success("$bot sat on the ground.");
            }
            if (pos is SimObject)
            {
                if (WorldSystem.TheSimAvatar.SitOn(pos as SimObject)) Success("$bot sat on " + pos);
                if (!args.IsTrue("down")) return Failure("$bot did not yet sit on " + pos);
            }
            else if (pos == null)
            {
                return Failure("$bot did not yet find " + args.str);
            }
            // @todo use autoppoiolot to the location andf then sit
            TheSimAvatar.GotoTargetAStar(pos);
            sittingOnGround = WorldSystem.TheSimAvatar.SitOnGround();
            if (sittingOnGround) return Success("$bot sat at " + pos);
            return Failure("$bot did not sit at " + pos);
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length == 0)
            {
                return(ShowUsage());
            }

            List <SimObject> PS;

            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                return(Failure("Cannot find objects from " + args.GetString("targets")));
            }
            foreach (var o in PS)
            {
                //SimObject o = WorldSystem.GetSimObject(currentPrim);
                Primitive.ObjectProperties Properties = o.Properties;
                if (Properties == null)
                {
                    Failure("Still waiting on properties for " + o);
                    continue;
                }
                GridClient client = TheBotClient;
                client.Objects.BuyObject(o.GetSimulator(), o.LocalID, Properties.SaleType,
                                         Properties.SalePrice, client.Self.ActiveGroup,
                                         client.Inventory.FindFolderForType(AssetType.Object));
                AddSuccess(Name + " on " + o);
            }
            return(SuccessOrFailure());
        }
示例#13
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length > 0)
            {
                try
                {
                    string treeName = args[0].Trim(new char[] { ' ' });
                    Tree   tree     = (Tree)0;
                    if (!args.TryGetValue("tree", out tree))
                    {
                        object value;
                        int    argsUsed;
                        if (TryEnumParse(typeof(Tree), args, 0, out argsUsed, out value))
                        {
                            tree = (Tree)value;
                        }
                    }

                    Vector3 treePosition = GetSimPosition();
                    treePosition.Z += 3.0f;
                    Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
                    Client.Objects.AddTree(Client.Network.CurrentSim, size,
                                           Quaternion.Identity, treePosition, tree, TheBotClient.GroupID, false);

                    return(Success("Attempted to rez a " + treeName + " tree"));
                }
                catch (Exception e)
                {
                    return(Failure("" + e));
                }
            }
            return(ShowUsage());
        }
示例#14
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            bool        asLocal = args.IsTrue("--local");
            SimPosition pos, pos2;

            if (!args.TryGetValue("start", out pos))
            {
                pos = TheSimAvatar;
            }
            if (!args.TryGetValue("end", out pos2))
            {
                pos = TheSimAvatar;
            }
            Vector3d from, to;

            if (pos2 == null)
            {
                pos2 = pos;
                pos  = TheSimAvatar;
            }
            from = pos.GlobalPosition;
            to   = pos2.GlobalPosition;
            Vector3d offset = Vector3d.Zero;

            if (asLocal)
            {
                offset = pos.PathStore.GlobalStart;
            }
            bool onlyStart, faked;
            var  path = SimPathStore.GetPath(null, from, to, 1, out onlyStart, out faked);

            WriteLine("onlyStart=" + onlyStart);
            WriteLine("faked=" + faked);
            WriteLine("start=" + VectorRoundString(from - offset));
            WriteLine("end=" + VectorRoundString(to - offset));
            WriteLine("pstart=" + pos);
            WriteLine("pend=" + pos2);
            WriteLine("len=" + path.Count);
            int step = 0;

            foreach (Vector3d vector3D in path)
            {
                WriteLine("p" + step + "=" + VectorRoundString(vector3D - offset));
                step++;
            }
            return(Success("SUCCESS " + Name));
        }
示例#15
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length == 0)
            {
                return ShowUsage();
            }
            SimObject o;
            if (!args.TryGetValue("target", out o))
            {
                return Failure(string.Format("Cant find {0}", args.str));
            }
            bool isObject = !(o is SimAvatar);
            UUID target = o.ID;
            Primitive currentPrim = o.Prim;
            if (currentPrim == null) return Failure(string.Format("No Prim localId for {0}", args.str));
            Primitive.ObjectProperties props = o.Properties;
            WorldObjects.EnsureSelected(currentPrim, WorldSystem.GetSimulator(currentPrim));
            if (props == null) return Failure("no props on " + o + " yet try again");
            GridClient client = TheBotClient;
            string strA;
            if (!args.TryGetValue("ammount", out strA))
            {
                return Success(string.Format("saletype {0} {1} {2}", o.ID, props.SalePrice, props.SaleType));
            }
            int amount;
            strA = strA.Replace("$", "").Replace("L", "");
            if (!int.TryParse(strA, out amount))
            {
                return Failure("Cant determine amount from: " + strA);
            }
            SaleType saletype;
            if (!args.TryGetValue("saletype", out saletype))
            {
                saletype = SaleType.Original;
                //return Failure("Cant determine SaleType: " + strA);
            }

            WriteLine("Setting Ammount={0} SaleType={1} for {2}", saletype, amount, o);
            TheBotClient.Objects.SetSaleInfo(WorldSystem.GetSimulator(currentPrim), currentPrim.LocalID, saletype,
                                             amount);

            return Success(Name + " on " + o);
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            string str;

            if (args.TryGetValue("commandMask", out str))
            {
                SortedList <string, CommandInfo> all = null;
                if (TheBotClient != null)
                {
                    all = TheBotClient.AllCommands();
                }
                else
                {
                    all = ClientManager.SingleInstance.AllCommands();
                }
                foreach (var cmdinfo in all)
                {
                    if (cmdinfo.Value.Matches(str))
                    {
                        WriteLine(cmdinfo.Value.ToPrologString());
                    }
                }
            }
            WriteLine("GroupNames:");
            foreach (var name  in  WorldSystem.GroupNames)
            {
                WriteLine("$" + name);
            }
            WriteLine("Filters:");
            Type typesearch = typeof(SimObjectImpl);
            IEnumerable <FilterMember> filters = WorldSystem.GetFilters(typesearch);

            foreach (FilterMember fmemb in filters)
            {
                if (!fmemb.IsCollectionType)
                {
                    continue;
                }
                WriteLine(typeString(fmemb.ReturnType) + " < = "
                          + fmemb.ReflectionMember.Name + (fmemb.IsOf ? "Of" : "")
                          + typeString(fmemb.CastArgTo));
            }
            foreach (FilterMember fmemb in filters)
            {
                if (fmemb.IsCollectionType)
                {
                    continue;
                }
                WriteLine("[!]"
                          + fmemb.ReflectionMember.Name + (fmemb.IsOf ? "Of" : "")
                          + (fmemb.PreCompare ? "<>" : "")
                          + typeString(fmemb.CastArgTo));
            }
            return(Success("Help complete"));
        }
示例#17
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     if (args.Length < 0)
         return ShowUsage(); // " md5 [password]";
     int padding;
     if (!args.TryGetValue("--padding", out padding))
     {
         padding = 32;
     }
     return Success(MD5(args[0], padding));
 }
示例#18
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     SimPosition pos;
     if (!args.TryGetValue("pos", out pos)) pos = TheSimAvatar;
     SimPathStore R = pos.PathStore;
     Vector3 v3 = pos.SimPosition;
     WriteLine("SimZInfo: " + pos + " " + R.GetGroundLevel(v3.X, v3.Y));
     SimWaypoint WP = R.GetWaypointOf(v3);
     WriteLine("WaypointInfo: {0}", WP.OccupiedString(R.GetCollisionPlane(v3.Z)));
     return Success("Ran " + Name);
 }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length == 0)
            {
                return(ShowUsage());
            }
            SimObject o;

            if (!args.TryGetValue("target", out o))
            {
                return(Failure(string.Format("Cant find {0}", args.str)));
            }

            bool       isObject = !(o is SimAvatar);
            UUID       target   = o.ID;
            GridClient client   = TheBotClient;
            string     strA;

            if (!args.TryGetValue("ammount", out strA))
            {
                return(Failure("Cant determine amount from: " + strA));
            }
            else
            {
                int amount;
                strA = strA.Replace("$", "").Replace("L", "");
                if (!int.TryParse(strA, out amount))
                {
                    return(Failure("Cant determine amount from: " + strA));
                }
                if (!isObject)
                {
                    client.Self.GiveAvatarMoney(target, amount);
                }
                else
                {
                    client.Self.GiveObjectMoney(target, amount, o.Properties.Name);
                }
            }
            return(Success(Name + " on " + o));
        }
示例#20
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int argsUsed;

            if (!WorldPathSystem.MaintainMeshes)
            {
                return(Success("WorldObjects.MaintainMeshes = false for " + Name));
            }
            IEnumerable <SimObject> objs;

            if (!args.TryGetValue("targets", out objs))
            {
                objs = WorldSystem.GetAllSimObjects();
            }
            //if (argsUsed == 0)
            {
                int meshed          = 0;
                int unmeshed        = 0;
                int notNeedBeMEshed = 0;
                foreach (var o2 in objs)
                {
                    SimObjectPathFinding o = o2.PathFinding;
                    if (o.IsMeshed)
                    {
                        meshed++;
                        continue;
                    }
                    if (o.IsWorthMeshing)
                    {
                        unmeshed++;
                        continue;
                    }
                    notNeedBeMEshed++;
                }
                float total    = meshed + unmeshed;
                float totalAll = meshed + unmeshed + notNeedBeMEshed;

                return
                    (Success(
                         string.Format("IsMeshed/UnMeshed/UnNeeded = {0}/{1}/{2} {3:0%} complete for {4:0%} of Sim {5}",
                                       meshed, unmeshed, notNeedBeMEshed,
                                       meshed / total,
                                       total / totalAll,
                                       Name)));
            }
            foreach (SimObject o in objs)
            {
                WriteLine("MeshInfo: " + o);
                WriteLine(o.PathFinding.Mesh.DebugString());
            }
            return(Success("Ran " + Name));
        }
示例#21
0
        public static string GetTaskID(CmdRequest args, out bool createFresh)
        {
            createFresh = false;
            String id;

            args.TryGetValue("taskid", out id);
            if (id == "create")
            {
                createFresh = true;
                id          = BotClient.UniqueThreadID();
            }
            return(id);
        }
示例#22
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int argcount;
            SimPosition pos;
            if (!args.TryGetValue("pos", out pos)) pos = TheSimAvatar;

            Vector3d v3d = pos.GlobalPosition;
            Vector3 v3 = pos.SimPosition;
            SimAbstractMover sam = SimCollisionPlaneMover.CreateSimPathMover(WorldSystem.TheSimAvatar, pos,
                                                                             pos.GetSizeDistance());
            sam.BlockTowardsVector(v3);
            return Success("SUCCESS ");
        }
示例#23
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     UUID masterUUID;
     if (!args.TryGetValue("master", out masterUUID))
     {
         TheBotClient.MasterName = args.GetString("master");
     }
     else
     {
         TheBotClient.MasterKey = masterUUID;
     }
     return Success(string.Format("Master set to {0} ({1})", Client.MasterName, Client.MasterKey.ToString()));
 }
示例#24
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            SimPosition pos;
            if (!args.TryGetValue("pos", out pos)) pos = TheSimAvatar;
            SimPathStore R = pos.PathStore;
            Vector3 v3 = pos.SimPosition;
            WriteLine("SimZInfo: " + pos + " " + R.GetGroundLevel(v3.X, v3.Y));

#if COLLIDER_ODE  
            Vector3 landing = R.CreateAndDropPhysicalCube(v3);
            WriteLine("SimHInfo: {0}", landing);
#endif
            return Success("Ran " + Name);
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 0)
            {
                return(ShowUsage()); // " md5 [password]";
            }
            int padding;

            if (!args.TryGetValue("--padding", out padding))
            {
                padding = 32;
            }
            return(Success(MD5(args[0], padding)));
        }
示例#26
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            UUID masterUUID;

            if (!args.TryGetValue("master", out masterUUID))
            {
                TheBotClient.MasterName = args.GetString("master");
            }
            else
            {
                TheBotClient.MasterKey = masterUUID;
            }
            return(Success(string.Format("Master set to {0} ({1})", Client.MasterName, Client.MasterKey.ToString())));
        }
示例#27
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     int count = 0;
     List<SimAsset> As;
     if (args.TryGetValue("assets", out As))
     {
         foreach (var A in As)
         {
             WriteLine(A.DebugInfo());
             count++;
             continue;
         }
     }
     return Success("Shown " + count + " assets");
 }
示例#28
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     bool asLocal = args.IsTrue("--local");
     SimPosition pos, pos2;
     if (!args.TryGetValue("start", out pos)) pos = TheSimAvatar;
     if (!args.TryGetValue("end", out pos2)) pos = TheSimAvatar;
     Vector3d from, to;
     if (pos2 == null)
     {
         pos2 = pos;
         pos = TheSimAvatar;
     }
     from = pos.GlobalPosition;
     to = pos2.GlobalPosition;
     Vector3d offset = Vector3d.Zero;
     if (asLocal)
     {
         offset = pos.PathStore.GlobalStart;
     }
     bool onlyStart, faked;
     var path = SimPathStore.GetPath(null, from, to, 1, out onlyStart, out faked);
     WriteLine("onlyStart=" + onlyStart);
     WriteLine("faked=" + faked);
     WriteLine("start=" + VectorRoundString(from - offset));
     WriteLine("end=" + VectorRoundString(to - offset));
     WriteLine("pstart=" + pos);
     WriteLine("pend=" + pos2);
     WriteLine("len=" + path.Count);
     int step = 0;
     foreach (Vector3d vector3D in path)
     {
         WriteLine("p" + step + "=" + VectorRoundString(vector3D - offset));
         step++;
     }
     return Success("SUCCESS " + Name);
 }
示例#29
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length == 0)
            {
                return ShowUsage();
            }
            SimObject o;
            if (!args.TryGetValue("target", out o)) return Failure(string.Format("Cant find {0}", args.str));

            bool isObject = !(o is SimAvatar);
            UUID target = o.ID;
            GridClient client = TheBotClient;
            string strA;
            if (!args.TryGetValue("ammount", out strA))
            {
                (new frmPay(TheBotClient.TheRadegastInstance, o.ID, o.GetName(), isObject)).ShowDialog();
            }
            else
            {
                int amount;
                strA = strA.Replace("$", "").Replace("L", "");
                if (!int.TryParse(strA, out amount))
                {
                    return Failure("Cant determine amount from: " + strA);
                }
                if (!isObject)
                {
                    client.Self.GiveAvatarMoney(target, amount);
                }
                else
                {
                    client.Self.GiveObjectMoney(target, amount, o.Properties.Name);
                }
            }
            return Success(Name + " on " + o);
        }
示例#30
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int             count = 0;
            List <SimAsset> As;

            if (args.TryGetValue("assets", out As))
            {
                foreach (var A in As)
                {
                    WriteLine(A.DebugInfo());
                    count++;
                    continue;
                }
            }
            return(Success("Shown " + count + " assets"));
        }
示例#31
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int argsUsed;
            if (!WorldPathSystem.MaintainMeshes) return Success("WorldObjects.MaintainMeshes = false for " + Name);
            IEnumerable<SimObject> objs;
            if (!args.TryGetValue("targets", out objs))
            {
                objs = WorldSystem.GetAllSimObjects();
            } 
            //if (argsUsed == 0)
            {
                int meshed = 0;
                int unmeshed = 0;
                int notNeedBeMEshed = 0;
                foreach (var o2 in objs)
                {
                    SimObjectPathFinding o = o2.PathFinding;
                    if (o.IsMeshed)
                    {
                        meshed++;
                        continue;
                    }
                    if (o.IsWorthMeshing)
                    {
                        unmeshed++;
                        continue;
                    }
                    notNeedBeMEshed++;
                }
                float total = meshed + unmeshed;
                float totalAll = meshed + unmeshed + notNeedBeMEshed;

                return
                    Success(
                        string.Format("IsMeshed/UnMeshed/UnNeeded = {0}/{1}/{2} {3:0%} complete for {4:0%} of Sim {5}",
                                      meshed, unmeshed, notNeedBeMEshed,
                                      meshed/total,
                                      total/totalAll,
                                      Name));
            }
            foreach (SimObject o in objs)
            {
                WriteLine("MeshInfo: " + o);
                WriteLine(o.PathFinding.Mesh.DebugString());
            }
            return Success("Ran " + Name);
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
            {
                return(ShowUsage()); // " objectinventory [objectID]";
            }
            int argsUsed;
            List <SimObject> PS;

            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                PS = WorldSystem.GetAllSimObjects();
            }
            foreach (var found in PS)
            {
                uint objectLocalID = found.LocalID;
                UUID objectID      = found.ID;

                List <InventoryBase> items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, 1000 * 30);

                if (items != null)
                {
                    string result = String.Empty;

                    for (int i = 0; i < items.Count; i++)
                    {
                        if (items[i] is InventoryFolder)
                        {
                            result += String.Format("[Folder] Name: {0}", items[i].Name) + Environment.NewLine;
                        }
                        else
                        {
                            InventoryItem item = (InventoryItem)items[i];
                            result += String.Format("[Item] Name: {0} Desc: {1} Type: {2}", item.Name, item.Description,
                                                    item.AssetType) + Environment.NewLine;
                        }
                    }

                    AddSuccess(result);
                }
                else
                {
                    Failure("failed to download task inventory for " + objectLocalID);
                }
            }
            return(SuccessOrFailure());
        }
示例#33
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     string str;
     if (args.TryGetValue("commandMask", out str))
     {
         SortedList<string, CommandInfo> all = null;
         if (TheBotClient != null)
         {
             all = TheBotClient.AllCommands();
         }
         else
         {
             all = ClientManager.SingleInstance.AllCommands();
         }
         foreach (var cmdinfo in all)
         {
             if (cmdinfo.Value.Matches(str))
             {
                 WriteLine(cmdinfo.Value.ToPrologString());
             }
         }
     }
     WriteLine("GroupNames:");
     foreach (var name  in  WorldSystem.GroupNames)
     {
         WriteLine("$" + name);
     }
     WriteLine("Filters:");
     Type typesearch = typeof (SimObjectImpl);
     IEnumerable<FilterMember> filters = WorldSystem.GetFilters(typesearch);
     foreach (FilterMember fmemb in filters)
     {
         if (!fmemb.IsCollectionType) continue;
         WriteLine(typeString(fmemb.ReturnType) + " < = "
                   + fmemb.ReflectionMember.Name + (fmemb.IsOf ? "Of" : "")
                   + typeString(fmemb.CastArgTo));
     }
     foreach (FilterMember fmemb in filters)
     {
         if (fmemb.IsCollectionType) continue;
         WriteLine("[!]"
                   + fmemb.ReflectionMember.Name + (fmemb.IsOf ? "Of" : "")
                   + (fmemb.PreCompare ? "<>" : "")
                   + typeString(fmemb.CastArgTo));
     }
     return Success("Help complete");
 }
示例#34
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            SimPosition pos;

            if (!args.TryGetValue("pos", out pos))
            {
                pos = TheSimAvatar;
            }
            SimPathStore R  = pos.PathStore;
            Vector3      v3 = pos.SimPosition;

            WriteLine("SimZInfo: " + pos + " " + R.GetGroundLevel(v3.X, v3.Y));
            SimWaypoint WP = R.GetWaypointOf(v3);

            WriteLine("WaypointInfo: {0}", WP.OccupiedString(R.GetCollisionPlane(v3.Z)));
            return(Success("Ran " + Name));
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage(); // " objectinventory [objectID]";

            int argsUsed;
            List<SimObject> PS;
            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                PS = WorldSystem.GetAllSimObjects();
            } 
            foreach (var found in PS)
            {
                uint objectLocalID = found.LocalID;
                UUID objectID = found.ID;

                List<InventoryBase> items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, 1000*30);

                if (items != null)
                {
                    string result = String.Empty;

                    for (int i = 0; i < items.Count; i++)
                    {
                        if (items[i] is InventoryFolder)
                        {
                            result += String.Format("[Folder] Name: {0}", items[i].Name) + Environment.NewLine;
                        }
                        else
                        {
                            InventoryItem item = (InventoryItem) items[i];
                            result += String.Format("[Item] Name: {0} Desc: {1} Type: {2}", item.Name, item.Description,
                                                    item.AssetType) + Environment.NewLine;
                        }
                    }

                    AddSuccess(result);
                }
                else
                {
                    Failure("failed to download task inventory for " + objectLocalID);
                }
            }
            return SuccessOrFailure();
        }
示例#36
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage(); // " touch UUID";

            List<SimObject> PS;
            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                return Failure("Cannot find objects from " + args.GetString("targets"));
            } 
            GridClient client = TheBotClient;
            foreach (var targetPrim in PS)
            {
                AddSuccess(Name + " on " + targetPrim);
                Client.Self.Touch(targetPrim.LocalID);
            }
            return SuccessOrFailure();
        }
示例#37
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int         argcount;
            SimPosition pos;

            if (!args.TryGetValue("pos", out pos))
            {
                pos = TheSimAvatar;
            }

            Vector3d         v3d = pos.GlobalPosition;
            Vector3          v3  = pos.SimPosition;
            SimAbstractMover sam = SimCollisionPlaneMover.CreateSimPathMover(WorldSystem.TheSimAvatar, pos,
                                                                             pos.GetSizeDistance());

            sam.BlockTowardsVector(v3);
            return(Success("SUCCESS "));
        }
示例#38
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            SimPosition pos;

            if (!args.TryGetValue("pos", out pos))
            {
                pos = TheSimAvatar;
            }
            SimPathStore R  = pos.PathStore;
            Vector3      v3 = pos.SimPosition;

            WriteLine("SimZInfo: " + pos + " " + R.GetGroundLevel(v3.X, v3.Y));

#if COLLIDER_ODE
            Vector3 landing = R.CreateAndDropPhysicalCube(v3);
            WriteLine("SimHInfo: {0}", landing);
#endif
            return(Success("Ran " + Name));
        }
示例#39
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            ICollection <SimObject> objs;

            if (!args.TryGetValue("targets", out objs))
            {
                int argsUsed;
                objs = WorldSystem.ResolveCollection("$regionprims", out argsUsed);
            }
            int detatched        = 0;
            int orphans          = 0;
            int missingSculpties = 0;

            foreach (SimObjectImpl o in objs)
            {
                if (!o.IsRoot)
                {
                    if (o.Parent == null)
                    {
                        orphans++;
                        WriteLine("Orphans: " + o);
                    }
                }
                if (!o.IsRegionAttached)
                {
                    detatched++;
                    WriteLine("Detatched " + o);
                }

                if (o.IsSculpted)
                {
                    Primitive p = o.Prim;
                    if (WorldSystem.StartTextureDownload(p.Sculpt.SculptTexture) == null)
                    {
                        missingSculpties++;
                        WriteLine("IsSculpted " + o);
                    }
                }
            }
            return
                (Success("object examinined " + objs.Count + " detacted: " + detatched + " orphans: " + orphans +
                         " missingScuplty: " + missingSculpties));
        }
示例#40
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            ICollection<SimObject> objs;
            if (!args.TryGetValue("targets", out objs))
            {
                int argsUsed;
                objs = WorldSystem.ResolveCollection("$regionprims", out argsUsed);
            }
            int detatched = 0;
            int orphans = 0;
            int missingSculpties = 0;
            foreach (SimObjectImpl o in objs)
            {
                if (!o.IsRoot)
                {
                    if (o.Parent == null)
                    {
                        orphans++;
                        WriteLine("Orphans: " + o);
                    }
                }
                if (!o.IsRegionAttached)
                {
                    detatched++;
                    WriteLine("Detatched " + o);
                }

                if (o.IsSculpted)
                {
                    Primitive p = o.Prim;
                    if (WorldSystem.StartTextureDownload(p.Sculpt.SculptTexture) == null)
                    {
                        missingSculpties++;
                        WriteLine("IsSculpted " + o);
                    }
                }
            }
            return
                Success("object examinined " + objs.Count + " detacted: " + detatched + " orphans: " + orphans +
                        " missingScuplty: " + missingSculpties);
        }
示例#41
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
            {
                return(ShowUsage()); // " touch UUID";
            }
            List <SimObject> PS;

            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                return(Failure("Cannot find objects from " + args.GetString("targets")));
            }
            GridClient client = TheBotClient;

            foreach (var targetPrim in PS)
            {
                AddSuccess(Name + " on " + targetPrim);
                Client.Self.Touch(targetPrim.LocalID);
            }
            return(SuccessOrFailure());
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
            {
                return(ShowUsage()); // " siton UUID";
            }
            int         argsUsed;
            SimPosition pos;

            if (!args.TryGetValue("on", out pos))
            {
                sittingOnGround = WorldSystem.TheSimAvatar.SitOnGround();
                return(!sittingOnGround
                           ? Failure("$bot did not yet sit on the ground.")
                           : Success("$bot sat on the ground."));
            }
            if (pos is SimObject)
            {
                if (WorldSystem.TheSimAvatar.SitOn(pos as SimObject))
                {
                    Success("$bot sat on " + pos);
                }
                if (!args.IsTrue("down"))
                {
                    return(Failure("$bot did not yet sit on " + pos));
                }
            }
            else if (pos == null)
            {
                return(Failure("$bot did not yet find " + args.str));
            }
            // @todo use autoppoiolot to the location andf then sit
            TheSimAvatar.GotoTargetAStar(pos);
            sittingOnGround = WorldSystem.TheSimAvatar.SitOnGround();
            if (sittingOnGround)
            {
                return(Success("$bot sat at " + pos));
            }
            return(Failure("$bot did not sit at " + pos));
        }
示例#43
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            UUID primID = UUID.Zero;

            if (args.Length < 1)
            {
                return ShowUsage();
            }

            List<SimObject> PS;
            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                return Failure("Cannot find objects from " + args.GetString("targets"));
            } 
            foreach (var target in PS)
            {
                WorldSystem.DeletePrim(target.Prim);
                WriteLine("\n {0}", target);
                AddSuccess("Done.");
            }
            return SuccessOrFailure();
        }
示例#44
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     List<SimObject> PS;
     if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
     {
         return Failure("Cannot find objects from " + args.GetString("targets"));
     }
     {
         int nfound = 0;
         foreach (var prim in PS)
         {
             Client.Self.SendTeleportLure(prim.ID);
             AddSuccess(Name + ": " + prim);
             nfound++;
         }
         if (nfound > 0) return Success(Name + " found: " + nfound + " object/agent(s)");
     }
     string user = args.str;
     UUID id = WorldSystem.GetUserID(user);
     if (id == UUID.Zero) return Failure("Cannot find " + user);
     Client.Self.SendTeleportLure(id);
     return Success("teleport Lure sent to " + user);
 }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            UUID primID = UUID.Zero;

            if (args.Length < 1)
            {
                return(ShowUsage());
            }

            List <SimObject> PS;

            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                return(Failure("Cannot find objects from " + args.GetString("targets")));
            }
            foreach (var target in PS)
            {
                WorldSystem.DeletePrim(target.Prim);
                WriteLine("\n {0}", target);
                AddSuccess("Done.");
            }
            return(SuccessOrFailure());
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int argsUsed;
            ICollection <SimObject> objs;
            bool rightNow = true;

            if (!args.TryGetValue("targets", out objs))
            {
                objs     = (ICollection <SimObject>)WorldSystem.GetAllSimObjects();
                rightNow = false;
            }
            WriteLine("Unmeshing " + objs.Count);
            foreach (SimObject o2 in objs)
            {
                SimObjectPathFinding o = o2.PathFinding;

                o.IsWorthMeshing = true;
                if (rightNow)
                {
                    o.RemoveCollisions();
                }
                else
                {
                    o.RemoveCollisions();
                }
            }
            if (rightNow)
            {
                TheSimAvatar.GetSimRegion().GetPathStore(TheSimAvatar.SimPosition).RemoveAllCollisionPlanes();
            }
            else
            {
                TheSimAvatar.GetSimRegion().GetPathStore(TheSimAvatar.SimPosition).RemoveAllCollisionPlanes();
            }

            return(TheBotClient.ExecuteCommand("meshinfo", args.CallerAgent, args.Output, args.CmdFlags));
        }
示例#47
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            string verb = args.CmdName;
            // base.acceptInput(verb, args);
            UUID     primID       = UUID.Zero;
            SimActor TheSimAvatar = this.TheSimAvatar;

            if (verb == "stop-following")
            {
                // SimPosition ap = TheSimAvatar.ApproachPosition;
                if (TheSimAvatar.CurrentAction is MoveToLocation)
                {
                    TheSimAvatar.CurrentAction = null;
                }
                TheSimAvatar.SetMoveTarget(null, 10);
                TheSimAvatar.StopMoving();
            }
            SimPosition position;

            if (!args.TryGetValue("target", out position))
            {
                return(Failure("$bot don't know who " + args.GetString("target") + " is."));
            }
            {
                if (position != null)
                {
                    String str = "" + Client + " start to follow " + position + ".";
                    WriteLine(str);
                    // The thread that accepts the Client and awaits messages
                    TheSimAvatar.CurrentAction = new FollowerAction(TheSimAvatar, position);
                    return(Success("$bot started following " + position));
                }
            }
            {
                return(Success("$bot ApproachPosition: " + TheSimAvatar.CurrentAction));
            }
        }
示例#48
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int argsUsed;
            ICollection<SimObject> objs;
            bool rightNow = true;
            if (!args.TryGetValue("targets", out objs))
            {
                objs = (ICollection<SimObject>) WorldSystem.GetAllSimObjects();
                rightNow = false;
            }
            WriteLine("Unmeshing " + objs.Count);
            foreach (SimObject o2 in objs)
            {
                SimObjectPathFinding o = o2.PathFinding;

                o.IsWorthMeshing = true;
                if (rightNow)
                {
                    o.RemoveCollisions();
                }
                else
                {
                    o.RemoveCollisions();
                }
            }
            if (rightNow)
            {
                TheSimAvatar.GetSimRegion().GetPathStore(TheSimAvatar.SimPosition).RemoveAllCollisionPlanes();
            }
            else
            {
                TheSimAvatar.GetSimRegion().GetPathStore(TheSimAvatar.SimPosition).RemoveAllCollisionPlanes();
            }

            return TheBotClient.ExecuteCommand("meshinfo", args.CallerAgent, args.Output, args.CmdFlags);
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage(); // " exportparticles [prim-uuid]";


            List<SimObject> PS;
            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS))
            {
                return Failure("Cannot find objects from " + args.GetString("targets"));
            }
            foreach (var o in PS)
            {
                Primitive exportPrim = o.Prim;
                if (exportPrim.ParticleSys.CRC != 0)
                {
                    StringBuilder lsl = new StringBuilder();

                    #region Particle System to LSL

                    lsl.Append("default" + Environment.NewLine);
                    lsl.Append("{" + Environment.NewLine);
                    lsl.Append("    state_entry()" + Environment.NewLine);
                    lsl.Append("    {" + Environment.NewLine);
                    lsl.Append("         llParticleSystem([" + Environment.NewLine);

                    lsl.Append("         PSYS_PART_FLAGS, 0");

                    if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.InterpColor) !=
                        0)
                        lsl.Append(" | PSYS_PART_INTERP_COLOR_MASK");
                    if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.InterpScale) !=
                        0)
                        lsl.Append(" | PSYS_PART_INTERP_SCALE_MASK");
                    if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.Bounce) != 0)
                        lsl.Append(" | PSYS_PART_BOUNCE_MASK");
                    if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.Wind) != 0)
                        lsl.Append(" | PSYS_PART_WIND_MASK");
                    if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.FollowSrc) !=
                        0)
                        lsl.Append(" | PSYS_PART_FOLLOW_SRC_MASK");
                    if ((exportPrim.ParticleSys.PartDataFlags &
                         Primitive.ParticleSystem.ParticleDataFlags.FollowVelocity) != 0)
                        lsl.Append(" | PSYS_PART_FOLLOW_VELOCITY_MASK");
                    if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.TargetPos) !=
                        0)
                        lsl.Append(" | PSYS_PART_TARGET_POS_MASK");
                    if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.TargetLinear) !=
                        0)
                        lsl.Append(" | PSYS_PART_TARGET_LINEAR_MASK");
                    if ((exportPrim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.Emissive) !=
                        0)
                        lsl.Append(" | PSYS_PART_EMISSIVE_MASK");

                    lsl.Append(",");
                    lsl.Append(Environment.NewLine);
                    lsl.Append("         PSYS_SRC_PATTERN, 0");

                    if ((exportPrim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.Drop) != 0)
                        lsl.Append(" | PSYS_SRC_PATTERN_DROP");
                    if ((exportPrim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.Explode) != 0)
                        lsl.Append(" | PSYS_SRC_PATTERN_EXPLODE");
                    if ((exportPrim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.Angle) != 0)
                        lsl.Append(" | PSYS_SRC_PATTERN_ANGLE");
                    if ((exportPrim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.AngleCone) != 0)
                        lsl.Append(" | PSYS_SRC_PATTERN_ANGLE_CONE");
                    if ((exportPrim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.AngleConeEmpty) != 0)
                        lsl.Append(" | PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY");

                    lsl.Append("," + Environment.NewLine);

                    lsl.Append("         PSYS_PART_START_ALPHA, " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.PartStartColor.A) + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_PART_END_ALPHA, " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.PartEndColor.A) + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_PART_START_COLOR, " + exportPrim.ParticleSys.PartStartColor.ToRGBString() +
                               "," + Environment.NewLine);
                    lsl.Append("         PSYS_PART_END_COLOR, " + exportPrim.ParticleSys.PartEndColor.ToRGBString() +
                               "," + Environment.NewLine);
                    lsl.Append("         PSYS_PART_START_SCALE, <" +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.PartStartScaleX) + ", " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.PartStartScaleY) + ", 0>, " +
                               Environment.NewLine);
                    lsl.Append("         PSYS_PART_END_SCALE, <" +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.PartEndScaleX) + ", " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.PartEndScaleY) + ", 0>, " +
                               Environment.NewLine);
                    lsl.Append("         PSYS_PART_MAX_AGE, " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.PartMaxAge) + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_SRC_MAX_AGE, " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.MaxAge) + "," + Environment.NewLine);
                    lsl.Append("         PSYS_SRC_ACCEL, " + exportPrim.ParticleSys.PartAcceleration.ToString() + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_SRC_BURST_PART_COUNT, " +
                               String.Format("{0:0}", exportPrim.ParticleSys.BurstPartCount) + "," + Environment.NewLine);
                    lsl.Append("         PSYS_SRC_BURST_RADIUS, " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.BurstRadius) + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_SRC_BURST_RATE, " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.BurstRate) + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_SRC_BURST_SPEED_MIN, " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.BurstSpeedMin) + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_SRC_BURST_SPEED_MAX, " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.BurstSpeedMax) + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_SRC_INNERANGLE, " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.InnerAngle) + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_SRC_OUTERANGLE, " +
                               String.Format("{0:0.00000}", exportPrim.ParticleSys.OuterAngle) + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_SRC_OMEGA, " + exportPrim.ParticleSys.AngularVelocity.ToString() + "," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_SRC_TEXTURE, (key)\"" + exportPrim.ParticleSys.Texture.ToString() + "\"," +
                               Environment.NewLine);
                    lsl.Append("         PSYS_SRC_TARGET_KEY, (key)\"" + exportPrim.ParticleSys.Target.ToString() + "\"" +
                               Environment.NewLine);

                    lsl.Append("         ]);" + Environment.NewLine);
                    lsl.Append("    }" + Environment.NewLine);
                    lsl.Append("}" + Environment.NewLine);

                    #endregion Particle System to LSL

                    return Success(lsl.ToString());
                }
                else
                {
                    Failure("Prim " + exportPrim.LocalID + " does not have a particle system");
                }
            }
            return SuccessOrFailure();
        }
示例#50
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     bool kill = args.IsTrue("--kill");
     bool createFresh;
     string id = GetTaskID(args, out createFresh);
     if (kill && createFresh)
     {
         return Failure("Cannot create and kill in the same operation");
     }
     int secondsOfSleep;
     if (!args.TryGetValue("seconds", out secondsOfSleep))
     {
         return ShowUsage();
     }
     // remove the time
     string[] cmdS;
     args.TryGetValue("command", out cmdS);
     string cmd = Parser.Rejoin(cmdS, 0);
     ThreadStart thread = () =>
                              {
                                  try
                                  {
                                      while (true)
                                      {
                                          try
                                          {
                                              Client.ExecuteCommand(cmd, args.CallerAgent, WriteLine,
                                                                    args.CmdFlags);
                                          }
                                          catch (ThreadAbortException e)
                                          {
                                              WriteLine("Aborting " + cmd);
                                          }
                                          catch (Exception e)
                                          {
                                              WriteLine("Problem with " + cmd + " " + e);
                                              return;
                                          }
                                          Thread.Sleep(secondsOfSleep*1000);
                                      }
                                  }
                                  finally
                                  {
                                      try
                                      {
                                          TheBotClient.RemoveThread(Thread.CurrentThread);
                                      }
                                      catch (OutOfMemoryException)
                                      {
                                      }
                                      catch (StackOverflowException)
                                      {
                                      }
                                      catch (Exception)
                                      {
                                      }
                                      WriteLine("done with " + cmd);
                                  }
                              };
     String threadName = "Repeating " + cmd;
     string message = TheBotClient.CreateTask(id, thread, threadName, createFresh, kill, null, WriteLine);
     SetResult("taskid", id);
     return Success(message);
 }
        public static CmdResult ExecuteRequestProc(CmdRequest args, Command thizcmd)
        {
            var              TheBotClient = thizcmd.TheBotClient;
            OutputDelegate   WriteLine    = thizcmd.WriteLine;
            bool             thread       = args.IsTrue("--thread");
            bool             queue        = args.IsTrue("--queue");
            bool             all          = args.IsTrue("--all");
            bool             kill         = args.IsTrue("--kill");
            bool             asyc         = args.IsTrue("--async") || thread;
            TimeSpan         wait;
            ManualResetEvent mre = null;

            if (args.TryGetValue("--wait", out wait))
            {
                mre = new ManualResetEvent(false);
            }
            bool newDebug    = args.IsTrue("--debug");
            bool changeDebug = newDebug || args.IsTrue("--nodebug");

            bool   createFresh = false;
            string id          = args.Length == 0 ? "list" : GetTaskID(args, out createFresh);

            id = (id == "list") ? "" : id;
            int n     = 0;
            int found = 0;

            if (id == "" || kill || changeDebug)
            {
                List <string> list = new List <string>();
                lock (TaskQueueHandler.TaskQueueHandlers)
                {
                    var atq = TheBotClient != null
                                  ? TheBotClient.AllTaskQueues()
                                  : ClientManager.SingleInstance.AllTaskQueues();

                    foreach (var queueHandler in atq)
                    {
                        if (!queueHandler.MatchesId(id))
                        {
                            continue;
                        }
                        bool isQueue = queueHandler.Impl == queueHandler;
                        if (isQueue)
                        {
                            found++;
                        }
                        else
                        {
                            n++;
                        }
                        if (changeDebug)
                        {
                            queueHandler.DebugQueue = newDebug;
                        }
                        if (queueHandler.IsAlive)
                        {
                            string str = queueHandler.ToDebugString(true);
                            if (kill)
                            {
                                if (!all)
                                {
                                    if (!isQueue && !thread || isQueue && !queue)
                                    {
                                        WriteLine("Not killing " + str);
                                        continue;
                                    }
                                }
                                queueHandler.Abort();
                                str = "Killing " + str;
                                thizcmd.IncrResult("killed", 1);
                            }

                            WriteLine(str);
                        }
                        else
                        {
                            list.Add(queueHandler.ToDebugString(true));
                        }
                    }
                }
                foreach (var s in list)
                {
                    WriteLine(s);
                }
            }

            if (kill && createFresh)
            {
                return(thizcmd.Failure("Cannot create and kill in the same operation"));
            }
            string[] cmdS;
            args.TryGetValue("command", out cmdS);
            thizcmd.IncrResult("taskqueues", found);
            thizcmd.IncrResult("threads", n);
            if (cmdS == null || cmdS.Length == 0)
            {
                return(thizcmd.Success("TaskQueueHandlers: " + found + ", threads: " + n));
            }

            /// task is killed if request.. now making a new one
            string cmd        = Parser.Rejoin(cmdS, 0);
            bool   needResult = mre != null;

            CmdResult[] result = null;
            if (createFresh)
            {
                needResult = false;
            }
            if (needResult)
            {
                result = new CmdResult[1];
            }
            CMDFLAGS flags = needResult ? CMDFLAGS.ForceResult : CMDFLAGS.Inherit;

            if (asyc)
            {
                flags |= CMDFLAGS.ForceAsync;
            }

            ThreadStart task = () =>
            {
                try
                {
                    var res = TheBotClient.ExecuteCommand(cmd, args.CallerAgent, args.Output,
                                                          flags);
                    if (result != null)
                    {
                        result[0] = res;
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            };
            string message = TheBotClient.CreateTask(id, task, cmd, createFresh, false, mre, WriteLine);

            thizcmd.SetResult("taskid", id);
            if (mre != null)
            {
                if (!mre.WaitOne(wait))
                {
                    return(thizcmd.Failure("Timeout: " + message));
                }
                if (result == null)
                {
                    return(thizcmd.Success(message));
                }
                return(result[0] ?? thizcmd.Success(message));
            }
            return(thizcmd.Success(message));
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
            {
                return(ShowUsage()); // " dumpoutfit [avatar-uuid]";
            }
            bool writeInfo = !args.IsFFI;

            //UUID target = UUID.Zero;

            //if (!UUIDTryParse(args, 0 , out target))
            //    return ShowUsage();// " dumpoutfit [avatar-uuid]";

            //lock (Client.Network.Simulators)
            {
                //for (int i = 0; i < Client.Network.Simulators.Count; i++)
                {
                    int argsUsed;
                    List <SimObject> PS;
                    args.TryGetValue("target", out PS);
                    if (IsEmpty(PS))
                    {
                        return(Failure("Cannot find objects from " + args.str));
                    }
                    List <UUID> OutfitAssets = new List <UUID>();
                    foreach (var O in PS)
                    {
                        Primitive     targetAv = O.Prim;
                        StringBuilder output   = new StringBuilder("Downloading ");
                        if (targetAv.Textures == null)
                        {
                            Failure("no textures " + targetAv);
                            continue;
                        }
                        for (int j = 0; j < targetAv.Textures.FaceTextures.Length; j++)
                        {
                            Primitive.TextureEntryFace face = targetAv.Textures.FaceTextures[j];

                            if (face != null)
                            {
                                ImageType type = ImageType.Normal;

                                switch ((AvatarTextureIndex)j)
                                {
                                case AvatarTextureIndex.HeadBaked:
                                case AvatarTextureIndex.EyesBaked:
                                case AvatarTextureIndex.UpperBaked:
                                case AvatarTextureIndex.LowerBaked:
                                case AvatarTextureIndex.SkirtBaked:
                                    type = ImageType.Baked;
                                    break;
                                }

                                OutfitAssets.Add(face.TextureID);
                                Client.Assets.RequestImage(face.TextureID, type,
                                                           delegate(TextureRequestState state, AssetTexture assettexture)
                                {
                                    lock (OutfitAssets)
                                    {
                                        if (OutfitAssets.Contains(assettexture.AssetID))
                                        {
                                            if (state == TextureRequestState.Finished)
                                            {
                                                try
                                                {
                                                    string newVariable =
                                                        assettexture.AssetID + ".jp2";
                                                    File.WriteAllBytes(newVariable,
                                                                       assettexture.
                                                                       AssetData);
                                                    AddSuccess("Wrote JPEG2000 image " +
                                                               newVariable);

                                                    ManagedImage imgData;
                                                    if (
                                                        OpenJPEG.DecodeToImage(
                                                            assettexture.AssetData,
                                                            out imgData))
                                                    {
                                                        byte[] tgaFile =
                                                            imgData.ExportTGA();
                                                        File.WriteAllBytes(
                                                            assettexture.AssetID + ".tga",
                                                            tgaFile);
                                                        AddSuccess("Wrote TGA image " +
                                                                   assettexture.AssetID +
                                                                   ".tga");
                                                    }
                                                    else
                                                    {
                                                        Failure("Failed decode of " +
                                                                newVariable);
                                                    }
                                                }
                                                catch (Exception e)
                                                {
                                                    Failure(e.ToString());
                                                }
                                            }
                                            else
                                            {
                                                Failure("Failed to download image " +
                                                        assettexture.AssetID);
                                            }

                                            OutfitAssets.Remove(assettexture.AssetID);
                                        }
                                    }
                                });
                                output.Append(((AvatarTextureIndex)j).ToString());
                                output.Append(" ");
                            }
                        }

                        AddSuccess(output.ToString());
                    }
                }
            }
            return(SuccessOrFailure());
        }
示例#53
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage(); // " dumpoutfit [avatar-uuid]";
            bool writeInfo = !args.IsFFI;
            //UUID target = UUID.Zero;

            //if (!UUIDTryParse(args, 0 , out target))
            //    return ShowUsage();// " dumpoutfit [avatar-uuid]";

            //lock (Client.Network.Simulators)
            {
                //for (int i = 0; i < Client.Network.Simulators.Count; i++)
                {
                    int argsUsed;
                    List<SimObject> PS;
                    args.TryGetValue("target", out PS);
                    if (IsEmpty(PS)) return Failure("Cannot find objects from " + args.str);
                    List<UUID> OutfitAssets = new List<UUID>();
                    foreach (var O in PS)
                    {
                        Primitive targetAv = O.Prim;
                        StringBuilder output = new StringBuilder("Downloading ");
                        if (targetAv.Textures == null)
                        {
                            Failure("no textures " + targetAv);
                            continue;
                        }
                        for (int j = 0; j < targetAv.Textures.FaceTextures.Length; j++)
                        {
                            Primitive.TextureEntryFace face = targetAv.Textures.FaceTextures[j];

                            if (face != null)
                            {
                                ImageType type = ImageType.Normal;

                                switch ((AvatarTextureIndex) j)
                                {
                                    case AvatarTextureIndex.HeadBaked:
                                    case AvatarTextureIndex.EyesBaked:
                                    case AvatarTextureIndex.UpperBaked:
                                    case AvatarTextureIndex.LowerBaked:
                                    case AvatarTextureIndex.SkirtBaked:
                                        type = ImageType.Baked;
                                        break;
                                }

                                OutfitAssets.Add(face.TextureID);
                                Client.Assets.RequestImage(face.TextureID, type,
                                                           delegate(TextureRequestState state, AssetTexture assettexture)
                                                               {
                                                                   lock (OutfitAssets)
                                                                   {
                                                                       if (OutfitAssets.Contains(assettexture.AssetID))
                                                                       {
                                                                           if (state == TextureRequestState.Finished)
                                                                           {
                                                                               try
                                                                               {
                                                                                   string newVariable =
                                                                                       assettexture.AssetID + ".jp2";
                                                                                   File.WriteAllBytes(newVariable,
                                                                                                      assettexture.
                                                                                                          AssetData);
                                                                                   AddSuccess("Wrote JPEG2000 image " +
                                                                                              newVariable);

                                                                                   ManagedImage imgData;
                                                                                   if (
                                                                                       OpenJPEG.DecodeToImage(
                                                                                           assettexture.AssetData,
                                                                                           out imgData))
                                                                                   {
                                                                                       byte[] tgaFile =
                                                                                           imgData.ExportTGA();
                                                                                       File.WriteAllBytes(
                                                                                           assettexture.AssetID + ".tga",
                                                                                           tgaFile);
                                                                                       AddSuccess("Wrote TGA image " +
                                                                                                  assettexture.AssetID +
                                                                                                  ".tga");
                                                                                   }
                                                                                   else
                                                                                   {
                                                                                       Failure("Failed decode of " +
                                                                                               newVariable);
                                                                                   }
                                                                               }
                                                                               catch (Exception e)
                                                                               {
                                                                                   Failure(e.ToString());
                                                                               }
                                                                           }
                                                                           else
                                                                           {
                                                                               Failure("Failed to download image " +
                                                                                       assettexture.AssetID);
                                                                           }

                                                                           OutfitAssets.Remove(assettexture.AssetID);
                                                                       }
                                                                   }
                                                               });
                                output.Append(((AvatarTextureIndex) j).ToString());
                                output.Append(" ");
                            }
                        }

                        AddSuccess(output.ToString());
                    }
                }
            }
            return SuccessOrFailure();
        }
示例#54
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)));
        }
示例#55
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            bool   kill = args.IsTrue("--kill");
            bool   createFresh;
            string id = GetTaskID(args, out createFresh);

            if (kill && createFresh)
            {
                return(Failure("Cannot create and kill in the same operation"));
            }
            int secondsOfSleep;

            if (!args.TryGetValue("seconds", out secondsOfSleep))
            {
                return(ShowUsage());
            }
            // remove the time
            string[] cmdS;
            args.TryGetValue("command", out cmdS);
            string      cmd    = Parser.Rejoin(cmdS, 0);
            ThreadStart thread = () =>
            {
                try
                {
                    while (true)
                    {
                        try
                        {
                            Client.ExecuteCommand(cmd, args.CallerAgent, WriteLine,
                                                  args.CmdFlags);
                        }
                        catch (ThreadAbortException e)
                        {
                            WriteLine("Aborting " + cmd);
                        }
                        catch (Exception e)
                        {
                            WriteLine("Problem with " + cmd + " " + e);
                            return;
                        }
                        Thread.Sleep(secondsOfSleep * 1000);
                    }
                }
                finally
                {
                    try
                    {
                        TheBotClient.RemoveThread(Thread.CurrentThread);
                    }
                    catch (OutOfMemoryException)
                    {
                    }
                    catch (StackOverflowException)
                    {
                    }
                    catch (Exception)
                    {
                    }
                    WriteLine("done with " + cmd);
                }
            };
            String threadName = "Repeating " + cmd;
            string message    = TheBotClient.CreateTask(id, thread, threadName, createFresh, kill, null, WriteLine);

            SetResult("taskid", id);
            return(Success(message));
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            bool writeInfo = !args.IsFFI;

            if (args.Length < 1)
            {
                return(ShowUsage());
            }

            ReceivedProperties = false;
            ReceivedInterests  = false;
            ReceivedGroups     = false;

            if (!registeredCallbacks)
            {
                registeredCallbacks = true;
                Client.Avatars.AvatarInterestsReply +=
                    new EventHandler <AvatarInterestsReplyEventArgs>(Avatars_AvatarInterestsReply);
                Client.Avatars.AvatarPropertiesReply +=
                    new EventHandler <AvatarPropertiesReplyEventArgs>(Avatars_AvatarPropertiesReply);
                Client.Avatars.AvatarGroupsReply +=
                    new EventHandler <AvatarGroupsReplyEventArgs>(Avatars_AvatarGroupsReply);
                Client.Groups.GroupJoinedReply  += new EventHandler <GroupOperationEventArgs>(Groups_OnGroupJoined);
                Client.Avatars.AvatarPicksReply += new EventHandler <AvatarPicksReplyEventArgs>(Avatars_AvatarPicksReply);
                Client.Avatars.PickInfoReply    += new EventHandler <PickInfoReplyEventArgs>(Avatars_PickInfoReply);
            }

            if (!args.TryGetValue("agent", out targetID))
            {
                return(ShowUsage());
            }

            // Request all of the packets that make up an avatar profile
            Client.Avatars.RequestAvatarProperties(targetID);

            //Request all of the avatars pics
            Client.Avatars.RequestAvatarPicks(Client.Self.AgentID);
            Client.Avatars.RequestAvatarPicks(targetID);

            // Wait for all the packets to arrive
            ReceivedProfileEvent.Reset();
            ReceivedProfileEvent.WaitOne(10000, false);

            // Check if everything showed up
            if (!ReceivedInterests || !ReceivedProperties || !ReceivedGroups)
            {
                return(Failure("Failed to retrieve a complete profile for that UUID"));
            }

            // Synchronize our profile
            Client.Self.UpdateInterests(Interests);
            Client.Self.UpdateProfile(Properties);

            // TODO: Leave all the groups we're currently a member of? This could
            // break BotClient connectivity that might be relying on group authentication

            // Attempt to join all the groups
            foreach (UUID groupID in Groups)
            {
                Client.Groups.RequestJoinGroup(groupID);
            }

            return(Success("Synchronizing our profile to the profile of " + targetID.ToString()));
        }
示例#57
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length != 1)
                return ShowUsage(); // " taskrunning objectID [[scriptName] true|false]";


            List<SimObject> PS;
            if (!args.TryGetValue("targets", out PS) || IsEmpty(PS as ICollection))
            {
                PS = WorldSystem.GetAllSimObjects();
            }

            string matching = args.GetString("match");
            string tf = args.GetString("set").ToLower();
            foreach (var found in PS)
            {
                uint objectLocalID = found.LocalID;
                UUID objectID = found.ID;


                List<InventoryBase> items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, 1000*30);

                //bool wantSet = false;
                bool setTaskTo = false;
                if (items != null)
                {
                    string result = String.Empty;
                    bool setAny = false;
                    if (tf == "true")
                    {
                        setAny = true;
                        setTaskTo = true;
                    }
                    else if (tf == "false")
                    {
                        setAny = true;
                        setTaskTo = false;
                    }
                    bool wasRunning = false;

                    EventHandler<ScriptRunningReplyEventArgs> callback;
                    using (AutoResetEvent OnScriptRunningReset = new AutoResetEvent(false))
                    {
                        callback = ((s, e) =>
                                        {
                                            if (e.ObjectID == objectID)
                                            {
                                                result += String.Format(" IsMono: {0} IsRunning: {1}", e.IsMono,
                                                                        e.IsRunning);
                                                wasRunning = e.IsRunning;
                                                OnScriptRunningReset.Set();
                                            }
                                        });

                        Client.Inventory.ScriptRunningReply += callback;

                        for (int i = 0; i < items.Count; i++)
                        {
                            if (items[i] is InventoryFolder)
                            {
                                // this shouldn't happen this year
                                result += String.Format("[Folder] Name: {0}", items[i].Name) + Environment.NewLine;
                            }
                            else
                            {
                                InventoryItem item = (InventoryItem) items[i];
                                AssetType assetType = item.AssetType;
                                result += String.Format("[Item] Name: {0} Desc: {1} Type: {2}", item.Name,
                                                        item.Description,
                                                        assetType);
                                if (assetType == AssetType.LSLBytecode || assetType == AssetType.LSLText)
                                {
                                    OnScriptRunningReset.Reset();
                                    Client.Inventory.RequestGetScriptRunning(objectID, item.UUID);
                                    if (!OnScriptRunningReset.WaitOne(10000, true))
                                    {
                                        result += " (no script info)";
                                    }
                                    if (setAny && item.Name.Contains(matching))
                                    {
                                        if (wasRunning != setTaskTo)
                                        {
                                            OnScriptRunningReset.Reset();
                                            result += " Setting " + setTaskTo + " => ";
                                            Client.Inventory.RequestSetScriptRunning(objectID, item.UUID, setTaskTo);
                                            if (!OnScriptRunningReset.WaitOne(10000, true))
                                            {
                                                result += " (was not set)";
                                            }
                                        }
                                    }
                                }

                                result += Environment.NewLine;
                            }
                        }
                    }
                    Client.Inventory.ScriptRunningReply -= callback;
                    AddSuccess(result);
                }
                else
                {
                    Failure("failed to download task inventory for " + objectLocalID);
                }
            }
            return SuccessOrFailure();
        }
示例#58
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            SimPosition position;
            if (!args.TryGetValue("is", out position))
            {
                return Failure("I don't understand how to move " + args.str);
            }

            {
                double RAD2DEG = 180/Math.PI;
                if (position != null)
                {
                    //avatar = ((SimAvatar)position).theAvatar;
                    //Client.Self.Movement.Camera.AtAxis
                    Vector3d myPos = TheSimAvatar.GlobalPosition;
                    Vector3 forward = new Vector3(1, 0, 0);
                    Vector3d positionVect = position.GlobalPosition;
                    Vector3d offsetG = positionVect - myPos;
                    Vector3 offset = new Vector3((float) offsetG.X, (float) offsetG.Y, (float) offsetG.Z);
                    Quaternion newRot2 = Vector3.RotationBetween(forward, offset);

                    //Quaternion newRot1 = Vector3d.RotationBetween(positionVect, Client.Self.RelativePosition);
                    double newDist = Vector3d.Distance(positionVect, myPos);
                    WriteLine("Where Found: {0}", position);

                    // Absolute
                    WriteLine(" SimPosition = " + Vector3Str(position.SimPosition));
                    WriteLine(" SimRotation = {0:0.#}*", WorldObjects.GetZHeading(position.SimRotation)*RAD2DEG);

                    // Relative
                    WriteLine(" RelSimPosition = {0} ", Vector3Str(offset));
                    double relAngle = (Math.Atan2(-offset.X, -offset.Y) + Math.PI); // 2P
                    WriteLine(" RelSimPolar = {0:0.#}*{1:0.0#}", relAngle*RAD2DEG, newDist);

                    double selfFacing = WorldObjects.GetZHeading(TheSimAvatar.SimRotation);
                    WriteLine(" SelfFacingPolar = {0:+0.0#;-0.0#}*{1:0.0#}", (relAngle - selfFacing)*RAD2DEG, newDist);

                    if (false)
                    {
                        //WriteLine(" newRot1 = {0:0.#}*", WorldObjects.GetZHeading(newRot1) * RAD2DEG);
                        //WriteLine(" newRot2 = {0:0.#}*", WorldObjects.GetZHeading(newRot2) * RAD2DEG);
                        WriteLine(" Client.Self.Movement.Camera.AtAxis = " +
                                  Vector3Str(Client.Self.Movement.Camera.AtAxis));
                        WriteLine(" Client.Self.RelativePosition = " + Vector3Str(Client.Self.RelativePosition));
                        WriteLine(" SelfFacing = {0:0.#}*{1:0.0#}", selfFacing*RAD2DEG,
                                  Client.Self.Movement.Camera.AtAxis.Length());
                    }
                    SimObjectImpl o = position as SimObjectImpl;
                    if (o != null) position = o.GetHeading();

                    //WriteLine(avatar.Rotation.X + ", " + avatar.Rotation.Y + ", " + avatar.Rotation.Z);
                    //WriteLine(Client.Self.RelativeRotation.X + ", " + Client.Self.RelativeRotation.Y + ", " + Client.Self.RelativeRotation.Z + "\n");

                    return Success("At: " + position + " " + TheSimAvatar.DistanceVectorString(position));
                }
                else
                {
                    return Failure("I don't know where " + args.str + ".");
                }
            }
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            bool detatchAll = args.IsTrue("--detatchall");

            SimAvatar simAv;

            if (args.TryGetValue("target", out simAv))
            {
                UUID   target     = simAv.ID;
                string targetName = simAv.GetName();
                targetName += String.Format(" ({0})", target);
                if (Client.Appearances.ContainsKey(target))
                {
                    #region AvatarAppearance to AgentSetAppearance

                    AvatarAppearancePacket   appearance = TheBotClient.Appearances[target];
                    AgentSetAppearancePacket set        = Client.Appearance.MakeAppearancePacket();
                    set.AgentData.AgentID   = Client.Self.AgentID;
                    set.AgentData.SessionID = Client.Self.SessionID;
                    set.AgentData.SerialNum = SerialNum++;
                    set.AgentData.Size      = new Vector3(2f, 2f, 2f); // HACK

                    set.WearableData = new AgentSetAppearancePacket.WearableDataBlock[0];
                    set.VisualParam  = new AgentSetAppearancePacket.VisualParamBlock[appearance.VisualParam.Length];

                    for (int i = 0; i < appearance.VisualParam.Length; i++)
                    {
                        set.VisualParam[i]            = new AgentSetAppearancePacket.VisualParamBlock();
                        set.VisualParam[i].ParamValue = appearance.VisualParam[i].ParamValue;
                    }

                    set.ObjectData.TextureEntry = appearance.ObjectData.TextureEntry;

                    #endregion AvatarAppearance to AgentSetAppearance

                    // Detach everything we are currently wearing
                    if (detatchAll)
                    {
                        Client.Appearance.AddAttachments(new List <InventoryItem>(), true);
                    }

                    // Send the new appearance packet
                    Client.Network.SendPacket(set);

                    return(Success("Cloned " + targetName));
                }
                else
                {
                    /// allow clone thyself
                    if (Client.Self.AgentID == target)
                    {
                        AgentSetAppearancePacket set = Client.Appearance.MakeAppearancePacket();

                        Client.Network.SendPacket(set);
                        Logger.DebugLog("Send AgentSetAppearance packet");

                        return(Success("Cloned " + targetName));
                    }
                    return(Failure("Don't know the appearance of avatar " + targetName));
                }
            }
            else
            {
                return(Failure("Couldn't find avatar " + args.str));
            }
        }
示例#60
0
        public static CmdResult ExecuteRequestProc(CmdRequest args, Command thizcmd)
        {
            var TheBotClient = thizcmd.TheBotClient;
            OutputDelegate WriteLine = thizcmd.WriteLine;
            bool thread = args.IsTrue("--thread");
            bool queue = args.IsTrue("--queue");
            bool all = args.IsTrue("--all");
            bool kill = args.IsTrue("--kill");
            bool asyc = args.IsTrue("--async") || thread;
            TimeSpan wait;
            ManualResetEvent mre = null;
            if (args.TryGetValue("--wait", out wait))
            {
                mre = new ManualResetEvent(false);
            }
            bool newDebug = args.IsTrue("--debug");
            bool changeDebug = newDebug || args.IsTrue("--nodebug");

            bool createFresh = false;
            string id = args.Length == 0 ? "list" : GetTaskID(args, out createFresh);
            id = (id == "list") ? "" : id;
            int n = 0;
            int found = 0;
            if (id == "" || kill || changeDebug)
            {
                List<string> list = new List<string>();
                lock (TaskQueueHandler.TaskQueueHandlers)
                {
                    var atq = TheBotClient != null
                                  ? TheBotClient.AllTaskQueues()
                                  : ClientManager.SingleInstance.AllTaskQueues();
                    foreach (var queueHandler in atq)
                    {
                        if (!queueHandler.MatchesId(id)) continue;
                        bool isQueue = queueHandler.Impl == queueHandler;
                        if (isQueue) found++;
                        else n++;
                        if (changeDebug) queueHandler.DebugQueue = newDebug;
                        if (queueHandler.IsAlive)
                        {
                            string str = queueHandler.ToDebugString(true);
                            if (kill)
                            {
                                if (!all)
                                {
                                    if (!isQueue && !thread || isQueue && !queue)
                                    {
                                        WriteLine("Not killing " + str);
                                        continue;
                                    }
                                }
                                queueHandler.Abort();
                                str = "Killing " + str;
                                thizcmd.IncrResult("killed", 1);
                            }

                            WriteLine(str);
                        }
                        else
                        {
                            list.Add(queueHandler.ToDebugString(true));
                        }
                    }
                }
                foreach (var s in list)
                {
                    WriteLine(s);
                }
            }

            if (kill && createFresh)
            {
                return thizcmd.Failure("Cannot create and kill in the same operation");
            }
            string[] cmdS;
            args.TryGetValue("command", out cmdS);
            thizcmd.IncrResult("taskqueues", found);
            thizcmd.IncrResult("threads", n);
            if (cmdS == null || cmdS.Length == 0)
            {
                return thizcmd.Success("TaskQueueHandlers: " + found + ", threads: " + n);
            }

            /// task is killed if request.. now making a new one
            string cmd = Parser.Rejoin(cmdS, 0);
            bool needResult = mre != null;
            CmdResult[] result = null;
            if (createFresh) needResult = false;
            if (needResult)
            {
                result = new CmdResult[1];
            }
            CMDFLAGS flags = needResult ? CMDFLAGS.ForceResult : CMDFLAGS.Inherit;
            if (asyc) flags |= CMDFLAGS.ForceAsync;

            ThreadStart task = () =>
                                   {
                                       try
                                       {
                                           var res = TheBotClient.ExecuteCommand(cmd, args.CallerAgent, args.Output,
                                                                                 flags);
                                           if (result != null) result[0] = res;
                                       }
                                       catch (Exception)
                                       {
                                           throw;
                                       }
                                   };
            string message = TheBotClient.CreateTask(id, task, cmd, createFresh, false, mre, WriteLine);
            thizcmd.SetResult("taskid", id);
            if (mre != null)
            {
                if (!mre.WaitOne(wait)) return thizcmd.Failure("Timeout: " + message);
                if (result == null) return thizcmd.Success(message);
                return result[0] ?? thizcmd.Success(message);
            }
            return thizcmd.Success(message);
        }