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.
This commit is contained in:
Melanie Thielker
2008-08-24 00:51:21 +00:00
parent 89f2148f56
commit 63b6ab467a
7 changed files with 125 additions and 5 deletions

View File

@@ -354,6 +354,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
client.OnEconomyDataRequest += EconomyDataRequestHandler;
client.OnMoneyBalanceRequest += SendMoneyBalance;
client.OnRequestPayPrice += requestPayPrice;
client.OnObjectBuy += ObjectBuy;
client.OnLogout += ClientClosed;
}
@@ -1554,6 +1555,40 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
}
#endregion
public void ObjectBuy(IClientAPI remoteClient, LLUUID agentID,
LLUUID sessionID, LLUUID groupID, LLUUID categoryID,
uint localID, byte saleType, int salePrice)
{
GetClientFunds(remoteClient);
if (!m_KnownClientFunds.ContainsKey(remoteClient.AgentId))
{
remoteClient.SendAgentAlertMessage("Unable to buy now. Your account balance was not found.", false);
return;
}
int funds = m_KnownClientFunds[remoteClient.AgentId];
if(salePrice != 0 && funds < salePrice)
{
remoteClient.SendAgentAlertMessage("Unable to buy now. You don't have sufficient funds.", false);
return;
}
Scene s = LocateSceneClientIn(remoteClient.AgentId);
SceneObjectPart part = s.GetSceneObjectPart(localID);
if (part == null)
{
remoteClient.SendAgentAlertMessage("Unable to buy now. The object was not found.", false);
return;
}
bool transactionresult = doMoneyTransfer(remoteClient.AgentId, part.OwnerID, salePrice, 5000, "Object buy");
s.PerformObjectBuy(remoteClient, categoryID, localID, saleType);
}
}
public enum TransactionType : int

View File

@@ -274,6 +274,9 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event ScriptAnswer OnScriptAnswer;
public event RequestPayPrice OnRequestPayPrice;
public event ObjectSaleInfo OnObjectSaleInfo;
public event ObjectBuy OnObjectBuy;
public event BuyObjectInventory OnBuyObjectInventory;
public event AgentSit OnUndo;
public event ForceReleaseControls OnForceReleaseControls;
@@ -695,7 +698,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
LLUUID GroupUUID, short InventorySerial, LLUUID LastOwnerUUID, LLUUID ObjectUUID,
LLUUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName,
string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask,
uint BaseMask)
uint BaseMask, byte saleType, int salePrice)
{
}