29 using System.Collections;
30 using System.Collections.Generic;
31 using System.Diagnostics;
32 using System.Reflection;
37 using OpenMetaverse.StructuredData;
38 using OpenMetaverse.Messages.Linden;
40 using OpenSim.Framework;
41 using OpenSim.Framework.Capabilities;
42 using OpenSim.Framework.Console;
43 using OpenSim.Framework.Servers;
44 using OpenSim.Framework.Servers.HttpServer;
45 using OpenSim.Region.Framework.Interfaces;
46 using OpenSim.Region.Framework.Scenes;
47 using OpenSim.Region.PhysicsModules.SharedBase;
48 using OpenSim.Services.Interfaces;
55 internal class ExtendedLandData
58 public ulong RegionHandle;
60 public byte RegionAccess;
63 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"LandManagementModule")]
66 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
67 private static readonly
string LogHeader =
"[LAND MANAGEMENT MODULE]";
73 public const int LandUnit = 4;
75 private static readonly
string remoteParcelRequestPath =
"0009/";
78 private Scene m_scene;
88 private int[,] m_landIDList;
96 private Dictionary<int, ILandObject> m_landList =
new Dictionary<int, ILandObject>();
98 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
100 private bool m_allowedForcefulBans =
true;
101 private bool m_showBansLines =
true;
102 private UUID DefaultGodParcelGroup;
103 private string DefaultGodParcelName;
106 private Cache parcelInfoCache;
111 private HashSet<UUID> forcedPosition =
new HashSet<UUID>();
115 private bool shouldLimitParcelLayerInfoToViewDistance {
get; set; }
117 private int parcelLayerViewDistance {
get; set; }
119 #region INonSharedRegionModule Members
121 public Type ReplaceableInterface
128 shouldLimitParcelLayerInfoToViewDistance =
true;
129 parcelLayerViewDistance = 128;
130 IConfig landManagementConfig = source.Configs[
"LandManagement"];
131 if (landManagementConfig != null)
133 shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean(
"LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance);
134 parcelLayerViewDistance = landManagementConfig.GetInt(
"ParcelLayerViewDistance", parcelLayerViewDistance);
135 DefaultGodParcelGroup =
new UUID(landManagementConfig.GetString(
"DefaultAdministratorGroupUUID",
UUID.Zero.ToString()));
136 DefaultGodParcelName = landManagementConfig.GetString(
"DefaultAdministratorParcelName",
"Default Parcel");
137 bool disablebans = landManagementConfig.GetBoolean(
"DisableParcelBans", !m_allowedForcefulBans);
138 m_allowedForcefulBans = !disablebans;
139 m_showBansLines = landManagementConfig.GetBoolean(
"ShowParcelBansLines", m_showBansLines);
146 m_landIDList =
new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
150 parcelInfoCache =
new Cache();
151 parcelInfoCache.Size = 30;
152 parcelInfoCache.DefaultTTL =
new TimeSpan(0, 5, 0);
154 m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
155 m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
156 m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
157 m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
159 m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
160 m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement;
161 m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy;
162 m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy;
163 m_scene.EventManager.OnNewClient += EventManagerOnNewClient;
164 m_scene.EventManager.OnMakeChildAgent += EventMakeChildAgent;
165 m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement;
166 m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage;
167 m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
168 m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;
169 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
182 m_groupManager = m_scene.RequestModuleInterface<
IGroupsModule>();
199 void EventManagerOnNewClient(
IClientAPI client)
202 client.OnParcelPropertiesRequest += ClientOnParcelPropertiesRequest;
203 client.OnParcelDivideRequest += ClientOnParcelDivideRequest;
204 client.OnParcelJoinRequest += ClientOnParcelJoinRequest;
205 client.OnParcelPropertiesUpdateRequest += ClientOnParcelPropertiesUpdateRequest;
206 client.OnParcelSelectObjects += ClientOnParcelSelectObjects;
207 client.OnParcelObjectOwnerRequest += ClientOnParcelObjectOwnerRequest;
208 client.OnParcelAccessListRequest += ClientOnParcelAccessListRequest;
209 client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessListUpdateRequest;
210 client.OnParcelAbandonRequest += ClientOnParcelAbandonRequest;
211 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
212 client.OnParcelReclaim += ClientOnParcelReclaim;
213 client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
214 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
215 client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
216 client.OnParcelEjectUser += ClientOnParcelEjectUser;
217 client.OnParcelFreezeUser += ClientOnParcelFreezeUser;
218 client.OnSetStartLocationRequest += ClientOnSetHome;
223 avatar.currentParcelUUID = UUID.Zero;
236 get {
return "LandManagementModule"; }
241 #region Parcel Add/Remove/Get/Create
245 AllowedForcefulBans = forceful;
251 newData.LocalID = local_id;
256 if (m_landList.TryGetValue(local_id, out land))
257 land.LandData = newData;
261 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, land);
264 public bool AllowedForcefulBans
266 get {
return m_allowedForcefulBans; }
267 set { m_allowedForcefulBans = value; }
279 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
281 m_landIDList =
new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
291 m_log.DebugFormat(
"{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName);
295 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
296 (int)m_scene.RegionInfo.RegionSizeX, (
int)m_scene.RegionInfo.RegionSizeY));
297 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
298 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
300 return AddLandObject(fullSimParcel);
307 return new List<ILandObject>(m_landList.Values);
313 List<ILandObject> parcelsNear =
new List<ILandObject>();
314 for (
int x = -8; x <= 8; x += 4)
316 for (
int y = -8; y <= 8; y += 4)
318 ILandObject check = GetLandObject(position.X + x, position.Y + y);
321 if (!parcelsNear.Contains(check))
323 parcelsNear.Add(check);
336 Vector3 agentpos = avatar.AbsolutePosition;
341 forcedPosition.Remove(avatar.UUID);
342 avatar.lastKnownAllowedPosition = agentpos;
350 reason =
"You do not have access to the parcel";
356 if ( m_allowedForcefulBans)
358 reason =
"You are banned from parcel";
363 if (forcedPosition.Contains(avatar.
UUID))
365 forcedPosition.Remove(avatar.UUID);
366 avatar.lastKnownAllowedPosition = agentpos;
373 if (!forcedPosition.Contains(avatar.
UUID))
379 agentpos.Z = h + 4.0f;
380 ForceAvatarToPosition(avatar, agentpos);
387 Vector3? pos = m_scene.GetNearestAllowedPosition(avatar);
390 forcedPosition.Remove(avatar.UUID);
391 m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient);
394 ForceAvatarToPosition(avatar, (Vector3)pos);
404 forcedPosition.Remove(avatar.UUID);
405 avatar.lastKnownAllowedPosition = agentpos;
410 private void ForceAvatarToPosition(
ScenePresence avatar, Vector3? position)
412 if (m_scene.Permissions.IsGod(avatar.
UUID))
return;
414 if (!position.HasValue)
418 avatar.ResetMoveToTarget();
419 avatar.AbsolutePosition = position.Value;
420 avatar.lastKnownAllowedPosition = position.Value;
421 avatar.Velocity = Vector3.Zero;
424 forcedPosition.Add(avatar.UUID);
429 if (m_scene.RegionInfo.RegionID == regionID)
434 parcelAvatarIsEntering = m_landList[localLandID];
437 if (parcelAvatarIsEntering != null &&
440 SendLandUpdate(avatar, parcelAvatarIsEntering);
441 avatar.currentParcelUUID = parcelAvatarIsEntering.LandData.GlobalID;
442 EnforceBans(parcelAvatarIsEntering, avatar);
458 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned,
false, (
int)ParcelResult.Single, client);
463 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList,
false, (
int)ParcelResult.Single, client);
474 if (!m_scene.TryGetScenePresence(remoteClient.
AgentId, out avatar))
477 if (!avatar.IsChildAgent)
479 ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
483 avatar.currentParcelUUID = over.LandData.GlobalID;
484 over.SendLandUpdateToClient(avatar.ControllingClient);
486 SendParcelOverlay(remoteClient);
496 over.SendLandUpdateToClient(avatar.ControllingClient);
507 if ( m_allowedForcefulBans && m_showBansLines)
520 Vector3 pos = avatar.AbsolutePosition;
524 EnforceBans(over, avatar);
525 pos = avatar.AbsolutePosition;
529 avatar.currentParcelUUID = newover.LandData.GlobalID;
530 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar,
531 newover.LandData.LocalID, m_scene.RegionInfo.RegionID);
542 m_landList.TryGetValue(landLocalID, out land);
547 land.SendAccessList(agentID, sessionID, flags, sequenceID, remote_client);
552 uint flags,
int landLocalID, UUID transactionID,
int sequenceID,
553 int sections, List<LandAccessEntry> entries,
566 m_landList.TryGetValue(landLocalID, out land);
571 GroupPowers requiredPowers = GroupPowers.LandManageAllowed;
572 if (flags == (uint)AccessList.Ban)
573 requiredPowers = GroupPowers.LandManageBanned;
575 if (m_scene.Permissions.CanEditParcelProperties(agentID,
576 land, requiredPowers,
false))
578 land.UpdateAccessList(flags, transactionID, sequenceID,
579 sections, entries, remote_client);
584 m_log.WarnFormat(
"[LAND MANAGEMENT MODULE]: Invalid local land ID {0}", landLocalID);
601 if (m_primCountModule != null)
602 new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID);
606 int newLandLocalID = m_lastLandLocalID + 1;
607 new_land.LandData.LocalID = newLandLocalID;
609 bool[,] landBitmap = new_land.GetLandBitmap();
610 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1))
613 m_log.ErrorFormat(
"{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})",
614 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1));
620 for (
int x = 0; x < landBitmap.GetLength(0); x++)
622 for (
int y = 0; y < landBitmap.GetLength(1); y++)
624 if (landBitmap[x, y])
626 int lastRecordedLandId = m_landIDList[x, y];
628 if (lastRecordedLandId > 0)
630 ILandObject lastRecordedLo = m_landList[lastRecordedLandId];
635 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}",
636 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y,
637 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name);
646 for (
int x = 0; x < landBitmap.GetLength(0); x++)
648 for (
int y = 0; y < landBitmap.GetLength(1); y++)
650 if (landBitmap[x, y])
656 m_landIDList[x, y] = newLandLocalID;
662 m_landList.Add(newLandLocalID, new_land);
666 new_land.ForceUpdateLandInfo();
667 m_scene.EventManager.TriggerLandObjectAdded(new_land);
681 for (
int x = 0; x < m_landIDList.GetLength(0); x++)
683 for (
int y = 0; y < m_landIDList.GetLength(1); y++)
685 if (m_landIDList[x, y] == local_id)
687 m_log.WarnFormat(
"[LAND MANAGEMENT MODULE]: Not removing land object {0}; still being used at {1}, {2}",
695 land = m_landList[local_id];
696 m_landList.Remove(local_id);
699 m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID);
705 public void Clear(
bool setupDefaultParcel)
707 Dictionary<int, ILandObject> landworkList;
711 landworkList = m_landList;
712 m_landList =
new Dictionary<int, ILandObject>();
716 ResetSimLandObjects();
718 if (setupDefaultParcel)
719 CreateDefaultParcel();
725 m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID);
727 landworkList.Clear();
733 bool[,] landBitmapSlave = slave.GetLandBitmap();
736 for (
int x = 0; x < landBitmapSlave.GetLength(0); x++)
738 for (
int y = 0; y < landBitmapSlave.GetLength(1); y++)
740 if (landBitmapSlave[x, y])
742 m_landIDList[x, y] = master.LandData.LocalID;
756 if (m_landList.ContainsKey(parcelLocalID))
758 return m_landList[parcelLocalID];
772 return GetLandObject((
int)x_float, (
int)y_float,
true);
783 else if (avx >= m_scene.RegionInfo.RegionSizeX)
789 else if (avy >= m_scene.RegionInfo.RegionSizeY)
796 return m_landList[m_landIDList[avx / LandUnit, avy / LandUnit]];
798 catch (IndexOutOfRangeException)
809 return GetLandObject(x, y,
false );
814 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
818 if (returnNullIfLandObjectOutsideBounds)
821 throw new Exception(
"Error: Parcel not found at point " + x +
", " + y);
828 return m_landList[m_landIDList[x / 4, y / 4]];
830 catch (IndexOutOfRangeException)
836 return m_landList[m_landIDList[x / 4, y / 4]];
840 private bool[,] CreateBitmapForID(
int landID)
842 bool[,] ret =
new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)];
844 for (
int xx = 0; xx < m_landIDList.GetLength(0); xx++)
845 for (
int yy = 0; yy < m_landIDList.GetLength(0); yy++)
846 if (m_landIDList[xx, yy] == landID)
854 #region Parcel Modification
862 p.ResetOverMeRecord();
869 Vector3 position = obj.AbsolutePosition;
870 ILandObject landUnderPrim = GetLandObject(position.X, position.Y);
871 if (landUnderPrim != null)
873 ((
LandObject)landUnderPrim).AddPrimOverMe(obj);
883 p.RemovePrimFromOverMe(obj);
891 Dictionary<UUID, List<LandObject>> landOwnersAndParcels =
new Dictionary<UUID, List<LandObject>>();
898 List<LandObject> tempList =
new List<LandObject>();
900 landOwnersAndParcels.Add(p.LandData.OwnerID, tempList);
904 landOwnersAndParcels[p.LandData.OwnerID].Add(p);
909 foreach (
UUID owner
in landOwnersAndParcels.Keys)
913 foreach (
LandObject p
in landOwnersAndParcels[owner])
915 simArea += p.LandData.Area;
916 simPrims += p.PrimCounts.Total;
919 foreach (
LandObject p
in landOwnersAndParcels[owner])
921 p.LandData.SimwideArea = simArea;
922 p.LandData.SimwidePrims = simPrims;
933 ResetOverMeRecords();
934 EntityBase[] entities = m_scene.Entities.GetEntities();
939 if ((obj is
SceneObjectGroup) && !obj.IsDeleted && !((SceneObjectGroup) obj).IsAttachment)
941 m_scene.EventManager.TriggerParcelPrimCountAdd((SceneObjectGroup) obj);
945 FinalizeLandPrimCountUpdate();
950 ResetOverMeRecords();
951 m_scene.EventManager.TriggerParcelPrimCountUpdate();
952 FinalizeLandPrimCountUpdate();
964 public void Subdivide(
int start_x,
int start_y,
int end_x,
int end_y, UUID attempting_user_id)
969 ILandObject startLandObject = GetLandObject(start_x, start_y);
971 if (startLandObject == null)
974 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin,
true))
982 for (
int y = start_y; y < end_y; y++)
984 for (
int x = start_x; x < end_x; x++)
987 if (tempLandObject == null)
989 if (tempLandObject != startLandObject)
1002 newLand.LandData.Name = newLand.LandData.Name;
1003 newLand.LandData.GlobalID = UUID.Random();
1004 newLand.LandData.Dwell = 0;
1006 newLand.LandData.Flags &= ~(uint)ParcelFlags.ShowDirectory;
1009 newLand.LandData.UserLocation = Vector3.Zero;
1010 newLand.LandData.UserLookAt = Vector3.Zero;
1012 newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y));
1015 int startLandObjectIndex = startLandObject.LandData.LocalID;
1018 m_landList[startLandObjectIndex].SetLandBitmap(
1019 newLand.ModifyLandBitmapSquare(startLandObject.GetLandBitmap(), start_x, start_y, end_x, end_y,
false));
1020 m_landList[startLandObjectIndex].ForceUpdateLandInfo();
1031 int y = (
int)startLandObject.LandData.UserLocation.Y;
1034 startLandObject.LandData.LandingType = (byte)LandingType.Direct;
1040 m_scene.EventManager.TriggerParcelPrimCountTainted();
1042 result.SendLandUpdateToAvatarsOverMe();
1043 startLandObject.SendLandUpdateToAvatarsOverMe();
1044 m_scene.ForEachClient(SendParcelOverlay);
1057 public void Join(
int start_x,
int start_y,
int end_x,
int end_y, UUID attempting_user_id)
1063 List<ILandObject> selectedLandObjects =
new List<ILandObject>();
1064 for (
int x = start_x; x < end_x; x += 4)
1066 for (
int y = start_y; y < end_y; y += 4)
1072 if (!selectedLandObjects.Contains(p))
1074 selectedLandObjects.Add(p);
1077 maxArea = p.LandData.Area;
1086 if(maxindex < 0 || selectedLandObjects.Count < 2)
1089 ILandObject masterLandObject = selectedLandObjects[maxindex];
1090 selectedLandObjects.RemoveAt(maxindex);
1092 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin,
true))
1097 UUID masterOwner = masterLandObject.LandData.OwnerID;
1106 foreach (
ILandObject slaveLandObject
in selectedLandObjects)
1108 m_landList[masterLandObject.LandData.LocalID].SetLandBitmap(
1109 slaveLandObject.MergeLandBitmaps(masterLandObject.GetLandBitmap(), slaveLandObject.
GetLandBitmap()));
1110 performFinalLandJoin(masterLandObject, slaveLandObject);
1114 m_scene.EventManager.TriggerParcelPrimCountTainted();
1115 masterLandObject.SendLandUpdateToAvatarsOverMe();
1116 m_scene.ForEachClient(SendParcelOverlay);
1120 #region Parcel Updating
1140 const int LAND_BLOCKS_PER_PACKET = 1024;
1142 byte[] byteArray =
new byte[LAND_BLOCKS_PER_PACKET];
1143 int byteArrayCount = 0;
1147 for (
int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += LandUnit)
1149 for (
int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += LandUnit)
1153 ILandObject currentParcelBlock = GetLandObject(x, y);
1155 if (currentParcelBlock != null)
1193 westParcel = GetLandObject((x - 1), y);
1197 southParcel = GetLandObject(x, (y - 1));
1204 else if (westParcel != null && westParcel != currentParcelBlock)
1213 else if (southParcel != null && southParcel != currentParcelBlock)
1219 if ((currentParcelBlock.
LandData.
Flags & (uint)ParcelFlags.SoundLocal) != 0)
1227 byteArray[byteArrayCount] = tempByte;
1229 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
1231 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1234 byteArray =
new byte[LAND_BLOCKS_PER_PACKET];
1240 if (byteArrayCount > 0)
1242 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1247 bool snap_selection,
IClientAPI remote_client)
1250 List<ILandObject> temp =
new List<ILandObject>();
1251 int inc_x = end_x - start_x;
1252 int inc_y = end_y - start_y;
1253 for (
int x = 0; x < inc_x; x++)
1255 for (
int y = 0; y < inc_y; y++)
1257 ILandObject currentParcel = GetLandObject(start_x + x, start_y + y);
1259 if (currentParcel != null)
1261 if (!temp.Contains(currentParcel))
1265 currentParcel.ForceUpdateLandInfo();
1266 temp.Add(currentParcel);
1273 int requestResult = LandChannel.LAND_RESULT_SINGLE;
1276 requestResult = LandChannel.LAND_RESULT_MULTIPLE;
1279 for (
int i = 0; i < temp.Count; i++)
1281 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client);
1289 bool snap_selection =
false;
1290 bool needOverlay =
false;
1294 ScenePresence av = m_scene.GetScenePresence(remote_client.AgentId);
1298 land.SendLandProperties(0,
false, LandChannel.LAND_RESULT_SINGLE, remote_client);
1300 UUID parcelID = land.LandData.GlobalID;
1306 IClientAPI client = avatar.ControllingClient;
1308 SendParcelOverlay(client);
1316 if (client != remote_client && land == aland)
1317 aland.SendLandProperties(0,
false, LandChannel.LAND_RESULT_SINGLE, client);
1320 avatar.currentParcelUUID = parcelID;
1330 m_landList.TryGetValue(localID, out land);
1335 UpdateLandProperties(land, args, remote_client);
1336 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client);
1342 Subdivide(west, south, east, north, remote_client.
AgentId);
1347 Join(west, south, east, north, remote_client.
AgentId);
1351 List<UUID> returnIDs,
IClientAPI remote_client)
1353 m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client);
1361 m_landList.TryGetValue(local_id, out land);
1366 m_scene.EventManager.TriggerParcelPrimCountUpdate();
1367 m_landList[local_id].SendLandObjectOwners(remote_client);
1371 m_log.WarnFormat(
"[LAND MANAGEMENT MODULE]: Invalid land object {0} passed for parcel object owner request", local_id);
1380 m_landList.TryGetValue(local_id, out land);
1385 if (m_scene.Permissions.IsGod(remote_client.
AgentId))
1387 land.LandData.OwnerID = ownerID;
1388 land.LandData.GroupID = UUID.Zero;
1389 land.LandData.IsGroupOwned =
false;
1390 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
1391 m_scene.ForEachClient(SendParcelOverlay);
1392 land.SendLandUpdateToClient(
true, remote_client);
1403 m_landList.TryGetValue(local_id, out land);
1408 if (m_scene.Permissions.CanAbandonParcel(remote_client.
AgentId, land))
1410 land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
1411 land.LandData.GroupID = UUID.Zero;
1412 land.LandData.IsGroupOwned =
false;
1413 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
1415 m_scene.ForEachClient(SendParcelOverlay);
1416 land.SendLandUpdateToClient(
true, remote_client);
1427 m_landList.TryGetValue(local_id, out land);
1432 if (m_scene.Permissions.CanReclaimParcel(remote_client.
AgentId, land))
1434 land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
1435 land.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
1436 land.LandData.GroupID = UUID.Zero;
1437 land.LandData.IsGroupOwned =
false;
1438 land.LandData.SalePrice = 0;
1439 land.LandData.AuthBuyerID = UUID.Zero;
1440 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
1441 m_scene.ForEachClient(SendParcelOverlay);
1442 land.SendLandUpdateToClient(
true, remote_client);
1455 if (e.economyValidated && e.landValidated)
1460 m_landList.TryGetValue(e.parcelLocalID, out land);
1465 land.UpdateLandSold(e.agentId, e.groupId, e.groupOwned, (uint)e.transactionID, e.parcelPrice, e.parcelArea);
1476 if (e.landValidated ==
false)
1481 m_landList.TryGetValue(e.parcelLocalID, out lob);
1486 UUID AuthorizedID = lob.LandData.AuthBuyerID;
1487 int saleprice = lob.LandData.SalePrice;
1488 UUID pOwnerID = lob.LandData.OwnerID;
1490 bool landforsale = ((lob.LandData.Flags &
1491 (uint)(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects)) != 0);
1492 if ((AuthorizedID ==
UUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale)
1497 e.parcelOwnerID = pOwnerID;
1498 e.landValidated =
true;
1505 void ClientOnParcelDeedToGroup(
int parcelLocalID, UUID groupID,
IClientAPI remote_client)
1510 m_landList.TryGetValue(parcelLocalID, out land);
1513 if (!m_scene.Permissions.CanDeedParcel(remote_client.
AgentId, land))
1518 land.DeedToGroup(groupID);
1522 #region Land Object From Storage Functions
1524 private void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1528 for (
int i = 0; i < data.Count; i++)
1529 IncomingLandObjectFromStorage(data[i]);
1532 for (
int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
1534 for (
int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
1536 if (m_landIDList[x, y] == 0)
1538 if (m_landList.Count == 1)
1541 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
1542 LogHeader, x, y, m_scene.Name);
1544 int onlyParcelID = 0;
1546 foreach (KeyValuePair<int, ILandObject> kvp
in m_landList)
1548 onlyParcelID = kvp.Key;
1549 onlyLandObject = kvp.Value;
1554 for (
int xx = 0; xx < m_landIDList.GetLength(0); xx++)
1555 for (
int yy = 0; yy < m_landIDList.GetLength(1); yy++)
1556 if (m_landIDList[xx, yy] == 0)
1557 m_landIDList[xx, yy] = onlyParcelID;
1559 onlyLandObject.LandBitmap = CreateBitmapForID(onlyParcelID);
1561 else if (m_landList.Count > 1)
1564 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
1565 LogHeader, x, y, m_scene.Name);
1570 newLand.SetLandBitmap(CreateBitmapForID(0));
1571 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
1572 newLand.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
1573 newLand = AddLandObject(newLand);
1579 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
1580 LogHeader, m_scene.Name);
1588 private void IncomingLandObjectFromStorage(
LandData data)
1591 new_land.LandData = data.Copy();
1593 new_land.SetLandBitmapFromByteArray();
1594 AddLandObject(new_land);
1605 m_landList.TryGetValue(localID, out selectedParcel);
1608 if (selectedParcel == null)
1611 selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient);
1615 if (returnType != 1)
1617 m_log.WarnFormat(
"[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: unknown return type {0}", returnType);
1624 Dictionary<UUID, HashSet<SceneObjectGroup>> returns =
new Dictionary<UUID, HashSet<SceneObjectGroup>>();
1626 foreach (
UUID groupID
in taskIDs)
1631 if (!returns.ContainsKey(obj.
OwnerID))
1632 returns[obj.
OwnerID] =
new HashSet<SceneObjectGroup>();
1633 returns[obj.OwnerID].Add(obj);
1637 m_log.WarnFormat(
"[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: unknown object {0}", groupID);
1642 foreach (HashSet<SceneObjectGroup> objs
in returns.Values)
1644 m_log.DebugFormat(
"[LAND MANAGEMENT MODULE]: Returning {0} specific object(s)", num);
1646 foreach (HashSet<SceneObjectGroup> objs
in returns.Values)
1648 List<SceneObjectGroup> objs2 =
new List<SceneObjectGroup>(objs);
1649 if (m_scene.Permissions.CanReturnObjects(null, remoteClient.
AgentId, objs2))
1651 m_scene.returnObjects(objs2.ToArray(), remoteClient.
AgentId);
1655 m_log.WarnFormat(
"[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: not permitted to return {0} object(s) belonging to user {1}",
1656 objs2.Count, objs2[0].OwnerID);
1664 ResetSimLandObjects();
1665 CreateDefaultParcel();
1674 foreach (
LandObject obj
in m_landList.Values)
1676 obj.SetParcelObjectMaxOverride(overrideDel);
1685 #region CAPS handler
1687 private void EventManagerOnRegisterCaps(UUID agentID,
Caps caps)
1689 string capsBase =
"/CAPS/" + caps.CapsObjectPath;
1690 caps.RegisterHandler(
1691 "RemoteParcelRequest",
1694 capsBase + remoteParcelRequestPath,
1695 (request, path, param, httpRequest, httpResponse)
1696 => RemoteParcelRequest(request, path, param, agentID, caps),
1697 "RemoteParcelRequest",
1698 agentID.ToString()));
1700 UUID parcelCapID = UUID.Random();
1701 caps.RegisterHandler(
1702 "ParcelPropertiesUpdate",
1705 "/CAPS/" + parcelCapID,
1706 (request, path, param, httpRequest, httpResponse)
1707 => ProcessPropertiesUpdate(request, path, param, agentID, caps),
1708 "ParcelPropertiesUpdate",
1709 agentID.ToString()));
1711 private string ProcessPropertiesUpdate(
string request,
string path,
string param, UUID agentID,
Caps caps)
1714 if (!m_scene.TryGetClient(agentID, out client))
1716 m_log.WarnFormat(
"[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID);
1717 return LLSDHelpers.SerialiseLLSDReply(
new LLSDEmpty());
1720 ParcelPropertiesUpdateMessage properties =
new ParcelPropertiesUpdateMessage();
1723 properties.Deserialize(args);
1726 int parcelID = properties.LocalID;
1727 land_update.AuthBuyerID = properties.AuthBuyerID;
1728 land_update.Category = properties.Category;
1729 land_update.Desc = properties.Desc;
1730 land_update.GroupID = properties.GroupID;
1731 land_update.LandingType = (byte) properties.Landing;
1732 land_update.MediaAutoScale = (byte) Convert.ToInt32(properties.MediaAutoScale);
1733 land_update.MediaID = properties.MediaID;
1734 land_update.MediaURL = properties.MediaURL;
1735 land_update.MusicURL = properties.MusicURL;
1736 land_update.Name = properties.Name;
1737 land_update.ParcelFlags = (uint) properties.ParcelFlags;
1738 land_update.PassHours = (
int) properties.PassHours;
1739 land_update.PassPrice = (int) properties.PassPrice;
1740 land_update.SalePrice = (
int) properties.SalePrice;
1741 land_update.SnapshotID = properties.SnapshotID;
1742 land_update.UserLocation = properties.UserLocation;
1743 land_update.UserLookAt = properties.UserLookAt;
1744 land_update.MediaDescription = properties.MediaDesc;
1745 land_update.MediaType = properties.MediaType;
1746 land_update.MediaWidth = properties.MediaWidth;
1747 land_update.MediaHeight = properties.MediaHeight;
1748 land_update.MediaLoop = properties.MediaLoop;
1749 land_update.ObscureMusic = properties.ObscureMusic;
1750 land_update.ObscureMedia = properties.ObscureMedia;
1752 if (args.ContainsKey(
"see_avs"))
1754 land_update.SeeAVs = args[
"see_avs"].AsBoolean();
1755 land_update.AnyAVSounds = args[
"any_av_sounds"].AsBoolean();
1756 land_update.GroupAVSounds = args[
"group_av_sounds"].AsBoolean();
1760 land_update.SeeAVs =
true;
1761 land_update.AnyAVSounds =
true;
1762 land_update.GroupAVSounds =
true;
1768 m_landList.TryGetValue(parcelID, out land);
1773 UpdateLandProperties(land,land_update, client);
1774 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
1778 m_log.WarnFormat(
"[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID);
1781 return LLSDHelpers.SerialiseLLSDReply(
new LLSDEmpty());
1801 private string RemoteParcelRequest(
string request,
string path,
string param, UUID agentID,
Caps caps)
1803 UUID parcelID = UUID.Zero;
1806 Hashtable hash =
new Hashtable();
1807 hash = (Hashtable)LLSD.LLSDDeserialize(
Utils.StringToBytes(request));
1808 if (hash.ContainsKey(
"region_id") && hash.ContainsKey(
"location"))
1810 UUID regionID = (
UUID)hash[
"region_id"];
1811 ArrayList list = (ArrayList)hash[
"location"];
1812 uint x = (uint)(
double)list[0];
1813 uint y = (uint)(
double)list[1];
1814 if (hash.ContainsKey(
"region_handle"))
1818 ulong regionHandle = Util.BytesToUInt64Big((byte[])hash[
"region_handle"]);
1819 parcelID = Util.BuildFakeParcelID(regionHandle, x, y);
1821 else if (regionID == m_scene.RegionInfo.RegionID)
1824 parcelID = Util.BuildFakeParcelID(m_scene.RegionInfo.RegionHandle, x, y);
1829 GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, regionID);
1831 parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y);
1835 catch (LLSD.LLSDParseException e)
1837 m_log.ErrorFormat(
"[LAND MANAGEMENT MODULE]: Fetch error: {0}", e.Message);
1838 m_log.ErrorFormat(
"[LAND MANAGEMENT MODULE]: ... in request {0}", request);
1840 catch (InvalidCastException)
1842 m_log.ErrorFormat(
"[LAND MANAGEMENT MODULE]: Wrong type in request {0}", request);
1846 response.parcel_id = parcelID;
1847 m_log.DebugFormat(
"[LAND MANAGEMENT MODULE]: Got parcelID {0}", parcelID);
1849 return LLSDHelpers.SerialiseLLSDReply(response);
1854 private void ClientOnParcelInfoRequest(
IClientAPI remoteClient, UUID parcelID)
1856 if (parcelID ==
UUID.Zero)
1859 ExtendedLandData data = (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
1862 UUID parcel = UUID.Zero;
1863 UUID.TryParse(id, out parcel);
1865 ExtendedLandData extLandData =
new ExtendedLandData();
1866 Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
1867 out extLandData.X, out extLandData.Y);
1868 m_log.DebugFormat(
"[LAND MANAGEMENT MODULE]: Got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
1869 extLandData.RegionHandle, extLandData.X, extLandData.Y);
1872 if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
1874 extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).
LandData;
1875 extLandData.RegionAccess = m_scene.RegionInfo.AccessLevel;
1880 extLandData.LandData = landService.GetLandData(m_scene.RegionInfo.ScopeID,
1881 extLandData.RegionHandle,
1884 out extLandData.RegionAccess);
1885 if (extLandData.LandData == null)
1897 if (data.RegionHandle == m_scene.RegionInfo.RegionHandle)
1905 Util.RegionHandleToWorldLoc(data.RegionHandle, out x, out y);
1906 info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (
int)y);
1909 m_log.DebugFormat(
"[LAND MANAGEMENT MODULE]: got parcelinfo for parcel {0} in region {1}; sending...",
1910 data.LandData.Name, data.RegionHandle);
1913 r.RegionName = info.RegionName;
1914 r.RegionLocX = (uint)info.RegionLocX;
1915 r.RegionLocY = (uint)info.RegionLocY;
1916 r.RegionSettings.Maturity = (int)Util.ConvertAccessLevelToMaturity(data.RegionAccess);
1917 remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
1920 m_log.Debug(
"[LAND MANAGEMENT MODULE]: got no parcelinfo; not sending");
1928 m_landList.TryGetValue(localID, out land);
1931 if (land == null)
return;
1933 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.
AgentId, land, GroupPowers.LandOptions,
false))
1936 land.LandData.OtherCleanTime = otherCleanTime;
1938 UpdateLandObject(localID, land.
LandData);
1944 List<ILandObject>
Land = ((
Scene)client.
Scene).LandChannel.AllParcels();
1952 land.DeedToGroup(DefaultGodParcelGroup);
1953 land.LandData.Name = DefaultGodParcelName;
1954 land.SendLandUpdateToAvatarsOverMe();
1957 private void ClientOnSimWideDeletes(
IClientAPI client, UUID agentID,
int flags, UUID targetID)
1960 ((
Scene)client.
Scene).TryGetScenePresence(client.AgentId, out SP);
1961 List<SceneObjectGroup> returns =
new List<SceneObjectGroup>();
1994 ILandObject landobject = ((
Scene)client.
Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y);
2007 ReturnObject(ol, client);
2015 ((
Scene)client.
Scene).returnObjects(objs, client.AgentId);
2018 Dictionary<
UUID, System.Threading.Timer> Timers =
new Dictionary<
UUID, System.Threading.Timer>();
2023 ((
Scene)client.
Scene).TryGetScenePresence(target, out targetAvatar);
2025 ((
Scene)client.
Scene).TryGetScenePresence(client.AgentId, out parcelManager);
2026 System.Threading.Timer
Timer;
2030 ILandObject land = ((
Scene)client.
Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
2031 if (!((
Scene)client.Scene).Permissions.CanEditParcelProperties(client.
AgentId, land, GroupPowers.LandEjectAndFreeze,
true))
2035 targetAvatar.AllowMovement =
false;
2036 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname +
" " + parcelManager.Lastname +
" has frozen you for 30 seconds. You cannot move or interact with the world.");
2037 parcelManager.ControllingClient.SendAlertMessage(
"Avatar Frozen.");
2038 System.Threading.TimerCallback timeCB =
new System.Threading.TimerCallback(OnEndParcelFrozen);
2039 Timer =
new System.Threading.Timer(timeCB, targetAvatar, 30000, 0);
2040 Timers.Add(targetAvatar.UUID,
Timer);
2044 targetAvatar.AllowMovement =
true;
2045 targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname +
" " + parcelManager.Lastname +
" has unfrozen you.");
2046 parcelManager.ControllingClient.SendAlertMessage(
"Avatar Unfrozen.");
2047 Timers.TryGetValue(targetAvatar.UUID, out
Timer);
2048 Timers.Remove(targetAvatar.UUID);
2053 private void OnEndParcelFrozen(
object avatar)
2056 targetAvatar.AllowMovement =
true;
2057 System.Threading.Timer
Timer;
2058 Timers.TryGetValue(targetAvatar.UUID, out
Timer);
2059 Timers.Remove(targetAvatar.UUID);
2060 targetAvatar.ControllingClient.SendAgentAlertMessage(
"The freeze has worn off; you may go about your business.",
false);
2069 if (!m_scene.TryGetScenePresence(target, out targetAvatar) ||
2070 !m_scene.TryGetScenePresence(client.AgentId, out parcelManager))
2074 if (m_scene.Permissions.IsAdministrator(target))
2078 ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
2079 if (!m_scene.Permissions.CanEditParcelProperties(client.
AgentId, land, GroupPowers.LandEjectAndFreeze,
true) &&
2080 !m_scene.Permissions.IsAdministrator(client.AgentId))
2083 Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land);
2085 targetAvatar.TeleportWithMomentum(pos, null);
2086 targetAvatar.ControllingClient.SendAlertMessage(
"You have been ejected by " + parcelManager.Firstname +
" " + parcelManager.Lastname);
2087 parcelManager.ControllingClient.SendAlertMessage(
"Avatar Ejected.");
2089 if ((flags & 1) != 0)
2092 entry.AgentID = targetAvatar.UUID;
2093 entry.Flags = AccessList.Ban;
2096 land.LandData.ParcelAccessList.Add(entry);
2111 ILandObject land = landChannel.GetLandObject(position);
2112 if (land == null || m_scene.GridUserService == null)
2114 m_Dialog.SendAlertToUser(remoteClient,
"Set Home request failed.");
2119 ulong gpowers = remoteClient.GetGroupPowers(land.LandData.GroupID);
2121 if (m_scene.RegionInfo.RegionSettings.TelehubObject !=
UUID.Zero)
2123 telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
2127 m_scene.UserManagementModule.IsLocalGridUser(remoteClient.
AgentId) &&
2129 m_scene.Permissions.IsAdministrator(remoteClient.AgentId) ||
2130 m_scene.Permissions.IsGod(remoteClient.
AgentId) ||
2132 remoteClient.AgentId == land.LandData.OwnerID ||
2134 ((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) ||
2136 (telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (
int)telehub.AbsolutePosition.Y))))
2140 if (!m_scene.UserManagementModule.GetUserUUI(remoteClient.
AgentId, out userId))
2143 m_Dialog.SendAlertToUser(remoteClient,
"Set Home request failed. (User Lookup)");
2145 else if (!
UUID.TryParse(userId, out test))
2147 m_Dialog.SendAlertToUser(remoteClient,
"Set Home request failed. (HG visitor)");
2149 else if (m_scene.GridUserService.SetHome(userId, land.
RegionUUID, position, lookAt))
2152 m_Dialog.SendAlertToUser(remoteClient,
"Home position set.");
2156 m_Dialog.SendAlertToUser(remoteClient,
"Set Home request failed.");
2160 m_Dialog.SendAlertToUser(remoteClient,
"You are not allowed to set your home location in this parcel.");
2165 ICommands commands = MainConsole.Instance.Commands;
2167 commands.AddCommand(
2168 "Land",
false,
"land clear",
2170 "Clear all the parcels from the region.",
2171 "Command will ask for confirmation before proceeding.",
2172 HandleClearCommand);
2174 commands.AddCommand(
2175 "Land",
false,
"land show",
2176 "land show [<local-land-id>]",
2177 "Show information about the parcels on the region.",
2178 "If no local land ID is given, then summary information about all the parcels is shown.\n"
2179 +
"If a local land ID is given then full information about that parcel is shown.",
2188 string response = MainConsole.Instance.CmdPrompt(
2190 "Are you sure that you want to clear all land parcels from {0} (y or n)", m_scene.Name),
2193 if (response.ToLower() ==
"y")
2196 MainConsole.Instance.OutputFormat(
"Cleared all parcels from {0}", m_scene.Name);
2200 MainConsole.Instance.OutputFormat(
"Aborting clear of all parcels from {0}", m_scene.Name);
2209 StringBuilder report =
new StringBuilder();
2211 if (args.Length <= 2)
2213 AppendParcelsSummaryReport(report);
2226 if (!m_landList.TryGetValue(landLocalId, out lo))
2228 MainConsole.Instance.OutputFormat(
"No parcel found with local ID {0}", landLocalId);
2233 AppendParcelReport(report, lo);
2236 MainConsole.Instance.Output(report.ToString());
2239 private void AppendParcelsSummaryReport(StringBuilder report)
2241 report.AppendFormat(
"Land information for {0}\n", m_scene.RegionInfo.RegionName);
2242 report.AppendFormat(
2243 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
2257 report.AppendFormat(
2258 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
2259 ld.Name, ld.LocalID, ld.Area, ld.AABBMin, ld.AABBMax, m_userManager.GetUserName(ld.OwnerID));
2265 private void AppendParcelReport(StringBuilder report,
ILandObject lo)
2270 cdl.AddRow(
"Parcel name", ld.Name);
2271 cdl.AddRow(
"Local ID", ld.LocalID);
2272 cdl.AddRow(
"Description", ld.Description);
2273 cdl.AddRow(
"Snapshot ID", ld.SnapshotID);
2274 cdl.AddRow(
"Area", ld.Area);
2275 cdl.AddRow(
"AABB Min", ld.AABBMin);
2276 cdl.AddRow(
"AABB Max", ld.AABBMax);
2280 GroupRecord rec = m_groupManager.GetGroupRecord(ld.GroupID);
2281 ownerName = (rec != null) ? rec.
GroupName :
"Unknown Group";
2285 ownerName = m_userManager.GetUserName(ld.OwnerID);
2287 cdl.AddRow(
"Owner", ownerName);
2288 cdl.AddRow(
"Is group owned?", ld.IsGroupOwned);
2289 cdl.AddRow(
"GroupID", ld.GroupID);
2291 cdl.AddRow(
"Status", ld.Status);
2292 cdl.AddRow(
"Flags", (ParcelFlags)ld.
Flags);
2294 cdl.AddRow(
"Landing Type", (LandingType)ld.
LandingType);
2295 cdl.AddRow(
"User Location", ld.UserLocation);
2296 cdl.AddRow(
"User look at", ld.UserLookAt);
2298 cdl.AddRow(
"Other clean time", ld.OtherCleanTime);
2300 cdl.AddRow(
"Max Prims", lo.GetParcelMaxPrimCount());
2302 cdl.AddRow(
"Owner Prims", pc.Owner);
2303 cdl.AddRow(
"Group Prims", pc.Group);
2304 cdl.AddRow(
"Other Prims", pc.Others);
2305 cdl.AddRow(
"Selected Prims", pc.Selected);
2306 cdl.AddRow(
"Total Prims", pc.Total);
2308 cdl.AddRow(
"Music URL", ld.MusicURL);
2309 cdl.AddRow(
"Obscure Music", ld.ObscureMusic);
2311 cdl.AddRow(
"Media ID", ld.MediaID);
2312 cdl.AddRow(
"Media Autoscale", Convert.ToBoolean(ld.MediaAutoScale));
2313 cdl.AddRow(
"Media URL", ld.MediaURL);
2314 cdl.AddRow(
"Media Type", ld.MediaType);
2315 cdl.AddRow(
"Media Description", ld.MediaDescription);
2316 cdl.AddRow(
"Media Width", ld.MediaWidth);
2317 cdl.AddRow(
"Media Height", ld.MediaHeight);
2318 cdl.AddRow(
"Media Loop", ld.MediaLoop);
2319 cdl.AddRow(
"Obscure Media", ld.ObscureMedia);
2321 cdl.AddRow(
"Parcel Category", ld.Category);
2323 cdl.AddRow(
"Claim Date", ld.ClaimDate);
2324 cdl.AddRow(
"Claim Price", ld.ClaimPrice);
2325 cdl.AddRow(
"Pass Hours", ld.PassHours);
2326 cdl.AddRow(
"Pass Price", ld.PassPrice);
2328 cdl.AddRow(
"Auction ID", ld.AuctionID);
2329 cdl.AddRow(
"Authorized Buyer ID", ld.AuthBuyerID);
2330 cdl.AddRow(
"Sale Price", ld.SalePrice);
2332 cdl.AddToStringBuilder(report);
Used to generated a formatted table for the console.
void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client)
void EventManagerOnSignificantClientMovement(ScenePresence avatar)
void EventMakeChildAgent(ScenePresence avatar)
IClientAPI ControllingClient
IUserManagement m_userManager
void EventManagerOnRequestParcelPrimCountUpdate()
void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
void SendParcelOverlay(IClientAPI remote_client)
Send the parcel overlay blocks to the client. We send the overlay packets around a location and limit...
static bool TryParseConsoleInt(ICommandConsole console, string rawConsoleInt, out int i)
Convert a console input to an int, automatically complaining if a console is given.
bool ContainsScripts()
Returns true if any part in the scene object contains scripts, false otherwise.
ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
Client provided parameters for avatar movement
bool IsRestrictedFromLand(UUID avatar)
void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
const byte LAND_FLAG_PROPERTY_BORDER_SOUTH
void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
OpenSim.Framework.RegionInfo RegionInfo
OpenSim.Server.Handlers.Simulation.Utils Utils
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
IGroupsModule m_groupManager
void FinalizeLandPrimCountUpdate()
void ReturnObject(SceneObjectGroup obj, IClientAPI client)
Vector3 UserLocation
When teleporting is restricted to a certain point, this is the location that the user will be redirec...
const byte LAND_TYPE_PUBLIC
void SendAlertMessage(string message)
OpenMetaverse.StructuredData.OSDMap OSDMap
List< ILandObject > AllParcels()
const byte LAND_TYPE_OWNED_BY_OTHER
void SendOutNearestBanLine(IClientAPI client)
const byte LAND_FLAG_HIDEAVATARS
Vector3 UserLookAt
When teleporting is restricted to a certain point, this is the rotation that the user will be positio...
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
void ClientOnParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client)
Vector3 lastKnownAllowedPosition
const byte LAND_TYPE_OWNED_BY_REQUESTER
void ClientOnParcelAccessListRequest(UUID agentID, UUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client)
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
void EventManagerOnValidateLandBuy(Object o, EventManager.LandBuyArgs e)
void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client)
void Clear(bool setupDefaultParcel)
Clear the scene of all parcels
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
bool IsEitherBannedOrRestricted(UUID avatar)
PresenceType
Indicate the type of ScenePresence.
ISceneAgent SceneAgent
The scene agent for this client. This will only be set if the client has an agent in a scene (i...
void HandleShowCommand(string module, string[] args)
System.Timers.Timer Timer
OpenSim.Framework.Capabilities.Caps Caps
void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client)
void HandleClearCommand(string module, string[] args)
void EventManagerOnClientMovement(ScenePresence avatar)
Like handleEventManagerOnSignificantClientMovement, but called with an AgentUpdate regardless of dist...
UUID GlobalID
Global ID for the parcel. (3rd Party Integration)
bool IsDeleted
Signals whether this entity was in a scene but has since been removed from it.
ILandObject AddLandObject(ILandObject land)
Adds a land object to the stored list and adds them to the landIDList to what they own ...
List< ILandObject > ParcelsNearPoint(Vector3 position)
void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
Keeps track of a specific piece of land's information
bool IsBannedFromLand(UUID avatar)
const byte LAND_FLAG_LOCALSOUND
void sendClientInitialLandInfo(IClientAPI remoteClient)
UUID GroupID
Unique ID of the Group that owns
override Vector3 AbsolutePosition
Position of this avatar relative to the region the avatar is in
virtual void ClientOnSetHome(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
Sets the Home Point. The LoginService uses this to know where to put a user when they log-in ...
const byte LAND_TYPE_IS_FOR_SALE
void ClientOnParcelSelectObjects(int local_id, int request_type, List< UUID > returnIDs, IClientAPI remote_client)
bool IsGroupMember(UUID GroupID)
void ClientOnParcelReclaim(int local_id, IClientAPI remote_client)
static ICommandConsole Instance
void EventManagerOnLandBuy(Object o, EventManager.LandBuyArgs e)
Details of a Parcel of land
void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj)
void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj)
const float BAN_LINE_SAFETY_HEIGHT
void ResetSimLandObjects()
Resets the sim to the default land object (full sim piece of land owned by the default user) ...
void UpdateLandObject(int local_id, LandData data)
void EventManagerOnParcelPrimCountUpdate()
bool ContainsPoint(int x, int y)
OpenSim.Services.Interfaces.GridRegion GridRegion
void removeLandObject(int local_id)
Removes a land object from the list. Will not remove if local_id is still owning an area in landIDLis...
byte LandingType
Determines if people are able to teleport where they please on the parcel or if they get constrainted...
void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID)
void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
Subdivides a piece of land
A class for triggering remote scene events.
delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj)
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void ClientOnParcelAbandonRequest(int local_id, IClientAPI remote_client)
bool IsSatOnObject
Are we sitting on an object?
bool EnforceBans(ILandObject land, ScenePresence avatar)
void ClientOnParcelGodForceOwner(int local_id, UUID ownerID, IClientAPI remote_client)
const int LAND_RESULT_SINGLE
bool IsGroupOwned
Returns true if the Land Parcel is owned by a group
void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
uint Flags
Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags ...
int SalePrice
When the parcel is being sold, this is the price to purchase the parcel
ILandObject CreateDefaultParcel()
Create a default parcel that spans the entire region and is owned by the estate owner.
ILandObject GetLandObject(int parcelLocalID)
void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
Join 2 land objects together
ILandObject GetLandObject(float x_float, float y_float)
Get the land object at the specified point
void EventManagerOnNoLandDataFromStorage()
void EventManagerOnSetAllowedForcefulBan(bool forceful)
bool UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client, out bool snap_selection, out bool needOverlay)
void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
void UpdateLandProperties(ILandObject land, LandUpdateArgs args, IClientAPI remote_client)
This maintains the relationship between a UUID and a user name.
void ClientOnParcelAccessListUpdateRequest(UUID agentID, uint flags, int landLocalID, UUID transactionID, int sequenceID, int sections, List< LandAccessEntry > entries, IClientAPI remote_client)
int LocalID
Internal ID of the parcel. Sometimes the client will try to use this value
IPrimCountModule m_primCountModule
ILandObject GetLandObjectClipedXY(float x, float y)
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
int Area
Area in meters^2 the parcel contains
UUID AuthBuyerID
UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it.
void SendLandUpdate(ScenePresence avatar, ILandObject over)
void ResetOverMeRecords()
const byte LAND_FLAG_PROPERTY_BORDER_WEST
ILandObject GetLandObject(int x, int y)
const byte LAND_TYPE_OWNED_BY_GROUP
PresenceType PresenceType
What type of presence is this? User, NPC, etc.
UUID OwnerID
Owner Avatar or Group of the parcel. Naturally, all land masses must be owned by someone ...