示例#1
0
        private void ParcelObjectOwnersRequestHandler(Packet packet, LLAgent agent)
        {
            ParcelObjectOwnersRequestPacket request = (ParcelObjectOwnersRequestPacket)packet;

            SceneParcel parcel;

            if (m_parcels.TryGetParcel(request.ParcelData.LocalID, out parcel))
            {
                ParcelObjectOwnersReplyPacket    reply  = new ParcelObjectOwnersReplyPacket();
                Dictionary <UUID, OwnershipInfo> owners = new Dictionary <UUID, OwnershipInfo>();

                lock (parcel.ParcelEntities)
                {
                    foreach (ISceneEntity entity in parcel.ParcelEntities.Values)
                    {
                        // Skip child entities
                        if (entity is ILinkable && ((ILinkable)entity).Parent != null)
                        {
                            continue;
                        }

                        OwnershipInfo count;
                        if (!owners.TryGetValue(entity.OwnerID, out count))
                        {
                            count = new OwnershipInfo();
                            count.IsGroupOwned = false; // FIXME: Need to track group ownership
                            count.OnlineStatus = false; // FIXME: m_permissions.IsOnline(agent.ID, entity.OwnerID);

                            owners.Add(entity.OwnerID, count);
                        }

                        ++count.Count;
                    }
                }

                reply.Data = new ParcelObjectOwnersReplyPacket.DataBlock[owners.Count];
                int i = 0;
                foreach (KeyValuePair <UUID, OwnershipInfo> kvp in owners)
                {
                    reply.Data[i++] = new ParcelObjectOwnersReplyPacket.DataBlock
                    {
                        Count        = kvp.Value.Count,
                        OwnerID      = kvp.Key,
                        IsGroupOwned = kvp.Value.IsGroupOwned,
                        OnlineStatus = kvp.Value.OnlineStatus
                    };
                }

                m_udp.SendPacket(agent, reply, ThrottleCategory.Task, true);
            }
            else
            {
                m_log.Warn(agent.Name + " requested object owners for unknown parcel " + request.ParcelData.LocalID);
            }
        }
示例#2
0
文件: Parcels.cs 项目: thoys/simian
        private void ParcelObjectOwnersRequestHandler(Packet packet, LLAgent agent)
        {
            ParcelObjectOwnersRequestPacket request = (ParcelObjectOwnersRequestPacket)packet;

            SceneParcel parcel;
            if (m_parcels.TryGetParcel(request.ParcelData.LocalID, out parcel))
            {
                ParcelObjectOwnersReplyPacket reply = new ParcelObjectOwnersReplyPacket();
                Dictionary<UUID, OwnershipInfo> owners = new Dictionary<UUID, OwnershipInfo>();

                lock (parcel.ParcelEntities)
                {
                    foreach (ISceneEntity entity in parcel.ParcelEntities.Values)
                    {
                        // Skip child entities
                        if (entity is ILinkable && ((ILinkable)entity).Parent != null)
                            continue;

                        OwnershipInfo count;
                        if (!owners.TryGetValue(entity.OwnerID, out count))
                        {
                            count = new OwnershipInfo();
                            count.IsGroupOwned = false; // FIXME: Need to track group ownership
                            count.OnlineStatus = false; // FIXME: m_permissions.IsOnline(agent.ID, entity.OwnerID);

                            owners.Add(entity.OwnerID, count);
                        }

                        ++count.Count;

                    }
                }

                reply.Data = new ParcelObjectOwnersReplyPacket.DataBlock[owners.Count];
                int i = 0;
                foreach (KeyValuePair<UUID, OwnershipInfo> kvp in owners)
                {
                    reply.Data[i++] = new ParcelObjectOwnersReplyPacket.DataBlock
                    {
                        Count = kvp.Value.Count,
                        OwnerID = kvp.Key,
                        IsGroupOwned = kvp.Value.IsGroupOwned,
                        OnlineStatus = kvp.Value.OnlineStatus
                    };
                }

                m_udp.SendPacket(agent, reply, ThrottleCategory.Task, true);
            }
            else
            {
                m_log.Warn(agent.Name + " requested object owners for unknown parcel " + request.ParcelData.LocalID);
            }
        }