/// <summary>
        /// Send the parcel overlay blocks to the client. We send the overlay packets
        /// around a location and limited by the 'parcelLayerViewDistance'. This number
        /// is usually 128 and the code is arranged so it sends all the parcel overlay
        /// information for a whole region if the region is legacy sized (256x256). If
        /// the region is larger, only the parcel layer information is sent around
        /// the point specified. This reduces the problem of parcel layer information
        /// blocks increasing exponentially as region size increases.
        /// </summary>
        /// <param name="remote_client">The object representing the client</param>
        /// <param name="xPlace">X position in the region to send surrounding parcel layer info</param>
        /// <param name="yPlace">y position in the region to send surrounding parcel layer info</param>
        /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param>
        public void SendParcelOverlay(IClientAPI remote_client)
        {
            if (remote_client.SceneAgent.PresenceType == PresenceType.Npc)
                return;

            const int LAND_BLOCKS_PER_PACKET = 1024;

            byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET];
            int byteArrayCount = 0;
            int sequenceID = 0;

            // Layer data is in LandUnit (4m) chunks
            for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += LandUnit)
            {
                for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += LandUnit)
                {
                    byte tempByte = 0; //This represents the byte for the current 4x4

                    ILandObject currentParcelBlock = GetLandObject(x, y);

                    if (currentParcelBlock != null)
                    {
                        // types 
                        if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
                        {
                            //Owner Flag
                            tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_REQUESTER;
                        }
                        else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID))
                        {
                            tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_GROUP;
                        }
                        else if (currentParcelBlock.LandData.SalePrice > 0 &&
                                 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
                                  currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
                        {
                            //Sale type
                            tempByte = (byte)LandChannel.LAND_TYPE_IS_FOR_SALE;
                        }
                        else if (currentParcelBlock.LandData.OwnerID == UUID.Zero)
                        {
                            //Public type 
                            tempByte = (byte)LandChannel.LAND_TYPE_PUBLIC; // this does nothing, its zero
                        }
                        // LAND_TYPE_IS_BEING_AUCTIONED still unsuported
                        else
                        {
                            //Other Flag
                            tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_OTHER;
                        }

                        // now flags
                        // border control

                        ILandObject westParcel = null;
                        ILandObject southParcel = null;
                        if (x > 0)
                        {
                            westParcel = GetLandObject((x - 1), y);
                        }
                        if (y > 0)
                        {
                            southParcel = GetLandObject(x, (y - 1));
                        }

                        if (x == 0)
                        {
                            tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST;
                        }
                        else if (westParcel != null && westParcel != currentParcelBlock)
                        {
                            tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST;
                        }

                        if (y == 0)
                        {
                            tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH;
                        }
                        else if (southParcel != null && southParcel != currentParcelBlock)
                        {
                            tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH;
                        }

                        // local sound
                        if ((currentParcelBlock.LandData.Flags & (uint)ParcelFlags.SoundLocal) != 0)
                            tempByte |= (byte)LandChannel.LAND_FLAG_LOCALSOUND;

                        // hide avatars
                        if (!currentParcelBlock.LandData.SeeAVs)
                            tempByte |= (byte)LandChannel.LAND_FLAG_HIDEAVATARS;


                        byteArray[byteArrayCount] = tempByte;
                        byteArrayCount++;
                        if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
                        {
                            remote_client.SendLandParcelOverlay(byteArray, sequenceID);
                            byteArrayCount = 0;
                            sequenceID++;
                            byteArray = new byte[LAND_BLOCKS_PER_PACKET];
                        }
                    }
                }
            }

            if (byteArrayCount > 0)
            {
                remote_client.SendLandParcelOverlay(byteArray, sequenceID);
            }
        }
        protected internal void HandleObjectGroupUpdate(
            IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage)
        {
            if (!remoteClient.IsGroupMember(GroupID))
                return;

            SceneObjectGroup group = GetGroupByPrim(objectLocalID);
            if (group != null)
            {
                if (group.OwnerID == remoteClient.AgentId)
                    group.SetGroup(GroupID, remoteClient);
            }
        }
        public bool IsAgentInGroup(IClientAPI remoteClient, UUID groupID)
        {
            // Use the known in-memory group membership data if available before going to db.
            if (remoteClient != null)
                remoteClient.IsGroupMember(groupID);

            return m_groupData.IsAgentInGroup(groupID, remoteClient.AgentId);
        }
示例#4
0
 protected internal void HandleObjectGroupUpdate(
     IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage)
 {
     if (!remoteClient.IsGroupMember(GroupID))
         return; // No settings to groups you arn't in
     SceneObjectGroup group = GetGroupByPrim(objectLocalID);
     if (group != null)
     { 
         if(m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
             if (group.OwnerID == remoteClient.AgentId)
                 group.SetGroup(GroupID, remoteClient);
     }
 }