diff options
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs | 101 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneEvents.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 9 |
5 files changed, 143 insertions, 6 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; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index bc8fb59..97d09aa 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -73,6 +73,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
73 | { | 73 | { |
74 | userInfo.AddItem(remoteClient.AgentId, item); | 74 | userInfo.AddItem(remoteClient.AgentId, item); |
75 | remoteClient.SendInventoryItemCreateUpdate(item); | 75 | remoteClient.SendInventoryItemCreateUpdate(item); |
76 | |||
77 | int userlevel = 0; | ||
78 | if (PermissionsMngr.IsEstateManager(remoteClient.AgentId)) | ||
79 | { | ||
80 | userlevel = 1; | ||
81 | } | ||
82 | if (m_regInfo.MasterAvatarAssignedUUID == remoteClient.AgentId) | ||
83 | { | ||
84 | userlevel = 2; | ||
85 | } | ||
86 | EventManager.TriggerOnNewInventoryItemUploadComplete(remoteClient.AgentId, item.AssetID, item.Name, userlevel); | ||
76 | } | 87 | } |
77 | } | 88 | } |
78 | 89 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 8f4c332..4a57c5d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -219,6 +219,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
219 | set { m_innerScene.RestorePresences = value; } | 219 | set { m_innerScene.RestorePresences = value; } |
220 | } | 220 | } |
221 | 221 | ||
222 | public int objectCapacity = 45000; | ||
223 | |||
222 | #endregion | 224 | #endregion |
223 | 225 | ||
224 | #region Constructors | 226 | #region Constructors |
@@ -299,6 +301,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
299 | 301 | ||
300 | m_statsReporter = new SimStatsReporter(regInfo); | 302 | m_statsReporter = new SimStatsReporter(regInfo); |
301 | m_statsReporter.OnSendStatsResult += SendSimStatsPackets; | 303 | m_statsReporter.OnSendStatsResult += SendSimStatsPackets; |
304 | |||
305 | m_statsReporter.SetObjectCapacity(objectCapacity); | ||
306 | |||
302 | string OSString = ""; | 307 | string OSString = ""; |
303 | 308 | ||
304 | if (System.Environment.OSVersion.Platform != PlatformID.Unix) | 309 | if (System.Environment.OSVersion.Platform != PlatformID.Unix) |
@@ -2016,6 +2021,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
2016 | } | 2021 | } |
2017 | } | 2022 | } |
2018 | 2023 | ||
2024 | public void SetObjectCapacity(int objects) | ||
2025 | { | ||
2026 | if (m_statsReporter != null) | ||
2027 | { | ||
2028 | m_statsReporter.SetObjectCapacity(objects); | ||
2029 | } | ||
2030 | objectCapacity = objects; | ||
2031 | } | ||
2032 | |||
2019 | #endregion | 2033 | #endregion |
2020 | 2034 | ||
2021 | #region Other Methods | 2035 | #region Other Methods |
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index c916009..02c9f3f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
@@ -137,6 +137,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
137 | 137 | ||
138 | public event OnNewPresenceDelegate OnMakeChildAgent; | 138 | public event OnNewPresenceDelegate OnMakeChildAgent; |
139 | 139 | ||
140 | public delegate void NewInventoryItemUploadComplete(LLUUID avatarID, LLUUID assetID, string name, int userlevel); | ||
141 | |||
142 | public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; | ||
143 | |||
140 | /// <summary> | 144 | /// <summary> |
141 | /// RegisterCapsEvent is called by Scene after the Caps object | 145 | /// RegisterCapsEvent is called by Scene after the Caps object |
142 | /// has been instantiated and before it is return to the | 146 | /// has been instantiated and before it is return to the |
@@ -207,6 +211,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
207 | private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick; | 211 | private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick; |
208 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; | 212 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; |
209 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; | 213 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; |
214 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; | ||
210 | 215 | ||
211 | public void TriggerOnScriptChangedEvent(uint localID, uint change) | 216 | public void TriggerOnScriptChangedEvent(uint localID, uint change) |
212 | { | 217 | { |
@@ -462,5 +467,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
462 | handlerDeregisterCaps(agentID, caps); | 467 | handlerDeregisterCaps(agentID, caps); |
463 | } | 468 | } |
464 | } | 469 | } |
470 | |||
471 | public void TriggerOnNewInventoryItemUploadComplete(LLUUID agentID, LLUUID AssetID, String AssetName, int userlevel) | ||
472 | { | ||
473 | handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete; | ||
474 | if (handlerNewInventoryItemUpdateComplete != null) | ||
475 | { | ||
476 | handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel); | ||
477 | } | ||
478 | } | ||
465 | } | 479 | } |
466 | } | 480 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index ef741d4..d72bee0 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | |||
@@ -100,6 +100,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
100 | private int m_pendingUploads = 0; | 100 | private int m_pendingUploads = 0; |
101 | private int m_activeScripts = 0; | 101 | private int m_activeScripts = 0; |
102 | private int m_scriptLinesPerSecond = 0; | 102 | private int m_scriptLinesPerSecond = 0; |
103 | |||
104 | private int objectCapacity = 45000; | ||
103 | 105 | ||
104 | 106 | ||
105 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21]; | 107 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21]; |
@@ -152,7 +154,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
152 | { | 154 | { |
153 | statpack.Region.RegionFlags = (uint) 0; | 155 | statpack.Region.RegionFlags = (uint) 0; |
154 | } | 156 | } |
155 | statpack.Region.ObjectCapacity = (uint) 45000; | 157 | statpack.Region.ObjectCapacity = (uint) objectCapacity; |
156 | 158 | ||
157 | #region various statistic googly moogly | 159 | #region various statistic googly moogly |
158 | 160 | ||
@@ -389,6 +391,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
389 | m_activeScripts = count; | 391 | m_activeScripts = count; |
390 | } | 392 | } |
391 | 393 | ||
394 | public void SetObjectCapacity(int objects) | ||
395 | { | ||
396 | objectCapacity = objects; | ||
397 | } | ||
398 | |||
392 | #endregion | 399 | #endregion |
393 | } | 400 | } |
394 | } | 401 | } |