aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/LandManagement
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/LandManagement')
-rw-r--r--OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs89
-rw-r--r--OpenSim/Region/Environment/Modules/LandManagement/LandManagementModule.cs33
-rw-r--r--OpenSim/Region/Environment/Modules/LandManagement/LandObject.cs18
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 @@
1using 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
28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3using System.Text; 30using System.Text;
4
5using Axiom.Math; 31using Axiom.Math;
6using libsecondlife; 32using libsecondlife;
7using libsecondlife.Packets; 33using libsecondlife.Packets;
@@ -11,6 +37,8 @@ using OpenSim.Region.Environment.Scenes;
11using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
12using OpenSim.Region.Physics.Manager; 38using OpenSim.Region.Physics.Manager;
13 39
40using LandBuyArgs = OpenSim.Region.Environment.Scenes.EventManager.LandBuyArgs;
41
14namespace OpenSim.Region.Environment.Modules.LandManagement 42namespace 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 @@
1using 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
28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3using libsecondlife; 30using libsecondlife;
4using libsecondlife.Packets; 31using libsecondlife.Packets;
@@ -8,6 +35,8 @@ using OpenSim.Region.Environment.Scenes;
8using OpenSim.Region.Environment.Interfaces; 35using OpenSim.Region.Environment.Interfaces;
9using Nini.Config; 36using Nini.Config;
10 37
38using LandBuyArgs = OpenSim.Region.Environment.Scenes.EventManager.LandBuyArgs;
39
11namespace OpenSim.Region.Environment.Modules.LandManagement 40namespace 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 {