From e21886eea0a4d2782a74bb1f974b2e1056fea055 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Mon, 14 Apr 2008 17:13:38 +0000 Subject: * 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. --- .../Modules/LandManagement/LandChannel.cs | 89 +++++++++++++++++++++- .../Modules/LandManagement/LandManagementModule.cs | 33 +++++++- .../Modules/LandManagement/LandObject.cs | 18 ++++- 3 files changed, 136 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/LandManagement') diff --git a/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs b/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs index ba5a098..a46895e 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 614929b..6b2de47 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 46ddf38..161434e 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) { -- cgit v1.1