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 | |
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 'OpenSim/Region/Environment')
4 files changed, 66 insertions, 2 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 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 3bae463..c44a714 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2153,6 +2153,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2153 | client.OnUndo += m_innerScene.HandleUndo; | 2153 | client.OnUndo += m_innerScene.HandleUndo; |
2154 | client.OnObjectGroupRequest += m_innerScene.HandleObjectGroupUpdate; | 2154 | client.OnObjectGroupRequest += m_innerScene.HandleObjectGroupUpdate; |
2155 | client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; | 2155 | client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; |
2156 | client.OnObjectSaleInfo += ObjectSaleInfo; | ||
2156 | client.OnScriptReset += ProcessScriptReset; | 2157 | client.OnScriptReset += ProcessScriptReset; |
2157 | client.OnGetScriptRunning += GetScriptRunning; | 2158 | client.OnGetScriptRunning += GetScriptRunning; |
2158 | client.OnSetScriptRunning += SetScriptRunning; | 2159 | client.OnSetScriptRunning += SetScriptRunning; |
@@ -3924,5 +3925,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
3924 | 3925 | ||
3925 | return inv.NeedSceneCacheClear(agentID, this); | 3926 | return inv.NeedSceneCacheClear(agentID, this); |
3926 | } | 3927 | } |
3928 | |||
3929 | public void ObjectSaleInfo(IClientAPI client, LLUUID agentID, LLUUID sessionID, uint localID, byte saleType, int salePrice) | ||
3930 | { | ||
3931 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
3932 | if(part == null || part.ParentGroup == null) | ||
3933 | return; | ||
3934 | |||
3935 | if(part.ParentGroup.RootPart == null) | ||
3936 | return; | ||
3937 | |||
3938 | part = part.ParentGroup.RootPart; | ||
3939 | |||
3940 | part.ObjectSaleType = saleType; | ||
3941 | part.SalePrice = salePrice; | ||
3942 | |||
3943 | m_log.DebugFormat("[SCENE] Set sale data of object {0} to {1} ${2}", part.UUID, saleType, salePrice); | ||
3944 | part.GetProperties(client); | ||
3945 | } | ||
3946 | |||
3947 | public void PerformObjectBuy(IClientAPI remoteClient, LLUUID categoryID, | ||
3948 | uint localID, byte saleType) | ||
3949 | { | ||
3950 | } | ||
3927 | } | 3951 | } |
3928 | } | 3952 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 517114f..927791f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1500,7 +1500,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1500 | _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, | 1500 | _groupID, (short)InventorySerial, _lastOwnerID, UUID, _ownerID, |
1501 | ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, | 1501 | ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, |
1502 | ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, | 1502 | ParentGroup.RootPart._ownerMask, ParentGroup.RootPart._nextOwnerMask, ParentGroup.RootPart._groupMask, ParentGroup.RootPart._everyoneMask, |
1503 | ParentGroup.RootPart._baseMask); | 1503 | ParentGroup.RootPart._baseMask, |
1504 | ParentGroup.RootPart.ObjectSaleType, | ||
1505 | ParentGroup.RootPart.SalePrice); | ||
1504 | } | 1506 | } |
1505 | 1507 | ||
1506 | public LLUUID GetRootPartUUID() | 1508 | public LLUUID GetRootPartUUID() |