From 97db1e8af00e3ea13826a4eb28151329c45ef7f7 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 29 Apr 2008 14:12:21 +0000 Subject: Committing Dee100's balance update patch with a few bug fixes and a twist. Thanks Dee100! --- .../Environment/Modules/BetaGridLikeMoneyModule.cs | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Modules') diff --git a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs index 34f8238..3a8906e 100644 --- a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs @@ -1045,7 +1045,33 @@ namespace OpenSim.Region.Environment.Modules public bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount) { string description=String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); - return doMoneyTransfer(fromID, toID, amount, 2, description); + + bool give_result = doMoneyTransfer(fromID, toID, amount, 2, description); + + if (m_MoneyAddress.Length == 0) + BalanceUpdate(fromID, toID, give_result, description); + + return give_result; + + + } + private void BalanceUpdate(LLUUID senderID, LLUUID receiverID, bool transactionresult, string description) + { + IClientAPI sender = LocateClientObject(senderID); + IClientAPI receiver = LocateClientObject(receiverID); + + if (senderID != receiverID) + { + if (sender != null) + { + sender.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(description), GetFundsForAgentID(senderID)); + } + + if (receiver != null) + { + receiver.SendMoneyBalance(LLUUID.Random(), transactionresult, Helpers.StringToField(description), GetFundsForAgentID(receiverID)); + } + } } /// -- cgit v1.1