Esempio n. 1
0
        public GridRegion GetRegionByName(UUID scopeID, string name)
        {
            GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name);

            if (rinfo != null)
            {
                return(rinfo);
            }

            // HG urls should not get here, strip them
            // side effect is that local regions with same name as HG may also be found
            // this mb good or bad
            string regionName = name;

            if (name.Contains("."))
            {
                if (!m_ThisGridInfo.HasHGConfig)
                {
                    return(rinfo); // no HG
                }
                string regionURI = "";
                if (!Util.buildHGRegionURI(name, out regionURI, out regionName))
                {
                    return(rinfo); // invalid
                }
                if (m_ThisGridInfo.IsLocalGrid(regionURI) != 1)
                {
                    return(rinfo); // not local grid
                }
            }

            if (String.IsNullOrEmpty(regionName))
            {
                rinfo = m_RemoteGridService.GetDefaultRegions(UUID.Zero)[0];
                if (rinfo == null)
                {
                    m_log.Warn("[REMOTE GRID CONNECTOR] returned null default region");
                }
                else
                {
                    m_log.WarnFormat("[REMOTE GRID CONNECTOR] returned default region {0}", rinfo.RegionName);
                }
            }
            else
            {
                rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName);
            }
            m_RegionInfoCache.Cache(scopeID, rinfo);
            return(rinfo);
        }
        private void Lure(IClientAPI client, uint teleportflags, GridInstantMessage im)
        {
            Scene      scene    = client.Scene as Scene;
            UUID       regionID = new UUID(im.RegionID);
            GridRegion region   = scene.GridService.GetRegionByUUID(scene.RegionInfo.ScopeID, regionID);

            if (region != null)
            {
                scene.RequestTeleportLocation(client, region.RegionHandle, im.Position + new Vector3(0.5f, 0.5f, 0f), Vector3.UnitX, teleportflags);
            }
            else // we don't have that region here. Check if it's HG
            {
                string[] parts = im.message.Split(new char[] { '@' });
                if (parts.Length > 1)
                {
                    string url = parts[parts.Length - 1]; // the last part
                    if (m_thisGridInfo.IsLocalGrid(url, true) == 0)
                    {
                        m_log.DebugFormat("[HG LURE MODULE]: Luring agent to grid {0} region {1} position {2}", url, im.RegionID, im.Position);
                        GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
                        GridRegion gatekeeper            = new GridRegion();
                        gatekeeper.ServerURI = url;
                        string homeURI = scene.GetAgentHomeURI(client.AgentId);

                        string     message;
                        GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, regionID, client.AgentId, homeURI, out message);
                        if (finalDestination != null)
                        {
                            ScenePresence         sp          = scene.GetScenePresence(client.AgentId);
                            IEntityTransferModule transferMod = scene.RequestModuleInterface <IEntityTransferModule>();

                            if (transferMod != null && sp != null)
                            {
                                if (message != null)
                                {
                                    sp.ControllingClient.SendAgentAlertMessage(message, true);
                                }

                                transferMod.DoTeleport(
                                    sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f),
                                    Vector3.UnitX, teleportflags);
                            }
                        }
                        else
                        {
                            m_log.InfoFormat("[HG LURE MODULE]: Lure failed: {0}", message);
                            client.SendAgentAlertMessage(message, true);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 public bool IsLocalGrid(string UriHost)
 {
     return(m_ThisGridInfo.IsLocalGrid(UriHost) == 1);
 }