Esempio n. 1
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 2)
                return ShowUsage(); // " moveprim prim [x y [z]]";

            int used;
            List<SimObject> PS = WorldSystem.GetSingleArg(args, out used);
            if (IsEmpty(PS)) return Failure("Cannot find prim: " + args.str);
            string[] to = Parser.SplitOff(args, used);
            SimPosition aPos = WorldSystem.GetVector(to, out used);
            if (aPos == null) return Failure("Cannot find position: " + string.Join(" ", to));
            if (!aPos.IsRegionAttached) return Failure("!IsRegionAttached: " + aPos);
            List<SimObject> TODO = new List<SimObject>();
            foreach (var O in PS)
            {
                if (!O.IsRegionAttached) return Failure("!IsRegionAttached: " + O);
                TODO.Add(O);
            }
            foreach (var O in TODO)
            {
                SimPosition localPos = WorldSystem.GetVector(to, out used, O);
                Vector3d local = localPos.GlobalPosition;
                O.SetObjectPosition(local);
            }
            return Success("acted on " + PS.Count);
        }
Esempio n. 2
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();
        }
Esempio n. 3
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length != 2)
                return ShowUsage(); // " packetlog 10 tenpackets.xml";

            return Success("This function is currently unimplemented");
        }
Esempio n. 4
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);
     }
 }
Esempio n. 5
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            float distance = 2.0f;

            int argsUsed;
            SimPosition simObject = WorldSystem.GetVector(args, out argsUsed);

            if (simObject == null) return Failure("Cannot find " + args.str);
            if (!simObject.IsRegionAttached)
            {
                return Failure("Cannot get SimPosition of " + simObject);
            }

            distance = 0.5f + simObject.GetSizeDistance();
            if (argsUsed < args.Length)
            {
                float d;
                if (float.TryParse(args[argsUsed], out d))
                {
                    distance = d;
                }
            }
            WriteLine("WalkTo {0} {1}", simObject, distance);
            WorldSystem.TheSimAvatar.SimpleMoveTo(simObject.GlobalPosition, distance, 10, false);
            WorldSystem.TheSimAvatar.StopMoving();
            return Success(WorldSystem.TheSimAvatar.DistanceVectorString(simObject));
        }
Esempio n. 6
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            string inventoryName;
            uint timeout;
            string fileName;

            if (args.Length != 3)
                return ShowUsage(); // " uploadimage [inventoryname] [timeout] [filename]";

            TextureID = UUID.Zero;
            inventoryName = args[0];
            fileName = args[2];
            if (!UInt32.TryParse(args[1], out timeout))
                return ShowUsage(); // " uploadimage [inventoryname] [timeout] [filename]";

            WriteLine("Loading image " + fileName);
            byte[] jpeg2k = LoadImage(fileName);
            if (jpeg2k == null)
                return Failure("failed to compress image to JPEG2000");
            WriteLine("Finished compressing image to JPEG2000, uploading...");
            start = DateTime.Now;
            DoUpload(jpeg2k, inventoryName);

            if (UploadCompleteEvent.WaitOne((int) timeout, false))
            {
                return
                    Success(string.Format("Texture upload {0}: {1}", (TextureID != UUID.Zero) ? "succeeded" : "failed",
                                          TextureID));
            }
            else
            {
                return Failure("Texture upload timed out");
            }
        }
Esempio n. 7
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            //  base.acceptInput(verb, args);

            if (args.str == "stop")
            {
                Client.Self.Fly(false);
                return Success("stopped flying");
            }
            if (args.str == "up")
            {
                Client.Self.Movement.UpPos = true;
                Client.Self.Movement.SendUpdate(true);
                Thread.Sleep(1000);
                Client.Self.Movement.UpPos = false;
                Client.Self.Movement.SendUpdate(true);
                return Success("flew up");
            }
            else if (args.str == "down")
            {
                Client.Self.Movement.UpNeg = true;
                Client.Self.Movement.SendUpdate(true);
                Thread.Sleep(1000);
                Client.Self.Movement.UpNeg = false;
                Client.Self.Movement.SendUpdate(true);
                return Success("flew down");
            }
            else
            {
                Client.Self.Fly(true);
                return Success("now flying");
            }
        }
