private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
        {
            if (parcelID == UUID.Zero)
                return;

            ExtendedLandData data = (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
                    delegate(string id)
                    {
                        UUID parcel = UUID.Zero;
                        UUID.TryParse(id, out parcel);
                        // assume we've got the parcelID we just computed in RemoteParcelRequest
                        ExtendedLandData extLandData = new ExtendedLandData();
                        Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
                                               out extLandData.X, out extLandData.Y);
                        m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
                                          extLandData.RegionHandle, extLandData.X, extLandData.Y);

                        // for this region or for somewhere else?
                        if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
                        {
                            extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).LandData;
                            extLandData.RegionAccess = m_scene.RegionInfo.AccessLevel;
                        }
                        else
                        {
                            ILandService landService = m_scene.RequestModuleInterface<ILandService>();
                            extLandData.LandData = landService.GetLandData(m_scene.RegionInfo.ScopeID,
                                    extLandData.RegionHandle,
                                    extLandData.X,
                                    extLandData.Y,
                                    out extLandData.RegionAccess);
                            if (extLandData.LandData == null)
                            {
                                // we didn't find the region/land => don't cache
                                return null;
                            }
                        }
                        return extLandData;
                    });

            if (data != null)  // if we found some data, send it
            {
                GridRegion info;
                if (data.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;
                    Utils.LongToUInts(data.RegionHandle, out x, out y);
                    info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
                }
                // 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 MANAGEMENT MODULE]: got parcelinfo for parcel {0} in region {1}; sending...",
                                  data.LandData.Name, data.RegionHandle);
                // HACK for now
                RegionInfo r = new RegionInfo();
                r.RegionName = info.RegionName;
                r.RegionLocX = (uint)info.RegionLocX;
                r.RegionLocY = (uint)info.RegionLocY;
                r.RegionSettings.Maturity = (int)Util.ConvertAccessLevelToMaturity(data.RegionAccess);
                remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
            }
            else
                m_log.Debug("[LAND MANAGEMENT MODULE]: got no parcelinfo; not sending");
        }
        private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
        {
            if (parcelID == UUID.Zero)
                return;
            ulong RegionHandle = 0;
            uint X, Y, Z;
            Util.ParseFakeParcelID(parcelID, out RegionHandle,
                                   out X, out Y, out Z);
            MainConsole.Instance.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
                                             RegionHandle, X, Y);
            IDirectoryServiceConnector DSC = Framework.Utilities.DataManager.RequestPlugin<IDirectoryServiceConnector>();
            if (DSC != null)
            {
                LandData data = DSC.GetParcelInfo(parcelID);

                if (data != null) // if we found some data, send it
                {
                    GridRegion info;
                    int RegionX, RegionY;
                    Util.UlongToInts(RegionHandle, out RegionX, out RegionY);
                    RegionX = (int) ((float) RegionX/Constants.RegionSize)*Constants.RegionSize;
                    RegionY = (RegionY/Constants.RegionSize)*Constants.RegionSize;
                    if (RegionX == m_scene.RegionInfo.RegionLocX &&
                        RegionY == m_scene.RegionInfo.RegionLocY)
                    {
                        info = new GridRegion(m_scene.RegionInfo);
                    }
                    else
                    {
                        // most likely still cached from building the extLandData entry
                        info = m_scene.GridService.GetRegionByPosition(null, RegionX, RegionY);
                    }
                    if (info == null)
                    {
                        MainConsole.Instance.WarnFormat("[LAND]: Failed to find region having parcel {0} @ {1} {2}",
                                                        parcelID, X, Y);
                        return;
                    }
                    // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
                    MainConsole.Instance.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
                                                     data.Name, RegionHandle);
                    remoteClient.SendParcelInfo(data, parcelID, (uint) (info.RegionLocX + data.UserLocation.X),
                                                (uint) (info.RegionLocY + data.UserLocation.Y), info.RegionName);
                }
                else
                    MainConsole.Instance.WarnFormat("[LAND]: Failed to find parcel {0}", parcelID);
            }
            else
                MainConsole.Instance.Debug("[LAND] got no directory service; not sending");
        }
        private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
        {
            if (parcelID == UUID.Zero)
                return;
            ulong RegionHandle = 0;
            uint X, Y;
            Util.ParseFakeParcelID(parcelID, out RegionHandle,
                out X, out Y);
            m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
                                                                            RegionHandle, X, Y);
            IDirectoryServiceConnector DSC = Aurora.DataManager.DataManager.RequestPlugin<IDirectoryServiceConnector>();
            if (DSC != null)
            {
                LandData data = DSC.GetParcelInfo(parcelID);

                if (data != null)  // if we found some data, send it
                {
                    GridRegion info;
                    if (RegionHandle == m_scene.RegionInfo.RegionHandle)
                    {
                        info = new GridRegion(m_scene.RegionInfo);
                    }
                    else
                    {
                        // most likely still cached from building the extLandData entry
                        info = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)X, (int)Y);
                    }
                    if (info == null)
                    {
                        m_log.WarnFormat("[LAND]: Failed to find parcel {0}", parcelID);
                        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...",
                                      data.Name, RegionHandle);
                    remoteClient.SendParcelInfo(data, parcelID, (uint)(info.RegionLocX + data.UserLocation.X), (uint)(info.RegionLocY + data.UserLocation.Y), info.RegionName);
                }
                else
                    m_log.WarnFormat("[LAND]: Failed to find parcel {0}", parcelID);
            }
            else
                m_log.Debug("[LAND] got no directory service; not sending");
        }
