diff options
author | Teravus Ovares | 2008-04-10 09:36:55 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-10 09:36:55 +0000 |
commit | 06967e230f50fbeee24176f3df8cda8a067544e4 (patch) | |
tree | d824f1a8834700d12a77159159094a6524a856bb | |
parent | * Adds twist support for Cubes, Cylinders, and Prisms in the Meshmerizer (diff) | |
download | opensim-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/Framework/IClientAPI.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 75 | ||||
-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 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 9 | ||||
-rw-r--r-- | bin/OpenSim.ini.example | 50 |
9 files changed, 272 insertions, 21 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 17d9510..e081e05 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -430,6 +430,8 @@ namespace OpenSim.Framework | |||
430 | 430 | ||
431 | public delegate void ObjectPermissions(IClientAPI controller, LLUUID agentID, LLUUID sessionID, byte field, uint localId, uint mask, byte set); | 431 | public delegate void ObjectPermissions(IClientAPI controller, LLUUID agentID, LLUUID sessionID, byte field, uint localId, uint mask, byte set); |
432 | 432 | ||
433 | public delegate void EconomyDataRequest(LLUUID agentID); | ||
434 | |||
433 | public interface IClientAPI | 435 | public interface IClientAPI |
434 | { | 436 | { |
435 | event ImprovedInstantMessage OnInstantMessage; | 437 | event ImprovedInstantMessage OnInstantMessage; |
@@ -538,10 +540,12 @@ namespace OpenSim.Framework | |||
538 | 540 | ||
539 | // Financial packets | 541 | // Financial packets |
540 | event MoneyTransferRequest OnMoneyTransferRequest; | 542 | event MoneyTransferRequest OnMoneyTransferRequest; |
543 | event EconomyDataRequest OnEconomyDataRequest; | ||
541 | 544 | ||
542 | event MoneyBalanceRequest OnMoneyBalanceRequest; | 545 | event MoneyBalanceRequest OnMoneyBalanceRequest; |
543 | event UpdateAvatarProperties OnUpdateAvatarProperties; | 546 | event UpdateAvatarProperties OnUpdateAvatarProperties; |
544 | 547 | ||
548 | |||
545 | 549 | ||
546 | LLVector3 StartPos { get; set; } | 550 | LLVector3 StartPos { get; set; } |
547 | 551 | ||
@@ -647,6 +651,12 @@ namespace OpenSim.Framework | |||
647 | void SendBulkUpdateInventory(InventoryItemBase item); | 651 | void SendBulkUpdateInventory(InventoryItemBase item); |
648 | 652 | ||
649 | void SendXferPacket(ulong xferID, uint packet, byte[] data); | 653 | void SendXferPacket(ulong xferID, uint packet, byte[] data); |
654 | |||
655 | void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, | ||
656 | int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, | ||
657 | int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, | ||
658 | int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent); | ||
659 | |||
650 | void SendAvatarPickerReply(AvatarPickerReplyPacket Pack); | 660 | void SendAvatarPickerReply(AvatarPickerReplyPacket Pack); |
651 | 661 | ||
652 | void SendAgentDataUpdate(LLUUID agentid, LLUUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle); | 662 | void SendAgentDataUpdate(LLUUID agentid, LLUUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle); |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 25ea3c6..a91987f 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -214,6 +214,8 @@ namespace OpenSim.Region.ClientStack | |||
214 | private ViewerEffectEventHandler handlerViewerEffect = null; //OnViewerEffect; | 214 | private ViewerEffectEventHandler handlerViewerEffect = null; //OnViewerEffect; |
215 | private Action<IClientAPI> handlerLogout = null; //OnLogout; | 215 | private Action<IClientAPI> handlerLogout = null; //OnLogout; |
216 | private MoneyTransferRequest handlerMoneyTransferRequest = null; //OnMoneyTransferRequest; | 216 | private MoneyTransferRequest handlerMoneyTransferRequest = null; //OnMoneyTransferRequest; |
217 | private EconomyDataRequest handlerEconomoyDataRequest = null; | ||
218 | |||
217 | private UpdateVector handlerUpdatePrimSinglePosition = null; //OnUpdatePrimSinglePosition; | 219 | private UpdateVector handlerUpdatePrimSinglePosition = null; //OnUpdatePrimSinglePosition; |
218 | private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = null; //OnUpdatePrimSingleRotation; | 220 | private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = null; //OnUpdatePrimSingleRotation; |
219 | private UpdateVector handlerUpdatePrimScale = null; //OnUpdatePrimScale; | 221 | private UpdateVector handlerUpdatePrimScale = null; //OnUpdatePrimScale; |
@@ -223,6 +225,7 @@ namespace OpenSim.Region.ClientStack | |||
223 | private PacketStats handlerPacketStats = null; // OnPacketStats;# | 225 | private PacketStats handlerPacketStats = null; // OnPacketStats;# |
224 | private RequestAsset handlerRequestAsset = null; // OnRequestAsset; | 226 | private RequestAsset handlerRequestAsset = null; // OnRequestAsset; |
225 | 227 | ||
228 | |||
226 | /* Properties */ | 229 | /* Properties */ |
227 | 230 | ||
228 | public LLUUID SecureSessionId | 231 | public LLUUID SecureSessionId |
@@ -763,6 +766,7 @@ namespace OpenSim.Region.ClientStack | |||
763 | public event PacketStats OnPacketStats; | 766 | public event PacketStats OnPacketStats; |
764 | 767 | ||
765 | public event MoneyTransferRequest OnMoneyTransferRequest; | 768 | public event MoneyTransferRequest OnMoneyTransferRequest; |
769 | public event EconomyDataRequest OnEconomyDataRequest; | ||
766 | 770 | ||
767 | public event MoneyBalanceRequest OnMoneyBalanceRequest; | 771 | public event MoneyBalanceRequest OnMoneyBalanceRequest; |
768 | 772 | ||
@@ -1523,6 +1527,34 @@ namespace OpenSim.Region.ClientStack | |||
1523 | OutPacket(sendXfer, ThrottleOutPacketType.Task); | 1527 | OutPacket(sendXfer, ThrottleOutPacketType.Task); |
1524 | } | 1528 | } |
1525 | 1529 | ||
1530 | public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, | ||
1531 | int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, | ||
1532 | int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, | ||
1533 | int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent) | ||
1534 | { | ||
1535 | EconomyDataPacket economyData = (EconomyDataPacket)PacketPool.Instance.GetPacket(PacketType.EconomyData); | ||
1536 | economyData.Info.EnergyEfficiency = EnergyEfficiency; | ||
1537 | economyData.Info.ObjectCapacity = ObjectCapacity; | ||
1538 | economyData.Info.ObjectCount = ObjectCount; | ||
1539 | economyData.Info.PriceEnergyUnit = PriceEnergyUnit; | ||
1540 | economyData.Info.PriceGroupCreate = PriceGroupCreate; | ||
1541 | economyData.Info.PriceObjectClaim = PriceObjectClaim; | ||
1542 | economyData.Info.PriceObjectRent = PriceObjectRent; | ||
1543 | economyData.Info.PriceObjectScaleFactor = PriceObjectScaleFactor; | ||
1544 | economyData.Info.PriceParcelClaim = PriceParcelClaim; | ||
1545 | economyData.Info.PriceParcelClaimFactor = PriceParcelClaimFactor; | ||
1546 | economyData.Info.PriceParcelRent = PriceParcelRent; | ||
1547 | economyData.Info.PricePublicObjectDecay = PricePublicObjectDecay; | ||
1548 | economyData.Info.PricePublicObjectDelete = PricePublicObjectDelete; | ||
1549 | economyData.Info.PriceRentLight = PriceRentLight; | ||
1550 | economyData.Info.PriceUpload = PriceUpload; | ||
1551 | economyData.Info.TeleportMinPrice = TeleportMinPrice; | ||
1552 | economyData.Info.TeleportPriceExponent = TeleportPriceExponent; | ||
1553 | economyData.Header.Reliable = true; | ||
1554 | OutPacket(economyData, ThrottleOutPacketType.Unknown); | ||
1555 | |||
1556 | } | ||
1557 | |||
1526 | public void SendAvatarPickerReply(AvatarPickerReplyPacket replyPacket) | 1558 | public void SendAvatarPickerReply(AvatarPickerReplyPacket replyPacket) |
1527 | { | 1559 | { |
1528 | OutPacket(replyPacket, ThrottleOutPacketType.Task); | 1560 | OutPacket(replyPacket, ThrottleOutPacketType.Task); |
@@ -4155,17 +4187,7 @@ namespace OpenSim.Region.ClientStack | |||
4155 | 4187 | ||
4156 | #endregion | 4188 | #endregion |
4157 | 4189 | ||
4158 | case PacketType.MoneyBalanceRequest: | 4190 | |
4159 | MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack; | ||
4160 | |||
4161 | handlerMoneyBalanceRequest = OnMoneyBalanceRequest; | ||
4162 | |||
4163 | if (handlerMoneyBalanceRequest != null) | ||
4164 | { | ||
4165 | handlerMoneyBalanceRequest(this, moneybalancerequestpacket.AgentData.AgentID, moneybalancerequestpacket.AgentData.SessionID, moneybalancerequestpacket.MoneyData.TransactionID); | ||
4166 | } | ||
4167 | |||
4168 | break; | ||
4169 | case PacketType.UUIDNameRequest: | 4191 | case PacketType.UUIDNameRequest: |
4170 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; | 4192 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; |
4171 | foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) | 4193 | foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) |
@@ -4373,6 +4395,32 @@ namespace OpenSim.Region.ClientStack | |||
4373 | 4395 | ||
4374 | #endregion | 4396 | #endregion |
4375 | 4397 | ||
4398 | #region Economy/Transaction Packets | ||
4399 | |||
4400 | case PacketType.MoneyBalanceRequest: | ||
4401 | MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack; | ||
4402 | |||
4403 | handlerMoneyBalanceRequest = OnMoneyBalanceRequest; | ||
4404 | |||
4405 | if (handlerMoneyBalanceRequest != null) | ||
4406 | { | ||
4407 | handlerMoneyBalanceRequest(this, moneybalancerequestpacket.AgentData.AgentID, moneybalancerequestpacket.AgentData.SessionID, moneybalancerequestpacket.MoneyData.TransactionID); | ||
4408 | } | ||
4409 | |||
4410 | break; | ||
4411 | case PacketType.EconomyDataRequest: | ||
4412 | |||
4413 | handlerEconomoyDataRequest = OnEconomyDataRequest; | ||
4414 | if (handlerEconomoyDataRequest != null) | ||
4415 | { | ||
4416 | handlerEconomoyDataRequest(AgentId); | ||
4417 | } | ||
4418 | // TODO: handle this packet | ||
4419 | //m_log.Warn("[CLIENT]: unhandled EconomyDataRequest packet"); | ||
4420 | break; | ||
4421 | |||
4422 | #endregion | ||
4423 | |||
4376 | #region unimplemented handlers | 4424 | #region unimplemented handlers |
4377 | 4425 | ||
4378 | case PacketType.StartPingCheck: | 4426 | case PacketType.StartPingCheck: |
@@ -4422,10 +4470,7 @@ namespace OpenSim.Region.ClientStack | |||
4422 | // TODO: Don't display this one, we handle it at a lower level | 4470 | // TODO: Don't display this one, we handle it at a lower level |
4423 | //m_log.Warn("[CLIENT]: unhandled UseCircuitCode packet"); | 4471 | //m_log.Warn("[CLIENT]: unhandled UseCircuitCode packet"); |
4424 | break; | 4472 | break; |
4425 | case PacketType.EconomyDataRequest: | 4473 | |
4426 | // TODO: handle this packet | ||
4427 | m_log.Warn("[CLIENT]: unhandled EconomyDataRequest packet"); | ||
4428 | break; | ||
4429 | case PacketType.AgentHeightWidth: | 4474 | case PacketType.AgentHeightWidth: |
4430 | // TODO: handle this packet | 4475 | // TODO: handle this packet |
4431 | m_log.Warn("[CLIENT]: unhandled AgentHeightWidth packet"); | 4476 | m_log.Warn("[CLIENT]: unhandled AgentHeightWidth packet"); |
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 | } |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 9901a50..9e9b52b 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -155,6 +155,8 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
155 | public event FriendActionDelegate OnDenyFriendRequest; | 155 | public event FriendActionDelegate OnDenyFriendRequest; |
156 | public event FriendshipTermination OnTerminateFriendship; | 156 | public event FriendshipTermination OnTerminateFriendship; |
157 | public event PacketStats OnPacketStats; | 157 | public event PacketStats OnPacketStats; |
158 | |||
159 | public event EconomyDataRequest OnEconomyDataRequest; | ||
158 | public event MoneyBalanceRequest OnMoneyBalanceRequest; | 160 | public event MoneyBalanceRequest OnMoneyBalanceRequest; |
159 | public event UpdateAvatarProperties OnUpdateAvatarProperties; | 161 | public event UpdateAvatarProperties OnUpdateAvatarProperties; |
160 | 162 | ||
@@ -408,6 +410,13 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
408 | { | 410 | { |
409 | } | 411 | } |
410 | 412 | ||
413 | public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, | ||
414 | int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, | ||
415 | int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, | ||
416 | int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent) | ||
417 | { | ||
418 | |||
419 | } | ||
411 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) | 420 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) |
412 | { | 421 | { |
413 | } | 422 | } |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 42f0d30..cbf5591 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -301,3 +301,53 @@ snapshot_cache_directory = "DataSnapshot" | |||
301 | ; This semicolon-separated string serves to notify specific data services | 301 | ; This semicolon-separated string serves to notify specific data services |
302 | ; about the existence of this sim. | 302 | ; about the existence of this sim. |
303 | data_services="http://metaverseink.com/cgi-bin/register.py" | 303 | data_services="http://metaverseink.com/cgi-bin/register.py" |
304 | |||
305 | [Economy] | ||
306 | ; These economy values get used in the BetaGridLikeMoneyModule | ||
307 | |||
308 | ; 45000 is the highest value that the sim could possibly report because of protocol constraints | ||
309 | ObjectCapacity = 45000 | ||
310 | |||
311 | ; Money Unit fee to upload textures, animations etc | ||
312 | PriceUpload = 0 | ||
313 | |||
314 | ; Money Unit fee to create groups | ||
315 | PriceGroupCreate = 0 | ||
316 | |||
317 | ; This is the account Money goes to for fees. Remember, economy requires that money circulates somewhere... even if it's an upload fee | ||
318 | EconomyBaseAccount = 00000000-0000-0000-0000-000000000000 | ||
319 | |||
320 | ; This is the type of user that will pay fees. | ||
321 | ; Set this to 2 for users, estate managers and Estate Owners | ||
322 | ; Set this to 1 for Users and Estate Managers | ||
323 | ; Set this to 0 for Users only. | ||
324 | ; -1 disables | ||
325 | UserLevelPaysFees = -1 | ||
326 | |||
327 | ; Amount to give to user as a stipend | ||
328 | UserStipend = 1000 | ||
329 | |||
330 | ; When a user gets low on money units and logs off, then logs back on, issue a new stipend if they have less money units then this | ||
331 | ; amount. Be aware that the account money isn't stored anywhere so users will get a stipend if you restart the simulator | ||
332 | IssueStipendWhenClientIsBelowAmount = 10 | ||
333 | |||
334 | ; If this is true, the simulator will remember account balances until the simulator is shutdown or restarted. | ||
335 | KeepMoneyAcrossLogins = true | ||
336 | |||
337 | ; We don't really know what the rest of these values do. These get sent to the client | ||
338 | ; These taken from Agni at a Public Telehub. Change at your own risk. | ||
339 | ObjectCount = 0 | ||
340 | PriceEnergyUnit = 100 | ||
341 | PriceObjectClaim = 10 | ||
342 | PricePublicObjectDecay = 4 | ||
343 | PricePublicObjectDelete = 4 | ||
344 | PriceParcelClaim = 1 | ||
345 | PriceParcelClaimFactor = 1 | ||
346 | |||
347 | PriceRentLight = 5 | ||
348 | TeleportMinPrice = 2 | ||
349 | TeleportPriceExponent = 2 | ||
350 | EnergyEfficiency = 1 | ||
351 | PriceObjectRent = 1 | ||
352 | PriceObjectScaleFactor = 10 | ||
353 | PriceParcelRent = 1 \ No newline at end of file | ||