Esempio n. 8
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
            {
                return ShowUsage(); // " goto_landmark [UUID]";
            }

            UUID landmark = UUID.Zero;
            int argsUsed;
            if (!UUIDTryParse(args, 0, out landmark, out argsUsed))
            {
                return Failure("Invalid LLUID");
            }
            else
            {
                WriteLine("Teleporting to " + landmark.ToString());
            }
            if (Client.Self.Teleport(landmark))
            {
                return Success("Teleport Succesful");
            }
            else
            {
                return Failure("Teleport Failed");
            }
        }
Esempio n. 9
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            StringBuilder output = new StringBuilder();
            {
                foreach (Simulator sim in LockInfo.CopyOf(Client.Network.Simulators))
                {
                    output.AppendLine(String.Format(
                                          "[{0}] Dilation: {1} InBPS: {2} OutBPS: {3} ResentOut: {4}  ResentIn: {5}",
                                          sim.ToString(), sim.Stats.Dilation, sim.Stats.IncomingBPS,
                                          sim.Stats.OutgoingBPS,
                                          sim.Stats.ResentPackets, sim.Stats.ReceivedResends));
                    output.Append("Packets in the queue: " + Client.Network.InboxCount);
                    Simulator csim = sim;
                    output.AppendLine(
                        String.Format(
                            "FPS : {0} PhysicsFPS : {1} AgentUpdates : {2} Objects : {3} Scripted Objects : {4}",
                            csim.Stats.FPS, csim.Stats.PhysicsFPS, csim.Stats.AgentUpdates, csim.Stats.Objects,
                            csim.Stats.ScriptedObjects));
                    output.AppendLine(
                        String.Format(
                            "Frame Time : {0} Net Time : {1} Image Time : {2} Physics Time : {3} Script Time : {4} Other Time : {5}",
                            csim.Stats.FrameTime, csim.Stats.NetTime, csim.Stats.ImageTime, csim.Stats.PhysicsTime,
                            csim.Stats.ScriptTime, csim.Stats.OtherTime));
                    output.AppendLine(String.Format("Agents : {0} Child Agents : {1} Active Scripts : {2}",
                                                    csim.Stats.Agents, csim.Stats.ChildAgents, csim.Stats.ActiveScripts));
                }
            }


            return Success(output.ToString());
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            ulong regionHandle;

            int argsUsed;
            Simulator CurSim = TryGetSim(args, out argsUsed) ?? Client.Network.CurrentSim;
            if (args.Length == 0)
                regionHandle = CurSim.Handle;
            else if (!(args.Length == 1 && UInt64.TryParse(args[0], out regionHandle)))
                return ShowUsage(); // " agentlocations [regionhandle]";

            List<MapItem> items = Client.Grid.MapItems(regionHandle, GridItemType.AgentLocations,
                                                       GridLayerType.Objects, 1000*20);

            if (items != null)
            {
                StringBuilder ret = new StringBuilder();
                ret.AppendLine("Agent locations:");

                for (int i = 0; i < items.Count; i++)
                {
                    MapAgentLocation location = (MapAgentLocation) items[i];

                    ret.AppendLine(String.Format("{0} avatar(s) at {1},{2}", location.AvatarCount, location.LocalX,
                                                 location.LocalY));
                }

                return Success(ret.ToString());
            }
            else
            {
                return Failure("failed to fetch agent locations");
            }
        }
