diff options
author | UbitUmarov | 2018-03-05 20:20:29 +0000 |
---|---|---|
committer | UbitUmarov | 2018-03-05 20:20:29 +0000 |
commit | 47fd3afecdd79bf6c36d838b655a74e9b5c74077 (patch) | |
tree | 404a62d5f84ffbc15391eaa2ea55808af801b5fb /OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | |
parent | make more clear some magic numbers on SOP getnumberofsides(), reduce unneces... (diff) | |
download | opensim-SC-47fd3afecdd79bf6c36d838b655a74e9b5c74077.zip opensim-SC-47fd3afecdd79bf6c36d838b655a74e9b5c74077.tar.gz opensim-SC-47fd3afecdd79bf6c36d838b655a74e9b5c74077.tar.bz2 opensim-SC-47fd3afecdd79bf6c36d838b655a74e9b5c74077.tar.xz |
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
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | 82 |
1 files changed, 46 insertions, 36 deletions
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 3666c3f..b32a429 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 | |||
65 | /// </summary> | 65 | /// </summary> |
66 | // private UUID EconomyBaseAccount = UUID.Zero; | 66 | // private UUID EconomyBaseAccount = UUID.Zero; |
67 | 67 | ||
68 | private float EnergyEfficiency = 0f; | 68 | private float EnergyEfficiency = 1f; |
69 | // private ObjectPaid handerOnObjectPaid; | 69 | // private ObjectPaid handerOnObjectPaid; |
70 | private bool m_enabled = true; | 70 | private bool m_enabled = true; |
71 | private bool m_sellEnabled = false; | 71 | private bool m_sellEnabled = true; |
72 | 72 | ||
73 | private IConfigSource m_gConfig; | 73 | private IConfigSource m_gConfig; |
74 | 74 | ||
@@ -85,12 +85,12 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
85 | 85 | ||
86 | private int ObjectCount = 0; | 86 | private int ObjectCount = 0; |
87 | private int PriceEnergyUnit = 0; | 87 | private int PriceEnergyUnit = 0; |
88 | private int PriceGroupCreate = 0; | 88 | private int PriceGroupCreate = -1; |
89 | private int PriceObjectClaim = 0; | 89 | private int PriceObjectClaim = 0; |
90 | private float PriceObjectRent = 0f; | 90 | private float PriceObjectRent = 0f; |
91 | private float PriceObjectScaleFactor = 0f; | 91 | private float PriceObjectScaleFactor = 10f; |
92 | private int PriceParcelClaim = 0; | 92 | private int PriceParcelClaim = 0; |
93 | private float PriceParcelClaimFactor = 0f; | 93 | private float PriceParcelClaimFactor = 1f; |
94 | private int PriceParcelRent = 0; | 94 | private int PriceParcelRent = 0; |
95 | private int PricePublicObjectDecay = 0; | 95 | private int PricePublicObjectDecay = 0; |
96 | private int PricePublicObjectDelete = 0; | 96 | private int PricePublicObjectDelete = 0; |
@@ -98,7 +98,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
98 | private int PriceUpload = 0; | 98 | private int PriceUpload = 0; |
99 | private int TeleportMinPrice = 0; | 99 | private int TeleportMinPrice = 0; |
100 | 100 | ||
101 | private float TeleportPriceExponent = 0f; | 101 | private float TeleportPriceExponent = 2f; |
102 | 102 | ||
103 | 103 | ||
104 | #region IMoneyModule Members | 104 | #region IMoneyModule Members |
@@ -124,13 +124,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
124 | public void Initialise(IConfigSource config) | 124 | public void Initialise(IConfigSource config) |
125 | { | 125 | { |
126 | m_gConfig = config; | 126 | m_gConfig = config; |
127 | 127 | ReadConfigAndPopulate(); | |
128 | IConfig startupConfig = m_gConfig.Configs["Startup"]; | ||
129 | IConfig economyConfig = m_gConfig.Configs["Economy"]; | ||
130 | |||
131 | |||
132 | ReadConfigAndPopulate(startupConfig, "Startup"); | ||
133 | ReadConfigAndPopulate(economyConfig, "Economy"); | ||
134 | } | 128 | } |
135 | 129 | ||
136 | public void AddRegion(Scene scene) | 130 | public void AddRegion(Scene scene) |
@@ -241,35 +235,51 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
241 | /// <summary> | 235 | /// <summary> |
242 | /// Parse Configuration | 236 | /// Parse Configuration |
243 | /// </summary> | 237 | /// </summary> |
244 | /// <param name="scene"></param> | 238 | private void ReadConfigAndPopulate() |
245 | /// <param name="startupConfig"></param> | ||
246 | /// <param name="config"></param> | ||
247 | private void ReadConfigAndPopulate(IConfig startupConfig, string config) | ||
248 | { | 239 | { |
249 | if (config == "Startup" && startupConfig != null) | 240 | // we are enabled by default |
241 | |||
242 | IConfig startupConfig = m_gConfig.Configs["Startup"]; | ||
243 | |||
244 | if(startupConfig == null) // should not happen | ||
245 | return; | ||
246 | |||
247 | IConfig economyConfig = m_gConfig.Configs["Economy"]; | ||
248 | |||
249 | // economymodule may be at startup or Economy (legacy) | ||
250 | string mmodule = startupConfig.GetString("economymodule",""); | ||
251 | if(String.IsNullOrEmpty(mmodule)) | ||
250 | { | 252 | { |
251 | m_enabled = (startupConfig.GetString("economymodule", "BetaGridLikeMoneyModule") == "BetaGridLikeMoneyModule"); | 253 | if(economyConfig != null) |
254 | mmodule = economyConfig.GetString("economymodule",""); | ||
252 | } | 255 | } |
253 | 256 | ||
254 | if (config == "Economy" && startupConfig != null) | 257 | if(!String.IsNullOrEmpty(mmodule) && mmodule != Name) |
255 | { | 258 | { |
256 | PriceEnergyUnit = startupConfig.GetInt("PriceEnergyUnit", 100); | 259 | // some other money module selected |
257 | PriceObjectClaim = startupConfig.GetInt("PriceObjectClaim", 10); | 260 | m_enabled = false; |
258 | PricePublicObjectDecay = startupConfig.GetInt("PricePublicObjectDecay", 4); | 261 | return; |
259 | PricePublicObjectDelete = startupConfig.GetInt("PricePublicObjectDelete", 4); | ||
260 | PriceParcelClaim = startupConfig.GetInt("PriceParcelClaim", 1); | ||
261 | PriceParcelClaimFactor = startupConfig.GetFloat("PriceParcelClaimFactor", 1f); | ||
262 | PriceUpload = startupConfig.GetInt("PriceUpload", 0); | ||
263 | PriceRentLight = startupConfig.GetInt("PriceRentLight", 5); | ||
264 | TeleportMinPrice = startupConfig.GetInt("TeleportMinPrice", 2); | ||
265 | TeleportPriceExponent = startupConfig.GetFloat("TeleportPriceExponent", 2f); | ||
266 | EnergyEfficiency = startupConfig.GetFloat("EnergyEfficiency", 1); | ||
267 | PriceObjectRent = startupConfig.GetFloat("PriceObjectRent", 1); | ||
268 | PriceObjectScaleFactor = startupConfig.GetFloat("PriceObjectScaleFactor", 10); | ||
269 | PriceParcelRent = startupConfig.GetInt("PriceParcelRent", 1); | ||
270 | PriceGroupCreate = startupConfig.GetInt("PriceGroupCreate", -1); | ||
271 | m_sellEnabled = startupConfig.GetBoolean("SellEnabled", false); | ||
272 | } | 262 | } |
263 | |||
264 | if(economyConfig == null) | ||
265 | return; | ||
266 | |||
267 | PriceEnergyUnit = economyConfig.GetInt("PriceEnergyUnit", 0); | ||
268 | PriceObjectClaim = economyConfig.GetInt("PriceObjectClaim", 0); | ||
269 | PricePublicObjectDecay = economyConfig.GetInt("PricePublicObjectDecay", 4); | ||
270 | PricePublicObjectDelete = economyConfig.GetInt("PricePublicObjectDelete", 0); | ||
271 | PriceParcelClaim = economyConfig.GetInt("PriceParcelClaim", 0); | ||
272 | PriceParcelClaimFactor = economyConfig.GetFloat("PriceParcelClaimFactor", 1f); | ||
273 | PriceUpload = economyConfig.GetInt("PriceUpload", 0); | ||
274 | PriceRentLight = economyConfig.GetInt("PriceRentLight", 0); | ||
275 | TeleportMinPrice = economyConfig.GetInt("TeleportMinPrice", 0); | ||
276 | TeleportPriceExponent = economyConfig.GetFloat("TeleportPriceExponent", 2f); | ||
277 | EnergyEfficiency = economyConfig.GetFloat("EnergyEfficiency", 1); | ||
278 | PriceObjectRent = economyConfig.GetFloat("PriceObjectRent", 0); | ||
279 | PriceObjectScaleFactor = economyConfig.GetFloat("PriceObjectScaleFactor", 10); | ||
280 | PriceParcelRent = economyConfig.GetInt("PriceParcelRent", 0); | ||
281 | PriceGroupCreate = economyConfig.GetInt("PriceGroupCreate", -1); | ||
282 | m_sellEnabled = economyConfig.GetBoolean("SellEnabled", true); | ||
273 | } | 283 | } |
274 | 284 | ||
275 | private void GetClientFunds(IClientAPI client) | 285 | private void GetClientFunds(IClientAPI client) |