/// <summary> /// Attempts to find a telehub in the region; if one is not found, returns false. /// </summary> /// <param name="regionID">Region ID</param> /// <param name="position">The position of the telehub</param> /// <returns></returns> public Telehub FindTelehub(UUID regionID, ulong regionHandle) { Telehub telehub = new Telehub(); List <string> telehubposition = GD.Query("RegionID", regionID, "telehubs", "RegionLocX,RegionLocY,TelehubLocX,TelehubLocY,TelehubLocZ,TelehubRotX,TelehubRotY,TelehubRotZ,Spawns,ObjectUUID,Name"); //Not the right number of values, so its not there. if (telehubposition.Count != 11) { return(null); } telehub.RegionID = regionID; telehub.RegionLocX = float.Parse(telehubposition[0]); telehub.RegionLocY = float.Parse(telehubposition[1]); telehub.TelehubLocX = float.Parse(telehubposition[2]); telehub.TelehubLocY = float.Parse(telehubposition[3]); telehub.TelehubLocZ = float.Parse(telehubposition[4]); telehub.TelehubRotX = float.Parse(telehubposition[5]); telehub.TelehubRotY = float.Parse(telehubposition[6]); telehub.TelehubRotZ = float.Parse(telehubposition[7]); telehub.SpawnPos = telehub.BuildToList(telehubposition[8]); telehub.ObjectUUID = UUID.Parse(telehubposition[9]); telehub.Name = telehubposition[10]; return(telehub); }
/// <summary> /// Attempts to find a telehub in the region; if one is not found, returns false. /// </summary> /// <param name="regionID">Region ID</param> /// <returns></returns> public Telehub FindTelehub(UUID regionID) { string sql = "SELECT * FROM telehubs where RegionID=?RegionID"; using (MySqlConnection conn = GetConnection()) { using (MySqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = sql; cmd.Parameters.Add("?RegionID", regionID.ToString()); using (IDataReader r = cmd.ExecuteReader()) { if (r.Read()) { if (r.FieldCount == 0) { return(null); } return(new Telehub() { RegionID = UUID.Parse(r["RegionID"].ToString()), TelehubLoc = Vector3.Parse(r["TelehubLoc"].ToString()), TelehubRot = Quaternion.Parse(r["TelehubRot"].ToString()), Name = r["Name"].ToString(), ObjectUUID = UUID.Parse(r["ObjectUUID"].ToString()), SpawnPos = Telehub.BuildToList(r["Spawns"].ToString()) }); } return(null); } } } }
public void AddTelehub(Telehub telehub, ulong RegionHandle) { foreach (string m_ServerURI in m_ServerURIs) { SimianUtils.AddGeneric(telehub.RegionID, "RegionTelehub", UUID.Zero.ToString(), telehub.ToOSD(), m_ServerURI); } }
public void AddTelehub(Telehub telehub, ulong RegionHandle) { foreach (string m_ServerURI in m_ServerURIs) { SimianUtils.AddGeneric(telehub.RegionID, "RegionTelehub", UUID.Zero.ToString(), telehub.ToOSD(), m_ServerURI); } }
public void AddTelehub(Telehub telehub, ulong RegionHandle) { Dictionary <string, object> sendData = telehub.ToKVP(); sendData["METHOD"] = "addtelehub"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(RegionHandle.ToString(), "GridServerURI"); foreach (string m_ServerURI in m_ServerURIs) { SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteRegionConnector]: Exception when contacting server: {0}", e); } }
public void AddTelehub(Telehub telehub, UUID SessionID) { foreach (string m_ServerURI in m_ServerURIs) { SimianUtils.AddGeneric(telehub.RegionID, "RegionTelehub", SessionID.ToString(), telehub.ToOSD(), m_ServerURI); } }
public Telehub FindTelehub(UUID regionID) { Dictionary<string, OSDMap> maps = new Dictionary<string,OSDMap>(); SimianUtils.GetGenericEntries(regionID, "RegionTelehub", m_ServerURI, out maps); List<OSDMap> listMaps = new List<OSDMap>(maps.Values); if (listMaps.Count == 0) return null; Telehub t = new Telehub(); t.FromOSD(listMaps[0]); return t; }
/// <summary> /// Adds a new telehub in the region. Replaces an old one automatically. /// </summary> /// <param name = "telehub"></param> public void AddTelehub(Telehub telehub, ulong regionhandle) { //Look for a telehub first. if (FindTelehub(new UUID(telehub.RegionID), 0) != null) { //Found one, time to update it. GD.Update("telehubs", new object[] { telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ, telehub.TelehubRotX, telehub.TelehubRotY, telehub.TelehubRotZ, telehub.BuildFromList(telehub.SpawnPos), telehub.ObjectUUID, telehub.Name.MySqlEscape(50) }, new[] { "TelehubLocX", "TelehubLocY", "TelehubLocZ", "TelehubRotX", "TelehubRotY", "TelehubRotZ", "Spawns", "ObjectUUID", "Name" }, new[] {"RegionID"}, new object[] {telehub.RegionID}); } else { //Make a new one List<object> values = new List<object> { telehub.RegionID, telehub.RegionLocX, telehub.RegionLocY, telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ, telehub.TelehubRotX, telehub.TelehubRotY, telehub.TelehubRotZ, telehub.BuildFromList(telehub.SpawnPos), telehub.ObjectUUID, telehub.Name.MySqlEscape(50) }; GD.Insert("telehubs", values.ToArray()); } }
public Telehub FindTelehub(UUID regionID, ulong regionHandle) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["METHOD"] = "findtelehub"; sendData["REGIONID"] = regionID.ToString(); string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(regionHandle.ToString(), "GridServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { if (!replyData.ContainsKey("Result") || replyData.ContainsKey("Result") && replyData["Result"].ToString() != "Failure") { if (replyData.Count != 0) { Telehub t = new Telehub(); t.FromKVP(replyData); if (t.RegionID != UUID.Zero) { return(t); } } } } else { m_log.DebugFormat("[AuroraRemoteRegionConnector]: RemoveTelehub {0} received null response", regionID.ToString()); } } } return(null); } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteRegionConnector]: Exception when contacting server: {0}", e.ToString()); } return(null); }
/// <summary> /// Adds a new telehub in the region. Replaces an old one automatically. /// </summary> /// <param name = "telehub"></param> public void AddTelehub(Telehub telehub, ulong regionhandle) { //Look for a telehub first. if (FindTelehub(new UUID(telehub.RegionID), 0) != null) { //Found one, time to update it. GD.Update("telehubs", new object[] { telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ, telehub.TelehubRotX, telehub.TelehubRotY, telehub.TelehubRotZ, telehub.BuildFromList(telehub.SpawnPos), telehub.ObjectUUID, telehub.Name.MySqlEscape(50) }, new[] { "TelehubLocX", "TelehubLocY", "TelehubLocZ", "TelehubRotX", "TelehubRotY", "TelehubRotZ", "Spawns", "ObjectUUID", "Name" }, new[] { "RegionID" }, new object[] { telehub.RegionID }); } else { //Make a new one List <object> values = new List <object> { telehub.RegionID, telehub.RegionLocX, telehub.RegionLocY, telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ, telehub.TelehubRotX, telehub.TelehubRotY, telehub.TelehubRotZ, telehub.BuildFromList(telehub.SpawnPos), telehub.ObjectUUID, telehub.Name.MySqlEscape(50) }; GD.Insert("telehubs", values.ToArray()); } }
public void FromOSD(OSDMap map) { AgentLimit = map["AgentLimit"]; AllowLandJoinDivide = map["AllowLandJoinDivide"]; AllowLandResell = map["AllowLandResell"]; BlockFly = map["BlockFly"]; BlockShowInSearch = map["BlockShowInSearch"]; BlockTerraform = map["BlockTerraform"]; Covenant = map["Covenant"]; CovenantLastUpdated = map["CovenantLastUpdated"]; DisableCollisions = map["DisableCollisions"]; DisablePhysics = map["DisablePhysics"]; DisableScripts = map["DisableScripts"]; Elevation1NE = map["Elevation1NE"]; Elevation1NW = map["Elevation1NW"]; Elevation1SE = map["Elevation1SE"]; Elevation1SW = map["Elevation1SW"]; Elevation2NE = map["Elevation2NE"]; Elevation2NW = map["Elevation2NW"]; Elevation2SE = map["Elevation2SE"]; Elevation2SW = map["Elevation2SW"]; FixedSun = map["FixedSun"]; LoadedCreationDateTime = map["LoadedCreationDateTime"]; LoadedCreationID = map["LoadedCreationID"]; Maturity = map["Maturity"]; MinimumAge = map["MinimumAge"]; ObjectBonus = map["ObjectBonus"]; RegionUUID = map["RegionUUID"]; RestrictPushing = map["RestrictPushing"]; Sandbox = map["Sandbox"]; SunPosition = map["SunPosition"]; SunVector = map["SunVector"]; TerrainImageID = map["TerrainImageID"]; TerrainMapImageID = map["TerrainMapImageID"]; TerrainMapLastRegenerated = map["TerrainMapLastRegenerated"]; ParcelMapImageID = map["ParcelMapImageID"]; TerrainLowerLimit = map["TerrainLowerLimit"]; TerrainRaiseLimit = map["TerrainRaiseLimit"]; TerrainTexture1 = map["TerrainTexture1"]; TerrainTexture2 = map["TerrainTexture2"]; TerrainTexture3 = map["TerrainTexture3"]; TerrainTexture4 = map["TerrainTexture4"]; UseEstateSun = map["UseEstateSun"]; WaterHeight = map["WaterHeight"]; if (map.ContainsKey("TeleHub")) { TeleHub = new Telehub(); TeleHub.FromOSD((OSDMap)map["Telehub"]); } }
public void AddTelehub(Telehub telehub, ulong regionhandle) { object remoteValue = DoRemote(telehub, regionhandle); if (remoteValue != null || m_doRemoteOnly) { return; } //Look for a telehub first. if (FindTelehub(new UUID(telehub.RegionID), 0) != null) { Dictionary <string, object> values = new Dictionary <string, object>(); values["TelehubLocX"] = telehub.TelehubLocX; values["TelehubLocY"] = telehub.TelehubLocY; values["TelehubLocZ"] = telehub.TelehubLocZ; values["TelehubRotX"] = telehub.TelehubRotX; values["TelehubRotY"] = telehub.TelehubRotY; values["TelehubRotZ"] = telehub.TelehubRotZ; values["Spawns"] = telehub.BuildFromList(telehub.SpawnPos); values["ObjectUUID"] = telehub.ObjectUUID; values["Name"] = telehub.Name; QueryFilter filter = new QueryFilter(); filter.andFilters["RegionID"] = telehub.RegionID; //Found one, time to update it. GD.Update("telehubs", values, null, filter, null, null); } else { //Make a new one GD.Insert("telehubs", new object[] { telehub.RegionID, telehub.RegionLocX, telehub.RegionLocY, telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ, telehub.TelehubRotX, telehub.TelehubRotY, telehub.TelehubRotZ, telehub.BuildFromList(telehub.SpawnPos), telehub.ObjectUUID, telehub.Name }); } }
/// <summary> /// Adds a new telehub in the region. Replaces an old one automatically. /// </summary> /// <param name="regionID"></param> /// <param name="position">Telehub position</param> /// <param name="regionPosX">Region Position in meters</param> /// <param name="regionPosY">Region Position in meters</param> public void AddTelehub(Telehub telehub, UUID SessionID) { //Look for a telehub first. if (FindTelehub(new UUID(telehub.RegionID)) != null) { //Found one, time to update it. GD.Update("telehubs", new object[] { telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ, telehub.TelehubRotX, telehub.TelehubRotY, telehub.TelehubRotZ, telehub.BuildFromList(telehub.SpawnPos), telehub.ObjectUUID, telehub.Name }, new string[] { "TelehubLocX", "TelehubLocY", "TelehubLocZ", "TelehubRotX", "TelehubRotY", "TelehubRotZ", "Spawns", "ObjectUUID", "Name" }, new string[] { "RegionID" }, new object[] { telehub.RegionID }); } else { //Make a new one List<object> values = new List<object>(); values.Add(telehub.RegionID); values.Add(telehub.RegionLocX); values.Add(telehub.RegionLocY); values.Add(telehub.TelehubLocX); values.Add(telehub.TelehubLocY); values.Add(telehub.TelehubLocZ); values.Add(telehub.TelehubRotX); values.Add(telehub.TelehubRotY); values.Add(telehub.TelehubRotZ); values.Add(telehub.BuildFromList(telehub.SpawnPos)); values.Add(telehub.ObjectUUID); values.Add(telehub.Name); GD.Insert("telehubs", values.ToArray()); } }
public Telehub FindTelehub(UUID regionID, ulong Regionhandle) { foreach (string m_ServerURI in m_ServerURIs) { Dictionary<string, OSDMap> maps = new Dictionary<string, OSDMap>(); SimianUtils.GetGenericEntries(regionID, "RegionTelehub", m_ServerURI, out maps); List<OSDMap> listMaps = new List<OSDMap>(maps.Values); if (listMaps.Count == 0) continue; Telehub t = new Telehub(); t.FromOSD(listMaps[0]); return t; } return null; }
public Telehub FindTelehub(UUID regionID, ulong regionHandle) { object remoteValue = DoRemote(regionID, regionHandle); if (remoteValue != null || m_doRemoteOnly) { return((Telehub)remoteValue); } QueryFilter filter = new QueryFilter(); filter.andFilters["RegionID"] = regionID; List <string> telehubposition = GD.Query(new[] { "RegionLocX", "RegionLocY", "TelehubLocX", "TelehubLocY", "TelehubLocZ", "TelehubRotX", "TelehubRotY", "TelehubRotZ", "Spawns", "ObjectUUID", "Name" }, "telehubs", filter, null, null, null); //Not the right number of values, so its not there. return((telehubposition == null || telehubposition.Count != 11) ? null : new Telehub { RegionID = regionID, RegionLocX = float.Parse(telehubposition[0]), RegionLocY = float.Parse(telehubposition[1]), TelehubLocX = float.Parse(telehubposition[2]), TelehubLocY = float.Parse(telehubposition[3]), TelehubLocZ = float.Parse(telehubposition[4]), TelehubRotX = float.Parse(telehubposition[5]), TelehubRotY = float.Parse(telehubposition[6]), TelehubRotZ = float.Parse(telehubposition[7]), SpawnPos = Telehub.BuildToList(telehubposition[8]), ObjectUUID = UUID.Parse(telehubposition[9]), Name = telehubposition[10] }); }
public void AddTelehub(Telehub telehub, ulong regionhandle) { object remoteValue = DoRemote(telehub, regionhandle); if (remoteValue != null || m_doRemoteOnly) return; //Look for a telehub first. if (FindTelehub(new UUID(telehub.RegionID), 0) != null) { Dictionary<string, object> values = new Dictionary<string, object>(); values["TelehubLocX"] = telehub.TelehubLocX; values["TelehubLocY"] = telehub.TelehubLocY; values["TelehubLocZ"] = telehub.TelehubLocZ; values["TelehubRotX"] = telehub.TelehubRotX; values["TelehubRotY"] = telehub.TelehubRotY; values["TelehubRotZ"] = telehub.TelehubRotZ; values["Spawns"] = telehub.BuildFromList(telehub.SpawnPos); values["ObjectUUID"] = telehub.ObjectUUID; values["Name"] = telehub.Name; QueryFilter filter = new QueryFilter(); filter.andFilters["RegionID"] = telehub.RegionID; //Found one, time to update it. GD.Update("telehubs", values, null, filter, null, null); } else { //Make a new one GD.Insert("telehubs", new object[] { telehub.RegionID, telehub.RegionLocX, telehub.RegionLocY, telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ, telehub.TelehubRotX, telehub.TelehubRotY, telehub.TelehubRotZ, telehub.BuildFromList(telehub.SpawnPos), telehub.ObjectUUID, telehub.Name }); } }
private void SendTelehubInfo(IClientAPI client) { if (RegionConnector != null) { Telehub telehub = RegionConnector.FindTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle); if (telehub == null) { client.SendTelehubInfo(Vector3.Zero, Quaternion.Identity, new List <Vector3>(), UUID.Zero, ""); } else { Vector3 pos = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); Quaternion rot = new Quaternion(telehub.TelehubRotX, telehub.TelehubRotY, telehub.TelehubRotZ); client.SendTelehubInfo(pos, rot, telehub.SpawnPos, telehub.ObjectUUID, telehub.Name); } } }
public Telehub FindTelehub(UUID regionID, ulong Regionhandle) { foreach (string m_ServerURI in m_ServerURIs) { Dictionary <string, OSDMap> maps = new Dictionary <string, OSDMap>(); SimianUtils.GetGenericEntries(regionID, "RegionTelehub", m_ServerURI, out maps); List <OSDMap> listMaps = new List <OSDMap>(maps.Values); if (listMaps.Count == 0) { continue; } Telehub t = new Telehub(); t.FromOSD(listMaps[0]); return(t); } return(null); }
public byte[] AddTelehub(Dictionary <string, object> request) { Telehub telehub = new Telehub(); telehub.FromKVP(request); int RegionX, RegionY; Util.UlongToInts(m_regionHandle, out RegionX, out RegionY); GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, RegionX, RegionY); if (r != null) { telehub.RegionID = r.RegionID; TelehubConnector.AddTelehub(telehub, 0); } return(SuccessResult()); }
/// <summary> /// Adds a new telehub in the region. Replaces an old one automatically. /// </summary> /// <param name="telehub"></param> /// <param name="regionhandle"> </param> public void AddTelehub(Telehub telehub) { string sql = "REPLACE into telehubs (RegionID, TelehubLoc, TelehubRot, ObjectUUID, Spawns, Name) VALUES (?RegionID, ?TelehubLoc, ?TelehubRot, ?ObjectUUID, ?Spawns, ?Name)"; using (MySqlConnection conn = GetConnection()) { using (MySqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = sql; cmd.Parameters.Add("?RegionID", telehub.RegionID.ToString()); cmd.Parameters.Add("?TelehubLoc", telehub.TelehubLoc.ToString()); cmd.Parameters.Add("?TelehubRot", telehub.TelehubRot.ToString()); cmd.Parameters.Add("?ObjectUUID", telehub.ObjectUUID.ToString()); cmd.Parameters.Add("?Spawns", telehub.BuildFromList(telehub.SpawnPos)); cmd.Parameters.Add("?Name", telehub.Name); cmd.ExecuteNonQuery(); } } }
public byte[] FindTelehub(Dictionary <string, object> request) { UUID regionID = UUID.Zero; UUID.TryParse(request["REGIONID"].ToString(), out regionID); Dictionary <string, object> result = new Dictionary <string, object>(); Telehub telehub = TelehubConnector.FindTelehub(regionID, 0); if (telehub != null) { result = telehub.ToKVP(); } string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
public void AddTelehub(Telehub telehub, UUID SessionID) { Dictionary<string, object> sendData = telehub.ToKeyValuePairs(); sendData["SESSIONID"] = SessionID.ToString(); sendData["METHOD"] = "addtelehub"; string reqString = ServerUtils.BuildQueryString(sendData); try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/grid", reqString); } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteRegionConnector]: Exception when contacting server: {0}", e.Message); } }
public void AddTelehub(Telehub telehub, ulong RegionHandle) { Dictionary<string, object> sendData = telehub.ToKeyValuePairs(); sendData["METHOD"] = "addtelehub"; string reqString = WebUtils.BuildQueryString(sendData); try { List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(RegionHandle.ToString(), "GridServerURI"); foreach (string m_ServerURI in m_ServerURIs) { SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); } } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteRegionConnector]: Exception when contacting server: {0}", e.ToString()); } }
public byte[] AddTelehub(Dictionary<string, object> request) { Telehub telehub = new Telehub(request); UUID SessionID = UUID.Parse(request["SESSIONID"].ToString()); if (SessionCache.ContainsKey(UUID.Parse(telehub.RegionID)) && SessionCache[UUID.Parse(telehub.RegionID)] == SessionID) TelehubConnector.AddTelehub(telehub, SessionID); return SuccessResult(); }
public void GodlikeMessage(IClientAPI client, UUID requester, string Method, List<string> Parameters) { if (RegionConnector == null) return; IScenePresence Sp = client.Scene.GetScenePresence (client.AgentId); if (!client.Scene.Permissions.CanIssueEstateCommand(client.AgentId, false)) return; string parameter1 = Parameters[0]; if (Method == "telehub") { if (parameter1 == "spawnpoint remove") { Telehub telehub = RegionConnector.FindTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle); if (telehub == null) return; //Remove the one we sent at X telehub.SpawnPos.RemoveAt(int.Parse(Parameters[1])); RegionConnector.AddTelehub(telehub, client.Scene.RegionInfo.RegionHandle); SendTelehubInfo(client); } if (parameter1 == "spawnpoint add") { ISceneChildEntity part = Sp.Scene.GetSceneObjectPart (uint.Parse (Parameters[1])); if (part == null) return; Telehub telehub = RegionConnector.FindTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle); if (telehub == null) return; telehub.RegionLocX = client.Scene.RegionInfo.RegionLocX; telehub.RegionLocY = client.Scene.RegionInfo.RegionLocY; telehub.RegionID = client.Scene.RegionInfo.RegionID; Vector3 pos = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); if (telehub.TelehubLocX == 0 && telehub.TelehubLocY == 0) return; //No spawns without a telehub telehub.SpawnPos.Add(part.AbsolutePosition - pos); //Spawns are offsets RegionConnector.AddTelehub(telehub, client.Scene.RegionInfo.RegionHandle); SendTelehubInfo(client); } if (parameter1 == "delete") { RegionConnector.RemoveTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle); SendTelehubInfo(client); } if (parameter1 == "connect") { ISceneChildEntity part = Sp.Scene.GetSceneObjectPart (uint.Parse (Parameters[1])); if (part == null) return; Telehub telehub = RegionConnector.FindTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle); if (telehub == null) telehub = new Telehub(); telehub.RegionLocX = client.Scene.RegionInfo.RegionLocX; telehub.RegionLocY = client.Scene.RegionInfo.RegionLocY; telehub.RegionID = client.Scene.RegionInfo.RegionID; telehub.TelehubLocX = part.AbsolutePosition.X; telehub.TelehubLocY = part.AbsolutePosition.Y; telehub.TelehubLocZ = part.AbsolutePosition.Z; telehub.TelehubRotX = part.ParentEntity.Rotation.X; telehub.TelehubRotY = part.ParentEntity.Rotation.Y; telehub.TelehubRotZ = part.ParentEntity.Rotation.Z; telehub.ObjectUUID = part.UUID; telehub.Name = part.Name; RegionConnector.AddTelehub(telehub, client.Scene.RegionInfo.RegionHandle); SendTelehubInfo(client); } if (parameter1 == "info ui") SendTelehubInfo(client); } }
public override IDataTransferable Duplicate() { Telehub t = new Telehub(); t.FromOSD(ToOSD()); return t; }
public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags, uint EstateID, bool godlike, uint itemtype, ulong regionhandle) { //All the parts are in for this, except for popular places and those are not in as they are not reqested anymore. List <mapItemReply> mapitems = new List <mapItemReply>(); mapItemReply mapitem = new mapItemReply(); uint xstart = 0; uint ystart = 0; Utils.LongToUInts(remoteClient.Scene.RegionInfo.RegionHandle, out xstart, out ystart); GridRegion GR = null; GR = regionhandle == 0 ? new GridRegion(remoteClient.Scene.RegionInfo) : m_Scenes[0].GridService.GetRegionByPosition(remoteClient.AllScopeIDs, (int)xstart, (int)ystart); if (GR == null) { //No region??? return; } #region Telehub if (itemtype == (uint)GridItemType.Telehub) { IRegionConnector GF = DataManager.DataManager.RequestPlugin <IRegionConnector>(); if (GF == null) { return; } int tc = Environment.TickCount; //Find the telehub Telehub telehub = GF.FindTelehub(GR.RegionID, GR.RegionHandle); if (telehub != null) { mapitem = new mapItemReply { x = (uint)(GR.RegionLocX + telehub.TelehubLocX), y = (uint)(GR.RegionLocY + telehub.TelehubLocY), id = GR.RegionID, name = Util.Md5Hash(GR.RegionName + tc.ToString()), Extra = 1, Extra2 = 0 }; //The position is in GLOBAL coordinates (in meters) //This is how the name is sent, go figure //Not sure, but this is what gets sent mapitems.Add(mapitem); remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); mapitems.Clear(); } } #endregion #region Land for sale //PG land that is for sale if (itemtype == (uint)GridItemType.LandForSale) { if (directoryService == null) { return; } //Find all the land, use "0" for the flags so we get all land for sale, no price or area checking List <DirLandReplyData> Landdata = directoryService.FindLandForSaleInRegion("0", uint.MaxValue, 0, 0, 0, GR.RegionID); int locX = 0; int locY = 0; foreach (DirLandReplyData landDir in Landdata) { if (landDir == null) { continue; } LandData landdata = directoryService.GetParcelInfo(landDir.parcelID); if (landdata == null || landdata.Maturity != 0) { continue; //Not a PG land } #if (!ISWIN) foreach (IScene scene in m_Scenes) { if (scene.RegionInfo.RegionID == landdata.RegionID) { //Global coords, so add the meters locX = scene.RegionInfo.RegionLocX; locY = scene.RegionInfo.RegionLocY; } } #else foreach (IScene scene in m_Scenes.Where(scene => scene.RegionInfo.RegionID == landdata.RegionID)) { //Global coords, so add the meters locX = scene.RegionInfo.RegionLocX; locY = scene.RegionInfo.RegionLocY; } #endif if (locY == 0 && locX == 0) { //Ask the grid service for the coordinates if the region is not local GridRegion r = m_Scenes[0].GridService.GetRegionByUUID(remoteClient.AllScopeIDs, landdata.RegionID); if (r != null) { locX = r.RegionLocX; locY = r.RegionLocY; } } if (locY == 0 && locX == 0) //Couldn't find the region, don't send { continue; } mapitem = new mapItemReply { x = (uint)(locX + landdata.UserLocation.X), y = (uint)(locY + landdata.UserLocation.Y), id = landDir.parcelID, name = landDir.name, Extra = landDir.actualArea, Extra2 = landDir.salePrice }; //Global coords, so make sure its in meters mapitems.Add(mapitem); } //Send all the map items if (mapitems.Count != 0) { remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); mapitems.Clear(); } } //Adult or mature land that is for sale if (itemtype == (uint)GridItemType.AdultLandForSale) { if (directoryService == null) { return; } //Find all the land, use "0" for the flags so we get all land for sale, no price or area checking List <DirLandReplyData> Landdata = directoryService.FindLandForSale("0", uint.MaxValue, 0, 0, 0, remoteClient.ScopeID); int locX = 0; int locY = 0; foreach (DirLandReplyData landDir in Landdata) { LandData landdata = directoryService.GetParcelInfo(landDir.parcelID); if (landdata == null || landdata.Maturity == 0) { continue; //Its PG } #if (!ISWIN) foreach (IScene scene in m_Scenes) { if (scene.RegionInfo.RegionID == landdata.RegionID) { locX = scene.RegionInfo.RegionLocX; locY = scene.RegionInfo.RegionLocY; } } #else foreach (IScene scene in m_Scenes.Where(scene => scene.RegionInfo.RegionID == landdata.RegionID)) { locX = scene.RegionInfo.RegionLocX; locY = scene.RegionInfo.RegionLocY; } #endif if (locY == 0 && locX == 0) { //Ask the grid service for the coordinates if the region is not local GridRegion r = m_Scenes[0].GridService.GetRegionByUUID(remoteClient.AllScopeIDs, landdata.RegionID); if (r != null) { locX = r.RegionLocX; locY = r.RegionLocY; } } if (locY == 0 && locX == 0) //Couldn't find the region, don't send { continue; } mapitem = new mapItemReply { x = (uint)(locX + landdata.UserLocation.X), y = (uint)(locY + landdata.UserLocation.Y), id = landDir.parcelID, name = landDir.name, Extra = landDir.actualArea, Extra2 = landDir.salePrice }; //Global coords, so make sure its in meters mapitems.Add(mapitem); } //Send the results if we have any if (mapitems.Count != 0) { remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); mapitems.Clear(); } } #endregion #region Events if (itemtype == (uint)GridItemType.PgEvent || itemtype == (uint)GridItemType.MatureEvent || itemtype == (uint)GridItemType.AdultEvent) { if (directoryService == null) { return; } //Find the maturity level int maturity = itemtype == (uint)GridItemType.PgEvent ? (int)DirectoryManager.EventFlags.PG : (itemtype == (uint)GridItemType.MatureEvent) ? (int)DirectoryManager.EventFlags.Mature : (int)DirectoryManager.EventFlags.Adult; //Gets all the events occuring in the given region by maturity level List <DirEventsReplyData> Eventdata = directoryService.FindAllEventsInRegion(GR.RegionName, maturity); foreach (DirEventsReplyData eventData in Eventdata) { //Get more info on the event EventData eventdata = directoryService.GetEventInfo(eventData.eventID); if (eventdata == null) { continue; //Can't do anything about it } Vector3 globalPos = eventdata.globalPos; mapitem = new mapItemReply { x = (uint)(globalPos.X + (remoteClient.Scene.RegionInfo.RegionSizeX / 2)), y = (uint)(globalPos.Y + (remoteClient.Scene.RegionInfo.RegionSizeY / 2)), id = UUID.Random(), name = eventData.name, Extra = (int)eventdata.dateUTC, Extra2 = (int)eventdata.eventID }; //Use global position plus half the region so that it doesn't always appear in the bottom corner mapitems.Add(mapitem); } //Send if we have any if (mapitems.Count != 0) { remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); mapitems.Clear(); } } #endregion #region Classified if (itemtype == (uint)GridItemType.Classified) { if (directoryService == null) { return; } //Get all the classifieds in this region List <Classified> Classifieds = directoryService.GetClassifiedsInRegion(GR.RegionName); foreach (Classified classified in Classifieds) { //Get the region so we have its position GridRegion region = m_Scenes[0].GridService.GetRegionByName(remoteClient.AllScopeIDs, classified.SimName); mapitem = new mapItemReply { x = (uint) (region.RegionLocX + classified.GlobalPos.X + (remoteClient.Scene.RegionInfo.RegionSizeX / 2)), y = (uint) (region.RegionLocY + classified.GlobalPos.Y + (remoteClient.Scene.RegionInfo.RegionSizeY / 2)), id = classified.CreatorUUID, name = classified.Name, Extra = 0, Extra2 = 0 }; //Use global position plus half the sim so that all classifieds are not in the bottom corner mapitems.Add(mapitem); } //Send the events, if we have any if (mapitems.Count != 0) { remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); mapitems.Clear(); } } #endregion }
private bool OnAllowedIncomingTeleport(UUID userID, IScene scene, Vector3 Position, uint TeleportFlags, out Vector3 newPosition, out string reason) { newPosition = Position; UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.AllScopeIDs, userID); IScenePresence Sp = scene.GetScenePresence(userID); if (account == null) { reason = "Failed authentication."; return(false); //NO! } //Make sure that this user is inside the region as well if (Position.X < -2f || Position.Y < -2f || Position.X > scene.RegionInfo.RegionSizeX + 2 || Position.Y > scene.RegionInfo.RegionSizeY + 2) { MainConsole.Instance.DebugFormat( "[EstateService]: AllowedIncomingTeleport was given an illegal position of {0} for avatar {1}, {2}. Clamping", Position, Name, userID); bool changedX = false; bool changedY = false; while (Position.X < 0) { Position.X += scene.RegionInfo.RegionSizeX; changedX = true; } while (Position.X > scene.RegionInfo.RegionSizeX) { Position.X -= scene.RegionInfo.RegionSizeX; changedX = true; } while (Position.Y < 0) { Position.Y += scene.RegionInfo.RegionSizeY; changedY = true; } while (Position.Y > scene.RegionInfo.RegionSizeY) { Position.Y -= scene.RegionInfo.RegionSizeY; changedY = true; } if (changedX) { Position.X = scene.RegionInfo.RegionSizeX - Position.X; } if (changedY) { Position.Y = scene.RegionInfo.RegionSizeY - Position.Y; } } IAgentConnector AgentConnector = Framework.Utilities.DataManager.RequestPlugin <IAgentConnector>(); IAgentInfo agentInfo = null; if (AgentConnector != null) { agentInfo = AgentConnector.GetAgent(userID); } ILandObject ILO = null; IParcelManagementModule parcelManagement = scene.RequestModuleInterface <IParcelManagementModule>(); if (parcelManagement != null) { ILO = parcelManagement.GetLandObject(Position.X, Position.Y); } if (ILO == null) { if (Sp != null) { Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity } //Can't find land, give them the first parcel in the region and find a good position for them ILO = parcelManagement.AllParcels()[0]; Position = parcelManagement.GetParcelCenterAtGround(ILO); } //parcel permissions if (ILO.IsBannedFromLand(userID)) //Note: restricted is dealt with in the next block { if (Sp != null) { Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity } if (Sp == null) { reason = "Banned from this parcel."; return(false); } if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { } } //Move them out of banned parcels ParcelFlags parcelflags = (ParcelFlags)ILO.LandData.Flags; if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup && (parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList && (parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList) { if (Sp != null) { Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity } //One of these is in play then if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup) { if (Sp == null) { reason = "Banned from this parcel."; return(false); } if (Sp.ControllingClient.ActiveGroupId != ILO.LandData.GroupID) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { } } } else if ((parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList) { if (Sp == null) { reason = "Banned from this parcel."; return(false); } //All but the people on the access list are banned if (ILO.IsRestrictedFromLand(userID)) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { } } } else if ((parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList) { if (Sp == null) { reason = "Banned from this parcel."; return(false); } //All but the people on the pass/access list are banned if (ILO.IsRestrictedFromLand(Sp.UUID)) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { } } } } EstateSettings ES = scene.RegionInfo.EstateSettings; TeleportFlags tpflags = (TeleportFlags)TeleportFlags; const TeleportFlags allowableFlags = OpenMetaverse.TeleportFlags.ViaLandmark | OpenMetaverse.TeleportFlags.ViaHome | OpenMetaverse.TeleportFlags.ViaLure | OpenMetaverse.TeleportFlags.ForceRedirect | OpenMetaverse.TeleportFlags.Godlike | OpenMetaverse.TeleportFlags.NineOneOne; //If the user wants to force landing points on crossing, we act like they are not crossing, otherwise, check the child property and that the ViaRegionID is set bool isCrossing = !ForceLandingPointsOnCrossing && (Sp != null && Sp.IsChildAgent && ((tpflags & OpenMetaverse.TeleportFlags.ViaRegionID) == OpenMetaverse.TeleportFlags.ViaRegionID)); //Move them to the nearest landing point if (!((tpflags & allowableFlags) != 0) && !isCrossing && !ES.AllowDirectTeleport) { if (Sp != null) { Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity } if (!scene.Permissions.IsGod(userID)) { Telehub telehub = RegionConnector.FindTelehub(scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle); if (telehub != null) { if (telehub.SpawnPos.Count == 0) { Position = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); } else { int LastTelehubNum = 0; if (!LastTelehub.TryGetValue(scene.RegionInfo.RegionID, out LastTelehubNum)) { LastTelehubNum = 0; } Position = telehub.SpawnPos[LastTelehubNum] + new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); LastTelehubNum++; if (LastTelehubNum == telehub.SpawnPos.Count) { LastTelehubNum = 0; } LastTelehub[scene.RegionInfo.RegionID] = LastTelehubNum; } } } } else if (!((tpflags & allowableFlags) != 0) && !isCrossing && !scene.Permissions.GenericParcelPermission(userID, ILO, (ulong)GroupPowers.None)) //Telehubs override parcels { if (Sp != null) { Sp.ClearSavedVelocity(); //If we are moving the agent, clear their velocity } if (ILO.LandData.LandingType == (int)LandingType.None) //Blocked, force this person off this land { //Find a new parcel for them List <ILandObject> Parcels = parcelManagement.ParcelsNearPoint(Position); if (Parcels.Count > 1) { newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp); } else { bool found = false; //We need to check here as well for bans, can't toss someone into a parcel they are banned from foreach (ILandObject Parcel in Parcels.Where(Parcel => !Parcel.IsBannedFromLand(userID))) { //Now we have to check their userloc if (ILO.LandData.LandingType == (int)LandingType.None) { continue; //Blocked, check next one } else if (ILO.LandData.LandingType == (int)LandingType.LandingPoint) { //Use their landing spot newPosition = Parcel.LandData.UserLocation; } else //They allow for anywhere, so dump them in the center at the ground { newPosition = parcelManagement.GetParcelCenterAtGround(Parcel); } found = true; } if (!found) //Dump them at the edge { if (Sp != null) { newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp); } else { reason = "Banned from this parcel."; return(false); } } } } else if (ILO.LandData.LandingType == (int)LandingType.LandingPoint) //Move to tp spot { newPosition = ILO.LandData.UserLocation != Vector3.Zero ? ILO.LandData.UserLocation : parcelManagement.GetNearestRegionEdgePosition(Sp); } } //We assume that our own region isn't null.... if (agentInfo != null) { //Can only enter prelude regions once! if (scene.RegionInfo.RegionFlags != -1 && ((scene.RegionInfo.RegionFlags & (int)RegionFlags.Prelude) == (int)RegionFlags.Prelude) && agentInfo != null) { if (agentInfo.OtherAgentInformation.ContainsKey("Prelude" + scene.RegionInfo.RegionID)) { reason = "You may not enter this region as you have already been to this prelude region."; return(false); } else { agentInfo.OtherAgentInformation.Add("Prelude" + scene.RegionInfo.RegionID, OSD.FromInteger((int)IAgentFlags.PastPrelude)); AgentConnector.UpdateAgent(agentInfo); } } if (agentInfo.OtherAgentInformation.ContainsKey("LimitedToEstate")) { int LimitedToEstate = agentInfo.OtherAgentInformation["LimitedToEstate"]; if (scene.RegionInfo.EstateSettings.EstateID != LimitedToEstate) { reason = "You may not enter this reason, as it is outside of the estate you are limited to."; return(false); } } } if ((ILO.LandData.Flags & (int)ParcelFlags.DenyAnonymous) != 0) { if (account != null && (account.UserFlags & (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile) == (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile) { reason = "You may not enter this region."; return(false); } } if ((ILO.LandData.Flags & (uint)ParcelFlags.DenyAgeUnverified) != 0 && agentInfo != null) { if ((agentInfo.Flags & IAgentFlags.Minor) == IAgentFlags.Minor) { reason = "You may not enter this region."; return(false); } } //Check that we are not underground as well ITerrainChannel chan = scene.RequestModuleInterface <ITerrainChannel>(); if (chan != null) { float posZLimit = chan[(int)newPosition.X, (int)newPosition.Y] + (float)1.25; if (posZLimit >= (newPosition.Z) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) { newPosition.Z = posZLimit; } } reason = ""; return(true); }
public Telehub FindTelehub(UUID regionID) { Dictionary<string, object> sendData = new Dictionary<string,object>(); sendData["METHOD"] = "findtelehub"; sendData["REGIONID"] = regionID.ToString(); string reqString = WebUtils.BuildQueryString(sendData); try { foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/grid", reqString); if (reply != string.Empty) { Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { if (replyData.Count != 0) { Telehub t = new Telehub(); t.FromKVP(replyData); return t; } } else { m_log.DebugFormat("[AuroraRemoteRegionConnector]: RemoveTelehub {0} received null response", regionID.ToString()); } } } return null; } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteRegionConnector]: Exception when contacting server: {0}", e.ToString()); } return null; }
private bool OnAllowedIncomingTeleport(UUID userID, IScene scene, Vector3 Position, out Vector3 newPosition, out string reason) { newPosition = Position; UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID); IScenePresence Sp = scene.GetScenePresence(userID); if (account == null) { reason = "Failed authentication."; return(false); //NO! } //Make sure that this user is inside the region as well if (Position.X < -2f || Position.Y < -2f || Position.X > scene.RegionInfo.RegionSizeX + 2 || Position.Y > scene.RegionInfo.RegionSizeY + 2) { m_log.DebugFormat( "[EstateService]: AllowedIncomingTeleport was given an illegal position of {0} for avatar {1}, {2}. Clamping", Position, Name, userID); bool changedX = false; bool changedY = false; while (Position.X < 0) { Position.X += scene.RegionInfo.RegionSizeX; changedX = true; } while (Position.X > scene.RegionInfo.RegionSizeX) { Position.X -= scene.RegionInfo.RegionSizeX; changedX = true; } while (Position.Y < 0) { Position.Y += scene.RegionInfo.RegionSizeY; changedY = true; } while (Position.Y > scene.RegionInfo.RegionSizeY) { Position.Y -= scene.RegionInfo.RegionSizeY; changedY = true; } if (changedX) { Position.X = scene.RegionInfo.RegionSizeX - Position.X; } if (changedY) { Position.Y = scene.RegionInfo.RegionSizeY - Position.Y; } } //Check that we are not underground as well float posZLimit = scene.RequestModuleInterface <ITerrainChannel>()[(int)Position.X, (int)Position.Y] + (float)1.25; if (posZLimit >= (Position.Z) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) { Position.Z = posZLimit; } IAgentConnector AgentConnector = DataManager.DataManager.RequestPlugin <IAgentConnector>(); IAgentInfo agentInfo = null; if (AgentConnector != null) { agentInfo = AgentConnector.GetAgent(userID); } ILandObject ILO = null; IParcelManagementModule parcelManagement = scene.RequestModuleInterface <IParcelManagementModule>(); if (parcelManagement != null) { ILO = parcelManagement.GetLandObject(Position.X, Position.Y); } if (ILO == null) { //Can't find land, give them the first parcel in the region and find a good position for them ILO = parcelManagement.AllParcels()[0]; Position = parcelManagement.GetParcelCenterAtGround(ILO); } //parcel permissions if (ILO.IsBannedFromLand(userID)) //Note: restricted is dealt with in the next block { if (Sp == null) { reason = "Banned from this parcel."; return(true); } if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { //We found a place for them, but we don't need to check any further return(true); } } //Move them out of banned parcels ParcelFlags parcelflags = (ParcelFlags)ILO.LandData.Flags; if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup && (parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList && (parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList) { //One of these is in play then if ((parcelflags & ParcelFlags.UseAccessGroup) == ParcelFlags.UseAccessGroup) { if (Sp == null) { reason = "Banned from this parcel."; return(true); } if (Sp.ControllingClient.ActiveGroupId != ILO.LandData.GroupID) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { //We found a place for them, but we don't need to check any further return(true); } } } else if ((parcelflags & ParcelFlags.UseAccessList) == ParcelFlags.UseAccessList) { if (Sp == null) { reason = "Banned from this parcel."; return(true); } //All but the people on the access list are banned if (ILO.IsRestrictedFromLand(userID)) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { //We found a place for them, but we don't need to check any further return(true); } } } else if ((parcelflags & ParcelFlags.UsePassList) == ParcelFlags.UsePassList) { if (Sp == null) { reason = "Banned from this parcel."; return(true); } //All but the people on the pass/access list are banned if (ILO.IsRestrictedFromLand(Sp.UUID)) { if (!FindUnBannedParcel(Position, Sp, userID, out ILO, out newPosition, out reason)) { //We found a place for them, but we don't need to check any further return(true); } } } } EstateSettings ES = scene.RegionInfo.EstateSettings; //Move them to the nearest landing point if (!ES.AllowDirectTeleport) { if (!scene.Permissions.IsGod(userID)) { Telehub telehub = RegionConnector.FindTelehub(scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle); if (telehub != null) { if (telehub.SpawnPos.Count == 0) { Position = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); } else { int LastTelehubNum = 0; if (!LastTelehub.TryGetValue(scene.RegionInfo.RegionID, out LastTelehubNum)) { LastTelehubNum = 0; } Position = telehub.SpawnPos[LastTelehubNum] + new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); LastTelehubNum++; if (LastTelehubNum == telehub.SpawnPos.Count) { LastTelehubNum = 0; } LastTelehub[scene.RegionInfo.RegionID] = LastTelehubNum; } } } } if (!scene.Permissions.GenericParcelPermission(userID, ILO, (ulong)GroupPowers.None)) { if (ILO.LandData.LandingType == 2) //Blocked, force this person off this land { //Find a new parcel for them List <ILandObject> Parcels = parcelManagement.ParcelsNearPoint(Position); if (Parcels.Count == 0) { IScenePresence SP; scene.TryGetScenePresence(userID, out SP); newPosition = parcelManagement.GetNearestRegionEdgePosition(SP); } else { bool found = false; //We need to check here as well for bans, can't toss someone into a parcel they are banned from foreach (ILandObject Parcel in Parcels) { if (!Parcel.IsBannedFromLand(userID)) { //Now we have to check their userloc if (ILO.LandData.LandingType == 2) { continue; //Blocked, check next one } else if (ILO.LandData.LandingType == 1) //Use their landing spot { newPosition = Parcel.LandData.UserLocation; } else //They allow for anywhere, so dump them in the center at the ground { newPosition = parcelManagement.GetParcelCenterAtGround(Parcel); } found = true; } } if (!found) //Dump them at the edge { if (Sp != null) { newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp); } else { reason = "Banned from this parcel."; return(true); } } } } else if (ILO.LandData.LandingType == 1) //Move to tp spot { if (ILO.LandData.UserLocation != Vector3.Zero) { newPosition = ILO.LandData.UserLocation; } else // Dump them at the nearest region corner since they havn't set a landing point { newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp); } } } //We assume that our own region isn't null.... if (agentInfo != null) { //Can only enter prelude regions once! int flags = scene.GridService.GetRegionFlags(scene.RegionInfo.ScopeID, scene.RegionInfo.RegionID); if (flags != -1 && ((flags & (int)Aurora.Framework.RegionFlags.Prelude) == (int)Aurora.Framework.RegionFlags.Prelude) && agentInfo != null) { if (agentInfo.OtherAgentInformation.ContainsKey("Prelude" + scene.RegionInfo.RegionID)) { reason = "You may not enter this region as you have already been to this prelude region."; return(false); } else { agentInfo.OtherAgentInformation.Add("Prelude" + scene.RegionInfo.RegionID, OSD.FromInteger((int)IAgentFlags.PastPrelude)); AgentConnector.UpdateAgent(agentInfo); //This only works for standalones... and thats ok } } } if ((ILO.LandData.Flags & (int)ParcelFlags.DenyAnonymous) != 0) { if ((account.UserFlags & (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile) == (int)IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile) { reason = "You may not enter this region."; return(false); } } if ((ILO.LandData.Flags & (uint)ParcelFlags.DenyAgeUnverified) != 0 && agentInfo != null) { if ((agentInfo.Flags & IAgentFlags.Minor) == IAgentFlags.Minor) { reason = "You may not enter this region."; return(false); } } newPosition = Position; reason = ""; return(true); }
public void GodlikeMessage(IClientAPI client, UUID requester, string Method, List <string> Parameters) { if (RegionConnector == null) { return; } IScenePresence Sp = ((Scene)client.Scene).GetScenePresence(client.AgentId); if (!((Scene)client.Scene).Permissions.CanIssueEstateCommand(client.AgentId, false)) { return; } string parameter1 = Parameters[0]; if (Method == "telehub") { if (parameter1 == "spawnpoint remove") { Telehub telehub = RegionConnector.FindTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle); if (telehub == null) { return; } //Remove the one we sent at X telehub.SpawnPos.RemoveAt(int.Parse(Parameters[1])); RegionConnector.AddTelehub(telehub, client.Scene.RegionInfo.RegionHandle); SendTelehubInfo(client); } if (parameter1 == "spawnpoint add") { ISceneChildEntity part = Sp.Scene.GetSceneObjectPart(uint.Parse(Parameters[1])); if (part == null) { return; } Telehub telehub = RegionConnector.FindTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle); if (telehub == null) { return; } telehub.RegionLocX = client.Scene.RegionInfo.RegionLocX; telehub.RegionLocY = client.Scene.RegionInfo.RegionLocY; telehub.RegionID = client.Scene.RegionInfo.RegionID; Vector3 pos = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ); if (telehub.TelehubLocX == 0 && telehub.TelehubLocY == 0) { return; //No spawns without a telehub } telehub.SpawnPos.Add(part.AbsolutePosition - pos); //Spawns are offsets RegionConnector.AddTelehub(telehub, client.Scene.RegionInfo.RegionHandle); SendTelehubInfo(client); } if (parameter1 == "delete") { RegionConnector.RemoveTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle); SendTelehubInfo(client); } if (parameter1 == "connect") { ISceneChildEntity part = Sp.Scene.GetSceneObjectPart(uint.Parse(Parameters[1])); if (part == null) { return; } Telehub telehub = RegionConnector.FindTelehub(client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle); if (telehub == null) { telehub = new Telehub(); } telehub.RegionLocX = client.Scene.RegionInfo.RegionLocX; telehub.RegionLocY = client.Scene.RegionInfo.RegionLocY; telehub.RegionID = client.Scene.RegionInfo.RegionID; telehub.TelehubLocX = part.AbsolutePosition.X; telehub.TelehubLocY = part.AbsolutePosition.Y; telehub.TelehubLocZ = part.AbsolutePosition.Z; telehub.TelehubRotX = part.ParentEntity.Rotation.X; telehub.TelehubRotY = part.ParentEntity.Rotation.Y; telehub.TelehubRotZ = part.ParentEntity.Rotation.Z; telehub.ObjectUUID = part.UUID; telehub.Name = part.Name; RegionConnector.AddTelehub(telehub, client.Scene.RegionInfo.RegionHandle); SendTelehubInfo(client); } if (parameter1 == "info ui") { SendTelehubInfo(client); } } }
/// <summary> /// Attempts to find a telehub in the region; if one is not found, returns false. /// </summary> /// <param name="regionID">Region ID</param> /// <param name="position">The position of the telehub</param> /// <returns></returns> public Telehub FindTelehub(UUID regionID, ulong regionHandle) { Telehub telehub = new Telehub(); List<string> telehubposition = GD.Query("RegionID", regionID, "telehubs", "RegionLocX,RegionLocY,TelehubLocX,TelehubLocY,TelehubLocZ,TelehubRotX,TelehubRotY,TelehubRotZ,Spawns,ObjectUUID,Name"); //Not the right number of values, so its not there. if (telehubposition.Count != 11) return null; telehub.RegionID = regionID; telehub.RegionLocX = float.Parse(telehubposition[0]); telehub.RegionLocY = float.Parse(telehubposition[1]); telehub.TelehubLocX = float.Parse(telehubposition[2]); telehub.TelehubLocY = float.Parse(telehubposition[3]); telehub.TelehubLocZ = float.Parse(telehubposition[4]); telehub.TelehubRotX = float.Parse(telehubposition[5]); telehub.TelehubRotY = float.Parse(telehubposition[6]); telehub.TelehubRotZ = float.Parse(telehubposition[7]); telehub.SpawnPos = telehub.BuildToList(telehubposition[8]); telehub.ObjectUUID = UUID.Parse(telehubposition[9]); telehub.Name = telehubposition[10]; return telehub; }
public Telehub FindTelehub(UUID regionID, ulong regionHandle) { Dictionary<string, object> sendData = new Dictionary<string,object>(); sendData["METHOD"] = "findtelehub"; sendData["REGIONID"] = regionID.ToString(); string reqString = WebUtils.BuildQueryString(sendData); try { List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(regionHandle.ToString(), "GridServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { if (!replyData.ContainsKey("Result") || replyData.ContainsKey("Result") && replyData["Result"].ToString() != "Failure") { if (replyData.Count != 0) { Telehub t = new Telehub(); t.FromKVP(replyData); if(t.RegionID != UUID.Zero) return t; } } } else { m_log.DebugFormat("[AuroraRemoteRegionConnector]: RemoveTelehub {0} received null response", regionID.ToString()); } } } return null; } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteRegionConnector]: Exception when contacting server: {0}", e.ToString()); } return null; }
public byte[] AddTelehub(Dictionary<string, object> request) { Telehub telehub = new Telehub(); telehub.FromKVP(request); int RegionX, RegionY; ulong handle; if (ulong.TryParse (m_SessionID, out handle)) { Util.UlongToInts (handle, out RegionX, out RegionY); GridRegion r = m_GridService.GetRegionByPosition (UUID.Zero, RegionX, RegionY); if (r != null) { telehub.RegionID = r.RegionID; TelehubConnector.AddTelehub (telehub, 0); } } return SuccessResult(); }