예제 #1
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);
                }
            }
        }
예제 #2
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
                        {
                        }
                    }
                }
            }
        }
예제 #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."));
                }
            }
        }
예제 #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
                }
            }
        }