Esempio n. 11
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage(); // " findsim [Simulator Name]";

            // Build the simulator name from the args list
            string simName = string.Empty;
            for (int i = 0; i < args.Length; i++)
                simName += args[i] + " ";
            simName = simName.TrimEnd().ToLower();

            //if (!GridDataCached[Client])
            //{
            //    Client.Grid.RequestAllSims(GridManager.MapLayerType.Objects);
            //    System.Threading.Thread.Sleep(5000);
            //    GridDataCached[Client] = true;
            //}

            GridRegion region;

            if (Client.Grid.GetGridRegion(simName, GridLayerType.Objects, out region))
                return
                    Success(string.Format("{0}: handle={1} ({2},{3})", region.Name, region.RegionHandle, region.X,
                                          region.Y));

            else
                return Failure("Lookup of " + simName + " failed");
        }
Esempio n. 12
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int seconds;
            if (args.Length != 1 || !Int32.TryParse(args[0], out seconds))
                return ShowUsage(); // " sleep [seconds]";

            AgentPausePacket pause = new AgentPausePacket();
            pause.AgentData.AgentID = Client.Self.AgentID;
            pause.AgentData.SessionID = Client.Self.SessionID;
            pause.AgentData.SerialNum = sleepSerialNum++;

            Client.Network.SendPacket(pause);

            // Sleep
            Thread.Sleep(seconds*1000);

            AgentResumePacket resume = new AgentResumePacket();
            resume.AgentData.AgentID = Client.Self.AgentID;
            resume.AgentData.SessionID = Client.Self.SessionID;
            resume.AgentData.SerialNum = pause.AgentData.SerialNum;

            Client.Network.SendPacket(resume);

            return Success("Paused, slept for " + seconds + " second(s), and resumed");
        }
Esempio n. 13
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     if (args.Length < 1) return ShowUsage();
     string botcmd = args.GetString("act");
     TheSimAvatar.CurrentAction = new CommandAction(TheSimAvatar, botcmd);
     return Success(string.Format("{0} CurrentAction = {1}", TheSimAvatar, botcmd));
 }
Esempio n. 14
0
        public override CmdResult ExecuteRequest(CmdRequest args0)
        {
            var args = args0.GetProperty("targets");
            if (args.Length == 0)
            {
                return ShowUsage();
            }

            int argsUsed;
            List<string> searchArgs = new List<string> {"family"};
            searchArgs.AddRange(args);
            List<SimObject> PSO = WorldSystem.GetPrimitives(searchArgs.ToArray(), out argsUsed);
            List<Primitive> PS = new List<Primitive>();
            WorldSystem.AsPrimitives(PS,PSO);
            if (IsEmpty(PS)) return Failure("Cannot find objects from " + string.Join(" ", args));
            Primitive rootPim = PS[0];
            foreach (Primitive ps in PS)
            {
                if (ps.ParentID == 0)
                {
                    rootPim = ps;
                }
            }
            TheBotClient.InvokeGUI(() =>
                                    {
                                        frmPrimWorkshop pw = new frmPrimWorkshop(TheBotClient.TheRadegastInstance,
                                                                                 rootPim.LocalID);
                                       // pw.LoadPrims(PS);
                                       // pw.
                                        pw.Show();
                                    });
            return Success(Name + " on " + PS.Count);
        }
Esempio n. 15
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage(); // " searchevents [search text]";

            string searchText = string.Empty;
            for (int i = 0; i < args.Length; i++)
                searchText += args[i] + " ";
            searchText = searchText.TrimEnd();

            waitQuery.Reset();

            Client.Directory.DirEventsReply += Directory_DirEvents;

            // send the request to the directory manager
            Client.Directory.StartEventsSearch(searchText, 0);

            try
            {
                if (waitQuery.WaitOne(20000, false) && Client.Network.Connected)
                {
                    return Success("Your query '" + searchText + "' matched " + resultCount + " Events. ");
                }
                else
                {
                    return Failure("Timeout waiting for simulator to respond.");
                }
            }
            finally
            {
                Client.Directory.DirEventsReply -= Directory_DirEvents;
            }
        }
Esempio n. 16
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();
        }
