コード例 #1
0
        public void OnPlacesQueryRequest(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client)
        {
            if (QueryFlags == 64) //Agent Owned
            {
                //Get all the parcels
                LandData[] LandData = directoryService.GetParcelByOwner(client.AgentId);

                List <ExtendedLandData> parcels = new List <ExtendedLandData>();
                foreach (LandData land in LandData)
                {
                    //Find the region so we can add the meters correctly
                    OpenSim.Services.Interfaces.GridRegion region = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero, land.RegionID);
                    if (region != null)
                    {
                        ExtendedLandData parcel = new ExtendedLandData();
                        parcel.LandData   = land;
                        parcel.RegionType = region.RegionType;
                        parcel.RegionName = region.RegionName;
                        parcel.GlobalPosX = region.RegionLocX + land.UserLocation.X;
                        parcel.GlobalPosY = region.RegionLocY + land.UserLocation.Y;
                        parcels.Add(parcel);
                    }
                }

                client.SendPlacesQuery(parcels.ToArray(), QueryID, TransactionID);
            }
            if (QueryFlags == 256) //Group Owned
            {
                //Find all the group owned land
                LandData[] LandData = directoryService.GetParcelByOwner(QueryID);

                List <ExtendedLandData> parcels = new List <ExtendedLandData>();
                foreach (LandData land in LandData)
                {
                    //Find the region from the grid service so that we can add the meters correctly
                    OpenSim.Services.Interfaces.GridRegion region = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero, land.RegionID);
                    if (region != null)
                    {
                        ExtendedLandData parcel = new ExtendedLandData();
                        parcel.LandData   = land;
                        parcel.RegionType = region.RegionType;
                        parcel.RegionName = region.RegionName;
                        parcel.GlobalPosX = region.RegionLocX + land.UserLocation.X;
                        parcel.GlobalPosY = region.RegionLocY + land.UserLocation.Y;
                        parcels.Add(parcel);
                    }
                }
                //Send if we have any parcels
                if (parcels.Count != 0)
                {
                    client.SendPlacesQuery(parcels.ToArray(), QueryID, TransactionID);
                }
            }
        }
コード例 #2
0
        private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
        {
            if (parcelID == UUID.Zero)
                return;
            ExtendedLandData extLandData = new ExtendedLandData();
            Util.ParseFakeParcelID(parcelID, out extLandData.RegionHandle,
                out extLandData.X, out extLandData.Y);
            m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
                                                                            extLandData.RegionHandle, extLandData.X, extLandData.Y);
            IDirectoryServiceConnector DSC = Aurora.DataManager.DataManager.RequestPlugin<IDirectoryServiceConnector>();
            LandData data = DSC.GetParcelInfo(parcelID);
            if (data == null)
            {
                ILandObject land = m_scene.LandChannel.GetLandObject(extLandData.X, extLandData.Y);
                data = DSC.GetParcelInfo(land.LandData.InfoUUID);
            }
            extLandData.LandData = data;

            if (extLandData != null)  // if we found some data, send it
            {
                GridRegion info;
                if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
                {
                    info = new GridRegion(m_scene.RegionInfo);
                }
                else
                {
                    // most likely still cached from building the extLandData entry
                    uint x = 0, y = 0;
                    OpenMetaverse.Utils.LongToUInts(extLandData.RegionHandle, out x, out y);
                    info = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
                }
                if (extLandData.LandData == null)
                {
                    m_log.WarnFormat("[LAND]: Failed to find parcel {0} in region {1}", parcelID, info.RegionName); 
                    return;
                }
                // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
                m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
                                  extLandData.LandData.Name, extLandData.RegionHandle);
                remoteClient.SendParcelInfo(extLandData.LandData, parcelID, (uint)(info.RegionLocX * Constants.RegionSize + extLandData.X), (uint)(info.RegionLocY * Constants.RegionSize + extLandData.Y), info.RegionName);
            }
            else
                m_log.Debug("[LAND] got no parcelinfo; not sending");
        }