*Estate settings are now saved in their own configuration file called estate_settings.xml using the configuration system.

afrisby
mingchen 2007-08-03 00:14:11 +00:00
parent 3e4d677c77
commit 1c68c7a37f
3 changed files with 685 additions and 46 deletions

View File

@ -64,7 +64,7 @@ namespace OpenSim.Framework.Configuration
configOption.configurationType = configuration_type;
configOption.configurationUseDefaultNoPrompt = use_default_no_prompt;
if (configuration_key != "" && configuration_question != "")
if ((configuration_key != "" && configuration_question != "") || (configuration_key != "" && use_default_no_prompt))
{
if (!configurationOptions.Contains(configOption))
{
@ -375,5 +375,13 @@ namespace OpenSim.Framework.Configuration
pluginAssembly = null;
return plug;
}
public void forceSetConfigurationOption(string configuration_key, string configuration_value)
{
this.configurationPlugin.LoadData();
this.configurationPlugin.SetAttribute(configuration_key, configuration_value);
this.configurationPlugin.Commit();
this.configurationPlugin.Close();
}
}
}

View File

@ -27,67 +27,706 @@
*/
using libsecondlife;
using OpenSim.Framework.Configuration;
namespace OpenSim.Framework.Types
{
public class EstateSettings
{
//Settings to this island
public float billableFactor = (float)0.0;
public uint estateID = 0;
public uint parentEstateID = 0;
private float m_billableFactor;
public float billableFactor
{
get
{
return m_billableFactor;
}
set
{
m_billableFactor = value;
configMember.forceSetConfigurationOption("billable_factor", m_billableFactor.ToString());
}
}
public byte maxAgents = 40;
public float objectBonusFactor = (float)1.0;
public int redirectGridX = 0; //??
public int redirectGridY = 0; //??
public Simulator.RegionFlags regionFlags = Simulator.RegionFlags.None; //Booleam values of various region settings
public Simulator.SimAccess simAccess = Simulator.SimAccess.Mature; //Is sim PG, Mature, etc? Mature by default.
public float sunHour = 0;
private uint m_estateID;
public uint estateID
{
get
{
return m_estateID;
}
set
{
m_estateID = value;
configMember.forceSetConfigurationOption("estate_id", m_estateID.ToString());
}
}
public float terrainRaiseLimit = 0;
public float terrainLowerLimit = 0;
public bool useFixedSun = false;
public int pricePerMeter = 1;
private uint m_parentEstateID;
public uint parentEstateID
{
get
{
return m_parentEstateID;
}
set
{
m_parentEstateID = value;
configMember.forceSetConfigurationOption("parent_estate_id", m_parentEstateID.ToString());
}
}
public ushort regionWaterHeight = 20;
public bool regionAllowTerraform = true;
private byte m_maxAgents;
public byte maxAgents
{
get
{
return m_maxAgents;
}
set
{
m_maxAgents = value;
configMember.forceSetConfigurationOption("max_agents", m_maxAgents.ToString());
}
}
private float m_objectBonusFactor;
public float objectBonusFactor
{
get
{
return m_objectBonusFactor;
}
set
{
m_objectBonusFactor = value;
configMember.forceSetConfigurationOption("object_bonus_factor", m_objectBonusFactor.ToString());
}
}
private int m_redirectGridX;
public int redirectGridX
{
get
{
return m_redirectGridX;
}
set
{
m_redirectGridX = value;
configMember.forceSetConfigurationOption("redirect_grid_x", m_redirectGridX.ToString());
}
}
private int m_redirectGridY;
public int redirectGridY
{
get
{
return m_redirectGridY;
}
set
{
m_redirectGridY = value;
configMember.forceSetConfigurationOption("redirect_grid_y", m_redirectGridY.ToString());
}
}
private Simulator.RegionFlags m_regionFlags;
public Simulator.RegionFlags regionFlags
{
get
{
return m_regionFlags;
}
set
{
m_regionFlags = value;
configMember.forceSetConfigurationOption("region_flags", m_regionFlags.ToString());
}
}
private Simulator.SimAccess m_simAccess;
public Simulator.SimAccess simAccess
{
get
{
return m_simAccess;
}
set
{
m_simAccess = value;
configMember.forceSetConfigurationOption("sim_access", m_simAccess.ToString());
}
}
private float m_sunHour;
public float sunHour
{
get
{
return m_sunHour;
}
set
{
m_sunHour = value;
configMember.forceSetConfigurationOption("sun_hour", m_sunHour.ToString());
}
}
private float m_terrainRaiseLimit;
public float terrainRaiseLimit
{
get
{
return m_terrainRaiseLimit;
}
set
{
m_terrainRaiseLimit = value;
configMember.forceSetConfigurationOption("terrain_raise_limit", m_terrainRaiseLimit.ToString());
}
}
private float m_terrainLowerLimit;
public float terrainLowerLimit
{
get
{
return m_terrainLowerLimit;
}
set
{
m_terrainLowerLimit = value;
configMember.forceSetConfigurationOption("terrain_lower_limit", m_terrainLowerLimit.ToString());
}
}
private bool m_useFixedSun;
public bool useFixedSun
{
get
{
return m_useFixedSun;
}
set
{
m_useFixedSun = value;
configMember.forceSetConfigurationOption("use_fixed_sun", m_useFixedSun.ToString());
}
}
private int m_pricePerMeter;
public int pricePerMeter
{
get
{
return m_pricePerMeter;
}
set
{
m_pricePerMeter = value;
configMember.forceSetConfigurationOption("price_per_meter", m_pricePerMeter.ToString());
}
}
private ushort m_regionWaterHeight;
public ushort regionWaterHeight
{
get
{
return m_regionWaterHeight;
}
set
{
m_regionWaterHeight = value;
configMember.forceSetConfigurationOption("region_water_height", m_regionWaterHeight.ToString());
}
}
private bool m_regionAllowTerraform;
public bool regionAllowTerraform
{
get
{
return m_regionAllowTerraform;
}
set
{
m_regionAllowTerraform = value;
configMember.forceSetConfigurationOption("region_allow_terraform", m_regionAllowTerraform.ToString());
}
}
// Region Information
// Low resolution 'base' textures. No longer used.
public LLUUID terrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); // Default
public LLUUID terrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); // Default
public LLUUID terrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); // Default
public LLUUID terrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); // Default
private LLUUID m_terrainBase0;
public LLUUID terrainBase0
{
get
{
return m_terrainBase0;
}
set
{
m_terrainBase0 = value;
configMember.forceSetConfigurationOption("terrain_base_0", m_terrainBase0.ToString());
}
}
private LLUUID m_terrainBase1;
public LLUUID terrainBase1
{
get
{
return m_terrainBase1;
}
set
{
m_terrainBase1 = value;
configMember.forceSetConfigurationOption("terrain_base_1", m_terrainBase1.ToString());
}
}
private LLUUID m_terrainBase2;
public LLUUID terrainBase2
{
get
{
return m_terrainBase2;
}
set
{
m_terrainBase2 = value;
configMember.forceSetConfigurationOption("terrain_base_2", m_terrainBase2.ToString());
}
}
private LLUUID m_terrainBase3;
public LLUUID terrainBase3
{
get
{
return m_terrainBase3;
}
set
{
m_terrainBase3 = value;
configMember.forceSetConfigurationOption("terrain_base_3", m_terrainBase3.ToString());
}
}
// Higher resolution terrain textures
public LLUUID terrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000");
public LLUUID terrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000");
public LLUUID terrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000");
public LLUUID terrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
private LLUUID m_terrainDetail0;
public LLUUID terrainDetail0
{
get
{
return m_terrainDetail0;
}
set
{
m_terrainDetail0 = value;
configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString());
}
}
private LLUUID m_terrainDetail1;
public LLUUID terrainDetail1
{
get
{
return m_terrainDetail1;
}
set
{
m_terrainDetail1 = value;
configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString());
}
}
private LLUUID m_terrainDetail2;
public LLUUID terrainDetail2
{
get
{
return m_terrainDetail2;
}
set
{
m_terrainDetail2 = value;
configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString());
}
}
private LLUUID m_terrainDetail3;
public LLUUID terrainDetail3
{
get
{
return m_terrainDetail3;
}
set
{
m_terrainDetail3 = value;
configMember.forceSetConfigurationOption("terrain_detail_3", m_terrainDetail3.ToString());
}
}
// First quad - each point is bilinearly interpolated at each meter of terrain
public float terrainStartHeight0 = 10.0f;
public float terrainStartHeight1 = 10.0f;
public float terrainStartHeight2 = 10.0f;
public float terrainStartHeight3 = 10.0f;
private float m_terrainStartHeight0;
public float terrainStartHeight0
{
get
{
return m_terrainStartHeight0;
}
set
{
m_terrainStartHeight0 = value;
configMember.forceSetConfigurationOption("terrain_start_height_0", m_terrainStartHeight0.ToString());
}
}
private float m_terrainStartHeight1;
public float terrainStartHeight1
{
get
{
return m_terrainStartHeight1;
}
set
{
m_terrainStartHeight1 = value;
configMember.forceSetConfigurationOption("terrain_start_height_1", m_terrainStartHeight1.ToString());
}
}
private float m_terrainStartHeight2;
public float terrainStartHeight2
{
get
{
return m_terrainStartHeight2;
}
set
{
m_terrainStartHeight2 = value;
configMember.forceSetConfigurationOption("terrain_start_height_2", m_terrainStartHeight2.ToString());
}
}
private float m_terrainStartHeight3;
public float terrainStartHeight3
{
get
{
return m_terrainStartHeight3;
}
set
{
m_terrainStartHeight3 = value;
configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString());
}
}
// Second quad - also bilinearly interpolated.
// Terrain texturing is done that:
// 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y]
public float terrainHeightRange0 = 60.0f; //00
public float terrainHeightRange1 = 60.0f; //01
public float terrainHeightRange2 = 60.0f; //10
public float terrainHeightRange3 = 60.0f; //11
private float m_terrainHeightRange0;
public float terrainHeightRange0
{
get
{
return m_terrainHeightRange0;
}
set
{
m_terrainHeightRange0 = value;
configMember.forceSetConfigurationOption("terrain_height_range_0", m_terrainHeightRange0.ToString());
}
}
private float m_terrainHeightRange1;
public float terrainHeightRange1
{
get
{
return m_terrainHeightRange1;
}
set
{
m_terrainHeightRange1 = value;
configMember.forceSetConfigurationOption("terrain_height_range_1", m_terrainHeightRange1.ToString());
}
}
private float m_terrainHeightRange2;
public float terrainHeightRange2
{
get
{
return m_terrainHeightRange2;
}
set
{
m_terrainHeightRange2 = value;
configMember.forceSetConfigurationOption("terrain_height_range_2", m_terrainHeightRange2.ToString());
}
}
private float m_terrainHeightRange3;
public float terrainHeightRange3
{
get
{
return m_terrainHeightRange3;
}
set
{
m_terrainHeightRange3 = value;
configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString());
}
}
// Terrain Default (Must be in F32 Format!)
public string terrainFile = "default.r32";
public double terrainMultiplier = 60.0;
public float waterHeight = (float)20.0;
private string m_terrainFile;
public string terrainFile
{
get
{
return m_terrainFile;
}
set
{
m_terrainFile = value;
configMember.forceSetConfigurationOption("terrain_file", m_terrainFile.ToString());
}
}
public LLUUID terrainImageID = LLUUID.Zero; // the assetID that is the current Map image for this region
private double m_terrainMultiplier;
public double terrainMultiplier
{
get
{
return m_terrainMultiplier;
}
set
{
m_terrainMultiplier = value;
configMember.forceSetConfigurationOption("terrain_multiplier", m_terrainMultiplier.ToString());
}
}
private float m_waterHeight;
public float waterHeight
{
get
{
return m_waterHeight;
}
set
{
m_waterHeight = value;
configMember.forceSetConfigurationOption("water_height", m_waterHeight.ToString());
}
}
private LLUUID m_terrainImageID;
public LLUUID terrainImageID
{
get
{
return m_terrainImageID;
}
set
{
m_terrainImageID = value;
configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString());
}
}
private ConfigurationMember configMember;
public EstateSettings()
{
configMember = new ConfigurationMember("estate_settings.xml", "ESTATE SETTINGS", this.loadConfigurationOptions, this.handleIncomingConfiguration);
configMember.performConfigurationRetrieve();
}
public void loadConfigurationOptions()
{
configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "","0.0",true);
configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "","0",true);
configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", true);
configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "40", true);
configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "1.0", true);
configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", "0", true);
configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", "0", true);
configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", true);
configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21", true);
configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true);
configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true);
configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true);
configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "false", true);
configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "1", true);
configMember.addConfigurationOption("region_water_height", ConfigurationOption.ConfigurationTypes.TYPE_UINT16, "", "20", true);
configMember.addConfigurationOption("region_allow_terraform", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "true", true);
configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "b8d3965a-ad78-bf43-699b-bff8eca6c975", true);
configMember.addConfigurationOption("terrain_base_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "abb783e6-3e93-26c0-248a-247666855da3", true);
configMember.addConfigurationOption("terrain_base_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "179cdabd-398a-9b6b-1391-4dc333ba321f", true);
configMember.addConfigurationOption("terrain_base_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "beb169c7-11ea-fff2-efe5-0f24dc881df2", true);
configMember.addConfigurationOption("terrain_detail_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("terrain_detail_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("terrain_detail_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("terrain_detail_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("terrain_start_height_0", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
configMember.addConfigurationOption("terrain_start_height_1", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
configMember.addConfigurationOption("terrain_start_height_2", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
configMember.addConfigurationOption("terrain_start_height_3", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
configMember.addConfigurationOption("terrain_height_range_0", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
configMember.addConfigurationOption("terrain_height_range_1", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
configMember.addConfigurationOption("terrain_height_range_2", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
configMember.addConfigurationOption("terrain_height_range_3", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
configMember.addConfigurationOption("terrain_file", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "", "default.r32", true);
configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "", "20.0", true);
configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true);
}
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
{
switch (configuration_key)
{
case "billable_factor":
this.m_billableFactor = (float)configuration_result;
break;
case "estate_id":
this.m_estateID = (uint)configuration_result;
break;
case "parent_estate_id":
this.m_parentEstateID = (uint)configuration_result;
break;
case "max_agents":
this.m_maxAgents = (byte)configuration_result;
break;
case "object_bonus_factor":
this.m_objectBonusFactor = (float)configuration_result;
break;
case "redirect_grid_x":
this.m_redirectGridX = (int)configuration_result;
break;
case "redirect_grid_y":
this.m_redirectGridY = (int)configuration_result;
break;
case "region_flags":
this.m_regionFlags = (Simulator.RegionFlags)((uint)configuration_result);
break;
case "sim_access":
this.m_simAccess = (Simulator.SimAccess)((byte)configuration_result);
break;
case "sun_hour":
this.m_sunHour = (float)configuration_result;
break;
case "terrain_raise_limit":
this.m_terrainRaiseLimit = (float)configuration_result;
break;
case "terrain_lower_limit":
this.m_terrainLowerLimit = (float)configuration_result;
break;
case "use_fixed_sun":
this.m_useFixedSun = (bool)configuration_result;
break;
case "price_per_meter":
this.m_pricePerMeter = System.Convert.ToInt32(configuration_result);
break;
case "region_water_height":
this.m_regionWaterHeight = (ushort)configuration_result;
break;
case "region_allow_terraform":
this.m_regionAllowTerraform = (bool)configuration_result;
break;
case "terrain_base_0":
this.m_terrainBase0 = (LLUUID)configuration_result;
break;
case "terrain_base_1":
this.m_terrainBase1 = (LLUUID)configuration_result;
break;
case "terrain_base_2":
this.m_terrainBase2 = (LLUUID)configuration_result;
break;
case "terrain_base_3":
this.m_terrainBase3 = (LLUUID)configuration_result;
break;
case "terrain_detail_0":
this.m_terrainDetail0 = (LLUUID)configuration_result;
break;
case "terrain_detail_1":
this.m_terrainDetail1 = (LLUUID)configuration_result;
break;
case "terrain_detail_2":
this.m_terrainDetail2 = (LLUUID)configuration_result;
break;
case "terrain_detail_3":
this.m_terrainDetail3 = (LLUUID)configuration_result;
break;
case "terrain_start_height_0":
this.m_terrainStartHeight0 = (float)configuration_result;
break;
case "terrain_start_height_1":
this.m_terrainStartHeight1 = (float)configuration_result;
break;
case "terrain_start_height_2":
this.m_terrainStartHeight2 = (float)configuration_result;
break;
case "terrain_start_height_3":
this.m_terrainStartHeight3 = (float)configuration_result;
break;
case "terrain_height_range_0":
this.m_terrainHeightRange0 = (float)configuration_result;
break;
case "terrain_height_range_1":
this.m_terrainHeightRange1 = (float)configuration_result;
break;
case "terrain_height_range_2":
this.m_terrainHeightRange2 = (float)configuration_result;
break;
case "terrain_height_range_3":
this.m_terrainHeightRange3 = (float)configuration_result;
break;
case "terrain_file":
this.m_terrainFile = (string)configuration_result;
break;
case "terrain_multiplier":
this.m_terrainMultiplier = System.Convert.ToDouble(configuration_result);
break;
case "water_height":
float.TryParse(((double)configuration_result).ToString(),out this.m_waterHeight);
break;
case "terrain_image_id":
this.m_terrainImageID = (LLUUID)configuration_result;
break;
}
return true;
}
}
}

View File

@ -172,8 +172,6 @@ namespace OpenSim.Framework.Types
configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false);
configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", "9000", false);
configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false);
configMember.addConfigurationOption("terrain_file", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Terrain File", "default.r32", false);
configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "Terrain Height Multiplier", "60.0", false);
configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false);
configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false);
configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false);
@ -216,12 +214,6 @@ namespace OpenSim.Framework.Types
this.m_externalHostName = Util.GetLocalHost().ToString();
}
break;
case "terrain_file":
this.estateSettings.terrainFile = (string)configuration_result;
break;
case "terrain_multiplier":
this.estateSettings.terrainMultiplier = (double)configuration_result;
break;
case "master_avatar_first":
this.MasterAvatarFirstName = (string)configuration_result;
break;