Esempio n. 17
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     int start = 0;
     string fname = "UI";
     TextFilter filter = ClientManager.TheUILogFilter;
     if (args.Length > 0)
     {
         string sf = args[0].ToLower();
         if (sf == "filter" || sf == "global")
         {
             filter = DLRConsole.TheGlobalLogFilter;
             fname = "Global";
         }
         else
         {
             if (sf == "ui")
             {
                 filter = DLRConsole.TheGlobalLogFilter;
                 fname = "UI";
             }
         }
         start = 1;
     }
     string ss = Parser.Rejoin(args, start);
     filter.UpateLogging(ss, WriteLine);
     return Success("//log " + fname + " clear " + ss.Replace("\n", " "));
 }
Esempio n. 18
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();
        }
Esempio n. 19
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage();

            string groupName = String.Empty;
            for (int i = 0; i < args.Length; i++)
                groupName += args[i] + " ";
            groupName = groupName.Trim();

            UUID groupUUID = Client.GroupName2UUID(groupName);
            if (UUID.Zero != groupUUID)
            {
                Client.Groups.GroupLeaveReply += Groups_OnGroupLeft;
                Client.Groups.LeaveGroup(groupUUID);

                GroupsEvent.WaitOne(30000, false);
                Client.Groups.GroupLeaveReply -= Groups_OnGroupLeft;

                GroupsEvent.Reset();
                Client.ReloadGroupsCache();

                if (leftGroup)
                    return Success(Client.ToString() + " has left the group " + groupName);
                return Failure("failed to leave the group " + groupName);
            }
            return Failure(Client.ToString() + " doesn't seem to be member of the group " + groupName);
        }
Esempio n. 20
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            UUID assetID = UUID.Zero;

            if (args.Length != 1 || !UUID.TryParse(args[0], out assetID))
                return ShowUsage(); // " xfer [uuid]";

            string filename;
            byte[] assetData = RequestXfer(assetID, AssetType.Object, out filename);

            if (assetData != null)
            {
                try
                {
                    File.WriteAllBytes(filename, assetData);
                    return Success("Saved asset " + filename);
                }
                catch (Exception ex)
                {
                    return Failure("failed to save asset " + filename + ": " + ex.Message);
                }
            }
            else
            {
                return Failure("failed to xfer asset " + assetID);
            }
        }
Esempio n. 21
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int channel = 0;
            int startIndex = 0;

            if (args.Length < 1)
            {
                return ShowUsage(); // " me (optional channel) whatever";
            }
            else if (args.Length > 1)
            {
                if (Int32.TryParse(args[0], out channel))
                    startIndex = 1;
            }

            StringBuilder message = new StringBuilder();

            for (int i = startIndex; i < args.Length; i++)
            {
                message.Append(args[i]);
                if (i != args.Length - 1) message.Append(" ");
            }

            Client.Self.Chat("/me " + message.ToString(), channel, ChatType.Normal);

            return Success("Emoted " + message.ToString());
        }
Esempio n. 22
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     if (args.Length == 0)
     {
         return ShowUsage();
     }
     int argsUsed;
     List<SimObject> PS = WorldSystem.GetPrimitives(args, out argsUsed);
     if (PS.Count != 1) return Failure("Cannot find single object from " + args.str);
     Primitive rootPrim = PS[0].Prim;
     Simulator worldSystemGetSimulator = WorldSystem.GetSimulator(rootPrim);
     if (rootPrim.ParentID != 0)
         return
             Failure("Root Prim Has Parent "
                     + WorldSystem.GetSimObject(rootPrim.ParentID, worldSystemGetSimulator));
     AddSuccess(Name + " on " + WorldSystem.GetSimObject(rootPrim));
     PS = WorldSystem.GetPrimitives(Parser.SplitOff(args, argsUsed), out argsUsed);
     try
     {
         PS.Remove(PS[0]);
         List<uint> linkSet = new List<uint>();
         PS.ForEach(o => linkSet.Add(o.LocalID));
         linkSet.Add(rootPrim.LocalID);
         TheBotClient.Objects.LinkPrims(worldSystemGetSimulator, linkSet);
         return Success("linked count =" + PS.Count);
     }
     catch (Exception e)
     {
         return Failure("" + e);
     }
 }
