diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/LandManagement')
3 files changed, 136 insertions, 4 deletions
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 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | using System.Text; | 30 | using System.Text; |
4 | |||
5 | using Axiom.Math; | 31 | using Axiom.Math; |
6 | using libsecondlife; | 32 | using libsecondlife; |
7 | using libsecondlife.Packets; | 33 | using libsecondlife.Packets; |
@@ -11,6 +37,8 @@ using OpenSim.Region.Environment.Scenes; | |||
11 | using OpenSim.Region.Environment.Interfaces; | 37 | using OpenSim.Region.Environment.Interfaces; |
12 | using OpenSim.Region.Physics.Manager; | 38 | using OpenSim.Region.Physics.Manager; |
13 | 39 | ||
40 | using LandBuyArgs = OpenSim.Region.Environment.Scenes.EventManager.LandBuyArgs; | ||
41 | |||
14 | namespace OpenSim.Region.Environment.Modules.LandManagement | 42 | namespace OpenSim.Region.Environment.Modules.LandManagement |
15 | { | 43 | { |
16 | public class LandChannel : ILandChannel | 44 | public class LandChannel : ILandChannel |
@@ -232,6 +260,18 @@ namespace OpenSim.Region.Environment.Modules.LandManagement | |||
232 | } | 260 | } |
233 | } | 261 | } |
234 | 262 | ||
263 | public ILandObject getLandObject(int parcelLocalID) | ||
264 | { | ||
265 | lock (landList) | ||
266 | { | ||
267 | if (landList.ContainsKey(parcelLocalID)) | ||
268 | { | ||
269 | return landList[parcelLocalID]; | ||
270 | } | ||
271 | } | ||
272 | return null; | ||
273 | } | ||
274 | |||
235 | public ILandObject getLandObject(int x, int y) | 275 | public ILandObject getLandObject(int x, int y) |
236 | { | 276 | { |
237 | if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) | 277 | 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 | |||
657 | if (landList.ContainsKey(packet.ParcelData.LocalID)) | 697 | if (landList.ContainsKey(packet.ParcelData.LocalID)) |
658 | { | 698 | { |
659 | landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); | 699 | landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); |
700 | |||
660 | } | 701 | } |
661 | } | 702 | } |
662 | 703 | ||
@@ -912,5 +953,49 @@ namespace OpenSim.Region.Environment.Modules.LandManagement | |||
912 | } | 953 | } |
913 | } | 954 | } |
914 | 955 | ||
956 | public void handleLandBuyRequest(Object o, LandBuyArgs e) | ||
957 | { | ||
958 | if (e.economyValidated && e.landValidated) | ||
959 | { | ||
960 | lock (landList) | ||
961 | { | ||
962 | if (landList.ContainsKey(e.parcelLocalID)) | ||
963 | { | ||
964 | landList[e.parcelLocalID].updateLandSold(e.agentId, e.groupId, e.groupOwned, (uint)e.transactionID, e.parcelPrice, e.parcelArea); | ||
965 | return; | ||
966 | } | ||
967 | } | ||
968 | } | ||
969 | else if (e.landValidated == false) | ||
970 | { | ||
971 | ILandObject lob = null; | ||
972 | lock (landList) | ||
973 | { | ||
974 | if (landList.ContainsKey(e.parcelLocalID)) | ||
975 | { | ||
976 | lob = landList[e.parcelLocalID]; | ||
977 | } | ||
978 | } | ||
979 | if (lob != null) | ||
980 | { | ||
981 | LLUUID AuthorizedID = lob.landData.authBuyerID; | ||
982 | int saleprice = lob.landData.salePrice; | ||
983 | LLUUID pOwnerID = lob.landData.ownerID; | ||
984 | |||
985 | bool landforsale = ((lob.landData.landFlags & (uint)(libsecondlife.Parcel.ParcelFlags.ForSale | libsecondlife.Parcel.ParcelFlags.ForSaleObjects | libsecondlife.Parcel.ParcelFlags.SellParcelObjects)) != 0); | ||
986 | if ((AuthorizedID == LLUUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale) | ||
987 | { | ||
988 | lock (e) | ||
989 | { | ||
990 | e.parcelOwnerID = pOwnerID; | ||
991 | e.landValidated = true; | ||
992 | |||
993 | } | ||
994 | |||
995 | } | ||
996 | } | ||
997 | m_scene.EventManager.TriggerValidatedLandBuy(this, e); | ||
998 | } | ||
999 | } | ||
915 | } | 1000 | } |
916 | } | 1001 | } |
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 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | using libsecondlife; | 30 | using libsecondlife; |
4 | using libsecondlife.Packets; | 31 | using libsecondlife.Packets; |
@@ -8,6 +35,8 @@ using OpenSim.Region.Environment.Scenes; | |||
8 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
9 | using Nini.Config; | 36 | using Nini.Config; |
10 | 37 | ||
38 | using LandBuyArgs = OpenSim.Region.Environment.Scenes.EventManager.LandBuyArgs; | ||
39 | |||
11 | namespace OpenSim.Region.Environment.Modules.LandManagement | 40 | namespace OpenSim.Region.Environment.Modules.LandManagement |
12 | { | 41 | { |
13 | public class LandManagementModule : IRegionModule | 42 | public class LandManagementModule : IRegionModule |
@@ -26,6 +55,8 @@ namespace OpenSim.Region.Environment.Modules.LandManagement | |||
26 | m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; | 55 | m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; |
27 | m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel); | 56 | m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel); |
28 | m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement); | 57 | m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement); |
58 | m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest; | ||
59 | m_scene.EventManager.OnValidatedLandBuy += landChannel.handleLandBuyRequest; | ||
29 | 60 | ||
30 | lock (m_scene) | 61 | lock (m_scene) |
31 | { | 62 | { |
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 | |||
256 | newData.snapshotID = packet.ParcelData.SnapshotID; | 256 | newData.snapshotID = packet.ParcelData.SnapshotID; |
257 | newData.userLocation = packet.ParcelData.UserLocation; | 257 | newData.userLocation = packet.ParcelData.UserLocation; |
258 | newData.userLookAt = packet.ParcelData.UserLookAt; | 258 | newData.userLookAt = packet.ParcelData.UserLookAt; |
259 | 259 | ||
260 | m_scene.LandChannel.updateLandObject(landData.localID, newData); | 260 | m_scene.LandChannel.updateLandObject(landData.localID, newData); |
261 | 261 | ||
262 | sendLandUpdateToAvatarsOverMe(); | 262 | sendLandUpdateToAvatarsOverMe(); |
263 | } | 263 | } |
264 | } | 264 | } |
265 | public void updateLandSold(LLUUID avatarID, LLUUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) | ||
266 | { | ||
267 | LandData newData = landData.Copy(); | ||
268 | newData.ownerID = avatarID; | ||
269 | newData.groupID = groupID; | ||
270 | newData.isGroupOwned = groupOwned; | ||
271 | //newData.auctionID = AuctionID; | ||
272 | newData.claimDate = Util.UnixTimeSinceEpoch(); | ||
273 | newData.claimPrice = claimprice; | ||
274 | newData.salePrice = 0; | ||
275 | newData.authBuyerID = LLUUID.Zero; | ||
276 | newData.landFlags &= ~(uint)(libsecondlife.Parcel.ParcelFlags.ForSale | Parcel.ParcelFlags.ForSaleObjects | Parcel.ParcelFlags.SellParcelObjects); | ||
277 | m_scene.LandChannel.updateLandObject(landData.localID, newData); | ||
278 | |||
279 | sendLandUpdateToAvatarsOverMe(); | ||
280 | } | ||
265 | 281 | ||
266 | public bool isEitherBannedOrRestricted(LLUUID avatar) | 282 | public bool isEitherBannedOrRestricted(LLUUID avatar) |
267 | { | 283 | { |