aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/LandManagement/LandChannel.cs89
1 files changed, 87 insertions, 2 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}