Esempio n. 23
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     if (args.Length == 0)
     {
         ShowEffects = true;
         return Success("Viewer effects will be shown on the console");
     }
     else if (args.Length == 1)
     {
         if (args[0] == "on")
         {
             Client.Avatars.ViewerEffect += new EventHandler<ViewerEffectEventArgs>(Avatars_ViewerEffect);
             Client.Avatars.ViewerEffectPointAt +=
                 new EventHandler<ViewerEffectPointAtEventArgs>(Avatars_ViewerEffectPointAt);
             Client.Avatars.ViewerEffectLookAt +=
                 new EventHandler<ViewerEffectLookAtEventArgs>(Avatars_ViewerEffectLookAt);
             ShowEffects = true;
             return Success("Viewer effects will be shown on the console");
         }
         else
         {
             ShowEffects = false;
             return Success("Viewer effects will not be shown");
         }
     }
     else
     {
         return ShowUsage();
     }
 }
Esempio n. 24
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage();

            int argsUsed;
            List<SimObject> PS = WorldSystem.GetSingleArg(args, out argsUsed);
            args = args.AdvanceArgs(argsUsed);
            AttachmentPoint attachmentPoint = AttachmentPoint.Default;
            if (args.Length > 0)
            {
                object obj;
                if (TryEnumParse(typeof (AttachmentPoint), args, 0, out argsUsed, out obj))
                {
                    attachmentPoint = (AttachmentPoint) obj;
                }
            }
            args = args.AdvanceArgs(argsUsed);
            Quaternion rotation = Quaternion.Identity;
            if (args.Length > 0)
            {
                Quaternion quat;
                if (Quaternion.TryParse(Parser.Rejoin(args, 0), out quat))
                {
                    rotation = quat;
                }
            }
            foreach (var found in PS)
            {
                Client.Objects.AttachObject(found.GetSimulator(), found.LocalID, attachmentPoint, rotation);
                AddSuccess("attaching " + found + " to " + attachmentPoint + " with rotation " + rotation);
            }
            return SuccessOrFailure();
        }
Esempio n. 25
0
        public override CmdResult ExecuteRequest(CmdRequest argsI)
        {
            string[] args = argsI;
            Client.Network.RegisterCallback(PacketType.AlertMessage, AlertMessageHandler);
            // Construct the target name from the passed arguments
            string target = String.Empty;
            for (int ct = 0; ct < args.Length; ct++)
                target = target + args[ct] + " ";
            target = target.TrimEnd();

            if (target.Length == 0 || target == "off")
            {
                Active = false;
                targetLocalID = 0;
                Client.Self.AutoPilotCancel();
                return Success("Following is off");
            }
            else
            {
                if (Follow(target))
                    return Success("Following " + target);
                else
                    return Failure("Unable to follow " + target + ".  Client may not be able to see that avatar.");
            }
        }
Esempio n. 26
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage(); // " wear [outfit name] eg: 'wear /My Outfit/Dance Party";

            string target = String.Empty;
            bool bake = true;

            for (int ct = 0; ct < args.Length; ct++)
            {
                if (args[ct].Equals("nobake"))
                    bake = false;
                else
                    target = target + args[ct] + " ";
            }

            target = target.TrimEnd();

            try
            {
                List<InventoryItem> outfit = Client.GetFolderItems(target);
                Client.Appearance.ReplaceOutfit(outfit);
            }
            catch (Exception ex)
            {
                return Failure("Invalid outfit (" + ex.Message + ")");
            }

            return Success(string.Empty);
        }
