From e21886eea0a4d2782a74bb1f974b2e1056fea055 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Mon, 14 Apr 2008 17:13:38 +0000 Subject: [PATCH] * Fixed a few warnings. * Added license info to a few files it was missing from. * Fleshed out the landbuy interfaces * If you add '-helperuri http://127.0.0.1:9000/' to your list of parameters you tell the client to use when you start it up you can transfer ownership of parcels now in standalone. Structured gridmode requires a lot more work, see the documentation in the example money module. The example money module is not secure especially in standalone mode. --- .../Framework/Communications/XMPP/Stanza.cs | 6 +- OpenSim/Framework/IClientAPI.cs | 4 + OpenSim/Region/ClientStack/ClientView.cs | 25 +++++ .../Environment/Interfaces/ILandObject.cs | 1 + .../Modules/BetaGridLikeMoneyModule.cs | 106 ++++++++++++++++++ .../Modules/LandManagement/LandChannel.cs | 89 ++++++++++++++- .../LandManagement/LandManagementModule.cs | 33 +++++- .../Modules/LandManagement/LandObject.cs | 18 ++- .../Scenes/Scene.PacketHandlers.cs | 9 ++ OpenSim/Region/Environment/Scenes/Scene.cs | 5 +- .../Region/Environment/Scenes/SceneEvents.cs | 60 +++++++++- .../Examples/SimpleModule/MyNpcCharacter.cs | 1 + 12 files changed, 347 insertions(+), 10 deletions(-) diff --git a/OpenSim/Framework/Communications/XMPP/Stanza.cs b/OpenSim/Framework/Communications/XMPP/Stanza.cs index 4c5711405d..ed6ef0618e 100644 --- a/OpenSim/Framework/Communications/XMPP/Stanza.cs +++ b/OpenSim/Framework/Communications/XMPP/Stanza.cs @@ -11,9 +11,9 @@ namespace OpenSim.Framework.Communications.XMPP public string localName = String.Empty; public JId to; public JId from; - string id; - string lang; - string nodeName; + public string id; + public string lang; + public string nodeName; public Stanza(XmlNode node, Object defaults, bool hasID) { diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index e081e059ce..cd59fa0139 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -424,6 +424,9 @@ namespace OpenSim.Framework public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes); public delegate void MoneyTransferRequest(LLUUID sourceID, LLUUID destID, int amount, int transactionType, string description); + + public delegate void ParcelBuy(LLUUID agentId, LLUUID groupId, bool final, bool groupOwned, + bool removeContribution, int parcelLocalID, int parcelArea, int parcelPrice, bool authenticated); // We keep all this information for fraud purposes in the future. public delegate void MoneyBalanceRequest(IClientAPI remoteClient, LLUUID agentID, LLUUID sessionID, LLUUID TransactionID); @@ -544,6 +547,7 @@ namespace OpenSim.Framework event MoneyBalanceRequest OnMoneyBalanceRequest; event UpdateAvatarProperties OnUpdateAvatarProperties; + event ParcelBuy OnParcelBuy; diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 9fe21443f7..25994563f6 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -214,6 +214,7 @@ namespace OpenSim.Region.ClientStack private ViewerEffectEventHandler handlerViewerEffect = null; //OnViewerEffect; private Action handlerLogout = null; //OnLogout; private MoneyTransferRequest handlerMoneyTransferRequest = null; //OnMoneyTransferRequest; + private ParcelBuy handlerParcelBuy = null; private EconomyDataRequest handlerEconomoyDataRequest = null; private UpdateVector handlerUpdatePrimSinglePosition = null; //OnUpdatePrimSinglePosition; @@ -769,6 +770,7 @@ namespace OpenSim.Region.ClientStack public event EconomyDataRequest OnEconomyDataRequest; public event MoneyBalanceRequest OnMoneyBalanceRequest; + public event ParcelBuy OnParcelBuy; #region Scene/Avatar to Client @@ -2396,6 +2398,7 @@ namespace OpenSim.Region.ClientStack AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest); + AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest); } private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack) @@ -2420,6 +2423,28 @@ namespace OpenSim.Region.ClientStack } } + private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack) + { + ParcelBuyPacket parcel = (ParcelBuyPacket)Pack; + if (parcel.AgentData.AgentID == AgentId && parcel.AgentData.SessionID == this.SessionId) + { + handlerParcelBuy = OnParcelBuy; + if (handlerParcelBuy != null) + { + handlerParcelBuy(parcel.AgentData.AgentID, parcel.Data.GroupID, parcel.Data.Final, parcel.Data.IsGroupOwned, + parcel.Data.RemoveContribution, parcel.Data.LocalID, parcel.ParcelData.Area, parcel.ParcelData.Price, + false); + } + return true; + + } + else + { + return false; + } + + } + private bool HandleViewerEffect(IClientAPI sender, Packet Pack) { ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; diff --git a/OpenSim/Region/Environment/Interfaces/ILandObject.cs b/OpenSim/Region/Environment/Interfaces/ILandObject.cs index 61d86705d9..779db018e0 100644 --- a/OpenSim/Region/Environment/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Environment/Interfaces/ILandObject.cs @@ -48,6 +48,7 @@ namespace OpenSim.Region.Environment.Interfaces void resetLandPrimCounts(); void addPrimToCount(SceneObjectGroup obj); void removePrimFromCount(SceneObjectGroup obj); + void updateLandSold(LLUUID avatarID, LLUUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); } diff --git a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs index aabb2d111f..d950af9143 100644 --- a/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/BetaGridLikeMoneyModule.cs @@ -39,12 +39,20 @@ using OpenSim.Region.Environment.Scenes; using Nwc.XmlRpc; using MoneyTransferArgs = OpenSim.Region.Environment.Scenes.EventManager.MoneyTransferArgs; +using LandBuyArgs = OpenSim.Region.Environment.Scenes.EventManager.LandBuyArgs; namespace OpenSim.Region.Environment.Modules { /// /// Demo Economy/Money Module. This is not a production quality money/economy module! /// This is a demo for you to use when making one that works for you. + /// // To use the following you need to add: + /// -helperuri
+ /// to the command line parameters you use to start up your client + /// This commonly looks like -helperuri http://127.0.0.1:9000/ + /// + /// Centralized grid structure example using OpenSimWi Redux revision 9+ + /// svn co https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux ///
public class BetaGridLikeMoneyModule: IRegionModule { @@ -134,6 +142,7 @@ namespace OpenSim.Region.Environment.Modules if (m_MoneyAddress.Length > 0) { // Centralized grid structure using OpenSimWi Redux revision 9+ + // https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux scene.AddXmlRPCHandler("dynamic_balance_update_request", GridMoneyUpdate); } else @@ -165,6 +174,8 @@ namespace OpenSim.Region.Environment.Modules scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; scene.EventManager.OnMakeChildAgent += MakeChildAgent; scene.EventManager.OnClientClosed += ClientLoggedOut; + scene.EventManager.OnLandBuy += ValidateLandBuy; + scene.EventManager.OnValidatedLandBuy += processLandBuy; } } @@ -329,6 +340,101 @@ namespace OpenSim.Region.Environment.Modules } } + private void ValidateLandBuy (Object osender, LandBuyArgs e) + { + LLUUID agentId = e.agentId; + int price = e.parcelPrice; + bool final = e.final; + + int funds = 0; + + if (m_MoneyAddress.Length > 0) + { + IClientAPI aClient = LocateClientObject(agentId); + if (aClient != null) + { + Scene s = LocateSceneClientIn(agentId); + if (s != null) + { + Hashtable hbinfo = GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(), s.RegionInfo.regionSecret); + if ((bool)hbinfo["success"] == true) + { + + Helpers.TryParse((string)hbinfo["agentId"], out agentId); + try + { + funds = (Int32)hbinfo["funds"]; + } + catch (ArgumentException) + { + } + catch (FormatException) + { + } + catch (OverflowException) + { + m_log.ErrorFormat("[MONEY]: While getting the Currency for user {0}, the return funds overflowed.", agentId); + aClient.SendAlertMessage("Unable to get your money balance, money operations will be unavailable"); + } + catch (InvalidCastException) + { + funds = 0; + } + + SetLocalFundsForAgentID(agentId, funds); + + } + else + { + m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId, (string)hbinfo["errorMessage"]); + aClient.SendAlertMessage((string)hbinfo["errorMessage"]); + } + } + } + } + else + { + funds = GetFundsForAgentID(agentId); + } + if (funds >= e.parcelPrice) + { + lock (e) + { + e.economyValidated = true; + } + XMLRPCHandler.EventManager.TriggerValidatedLandBuy(this, e); + } + } + + private void processLandBuy(Object osender, LandBuyArgs e) + { + LLUUID agentId = e.agentId; + int price = e.parcelPrice; + bool final = e.final; + + int funds = 0; + + // Only do this if we have not already transacted against this. + if (e.transactionID == 0) + { + funds = GetFundsForAgentID(e.agentId); + if (e.landValidated) + { + if (e.parcelPrice >= 0) + { + doMoneyTranfer(agentId, e.parcelOwnerID, e.parcelPrice); + lock (e) + { + e.transactionID = Util.UnixTimeSinceEpoch(); + e.amountDebited = e.parcelPrice; + } + } + // This tells the land module that we've transacted. + XMLRPCHandler.EventManager.TriggerValidatedLandBuy(this, e); + } + } + + } /// /// THis method gets called when someone pays someone else as a gift. /// diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs index ba5a098a8f..a46895e0c9 100644 --- a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs @@ -1,7 +1,33 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using System.Text; - using Axiom.Math; using libsecondlife; using libsecondlife.Packets; @@ -11,6 +37,8 @@ using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Physics.Manager; +using LandBuyArgs = OpenSim.Region.Environment.Scenes.EventManager.LandBuyArgs; + namespace OpenSim.Region.Environment.Modules.LandManagement { public class LandChannel : ILandChannel @@ -232,6 +260,18 @@ namespace OpenSim.Region.Environment.Modules.LandManagement } } + public ILandObject getLandObject(int parcelLocalID) + { + lock (landList) + { + if (landList.ContainsKey(parcelLocalID)) + { + return landList[parcelLocalID]; + } + } + return null; + } + public ILandObject getLandObject(int x, int y) { if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) @@ -657,6 +697,7 @@ namespace OpenSim.Region.Environment.Modules.LandManagement if (landList.ContainsKey(packet.ParcelData.LocalID)) { landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); + } } @@ -912,5 +953,49 @@ namespace OpenSim.Region.Environment.Modules.LandManagement } } + public void handleLandBuyRequest(Object o, LandBuyArgs e) + { + if (e.economyValidated && e.landValidated) + { + lock (landList) + { + if (landList.ContainsKey(e.parcelLocalID)) + { + landList[e.parcelLocalID].updateLandSold(e.agentId, e.groupId, e.groupOwned, (uint)e.transactionID, e.parcelPrice, e.parcelArea); + return; + } + } + } + else if (e.landValidated == false) + { + ILandObject lob = null; + lock (landList) + { + if (landList.ContainsKey(e.parcelLocalID)) + { + lob = landList[e.parcelLocalID]; + } + } + if (lob != null) + { + LLUUID AuthorizedID = lob.landData.authBuyerID; + int saleprice = lob.landData.salePrice; + LLUUID pOwnerID = lob.landData.ownerID; + + bool landforsale = ((lob.landData.landFlags & (uint)(libsecondlife.Parcel.ParcelFlags.ForSale | libsecondlife.Parcel.ParcelFlags.ForSaleObjects | libsecondlife.Parcel.ParcelFlags.SellParcelObjects)) != 0); + if ((AuthorizedID == LLUUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale) + { + lock (e) + { + e.parcelOwnerID = pOwnerID; + e.landValidated = true; + + } + + } + } + m_scene.EventManager.TriggerValidatedLandBuy(this, e); + } + } } } diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs index 614929b0dc..6b2de47e85 100644 --- a/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; @@ -8,6 +35,8 @@ using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Interfaces; using Nini.Config; +using LandBuyArgs = OpenSim.Region.Environment.Scenes.EventManager.LandBuyArgs; + namespace OpenSim.Region.Environment.Modules.LandManagement { public class LandManagementModule : IRegionModule @@ -26,6 +55,8 @@ namespace OpenSim.Region.Environment.Modules.LandManagement m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel); m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement); + m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest; + m_scene.EventManager.OnValidatedLandBuy += landChannel.handleLandBuyRequest; lock (m_scene) { diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs index 46ddf38ca0..161434e110 100644 --- a/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs @@ -256,12 +256,28 @@ namespace OpenSim.Region.Environment.Modules.LandManagement newData.snapshotID = packet.ParcelData.SnapshotID; newData.userLocation = packet.ParcelData.UserLocation; newData.userLookAt = packet.ParcelData.UserLookAt; - + m_scene.LandChannel.updateLandObject(landData.localID, newData); sendLandUpdateToAvatarsOverMe(); } } + public void updateLandSold(LLUUID avatarID, LLUUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) + { + LandData newData = landData.Copy(); + newData.ownerID = avatarID; + newData.groupID = groupID; + newData.isGroupOwned = groupOwned; + //newData.auctionID = AuctionID; + newData.claimDate = Util.UnixTimeSinceEpoch(); + newData.claimPrice = claimprice; + newData.salePrice = 0; + newData.authBuyerID = LLUUID.Zero; + newData.landFlags &= ~(uint)(libsecondlife.Parcel.ParcelFlags.ForSale | Parcel.ParcelFlags.ForSaleObjects | Parcel.ParcelFlags.SellParcelObjects); + m_scene.LandChannel.updateLandObject(landData.localID, newData); + + sendLandUpdateToAvatarsOverMe(); + } public bool isEitherBannedOrRestricted(LLUUID avatar) { diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index ebdb0a6319..1c36853a4f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -130,6 +130,15 @@ namespace OpenSim.Region.Environment.Scenes EventManager.TriggerMoneyTransfer(this, args); } + public virtual void ProcessParcelBuy(LLUUID agentId, LLUUID groupId, bool final, bool groupOwned, + bool removeContribution, int parcelLocalID, int parcelArea, int parcelPrice, bool authenticated) + { + EventManager.LandBuyArgs args = new EventManager.LandBuyArgs( + agentId, groupId, final, groupOwned, removeContribution, parcelLocalID, parcelArea, parcelPrice, authenticated); + + m_eventManager.TriggerLandBuy(this, args); + } + public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) { diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f15ec435fa..410120f6f8 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1001,8 +1001,8 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 RayEnd = new LLVector3(0, 0, 0); LLVector3 RayStart = new LLVector3(0, 0, 0); LLVector3 direction = new LLVector3(0, 0, -1); - Vector3 AXOrigin = new Vector3(); - Vector3 AXdirection = new Vector3(); + //Vector3 AXOrigin = new Vector3(); + //Vector3 AXdirection = new Vector3(); Ray testRay = new Ray(); EntityIntersection rt = new EntityIntersection(); @@ -1573,6 +1573,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnGrabObject += ProcessObjectGrab; client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; + client.OnParcelBuy += ProcessParcelBuy; client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; client.OnPacketStats += AddPacketStats; diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 02c9f3f165..67edf6b40d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs @@ -176,10 +176,50 @@ namespace OpenSim.Region.Environment.Scenes } } + public class LandBuyArgs : System.EventArgs + { + public LLUUID agentId = LLUUID.Zero; + + public LLUUID groupId = LLUUID.Zero; + + public LLUUID parcelOwnerID = LLUUID.Zero; + + public bool final = false; + public bool groupOwned = false; + public bool removeContribution = false; + public int parcelLocalID = 0; + public int parcelArea = 0; + public int parcelPrice = 0; + public bool authenticated = false; + public bool landValidated = false; + public bool economyValidated = false; + public int transactionID = 0; + public int amountDebited = 0; + + + public LandBuyArgs(LLUUID pagentId, LLUUID pgroupId, bool pfinal, bool pgroupOwned, + bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice, + bool pauthenticated) + { + agentId = pagentId; + groupId = pgroupId; + final = pfinal; + groupOwned = pgroupOwned; + removeContribution = premoveContribution; + parcelLocalID = pparcelLocalID; + parcelArea = pparcelArea; + parcelPrice = pparcelPrice; + authenticated = pauthenticated; + } + } + public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e); - public event MoneyTransferEvent OnMoneyTransfer; + public delegate void LandBuy(Object sender, LandBuyArgs e); + public event MoneyTransferEvent OnMoneyTransfer; + public event LandBuy OnLandBuy; + public event LandBuy OnValidatedLandBuy; /* Designated Event Deletage Instances */ @@ -212,6 +252,8 @@ namespace OpenSim.Region.Environment.Scenes private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; + private LandBuy handlerLandBuy = null; + private LandBuy handlerValidatedLandBuy = null; public void TriggerOnScriptChangedEvent(uint localID, uint change) { @@ -476,5 +518,21 @@ namespace OpenSim.Region.Environment.Scenes handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel); } } + public void TriggerLandBuy (Object sender, LandBuyArgs e) + { + handlerLandBuy = OnLandBuy; + if (handlerLandBuy != null) + { + handlerLandBuy(sender, e); + } + } + public void TriggerValidatedLandBuy(Object sender, LandBuyArgs e) + { + handlerValidatedLandBuy = OnValidatedLandBuy; + if (handlerValidatedLandBuy != null) + { + handlerValidatedLandBuy(sender, e); + } + } } } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 9e9b52bd3c..23b3015c7d 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -49,6 +49,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event ObjectPermissions OnObjectPermissions; public event MoneyTransferRequest OnMoneyTransferRequest; + public event ParcelBuy OnParcelBuy; public event Action OnConnectionClosed; public event ImprovedInstantMessage OnInstantMessage;