aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-24 00:51:21 +0000
committerMelanie Thielker2008-08-24 00:51:21 +0000
commit63b6ab467a2d617b180284861baba544cac602d2 (patch)
tree87f6589c04dd0340abffe61c5483c899ecc3cf0f /OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney
parentMantis#2036. Thank you kindly, HomerHorwitz for a patch that: (diff)
downloadopensim-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 'OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs35
1 files changed, 35 insertions, 0 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