private void ParseUpdatedList(UUID regionID, Dictionary <string, string> vars) { IOpenRegionSettingsConnector orsc = DataManager.DataManager.RequestPlugin <IOpenRegionSettingsConnector>(); if (orsc != null) { OpenRegionSettings settings = orsc.GetSettings(regionID); settings.DefaultDrawDistance = float.Parse(vars["Default Draw Distance"]); settings.ForceDrawDistance = vars["Force Draw Distance"] != null; settings.MaxDragDistance = float.Parse(vars["Max Drag Distance"]); settings.MaximumPrimScale = float.Parse(vars["Max Prim Scale"]); settings.MinimumPrimScale = float.Parse(vars["Min Prim Scale"]); settings.MaximumPhysPrimScale = float.Parse(vars["Max Physical Prim Scale"]); settings.MaximumHollowSize = float.Parse(vars["Max Hollow Size"]); settings.MinimumHoleSize = float.Parse(vars["Min Hole Size"]); settings.MaximumLinkCount = int.Parse(vars["Max Link Count"]); settings.MaximumLinkCountPhys = int.Parse(vars["Max Link Count Phys"]); settings.MaximumInventoryItemsTransfer = int.Parse(vars["Max Inventory Items To Transfer"]); settings.TerrainDetailScale = float.Parse(vars["Terrain Scale"]); settings.ShowTags = int.Parse(vars["Show Tags"]); settings.RenderWater = vars["Render Water"] != null; settings.DisplayMinimap = vars["Allow Minimap"] != null; settings.AllowPhysicalPrims = vars["Allow Physical Prims"] != null; settings.EnableTeenMode = vars["Enable Teen Mode"] != null; settings.ClampPrimSizes = vars["Enforce Max Build Constraints"] != null; orsc.SetSettings(regionID, settings); } }
public string AddOpenRegionSettingsHTMLPage(UUID regionID) { Dictionary <string, string> vars = new Dictionary <string, string>(); IOpenRegionSettingsConnector orsc = DataManager.DataManager.RequestPlugin <IOpenRegionSettingsConnector>(); if (orsc != null) { OpenRegionSettings settings = orsc.GetSettings(regionID); vars.Add("Default Draw Distance", settings.DefaultDrawDistance.ToString()); vars.Add("Force Draw Distance", settings.ForceDrawDistance ? "checked" : ""); vars.Add("Max Drag Distance", settings.MaxDragDistance.ToString()); vars.Add("Max Prim Scale", settings.MaximumPrimScale.ToString()); vars.Add("Min Prim Scale", settings.MinimumPrimScale.ToString()); vars.Add("Max Physical Prim Scale", settings.MaximumPhysPrimScale.ToString()); vars.Add("Max Hollow Size", settings.MaximumHollowSize.ToString()); vars.Add("Min Hole Size", settings.MinimumHoleSize.ToString()); vars.Add("Max Link Count", settings.MaximumLinkCount.ToString()); vars.Add("Max Link Count Phys", settings.MaximumLinkCountPhys.ToString()); vars.Add("Max Inventory Items To Transfer", settings.MaximumInventoryItemsTransfer.ToString()); vars.Add("Terrain Scale", settings.TerrainDetailScale.ToString()); vars.Add("Show Tags", settings.ShowTags.ToString()); vars.Add("Render Water", settings.RenderWater ? "checked" : ""); vars.Add("Allow Minimap", settings.DisplayMinimap ? "checked" : ""); vars.Add("Allow Physical Prims", settings.AllowPhysicalPrims ? "checked" : ""); vars.Add("Enable Teen Mode", settings.EnableTeenMode ? "checked" : ""); vars.Add("Enforce Max Build Constraints", settings.ClampPrimSizes ? "checked" : ""); return(CSHTMLCreator.AddHTMLPage(HTMLPage, "", "OpenRegionSettings", vars, (newVars) => { ParseUpdatedList(regionID, newVars); return AddOpenRegionSettingsHTMLPage(regionID); })); } return(""); }
public void AddRegion(IScene scene) { m_scene = scene; scene.EventManager.OnMakeRootAgent += OnNewClient; scene.EventManager.OnRegisterCaps += OnRegisterCaps; scene.RegisterModuleInterface <IOpenRegionSettingsModule>(this); IOpenRegionSettingsConnector orsc = DataManager.DataManager.RequestPlugin <IOpenRegionSettingsConnector>(); if (orsc != null) { m_settings = orsc.GetSettings(scene.RegionInfo.RegionID); } ReadConfig(scene); }
private new void Update() { if (RegionListBox.SelectedIndex < 0) { return; } object item = RegionListBox.Items[RegionListBox.SelectedIndex]; if (item == null) { MessageBox.Show("Select a valid region from the list."); return; } if (item.ToString().StartsWith("Online - ")) { item = item.ToString().Remove(0, 9); } RegionInfo region = m_connector.GetRegionInfo(item.ToString()); if (region == null) { MessageBox.Show("You must enter a valid region name!"); return; } string oldRegionName = region.RegionName; bool listNeedsUpdated = oldRegionName != textBox1.Text; region.RegionName = textBox1.Text; region.RegionID = CurrentRegionID; region.RegionLocX = int.Parse(textBox3.Text) * Constants.RegionSize; region.RegionLocY = int.Parse(textBox5.Text) * Constants.RegionSize; IPAddress address = IPAddress.Parse("0.0.0.0"); string[] ports = textBox7.Text.Split(','); region.UDPPorts.Clear(); foreach (string port in ports) { string tPort = port.Trim(); int iPort = 0; if (int.TryParse(tPort, out iPort)) { region.UDPPorts.Add(iPort); } } region.InternalEndPoint = new IPEndPoint(address, region.UDPPorts[0]); region.RegionType = textBox11.Text; region.ObjectCapacity = int.Parse(textBox6.Text); int maturityLevel = 0; if (!int.TryParse(Maturity.Text, out maturityLevel)) { if (Maturity.Text == "Adult") { maturityLevel = 2; } else if (Maturity.Text == "Mature") { maturityLevel = 1; } else //Leave it as PG by default if they do not select a valid option { maturityLevel = 0; } } region.RegionSettings.Maturity = maturityLevel; region.Disabled = DisabledEdit.Checked; region.NumberStartup = int.Parse(StartupNumberBox.Text); region.RegionSizeX = int.Parse(RegionSizeX.Text); region.RegionSizeY = int.Parse(RegionSizeY.Text); region.Startup = ConvertIntToStartupType(startupType.SelectedIndex); region.InfiniteRegion = einfiniteRegion.Checked; if ((region.RegionSizeX % Constants.MinRegionSize) != 0 || (region.RegionSizeY % Constants.MinRegionSize) != 0) { MessageBox.Show("You must enter a valid region size (multiple of " + Constants.MinRegionSize + "!"); return; } m_connector.UpdateRegionInfo(region); if (OnNewRegion != null) { OnNewRegion(region); } if (listNeedsUpdated) { RefreshCurrentRegions(); } RegionListBox.SelectedItem = region.RegionName; IOpenRegionSettingsConnector orsc = Aurora.DataManager.DataManager.RequestPlugin <IOpenRegionSettingsConnector>(); if (orsc != null) { OpenRegionSettings ors = orsc.GetSettings(region.RegionID); ors.MaximumPhysPrimScale = float.Parse(eMaxPhysPrim.Text); ors.MaximumPrimScale = float.Parse(eMaxPrimSize.Text); orsc.SetSettings(region.RegionID, ors); } }