Beispiel #1
0
        public void HandleObjectAttach(Message m)
        {
            var req = (ObjectAttach)m;

            if (req.CircuitSessionID != req.SessionID ||
                req.CircuitAgentID != req.AgentID)
            {
                return;
            }
            ObjectPart part;
            IAgent     agent;

            if (!RootAgents.TryGetValue(req.AgentID, out agent))
            {
                return;
            }
            foreach (ObjectAttach.Data d in req.ObjectData)
            {
                if (Primitives.TryGetValue(d.ObjectLocalID, out part))
                {
                    Object.ObjectGroup grp = part.ObjectGroup;
                    if (CanTake(agent, grp, grp.Position))
                    {
                        try
                        {
                            agent.AttachObject(grp, req.AttachmentPoint);
                            grp.Rotation = d.Rotation;
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void HandleObjectDrop(Message m)
        {
            var req = (ObjectDrop)m;

            if (req.CircuitSessionID != req.SessionID ||
                req.CircuitAgentID != req.AgentID)
            {
                return;
            }

            IAgent agent;

            if (!RootAgents.TryGetValue(req.AgentID, out agent))
            {
                return;
            }

            foreach (uint localid in req.ObjectList)
            {
                ObjectPart part;
                if (Primitives.TryGetValue(localid, out part))
                {
                    agent.DropAttachment(part.ObjectGroup);
                }
            }
        }
Beispiel #3
0
        public void HandleObjectOwner(Message m)
        {
            var req = (ObjectOwner)m;

            if (req.CircuitSessionID != req.SessionID ||
                req.CircuitAgentID != req.AgentID)
            {
                return;
            }

            IAgent agent;

            if (!RootAgents.TryGetValue(req.AgentID, out agent) || !agent.IsActiveGod)
            {
                return;
            }

            UGUI owner;
            UGI  group = UGI.Unknown;

            if (!AvatarNameService.TryGetValue(req.OwnerID, out owner))
            {
                return;
            }

            if (UUID.Zero != group.ID && !GroupsNameService.TryGetValue(req.GroupID, out group))
            {
                return;
            }

            using (var propHandler = new ObjectPropertiesSendHandler(agent, ID))
            {
                foreach (uint d in req.ObjectList)
                {
#if DEBUG
                    m_Log.DebugFormat("ObjectOwner localid={0}", d);
#endif

                    ObjectPart prim;
                    if (!Primitives.TryGetValue(d, out prim))
                    {
                        continue;
                    }

                    prim.Owner = owner;
                    prim.Group = group;

                    propHandler.Send(prim);
                }
            }
        }
        public void EjectFromParcel(UUID agentID, UUID parcelID)
        {
            IAgent     agent;
            ParcelInfo parcelInfo;

            if (RootAgents.TryGetValue(agentID, out agent) &&
                Parcels.TryGetValue(parcelID, out parcelInfo) &&
                parcelInfo.LandBitmap.ContainsLocation(agent.GlobalPosition))
            {
                ParcelInfo newParcel;
                Vector3    newPosition;
                if (TryGetNearestAccessibleParcel(agent, agent.GlobalPosition, out newParcel, out newPosition))
                {
                    agent.UnSit();
                    agent.GlobalPosition = newPosition;
                }
                else if (!agent.TeleportHome(this))
                {
                    agent.KickUser(typeof(SceneInterface).GetLanguageString(agent.CurrentCulture, "YouHaveBeenKickedFromParcel", "You have been kicked from parcel."));
                }
            }
        }
Beispiel #5
0
        public void HandleObjectPermissions(Message m)
        {
            var req = (ObjectPermissions)m;

            if (req.CircuitSessionID != req.SessionID ||
                req.CircuitAgentID != req.AgentID)
            {
                return;
            }

            IAgent agent;

            if (!RootAgents.TryGetValue(req.AgentID, out agent))
            {
                return;
            }

            bool isGod = agent.IsActiveGod && agent.IsInScene(this);

            using (ObjectPropertiesSendHandler propHandler = new ObjectPropertiesSendHandler(agent, ID))
            {
                foreach (ObjectPermissions.Data d in req.ObjectData)
                {
#if DEBUG
                    m_Log.DebugFormat("ObjectPermissions localid={0} field={1} change={2} mask=({3})", d.ObjectLocalID, d.Field.ToString(), d.ChangeType.ToString(), d.Mask.ToString());
#endif

                    ObjectPart prim;
                    if (!Primitives.TryGetValue(d.ObjectLocalID, out prim))
                    {
                        continue;
                    }
                    var grp     = prim.ObjectGroup;
                    var setmask = InventoryPermissionsMask.Every;
                    if (!isGod)
                    {
                        setmask = grp.RootPart.OwnerMask;
                    }

                    var clrmask = InventoryPermissionsMask.None;

                    switch (d.ChangeType)
                    {
                    case ObjectPermissions.ChangeType.Set:
                        setmask &= d.Mask;
                        break;

                    case ObjectPermissions.ChangeType.Clear:
                    default:
                        setmask = InventoryPermissionsMask.None;
                        clrmask = d.Mask;
                        break;
                    }

                    if (agent.IsActiveGod)
                    {
                        foreach (ObjectPart part in grp.ValuesByKey1)
                        {
                            ApplyPermissions(part, d, setmask, clrmask, propHandler);
                        }
                    }
                    else if (grp.RootPart.CheckPermissions(agent.Owner, agent.Group, InventoryPermissionsMask.Modify))
                    {
                        ApplyPermissions(grp.RootPart, d, setmask, clrmask, propHandler);
                    }

#if DEBUG
                    m_Log.DebugFormat("changed {5} => base=({0}) owner=({1}) group=({2}) everyone=({3}) nextowner=({4})",
                                      grp.RootPart.BaseMask.ToString(),
                                      grp.RootPart.OwnerMask.ToString(),
                                      grp.RootPart.GroupMask.ToString(),
                                      grp.RootPart.EveryoneMask.ToString(),
                                      grp.RootPart.NextOwnerMask.ToString(),
                                      grp.RootPart.LocalID);
#endif
                }
            }
        }
Beispiel #6
0
        static async Task Main(string[] args)
        {
            string HTTPAgentPath;

            if (args.Length == 0)
            {
                Console.WriteLine("Missing input ,Please pass filename along with Path");
                HTTPAgentPath = Console.ReadLine();
            }
            else
            {
                HTTPAgentPath = args[0];
            }


            //Read any file of json type

            string json = "";

            if (!File.Exists(HTTPAgentPath))
            {
                Console.WriteLine("File not found");
                return;
            }
            using (StreamReader r = new StreamReader(HTTPAgentPath))
            {
                json = r.ReadToEnd();
            }

            RootAgents agentList = JsonConvert.DeserializeObject <RootAgents>(json);

            string   locationURL;
            string   agentName;
            string   tinsResponse = "";
            ApiProxy proxy        = new ApiProxy();

            if (agentList != null)
            {
                foreach (var agent in agentList.Agents)
                {
                    agentName = agent.name;

                    locationURL = (agent.options.url != null ? agent.options.url : agent.options.message);

                    if (agent.type == "HTTPRequestAgent")
                    {
                        using (proxy = new ApiProxy())
                        {
                            if (locationURL.Contains("?"))
                            {
                                locationURL  = ParseJson.parsePrint(locationURL, tinsResponse);
                                tinsResponse = tinsResponse + "|" + await proxy.GetLocationAsync(locationURL);
                            }
                            else
                            {
                                tinsResponse = (tinsResponse != "" ? tinsResponse + "|" + await proxy.GetValues(locationURL) : await proxy.GetValues(locationURL));
                            }
                        }
                    }
                    else if (agent.type == "PrintAgent")
                    {
                        var arrResult = tinsResponse.Split('|');
                        foreach (string jsonResponseCollection in arrResult)
                        {
                            if (jsonResponseCollection != "")
                            {
                                locationURL = ParseJson.parsePrint(locationURL, jsonResponseCollection);
                            }
                        }

                        Console.WriteLine(locationURL);
                    }
                }
            }

            Console.ReadLine();
        }