Esempio n. 27
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage();
            if (args.ContainsFlag("--all"))
            {
                List<uint> ids = new List<uint>();
                foreach (SimObject o in TheSimAvatar.Children)
                {
                    Success("Detatching " + o);
                    ids.Add(o.LocalID);
                }
                Client.Objects.DetachObjects(TheSimAvatar.GetSimulator(), ids);
                return Success("detatched all " + ids.Count);
            }

            int argsUsed;
            string[] keyargs = args.GetProperty("targets");
            List<SimObject> PS = WorldSystem.GetPrimitives(keyargs, out argsUsed);
            List<uint> idz = new List<uint>();
            foreach (var o in PS)
            {
                Success("Detatching " + o);
                idz.Add(o.LocalID);
            }
            Client.Objects.DetachObjects(TheSimAvatar.GetSimulator(), idz);
            return Success("detatched  " + args.str + " " + idz.Count);
        }
Esempio n. 28
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (Client.Network.CurrentSim == null) return Failure("not yet connected");
            int argsUsed;
            var args0 = args.GetProperty("targets");
            List<SimObject> OS = WorldSystem.GetPrimitives(args0, out argsUsed);
            bool writeInfo = !args.IsFFI;
            if (IsEmpty(OS))
            {
                OS = new List<SimObject> {TheSimAvatar};
            }
            int total = 0;
            foreach (var O in OS)
            {
                if (writeInfo) WriteLine("Attachments for " + O);
                int count = O.Children.Count;
                total++;
                foreach (var s in O.Children)
                {
                    AppendItem("list", O);
                    if (!writeInfo) continue;
                    String point = "Unknown";
                    Primitive prim = s.Prim;
                    if (prim != null)
                    {
                        point = prim.PrimData.AttachmentPoint.ToString() + " Offset: " + prim.Position;
                    }

                    // TODO: Done? Fetch properties for the objects with missing property sets so we can show names
                    WriteLine("[Attachment @ {0}] {1}", point, s);
                }
            }
            SetResult("count", total);
            return SuccessOrFailure();
        }
Esempio n. 29
0
 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     string to_op = args.GetString("verb");
     string objname = args.GetString("target");
     if (objname == "")
     {
         return Failure("$bot don't know what object to use.");
     }
     if (to_op == "")
     {
         SimObject objToUse;
         if (WorldSystem.tryGetPrim(objname, out objToUse))
         {
             if ((BotNeeds) TheSimAvatar["CurrentNeeds"] == null)
             {
                 TheSimAvatar["CurrentNeeds"] = new BotNeeds(90.0f);
             }
             SimTypeUsage usage = objToUse.Affordances.GetBestUse((BotNeeds) TheSimAvatar["CurrentNeeds"]);
             if (usage == null)
             {
                 //usage = new MoveToLocation(TheSimAvatar, objToUse);
                 return Failure("$bot don't have a use for " + objToUse + " yet.");
             }
             TheSimAvatar.Do(usage, objToUse);
             return Success("used " + objToUse);
         }
         return Failure("$bot don't know what to do with " + objname);
     }
     WriteLine("Trying to (" + to_op + ") with (" + objname + ")");
     TheBotClient.UseInventoryItem(to_op, objname);
     return Success("completed to (" + to_op + ") with (" + objname + ")");
 }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 2)
                return ShowUsage();
                    // " selectobjects parcelID OwnerUUID (use parcelinfo to get ID, use parcelprimowners to get ownerUUID)";
            int argsUsed;
            Simulator CurSim = TryGetSim(args, out argsUsed) ?? Client.Network.CurrentSim;
            int parcelID;
            UUID ownerUUID = UUID.Zero;

            int counter = 0;
            StringBuilder result = new StringBuilder();
            // test argument that is is a valid integer, then verify we have that parcel data stored in the dictionary
            if (Int32.TryParse(args[argsUsed], out parcelID) &&
                UUIDTryParse(args, argsUsed + 1, out ownerUUID, out argsUsed))
            {
                Client.Parcels.ReturnObjects(CurSim, parcelID, ObjectReturnType.Owner, new List<UUID> {ownerUUID});
                return Success("returning parcel=" + parcelID + " sim=" + CurSim + " user="******"Unable to find Parcel {0} in Parcels Dictionary, Did you run parcelinfo to populate the dictionary first?",
                            args[0]));
            }
        }