aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
authorTeravus Ovares2008-04-10 09:36:55 +0000
committerTeravus Ovares2008-04-10 09:36:55 +0000
commit06967e230f50fbeee24176f3df8cda8a067544e4 (patch)
treed824f1a8834700d12a77159159094a6524a856bb /OpenSim/Region/Environment/Modules
parent* Adds twist support for Cubes, Cylinders, and Prisms in the Meshmerizer (diff)
downloadopensim-SC_OLD-06967e230f50fbeee24176f3df8cda8a067544e4.zip
opensim-SC_OLD-06967e230f50fbeee24176f3df8cda8a067544e4.tar.gz
opensim-SC_OLD-06967e230f50fbeee24176f3df8cda8a067544e4.tar.bz2
opensim-SC_OLD-06967e230f50fbeee24176f3df8cda8a067544e4.tar.xz
* Updates BetaGridLikeMoneyModule
* Several people have asked for a way to limit uploads, so I've decided to show people how to do this in the BetaGridLikeMoneyModule. * Configure it in OpenSim.ini using the [Economy] header. See the bottom of the OpenSim.ini.example for more information. * This also fleshes out the Economy API a bit more.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs101
1 files changed, 96 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs
index 6e16eb3..74ae0dc 100644
--- a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs
+++ b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs
@@ -56,10 +56,39 @@ namespace OpenSim.Region.Environment.Modules
56 56
57 private bool gridmode = false; 57 private bool gridmode = false;
58 58
59 private float EnergyEfficiency = 0f;
60 private int ObjectCapacity = 45000;
61 private int ObjectCount = 0;
62 private int PriceEnergyUnit = 0;
63 private int PriceGroupCreate = 0;
64 private int PriceObjectClaim = 0;
65 private float PriceObjectRent = 0f;
66 private float PriceObjectScaleFactor = 0f;
67 private int PriceParcelClaim = 0;
68 private float PriceParcelClaimFactor = 0f;
69 private int PriceParcelRent = 0;
70 private int PricePublicObjectDecay = 0;
71 private int PricePublicObjectDelete = 0;
72 private int PriceRentLight = 0;
73 private int PriceUpload = 0;
74 private int TeleportMinPrice = 0;
75 private int UserLevelPaysFees = 2;
76
77 float TeleportPriceExponent = 0f;
78
79 LLUUID EconomyBaseAccount = LLUUID.Zero;
80
59 public void Initialise(Scene scene, IConfigSource config) 81 public void Initialise(Scene scene, IConfigSource config)
60 { 82 {
61 m_gConfig = config; 83 m_gConfig = config;
62 ReadConfigAndPopulate(); 84
85 IConfig startupConfig = m_gConfig.Configs["Startup"];
86 IConfig economyConfig = m_gConfig.Configs["Economy"];
87
88
89
90 ReadConfigAndPopulate(scene, startupConfig, "Startup");
91 ReadConfigAndPopulate(scene, economyConfig, "Economy");
63 92
64 if (m_enabled) 93 if (m_enabled)
65 { 94 {
@@ -79,14 +108,47 @@ namespace OpenSim.Region.Environment.Modules
79 scene.EventManager.OnNewClient += OnNewClient; 108 scene.EventManager.OnNewClient += OnNewClient;
80 scene.EventManager.OnMoneyTransfer += MoneyTransferAction; 109 scene.EventManager.OnMoneyTransfer += MoneyTransferAction;
81 scene.EventManager.OnClientClosed += ClientClosed; 110 scene.EventManager.OnClientClosed += ClientClosed;
111 scene.EventManager.OnNewInventoryItemUploadComplete += NewInventoryItemEconomyHandler;
112
82 } 113 }
83 } 114 }
84 115
85 private void ReadConfigAndPopulate() 116 private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string config)
86 { 117 {
87 IConfig startupConfig = m_gConfig.Configs["Startup"]; 118 if (config == "Startup")
88 gridmode = startupConfig.GetBoolean("gridmode", false); 119 {
89 m_enabled = (startupConfig.GetString("moneymodule", "BetaGridLikeMoneyModule") == "BetaGridLikeMoneyModule"); 120 gridmode = startupConfig.GetBoolean("gridmode", false);
121 m_enabled = (startupConfig.GetString("economymodule", "BetaGridLikeMoneyModule") == "BetaGridLikeMoneyModule");
122 }
123
124 if (config == "Economy")
125 {
126 ObjectCapacity = startupConfig.GetInt("ObjectCapacity", 45000);
127 PriceEnergyUnit = startupConfig.GetInt("PriceEnergyUnit", 100);
128 PriceObjectClaim = startupConfig.GetInt("PriceObjectClaim", 10);
129 PricePublicObjectDecay = startupConfig.GetInt("PricePublicObjectDecay", 4);
130 PricePublicObjectDelete = startupConfig.GetInt("PricePublicObjectDelete", 4);
131 PriceParcelClaim = startupConfig.GetInt("PriceParcelClaim", 1);
132 PriceParcelClaimFactor = startupConfig.GetFloat("PriceParcelClaimFactor", 1f);
133 PriceUpload = startupConfig.GetInt("PriceUpload", 0);
134 PriceRentLight = startupConfig.GetInt("PriceRentLight", 5);
135 TeleportMinPrice = startupConfig.GetInt("TeleportMinPrice", 2);
136 TeleportPriceExponent = startupConfig.GetFloat("TeleportPriceExponent", 2f);
137 EnergyEfficiency = startupConfig.GetFloat("EnergyEfficiency", 1);
138 PriceObjectRent = startupConfig.GetFloat("PriceObjectRent", 1);
139 PriceObjectScaleFactor = startupConfig.GetFloat("PriceObjectScaleFactor", 10);
140 PriceParcelRent = startupConfig.GetInt("PriceParcelRent", 1);
141 PriceGroupCreate = startupConfig.GetInt("PriceGroupCreate", -1);
142 string EBA = startupConfig.GetString("EconomyBaseAccount", LLUUID.Zero.ToString());
143 Helpers.TryParse(EBA,out EconomyBaseAccount);
144 UserLevelPaysFees = startupConfig.GetInt("UserLevelPaysFees", -1);
145 m_stipend = startupConfig.GetInt("UserStipend", 500);
146 m_minFundsBeforeRefresh = startupConfig.GetInt("IssueStipendWhenClientIsBelowAmount", 10);
147 m_keepMoneyAcrossLogins = startupConfig.GetBoolean("KeepMoneyAcrossLogins", true);
148 }
149
150 // Send ObjectCapacity to Scene.. Which sends it to the SimStatsReporter.
151 scene.SetObjectCapacity(ObjectCapacity);
90 } 152 }
91 153
92 private void OnNewClient(IClientAPI client) 154 private void OnNewClient(IClientAPI client)
@@ -105,8 +167,11 @@ namespace OpenSim.Region.Environment.Modules
105 } 167 }
106 168
107 // Subscribe to Money messages 169 // Subscribe to Money messages
170 client.OnEconomyDataRequest += EconomyDataRequestHandler;
108 client.OnMoneyBalanceRequest += SendMoneyBalance; 171 client.OnMoneyBalanceRequest += SendMoneyBalance;
109 client.OnLogout += ClientClosed; 172 client.OnLogout += ClientClosed;
173
174
110 } 175 }
111 176
112 public void ClientClosed(LLUUID AgentID) 177 public void ClientClosed(LLUUID AgentID)
@@ -118,6 +183,16 @@ namespace OpenSim.Region.Environment.Modules
118 } 183 }
119 } 184 }
120 185
186 public void EconomyDataRequestHandler(LLUUID agentId)
187 {
188 IClientAPI user = LocateClientObject(agentId);
189
190 user.SendEconomyData(EnergyEfficiency, ObjectCapacity, ObjectCount, PriceEnergyUnit, PriceGroupCreate,
191 PriceObjectClaim, PriceObjectRent, PriceObjectScaleFactor, PriceParcelClaim, PriceParcelClaimFactor,
192 PriceParcelRent, PricePublicObjectDecay, PricePublicObjectDelete, PriceRentLight, PriceUpload,
193 TeleportMinPrice, TeleportPriceExponent);
194 }
195
121 private void MoneyTransferAction (Object osender, MoneyTransferArgs e) 196 private void MoneyTransferAction (Object osender, MoneyTransferArgs e)
122 { 197 {
123 IClientAPI sender = null; 198 IClientAPI sender = null;
@@ -150,6 +225,22 @@ namespace OpenSim.Region.Environment.Modules
150 } 225 }
151 } 226 }
152 227
228 private void NewInventoryItemEconomyHandler(LLUUID Uploader, LLUUID AssetID, String AssetName, int userlevel)
229 {
230 // Presumably a normal grid would actually send this information to a server somewhere.
231 // We're going to apply the UploadCost here.
232 if (m_enabled)
233 {
234 // Only make users that are below the UserLevelPaysFees value pay.
235 // Use this to exclude Region Owners (2), Estate Managers(1), Users (0), Disabled(-1)
236 if (PriceUpload > 0 && userlevel <= UserLevelPaysFees)
237 {
238 doMoneyTranfer(Uploader, EconomyBaseAccount, PriceUpload);
239 }
240 }
241
242 }
243
153 private bool doMoneyTranfer(LLUUID Sender, LLUUID Receiver, int amount) 244 private bool doMoneyTranfer(LLUUID Sender, LLUUID Receiver, int amount)
154 { 245 {
155 bool result = false; 246 bool result = false;