From 47fd3afecdd79bf6c36d838b655a74e9b5c74077 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 5 Mar 2018 20:20:29 +0000 Subject: [PATCH 1/2] change SampleMoneyModule intialization, make it look for economymodule setting both in startup and economy sections; change some default settings to no cost values, since that is our default --- .../World/MoneyModule/SampleMoneyModule.cs | 82 +++++++++++-------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 3666c3f2fc..b32a4290c6 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -65,10 +65,10 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule /// // private UUID EconomyBaseAccount = UUID.Zero; - private float EnergyEfficiency = 0f; + private float EnergyEfficiency = 1f; // private ObjectPaid handerOnObjectPaid; private bool m_enabled = true; - private bool m_sellEnabled = false; + private bool m_sellEnabled = true; private IConfigSource m_gConfig; @@ -85,12 +85,12 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule private int ObjectCount = 0; private int PriceEnergyUnit = 0; - private int PriceGroupCreate = 0; + private int PriceGroupCreate = -1; private int PriceObjectClaim = 0; private float PriceObjectRent = 0f; - private float PriceObjectScaleFactor = 0f; + private float PriceObjectScaleFactor = 10f; private int PriceParcelClaim = 0; - private float PriceParcelClaimFactor = 0f; + private float PriceParcelClaimFactor = 1f; private int PriceParcelRent = 0; private int PricePublicObjectDecay = 0; private int PricePublicObjectDelete = 0; @@ -98,7 +98,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule private int PriceUpload = 0; private int TeleportMinPrice = 0; - private float TeleportPriceExponent = 0f; + private float TeleportPriceExponent = 2f; #region IMoneyModule Members @@ -124,13 +124,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule public void Initialise(IConfigSource config) { m_gConfig = config; - - IConfig startupConfig = m_gConfig.Configs["Startup"]; - IConfig economyConfig = m_gConfig.Configs["Economy"]; - - - ReadConfigAndPopulate(startupConfig, "Startup"); - ReadConfigAndPopulate(economyConfig, "Economy"); + ReadConfigAndPopulate(); } public void AddRegion(Scene scene) @@ -241,35 +235,51 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule /// /// Parse Configuration /// - /// - /// - /// - private void ReadConfigAndPopulate(IConfig startupConfig, string config) + private void ReadConfigAndPopulate() { - if (config == "Startup" && startupConfig != null) + // we are enabled by default + + IConfig startupConfig = m_gConfig.Configs["Startup"]; + + if(startupConfig == null) // should not happen + return; + + IConfig economyConfig = m_gConfig.Configs["Economy"]; + + // economymodule may be at startup or Economy (legacy) + string mmodule = startupConfig.GetString("economymodule",""); + if(String.IsNullOrEmpty(mmodule)) { - m_enabled = (startupConfig.GetString("economymodule", "BetaGridLikeMoneyModule") == "BetaGridLikeMoneyModule"); + if(economyConfig != null) + mmodule = economyConfig.GetString("economymodule",""); } - if (config == "Economy" && startupConfig != null) + if(!String.IsNullOrEmpty(mmodule) && mmodule != Name) { - PriceEnergyUnit = startupConfig.GetInt("PriceEnergyUnit", 100); - PriceObjectClaim = startupConfig.GetInt("PriceObjectClaim", 10); - PricePublicObjectDecay = startupConfig.GetInt("PricePublicObjectDecay", 4); - PricePublicObjectDelete = startupConfig.GetInt("PricePublicObjectDelete", 4); - PriceParcelClaim = startupConfig.GetInt("PriceParcelClaim", 1); - PriceParcelClaimFactor = startupConfig.GetFloat("PriceParcelClaimFactor", 1f); - PriceUpload = startupConfig.GetInt("PriceUpload", 0); - PriceRentLight = startupConfig.GetInt("PriceRentLight", 5); - TeleportMinPrice = startupConfig.GetInt("TeleportMinPrice", 2); - TeleportPriceExponent = startupConfig.GetFloat("TeleportPriceExponent", 2f); - EnergyEfficiency = startupConfig.GetFloat("EnergyEfficiency", 1); - PriceObjectRent = startupConfig.GetFloat("PriceObjectRent", 1); - PriceObjectScaleFactor = startupConfig.GetFloat("PriceObjectScaleFactor", 10); - PriceParcelRent = startupConfig.GetInt("PriceParcelRent", 1); - PriceGroupCreate = startupConfig.GetInt("PriceGroupCreate", -1); - m_sellEnabled = startupConfig.GetBoolean("SellEnabled", false); + // some other money module selected + m_enabled = false; + return; } + + if(economyConfig == null) + return; + + PriceEnergyUnit = economyConfig.GetInt("PriceEnergyUnit", 0); + PriceObjectClaim = economyConfig.GetInt("PriceObjectClaim", 0); + PricePublicObjectDecay = economyConfig.GetInt("PricePublicObjectDecay", 4); + PricePublicObjectDelete = economyConfig.GetInt("PricePublicObjectDelete", 0); + PriceParcelClaim = economyConfig.GetInt("PriceParcelClaim", 0); + PriceParcelClaimFactor = economyConfig.GetFloat("PriceParcelClaimFactor", 1f); + PriceUpload = economyConfig.GetInt("PriceUpload", 0); + PriceRentLight = economyConfig.GetInt("PriceRentLight", 0); + TeleportMinPrice = economyConfig.GetInt("TeleportMinPrice", 0); + TeleportPriceExponent = economyConfig.GetFloat("TeleportPriceExponent", 2f); + EnergyEfficiency = economyConfig.GetFloat("EnergyEfficiency", 1); + PriceObjectRent = economyConfig.GetFloat("PriceObjectRent", 0); + PriceObjectScaleFactor = economyConfig.GetFloat("PriceObjectScaleFactor", 10); + PriceParcelRent = economyConfig.GetInt("PriceParcelRent", 0); + PriceGroupCreate = economyConfig.GetInt("PriceGroupCreate", -1); + m_sellEnabled = economyConfig.GetBoolean("SellEnabled", true); } private void GetClientFunds(IClientAPI client) From c5ce9b7be81414ea078477fe89e886bab3777edc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 5 Mar 2018 20:37:58 +0000 Subject: [PATCH 2/2] make the setting economymodule visible on Economy section of OpenSimDefaults.ini and OpenSim.ini.example. This setting must be changed to allow other modules and disable our simple one. (ours does look for it at Startup section for legacy reasons) --- bin/OpenSim.ini.example | 4 ++++ bin/OpenSimDefaults.ini | 46 ++++++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 14a41b03e5..21f98413ff 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -864,6 +864,10 @@ ;DATA_SRV_MISearch = "http://metaverseink.com/cgi-bin/register.py" [Economy] + ; the economy module in use + ; To use other modules you need to override this setting + ; economymodule = BetaGridLikeMoneyModule + ;# {SellEnabled} {} {Enable selling for 0?} {true false} true ; The default economy module only implements just enough to allow free actions (transfer of objects, etc). ; There is no intention to implement anything further in core OpenSimulator. diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index bb81c95d43..d76565a3c5 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1709,40 +1709,48 @@ ; data service ;DATA_SRV_MISearch = "http://metaverseink.com/cgi-bin/register.py" - + [Economy] + ; the economy module in use + ; default is the provided BetaGridLikeMoneyModule + ; - This module is for demonstration only - + ; The default economy module only implements just enough to allow free actions (transfer of objects, etc). + ; There is no intention to implement anything further in core OpenSimulator. + ; This functionality has to be provided by third party modules. + ; To use other modules you need to override this setting on OpenSim.ini Economy (or startup) section + ; economymodule = BetaGridLikeMoneyModule + ; These economy values get used in the BetaGridLikeMoneyModule. - This module is for demonstration only - ; The default economy module only implements just enough to allow free actions (transfer of objects, etc). ; There is no intention to implement anything further in core OpenSimulator. ; This functionality has to be provided by third party modules. ;; Enables selling things for $0. Default is true. - SellEnabled = true + ; SellEnabled = true ;; Money Unit fee to upload textures, animations etc. Default is 0. - PriceUpload = 0 + ;PriceUpload = 0 ;; Money Unit fee to create groups. Default is 0. - PriceGroupCreate = 0 + ;PriceGroupCreate = 0 ; We don't really know what the rest of these values do. These get sent to the client ; These taken from Agni at a Public Telehub. Change at your own risk. - ObjectCount = 0 - PriceEnergyUnit = 100 - PriceObjectClaim = 10 - PricePublicObjectDecay = 4 - PricePublicObjectDelete = 4 - PriceParcelClaim = 1 - PriceParcelClaimFactor = 1 - - PriceRentLight = 5 - TeleportMinPrice = 2 - TeleportPriceExponent = 2 - EnergyEfficiency = 1 - PriceObjectRent = 1 - PriceObjectScaleFactor = 10 - PriceParcelRent = 1 + ;ObjectCount = 0 + ;PriceEnergyUnit = 0 + ;PriceObjectClaim = 0 + ;PricePublicObjectDecay = 0 + ;PricePublicObjectDelete = 0 + ;PriceParcelClaim = 0 + ;PriceParcelClaimFactor = 1 + ;PriceRentLight = 0 + ;TeleportMinPrice = 0 + ;TeleportPriceExponent = 2 + ;EnergyEfficiency = 1 + ;PriceObjectRent = 0 + ;PriceObjectScaleFactor = 10 + ;PriceParcelRent = 0 [XEngine] ; Enable this engine in this OpenSim instance