diff options
author | Melanie Thielker | 2008-08-24 00:51:21 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-08-24 00:51:21 +0000 |
commit | 63b6ab467a2d617b180284861baba544cac602d2 (patch) | |
tree | 87f6589c04dd0340abffe61c5483c899ecc3cf0f /OpenSim/Region/Environment/Modules | |
parent | Mantis#2036. Thank you kindly, HomerHorwitz for a patch that: (diff) | |
download | opensim-SC_OLD-63b6ab467a2d617b180284861baba544cac602d2.zip opensim-SC_OLD-63b6ab467a2d617b180284861baba544cac602d2.tar.gz opensim-SC_OLD-63b6ab467a2d617b180284861baba544cac602d2.tar.bz2 opensim-SC_OLD-63b6ab467a2d617b180284861baba544cac602d2.tar.xz |
Implements 80% of object buy (prim vendor). You can't buy the object yet,
and the for sale setting doesn't survive a sim restart, but this is most
of the plumbing.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs | 35 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | 5 |
2 files changed, 39 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs index 4a6828c..2795358 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs | |||
@@ -354,6 +354,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney | |||
354 | client.OnEconomyDataRequest += EconomyDataRequestHandler; | 354 | client.OnEconomyDataRequest += EconomyDataRequestHandler; |
355 | client.OnMoneyBalanceRequest += SendMoneyBalance; | 355 | client.OnMoneyBalanceRequest += SendMoneyBalance; |
356 | client.OnRequestPayPrice += requestPayPrice; | 356 | client.OnRequestPayPrice += requestPayPrice; |
357 | client.OnObjectBuy += ObjectBuy; | ||
357 | client.OnLogout += ClientClosed; | 358 | client.OnLogout += ClientClosed; |
358 | } | 359 | } |
359 | 360 | ||
@@ -1554,6 +1555,40 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney | |||
1554 | } | 1555 | } |
1555 | 1556 | ||
1556 | #endregion | 1557 | #endregion |
1558 | |||
1559 | public void ObjectBuy(IClientAPI remoteClient, LLUUID agentID, | ||
1560 | LLUUID sessionID, LLUUID groupID, LLUUID categoryID, | ||
1561 | uint localID, byte saleType, int salePrice) | ||
1562 | { | ||
1563 | GetClientFunds(remoteClient); | ||
1564 | |||
1565 | if (!m_KnownClientFunds.ContainsKey(remoteClient.AgentId)) | ||
1566 | { | ||
1567 | remoteClient.SendAgentAlertMessage("Unable to buy now. Your account balance was not found.", false); | ||
1568 | return; | ||
1569 | } | ||
1570 | |||
1571 | int funds = m_KnownClientFunds[remoteClient.AgentId]; | ||
1572 | |||
1573 | if(salePrice != 0 && funds < salePrice) | ||
1574 | { | ||
1575 | remoteClient.SendAgentAlertMessage("Unable to buy now. You don't have sufficient funds.", false); | ||
1576 | return; | ||
1577 | } | ||
1578 | |||
1579 | Scene s = LocateSceneClientIn(remoteClient.AgentId); | ||
1580 | |||
1581 | SceneObjectPart part = s.GetSceneObjectPart(localID); | ||
1582 | if (part == null) | ||
1583 | { | ||
1584 | remoteClient.SendAgentAlertMessage("Unable to buy now. The object was not found.", false); | ||
1585 | return; | ||
1586 | } | ||
1587 | |||
1588 | bool transactionresult = doMoneyTransfer(remoteClient.AgentId, part.OwnerID, salePrice, 5000, "Object buy"); | ||
1589 | |||
1590 | s.PerformObjectBuy(remoteClient, categoryID, localID, saleType); | ||
1591 | } | ||
1557 | } | 1592 | } |
1558 | 1593 | ||
1559 | public enum TransactionType : int | 1594 | public enum TransactionType : int |
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 0b0f4c1..4754a04 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -274,6 +274,9 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
274 | 274 | ||
275 | public event ScriptAnswer OnScriptAnswer; | 275 | public event ScriptAnswer OnScriptAnswer; |
276 | public event RequestPayPrice OnRequestPayPrice; | 276 | public event RequestPayPrice OnRequestPayPrice; |
277 | public event ObjectSaleInfo OnObjectSaleInfo; | ||
278 | public event ObjectBuy OnObjectBuy; | ||
279 | public event BuyObjectInventory OnBuyObjectInventory; | ||
277 | public event AgentSit OnUndo; | 280 | public event AgentSit OnUndo; |
278 | 281 | ||
279 | public event ForceReleaseControls OnForceReleaseControls; | 282 | public event ForceReleaseControls OnForceReleaseControls; |
@@ -695,7 +698,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
695 | LLUUID GroupUUID, short InventorySerial, LLUUID LastOwnerUUID, LLUUID ObjectUUID, | 698 | LLUUID GroupUUID, short InventorySerial, LLUUID LastOwnerUUID, LLUUID ObjectUUID, |
696 | LLUUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName, | 699 | LLUUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName, |
697 | string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask, | 700 | string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask, |
698 | uint BaseMask) | 701 | uint BaseMask, byte saleType, int salePrice) |
699 | { | 702 | { |
700 | } | 703 | } |
701 | 704 | ||