public override IDataTransferable Duplicate() { Telehub t = new Telehub(); t.FromOSD(ToOSD()); return(t); }
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); } }
/// <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()); } }
/// <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 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.MySqlEscape(50); 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.MySqlEscape(50) }); } }
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 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(); }
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 (Dictionary<string, object> replyData in from m_ServerURI in m_ServerURIs select SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString) into reply where reply != string.Empty select 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 { MainConsole.Instance.DebugFormat("[AuroraRemoteRegionConnector]: RemoveTelehub {0} received null response", regionID.ToString()); } } return null; } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteRegionConnector]: Exception when contacting server: {0}", e); } return null; }
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 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; }
/// <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) { 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.ToString(); 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 = telehubposition[9]; telehub.Name = telehubposition[10]; return telehub; }