public static string Serialize(Telehub settings) { StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw) { Formatting = Formatting.Indented }; xtw.WriteStartDocument(); xtw.WriteStartElement("Telehub"); if (settings.ObjectUUID != UUID.Zero) { xtw.WriteElementString("TelehubObject", settings.ObjectUUID.ToString()); xtw.WriteElementString("TelehubName", settings.Name); foreach (var point in settings.SpawnPos) { xtw.WriteElementString("SpawnPoint", point.ToString()); } } xtw.WriteEndElement(); xtw.Close(); return(sw.ToString()); }
public void AddTelehub(Telehub telehub, ulong regionhandle) { if (m_doRemoteOnly) { DoRemote (telehub, regionhandle); 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 }); } }
public static Telehub Deserialize(string serializedSettings, UUID RegionID) { Telehub settings = new Telehub(); StringReader sr = new StringReader(serializedSettings); XmlTextReader xtr = new XmlTextReader(sr); xtr.ReadEndElement(); xtr.ReadStartElement("Telehub"); // OAR 0.8 format addition while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) { switch (xtr.Name) { case "TelehubObject": { settings.RegionID = RegionID; settings.ObjectUUID = UUID.Parse(xtr.ReadElementContentAsString()); break; } case "SpawnPoint": settings.SpawnPos.Add(Vector3.Parse(xtr.ReadElementContentAsString())); break; //case "SpawnPoint": // string str = xtr.ReadElementContentAsString(); // SpawnPoint sp = SpawnPoint.Parse(str); // settings.AddSpawnPoint(sp); // break; case "TelehubName": settings.Name = xtr.ReadElementContentAsString(); break; } } xtr.ReadEndElement(); xtr.Close(); return(settings); }
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); client.Scene.RegionInfo.RegionSettings.TeleHub = telehub; 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); client.Scene.RegionInfo.RegionSettings.TeleHub = telehub; SendTelehubInfo (client); } if (parameter1 == "delete") { regionConnector.RemoveTelehub (client.Scene.RegionInfo.RegionID, client.Scene.RegionInfo.RegionHandle); client.Scene.RegionInfo.RegionSettings.TeleHub = new Telehub (); 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); client.Scene.RegionInfo.RegionSettings.TeleHub = telehub; SendTelehubInfo (client); } if (parameter1 == "info ui") SendTelehubInfo (client); } }
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 static Telehub Deserialize(string serializedSettings, UUID RegionID) { Telehub settings = new Telehub(); StringReader sr = new StringReader(serializedSettings); XmlTextReader xtr = new XmlTextReader(sr); xtr.ReadEndElement(); xtr.ReadStartElement("Telehub"); // OAR 0.8 format addition while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) { switch (xtr.Name) { case "TelehubObject": { settings.RegionID = RegionID; settings.ObjectUUID = UUID.Parse (xtr.ReadElementContentAsString ()); break; } case "SpawnPoint": settings.SpawnPos.Add( Vector3.Parse(xtr.ReadElementContentAsString()) ); break; //case "SpawnPoint": // string str = xtr.ReadElementContentAsString(); // SpawnPoint sp = SpawnPoint.Parse(str); // settings.AddSpawnPoint(sp); // break; case "TelehubName": settings.Name = xtr.ReadElementContentAsString(); break; } } xtr.ReadEndElement(); xtr.Close(); return settings; }
public static string Serialize(Telehub settings) { StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw) {Formatting = Formatting.Indented}; xtw.WriteStartDocument(); xtw.WriteStartElement("Telehub"); if (settings.ObjectUUID != UUID.Zero) { xtw.WriteElementString("TelehubObject", settings.ObjectUUID.ToString()); xtw.WriteElementString("TelehubName", settings.Name); foreach( var point in settings.SpawnPos) xtw.WriteElementString("SpawnPoint", point.ToString()); } xtw.WriteEndElement(); xtw.Close(); return sw.ToString(); }