示例#4
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");
        }
示例#5
0
        private void handleParcelInfo(IClientAPI remoteClient, UUID parcelID)
        {
            ExtendedLandData data = null;

            if (parcelID != UUID.Zero)
            {
                data = (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), delegate(string id)
                {
                    UUID parcel = UUID.Zero;
                    UUID.TryParse(id, out parcel);

                    // First try this parcel ID as a valid real parcel ID in the db.
                    ExtendedLandData extLandData = QueryParcelID(parcelID);
                    if (extLandData == null)
                        extLandData = QueryFakeParcelID(parcelID);
                    return extLandData;
                });
            }
            if (data == null)
            {
                m_log.Debug("[LAND]: got no parcelinfo; substituting dummy parcel at current location.");
                data = ParcelNotFound(remoteClient);
            }

            // if we found some data, send it
            RegionInfo info = null;
            if (data.regionHandle == m_scene.RegionInfo.RegionHandle)
            {
                info = m_scene.RegionInfo;
            }
            else
            {
                // most likely still cached from building the extLandData entry
                info = m_scene.CommsManager.GridService.RequestNeighbourInfo(data.regionHandle);
            }

            if (info == null)
            {
                m_log.Debug("[LAND]: parcelinfo could not find region; substituting dummy location.");
                data = ParcelNotFound(remoteClient);
                info = m_scene.RegionInfo;
            }

            // we need to transfer the same parcelID, possibly fake, 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...", data.landData.Name, data.regionHandle);
            remoteClient.SendParcelInfo(info, data.landData, parcelID, data.x, data.y);
        }
        private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
        {
            if (parcelID == UUID.Zero)
                return;
            IDirectoryServiceConnector DSC = Framework.Utilities.DataManager.RequestPlugin<IDirectoryServiceConnector>();
            if (DSC != null)
            {
                LandData data = DSC.GetParcelInfo(parcelID);

                if (data != null) // if we found some data, send it
                {
                    GridRegion info;
                    if (data.RegionID == m_scene.RegionInfo.RegionID)
                    {
                        info = new GridRegion(m_scene.RegionInfo);
                    }
                    else
                    {
                        // most likely still cached from building the extLandData entry
                        info = m_scene.GridService.GetRegionByUUID(null, data.RegionID);
                    }
                    if (info == null)
                    {
                        MainConsole.Instance.WarnFormat("[LAND]: Failed to find region having parcel {0} @ {1} {2}",
                                                        parcelID);
                        return;
                    }
                    MainConsole.Instance.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
                                                     data.Name, data.RegionHandle);
                    remoteClient.SendParcelInfo(data, parcelID, (uint) (info.RegionLocX + data.UserLocation.X),
                                                (uint) (info.RegionLocY + data.UserLocation.Y), info.RegionName);
                }
                else
                    MainConsole.Instance.WarnFormat("[LAND]: Failed to find parcel {0}", parcelID);
            }
            else
                MainConsole.Instance.Debug("[LAND] got no directory service; not sending");
        }
        private void handleParcelInfo(IClientAPI remoteClient, UUID parcelID)
        {
            if (parcelID == UUID.Zero)
                return;

            ExtendedLandData data = (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), delegate(string id) {
                UUID parcel = UUID.Zero;
                UUID.TryParse(id, out parcel);
                // assume we've got the parcelID we just computed in RemoteParcelRequest
                ExtendedLandData extLandData = new ExtendedLandData();
                Util.ParseFakeParcelID(parcel, 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);

                // for this region or for somewhere else?
                if (extLandData.regionHandle == m_scene.RegionInfo.RegionHandle)
                {
                    extLandData.landData = this.GetLandObject(extLandData.x, extLandData.y).landData;
                }
                else
                {
                    extLandData.landData = m_scene.CommsManager.GridService.RequestLandData(extLandData.regionHandle,
                                                                                            extLandData.x,
                                                                                            extLandData.y);
                    if (extLandData.landData == null)
                    {
                        // we didn't find the region/land => don't cache
                        return null;
                    }
                }
                return extLandData;
            });

            if (data != null)  // if we found some data, send it
            {
                RegionInfo info;
                if (data.regionHandle == m_scene.RegionInfo.RegionHandle)
                {
                    info = m_scene.RegionInfo;
                }
                else
                {
                    // most likely still cached from building the extLandData entry
                    info = m_scene.CommsManager.GridService.RequestNeighbourInfo(data.regionHandle);
                }
                // 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...",
                                  data.landData.Name, data.regionHandle);
                remoteClient.SendParcelInfo(info, data.landData, parcelID, data.x, data.y);
            }
            else
                m_log.Debug("[LAND] got no parcelinfo; not sending");
        }