aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authormingchen2008-05-05 17:44:40 +0000
committermingchen2008-05-05 17:44:40 +0000
commitc535f3947dbcfb78dcac8045c7452f34f8dd79eb (patch)
treeaae82fefa906ac823b46f1291a669d5930a330e1 /OpenSim/Region
parent* Unraveled the DEBUG_CHANNEL mystery. (diff)
downloadopensim-SC_OLD-c535f3947dbcfb78dcac8045c7452f34f8dd79eb.zip
opensim-SC_OLD-c535f3947dbcfb78dcac8045c7452f34f8dd79eb.tar.gz
opensim-SC_OLD-c535f3947dbcfb78dcac8045c7452f34f8dd79eb.tar.bz2
opensim-SC_OLD-c535f3947dbcfb78dcac8045c7452f34f8dd79eb.tar.xz
*Standardized the Land module by removing all references to libsecondlife.packets
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs220
-rw-r--r--OpenSim/Region/Environment/Interfaces/ILandChannel.cs3
-rw-r--r--OpenSim/Region/Environment/Interfaces/ILandObject.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandObject.cs259
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs13
6 files changed, 271 insertions, 235 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 4ff27e7..f2271fb 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2274,10 +2274,205 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2274 } 2274 }
2275 2275
2276 #endregion 2276 #endregion
2277
2278 #region Land Data Sending Methods
2277 2279
2278 #region Helper Methods 2280 public void sendLandProperties(IClientAPI remote_client,int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int simObjectCapacity)
2281 {
2282 ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties);
2283 // TODO: don't create new blocks if recycling an old packet
2284
2285 updatePacket.ParcelData.AABBMax = landData.AABBMax;
2286 updatePacket.ParcelData.AABBMin = landData.AABBMin;
2287 updatePacket.ParcelData.Area = landData.area;
2288 updatePacket.ParcelData.AuctionID = landData.auctionID;
2289 updatePacket.ParcelData.AuthBuyerID = landData.authBuyerID; //unemplemented
2290
2291 updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray;
2292
2293 updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc);
2294 updatePacket.ParcelData.Category = (byte) landData.category;
2295 updatePacket.ParcelData.ClaimDate = landData.claimDate;
2296 updatePacket.ParcelData.ClaimPrice = landData.claimPrice;
2297 updatePacket.ParcelData.GroupID = landData.groupID;
2298 updatePacket.ParcelData.GroupPrims = landData.groupPrims;
2299 updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned;
2300 updatePacket.ParcelData.LandingType = (byte) landData.landingType;
2301 updatePacket.ParcelData.LocalID = landData.localID;
2302 if (landData.area > 0)
2303 {
2304 updatePacket.ParcelData.MaxPrims =
2305 Convert.ToInt32(
2306 Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * simObjectCapacity *
2307 Convert.ToDecimal(simObjectBonusFactor)));
2308 }
2309 else
2310 {
2311 updatePacket.ParcelData.MaxPrims = 0;
2312 }
2313 updatePacket.ParcelData.MediaAutoScale = landData.mediaAutoScale;
2314 updatePacket.ParcelData.MediaID = landData.mediaID;
2315 updatePacket.ParcelData.MediaURL = Helpers.StringToField(landData.mediaURL);
2316 updatePacket.ParcelData.MusicURL = Helpers.StringToField(landData.musicURL);
2317 updatePacket.ParcelData.Name = Helpers.StringToField(landData.landName);
2318 updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
2319 updatePacket.ParcelData.OtherCount = 0; //unemplemented
2320 updatePacket.ParcelData.OtherPrims = landData.otherPrims;
2321 updatePacket.ParcelData.OwnerID = landData.ownerID;
2322 updatePacket.ParcelData.OwnerPrims = landData.ownerPrims;
2323 updatePacket.ParcelData.ParcelFlags = landData.landFlags;
2324 updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.EstateSettings.objectBonusFactor;
2325 updatePacket.ParcelData.PassHours = landData.passHours;
2326 updatePacket.ParcelData.PassPrice = landData.passPrice;
2327 updatePacket.ParcelData.PublicCount = 0; //unemplemented
2328
2329 uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags;
2330 updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) >
2331 0);
2332 updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) >
2333 0);
2334 updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) >
2335 0);
2336 updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) >
2337 0);
2338
2339 updatePacket.ParcelData.RentPrice = 0;
2340 updatePacket.ParcelData.RequestResult = request_result;
2341 updatePacket.ParcelData.SalePrice = landData.salePrice;
2342 updatePacket.ParcelData.SelectedPrims = landData.selectedPrims;
2343 updatePacket.ParcelData.SelfCount = 0; //unemplemented
2344 updatePacket.ParcelData.SequenceID = sequence_id;
2345 if (landData.simwideArea > 0)
2346 {
2347 updatePacket.ParcelData.SimWideMaxPrims =
2348 Convert.ToInt32(
2349 Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * simObjectCapacity *
2350 Convert.ToDecimal(simObjectBonusFactor)));
2351 }
2352 else
2353 {
2354 updatePacket.ParcelData.SimWideMaxPrims = 0;
2355 }
2356 updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims;
2357 updatePacket.ParcelData.SnapSelection = snap_selection;
2358 updatePacket.ParcelData.SnapshotID = landData.snapshotID;
2359 updatePacket.ParcelData.Status = (byte) landData.landStatus;
2360 updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims +
2361 landData.selectedPrims;
2362 updatePacket.ParcelData.UserLocation = landData.userLocation;
2363 updatePacket.ParcelData.UserLookAt = landData.userLookAt;
2364 remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task);
2365 }
2366
2367 public void sendLandAccessListData(List<LLUUID> avatars, uint accessFlag, int localLandID)
2368 {
2369 ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
2370 replyPacket.Data.AgentID = this.AgentId;
2371 replyPacket.Data.Flags = accessFlag;
2372 replyPacket.Data.LocalID = localLandID;
2373 replyPacket.Data.SequenceID = 0;
2374
2375 List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>();
2376 foreach (LLUUID avatar in avatars)
2377 {
2378 ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock();
2379 block.Flags = accessFlag;
2380 block.ID = avatar;
2381 block.Time = 0;
2382 }
2383
2384 replyPacket.List = list.ToArray();
2385 this.OutPacket((Packet)replyPacket, ThrottleOutPacketType.Task);
2386 }
2387
2388 public void sendForceClientSelectObjects(List<uint> ObjectIDs)
2389 {
2390 bool firstCall = true;
2391 int MAX_OBJECTS_PER_PACKET = 251;
2392 ForceObjectSelectPacket pack = (ForceObjectSelectPacket)PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect);
2393 ForceObjectSelectPacket.DataBlock[] data;
2394 while (ObjectIDs.Count > 0)
2395 {
2396 if (firstCall)
2397 {
2398 pack._Header.ResetList = true;
2399 firstCall = false;
2400 }
2401 else
2402 {
2403 pack._Header.ResetList = false;
2404 }
2405
2406 if (ObjectIDs.Count > MAX_OBJECTS_PER_PACKET)
2407 {
2408 data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET];
2409 }
2410 else
2411 {
2412 data = new ForceObjectSelectPacket.DataBlock[ObjectIDs.Count];
2413 }
2414
2415 int i;
2416 for (i = 0; i < MAX_OBJECTS_PER_PACKET && ObjectIDs.Count > 0; i++)
2417 {
2418 data[i] = new ForceObjectSelectPacket.DataBlock();
2419 data[i].LocalID = Convert.ToUInt32(ObjectIDs[0]);
2420 ObjectIDs.RemoveAt(0);
2421 }
2422 pack.Data = data;
2423 this.OutPacket((Packet)pack, ThrottleOutPacketType.Task);
2424 }
2425 }
2426
2427 public void sendLandObjectOwners(Dictionary<LLUUID, int> ownersAndCount)
2428 {
2429 int notifyCount = ownersAndCount.Count;
2430 ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply);
2431
2432 if (notifyCount > 0)
2433 {
2434 if (notifyCount > 32)
2435 {
2436 m_log.InfoFormat(
2437 "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
2438 + " - a developer might want to investigate whether this is a hard limit", 32);
2439
2440 notifyCount = 32;
2441 }
2442
2443
2444
2445 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
2446 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
2447
2448 int num = 0;
2449 foreach (LLUUID owner in ownersAndCount.Keys)
2450 {
2451 dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock();
2452 dataBlock[num].Count = ownersAndCount[owner];
2453 dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added
2454 dataBlock[num].OnlineStatus = true; //TODO: fix me later
2455 dataBlock[num].OwnerID = owner;
2456
2457 num++;
2458
2459 if (num >= notifyCount)
2460 {
2461 break;
2462 }
2463 }
2464
2465 pack.Data = dataBlock;
2466 }
2467
2468 this.OutPacket(pack, ThrottleOutPacketType.Task);
2469 }
2470
2471 #endregion
2472
2473 #region Helper Methods
2279 2474
2280 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, 2475 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos,
2281 LLVector3 velocity, 2476 LLVector3 velocity,
2282 LLQuaternion rotation) 2477 LLQuaternion rotation)
2283 { 2478 {
@@ -4704,7 +4899,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4704 4899
4705 if (handlerParcelPropertiesUpdateRequest != null) 4900 if (handlerParcelPropertiesUpdateRequest != null)
4706 { 4901 {
4707 handlerParcelPropertiesUpdateRequest(parcelPropertiesPacket, this); 4902 LandUpdateArgs args = new LandUpdateArgs();
4903
4904 args.AuthBuyerID = parcelPropertiesPacket.ParcelData.AuthBuyerID;
4905 args.Category = (Parcel.ParcelCategory)parcelPropertiesPacket.ParcelData.Category;
4906 args.Desc = Helpers.FieldToUTF8String(parcelPropertiesPacket.ParcelData.Desc);
4907 args.GroupID = parcelPropertiesPacket.ParcelData.GroupID;
4908 args.LandingType = parcelPropertiesPacket.ParcelData.LandingType;
4909 args.MediaAutoScale = parcelPropertiesPacket.ParcelData.MediaAutoScale;
4910 args.MediaID = parcelPropertiesPacket.ParcelData.MediaID;
4911 args.MediaURL = Helpers.FieldToUTF8String(parcelPropertiesPacket.ParcelData.MediaURL);
4912 args.MusicURL = Helpers.FieldToUTF8String(parcelPropertiesPacket.ParcelData.MusicURL);
4913 args.Name = Helpers.FieldToUTF8String(parcelPropertiesPacket.ParcelData.Name);
4914 args.ParcelFlags = parcelPropertiesPacket.ParcelData.ParcelFlags;
4915 args.PassHours = parcelPropertiesPacket.ParcelData.PassHours;
4916 args.PassPrice = parcelPropertiesPacket.ParcelData.PassPrice;
4917 args.SalePrice = parcelPropertiesPacket.ParcelData.SalePrice;
4918 args.SnapshotID = parcelPropertiesPacket.ParcelData.SnapshotID;
4919 args.UserLocation = parcelPropertiesPacket.ParcelData.UserLocation;
4920 args.UserLookAt = parcelPropertiesPacket.ParcelData.UserLookAt;
4921 handlerParcelPropertiesUpdateRequest(args, parcelPropertiesPacket.ParcelData.LocalID, this);
4708 } 4922 }
4709 break; 4923 break;
4710 case PacketType.ParcelSelectObjects: 4924 case PacketType.ParcelSelectObjects:
diff --git a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs
index 464a213..ce79a8f 100644
--- a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs
+++ b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs
@@ -27,7 +27,6 @@
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets;
31using OpenSim.Framework; 30using OpenSim.Framework;
32using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
33 32
@@ -56,7 +55,7 @@ namespace OpenSim.Region.Environment.Interfaces
56 55
57 void sendParcelOverlay(IClientAPI remote_client); 56 void sendParcelOverlay(IClientAPI remote_client);
58 void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); 57 void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
59 void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); 58 void handleParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client);
60 void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client); 59 void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client);
61 void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client); 60 void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
62 void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client); 61 void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client);
diff --git a/OpenSim/Region/Environment/Interfaces/ILandObject.cs b/OpenSim/Region/Environment/Interfaces/ILandObject.cs
index 420ffc3..25c51de 100644
--- a/OpenSim/Region/Environment/Interfaces/ILandObject.cs
+++ b/OpenSim/Region/Environment/Interfaces/ILandObject.cs
@@ -27,7 +27,6 @@
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets;
31using OpenSim.Framework; 30using OpenSim.Framework;
32using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
33 32
@@ -44,12 +43,12 @@ namespace OpenSim.Region.Environment.Interfaces
44 void sendLandUpdateToAvatarsOverMe(); 43 void sendLandUpdateToAvatarsOverMe();
45 44
46 void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client); 45 void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client);
47 void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); 46 void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client);
48 bool isEitherBannedOrRestricted(LLUUID avatar); 47 bool isEitherBannedOrRestricted(LLUUID avatar);
49 bool isBannedFromLand(LLUUID avatar); 48 bool isBannedFromLand(LLUUID avatar);
50 bool isRestrictedFromLand(LLUUID avatar); 49 bool isRestrictedFromLand(LLUUID avatar);
51 void sendLandUpdateToClient(IClientAPI remote_client); 50 void sendLandUpdateToClient(IClientAPI remote_client);
52 ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag); 51 List<LLUUID> createAccessListArrayByFlag(ParcelManager.AccessList flag);
53 void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); 52 void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, IClientAPI remote_client);
54 void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client); 53 void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
55 void updateLandBitmapByteArray(); 54 void updateLandBitmapByteArray();
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs
index 9ac3cc3..4454c38 100644
--- a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs
@@ -672,11 +672,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land
672 sendParcelOverlay(remote_client); 672 sendParcelOverlay(remote_client);
673 } 673 }
674 674
675 public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) 675 public void handleParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client)
676 { 676 {
677 if (landList.ContainsKey(packet.ParcelData.LocalID)) 677 if (landList.ContainsKey(localID))
678 { 678 {
679 landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); 679 landList[localID].updateLandProperties(args, remote_client);
680 } 680 }
681 } 681 }
682 682
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs
index 628ea04..891e1db 100644
--- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs
+++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets;
33using log4net; 32using log4net;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
@@ -121,123 +120,35 @@ namespace OpenSim.Region.Environment.Modules.World.Land
121 120
122 #region Packet Request Handling 121 #region Packet Request Handling
123 122
124 /// <summary> 123 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
125 /// Sends land properties as requested 124 {
126 /// </summary> 125 remote_client.sendLandProperties(remote_client, sequence_id, snap_selection, request_result, landData, m_scene.RegionInfo.EstateSettings.objectBonusFactor, m_scene.objectCapacity);
127 /// <param name="sequence_id">ID sent by client for them to keep track of</param>
128 /// <param name="snap_selection">Bool sent by client for them to use</param>
129 /// <param name="remote_client">Object representing the client</param>
130 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result,
131 IClientAPI remote_client)
132 {
133 ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties);
134 // TODO: don't create new blocks if recycling an old packet
135
136 updatePacket.ParcelData.AABBMax = landData.AABBMax;
137 updatePacket.ParcelData.AABBMin = landData.AABBMin;
138 updatePacket.ParcelData.Area = landData.area;
139 updatePacket.ParcelData.AuctionID = landData.auctionID;
140 updatePacket.ParcelData.AuthBuyerID = landData.authBuyerID; //unemplemented
141
142 updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray;
143
144 updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc);
145 updatePacket.ParcelData.Category = (byte) landData.category;
146 updatePacket.ParcelData.ClaimDate = landData.claimDate;
147 updatePacket.ParcelData.ClaimPrice = landData.claimPrice;
148 updatePacket.ParcelData.GroupID = landData.groupID;
149 updatePacket.ParcelData.GroupPrims = landData.groupPrims;
150 updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned;
151 updatePacket.ParcelData.LandingType = (byte) landData.landingType;
152 updatePacket.ParcelData.LocalID = landData.localID;
153 if (landData.area > 0)
154 {
155 updatePacket.ParcelData.MaxPrims =
156 Convert.ToInt32(
157 Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity *
158 Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor)));
159 }
160 else
161 {
162 updatePacket.ParcelData.MaxPrims = 0;
163 }
164 updatePacket.ParcelData.MediaAutoScale = landData.mediaAutoScale;
165 updatePacket.ParcelData.MediaID = landData.mediaID;
166 updatePacket.ParcelData.MediaURL = Helpers.StringToField(landData.mediaURL);
167 updatePacket.ParcelData.MusicURL = Helpers.StringToField(landData.musicURL);
168 updatePacket.ParcelData.Name = Helpers.StringToField(landData.landName);
169 updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
170 updatePacket.ParcelData.OtherCount = 0; //unemplemented
171 updatePacket.ParcelData.OtherPrims = landData.otherPrims;
172 updatePacket.ParcelData.OwnerID = landData.ownerID;
173 updatePacket.ParcelData.OwnerPrims = landData.ownerPrims;
174 updatePacket.ParcelData.ParcelFlags = landData.landFlags;
175 updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.EstateSettings.objectBonusFactor;
176 updatePacket.ParcelData.PassHours = landData.passHours;
177 updatePacket.ParcelData.PassPrice = landData.passPrice;
178 updatePacket.ParcelData.PublicCount = 0; //unemplemented
179
180 uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags;
181 updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) >
182 0);
183 updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) >
184 0);
185 updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) >
186 0);
187 updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) >
188 0);
189
190 updatePacket.ParcelData.RentPrice = 0;
191 updatePacket.ParcelData.RequestResult = request_result;
192 updatePacket.ParcelData.SalePrice = landData.salePrice;
193 updatePacket.ParcelData.SelectedPrims = landData.selectedPrims;
194 updatePacket.ParcelData.SelfCount = 0; //unemplemented
195 updatePacket.ParcelData.SequenceID = sequence_id;
196 if (landData.simwideArea > 0)
197 {
198 updatePacket.ParcelData.SimWideMaxPrims =
199 Convert.ToInt32(
200 Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * m_scene.objectCapacity *
201 Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor)));
202 }
203 else
204 {
205 updatePacket.ParcelData.SimWideMaxPrims = 0;
206 }
207 updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims;
208 updatePacket.ParcelData.SnapSelection = snap_selection;
209 updatePacket.ParcelData.SnapshotID = landData.snapshotID;
210 updatePacket.ParcelData.Status = (byte) landData.landStatus;
211 updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims +
212 landData.selectedPrims;
213 updatePacket.ParcelData.UserLocation = landData.userLocation;
214 updatePacket.ParcelData.UserLookAt = landData.userLookAt;
215 remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task);
216 } 126 }
217 127
218 public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) 128 public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
219 { 129 {
220 if (remote_client.AgentId == landData.ownerID) 130 if (remote_client.AgentId == landData.ownerID)
221 { 131 {
222 //Needs later group support 132 //Needs later group support
223 LandData newData = landData.Copy(); 133 LandData newData = landData.Copy();
224 newData.authBuyerID = packet.ParcelData.AuthBuyerID; 134
225 newData.category = (Parcel.ParcelCategory) packet.ParcelData.Category; 135 newData.authBuyerID = args.AuthBuyerID;
226 newData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); 136 newData.category = args.Category;
227 newData.groupID = packet.ParcelData.GroupID; 137 newData.landDesc = args.Desc;
228 newData.landingType = packet.ParcelData.LandingType; 138 newData.groupID = args.GroupID;
229 newData.mediaAutoScale = packet.ParcelData.MediaAutoScale; 139 newData.landingType = args.LandingType;
230 newData.mediaID = packet.ParcelData.MediaID; 140 newData.mediaAutoScale = args.MediaAutoScale;
231 newData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); 141 newData.mediaID = args.MediaID;
232 newData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); 142 newData.mediaURL = args.MediaURL;
233 newData.landName = Helpers.FieldToUTF8String(packet.ParcelData.Name); 143 newData.musicURL = args.MusicURL;
234 newData.landFlags = packet.ParcelData.ParcelFlags; 144 newData.landName = args.Name;
235 newData.passHours = packet.ParcelData.PassHours; 145 newData.landFlags = args.ParcelFlags;
236 newData.passPrice = packet.ParcelData.PassPrice; 146 newData.passHours = args.PassHours;
237 newData.salePrice = packet.ParcelData.SalePrice; 147 newData.passPrice = args.PassPrice;
238 newData.snapshotID = packet.ParcelData.SnapshotID; 148 newData.salePrice = args.SalePrice;
239 newData.userLocation = packet.ParcelData.UserLocation; 149 newData.snapshotID = args.SnapshotID;
240 newData.userLookAt = packet.ParcelData.UserLookAt; 150 newData.userLocation = args.UserLocation;
151 newData.userLookAt = args.UserLookAt;
241 152
242 m_scene.LandChannel.updateLandObject(landData.localID, newData); 153 m_scene.LandChannel.updateLandObject(landData.localID, newData);
243 154
@@ -351,63 +262,38 @@ namespace OpenSim.Region.Environment.Modules.World.Land
351 262
352 #region AccessList Functions 263 #region AccessList Functions
353 264
354 public ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag) 265 public List<LLUUID> createAccessListArrayByFlag(ParcelManager.AccessList flag)
355 { 266 {
356 List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); 267 List<LLUUID> list = new List<LLUUID>();
357 foreach (ParcelManager.ParcelAccessEntry entry in landData.parcelAccessList) 268 foreach (ParcelManager.ParcelAccessEntry entry in landData.parcelAccessList)
358 { 269 {
359 if (entry.Flags == flag) 270 if (entry.Flags == flag)
360 { 271 {
361 ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); 272 list.Add(entry.AgentID);
362
363 listBlock.Flags = (uint) 0;
364 listBlock.ID = entry.AgentID;
365 listBlock.Time = 0;
366
367 list.Add(listBlock);
368 } 273 }
369 } 274 }
370 275 if(list.Count == 0)
371 if (list.Count == 0)
372 { 276 {
373 ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); 277 list.Add(LLUUID.Zero);
374
375 listBlock.Flags = (uint) 0;
376 listBlock.ID = LLUUID.Zero;
377 listBlock.Time = 0;
378
379 list.Add(listBlock);
380 } 278 }
381 return list.ToArray(); 279
280 return list;
382 } 281 }
383 282
384 public void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, 283 public void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID,
385 IClientAPI remote_client) 284 IClientAPI remote_client)
386 { 285 {
387 ParcelAccessListReplyPacket replyPacket;
388 286
389 if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) 287 if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both)
390 { 288 {
391 replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); 289 List<LLUUID> avatars = createAccessListArrayByFlag(ParcelManager.AccessList.Access);
392 replyPacket.Data.AgentID = agentID; 290 remote_client.sendLandAccessListData(avatars,(uint) ParcelManager.AccessList.Access,landData.localID);
393 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access;
394 replyPacket.Data.LocalID = landData.localID;
395 replyPacket.Data.SequenceID = 0;
396
397 replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access);
398 remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
399 } 291 }
400 292
401 if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) 293 if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both)
402 { 294 {
403 replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); 295 List<LLUUID> avatars = createAccessListArrayByFlag(ParcelManager.AccessList.Ban);
404 replyPacket.Data.AgentID = agentID; 296 remote_client.sendLandAccessListData(avatars, (uint)ParcelManager.AccessList.Ban, landData.localID);
405 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban;
406 replyPacket.Data.LocalID = landData.localID;
407 replyPacket.Data.SequenceID = 0;
408
409 replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban);
410 remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
411 } 297 }
412 } 298 }
413 299
@@ -721,43 +607,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
721 } 607 }
722 } 608 }
723 609
724 610 remote_client.sendForceClientSelectObjects(resultLocalIDs);
725 bool firstCall = true;
726 int MAX_OBJECTS_PER_PACKET = 251;
727 ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect);
728 // TODO: don't create new blocks if recycling an old packet
729 ForceObjectSelectPacket.DataBlock[] data;
730 while (resultLocalIDs.Count > 0)
731 {
732 if (firstCall)
733 {
734 pack._Header.ResetList = true;
735 firstCall = false;
736 }
737 else
738 {
739 pack._Header.ResetList = false;
740 }
741
742 if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET)
743 {
744 data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET];
745 }
746 else
747 {
748 data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count];
749 }
750
751 int i;
752 for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++)
753 {
754 data[i] = new ForceObjectSelectPacket.DataBlock();
755 data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]);
756 resultLocalIDs.RemoveAt(0);
757 }
758 pack.Data = data;
759 remote_client.OutPacket((Packet) pack, ThrottleOutPacketType.Task);
760 }
761 } 611 }
762 612
763 /// <summary> 613 /// <summary>
@@ -771,9 +621,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
771 public void sendLandObjectOwners(IClientAPI remote_client) 621 public void sendLandObjectOwners(IClientAPI remote_client)
772 { 622 {
773 Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>(); 623 Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>();
774 ParcelObjectOwnersReplyPacket pack
775 = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply);
776 // TODO: don't create new blocks if recycling an old packet
777 624
778 foreach (SceneObjectGroup obj in primsOverMe) 625 foreach (SceneObjectGroup obj in primsOverMe)
779 { 626 {
@@ -798,43 +645,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
798 } 645 }
799 } 646 }
800 647
801 int notifyCount = primCount.Count; 648 remote_client.sendLandObjectOwners(primCount);
802
803 if (notifyCount > 0)
804 {
805 if (notifyCount > 32)
806 {
807 m_log.InfoFormat(
808 "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
809 + " - a developer might want to investigate whether this is a hard limit", 32);
810
811 notifyCount = 32;
812 }
813
814 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
815 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
816
817 int num = 0;
818 foreach (LLUUID owner in primCount.Keys)
819 {
820 dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock();
821 dataBlock[num].Count = primCount[owner];
822 dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added
823 dataBlock[num].OnlineStatus = true; //TODO: fix me later
824 dataBlock[num].OwnerID = owner;
825
826 num++;
827
828 if (num >= notifyCount)
829 {
830 break;
831 }
832 }
833
834 pack.Data = dataBlock;
835 }
836
837 remote_client.OutPacket(pack, ThrottleOutPacketType.Task);
838 } 649 }
839 650
840 public Dictionary<LLUUID, int> getLandObjectOwners() 651 public Dictionary<LLUUID, int> getLandObjectOwners()
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 3a64698..79bc7d0 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -645,5 +645,18 @@ namespace OpenSim.Region.Examples.SimpleModule
645 public void sendDetailedEstateData(LLUUID invoice) 645 public void sendDetailedEstateData(LLUUID invoice)
646 { 646 {
647 } 647 }
648
649 public void sendLandProperties(IClientAPI remote_client, int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int simObjectCapacity)
650 {
651 }
652 public void sendLandAccessListData(List<LLUUID> avatars, uint accessFlag, int localLandID)
653 {
654 }
655 public void sendForceClientSelectObjects(List<uint> objectIDs)
656 {
657 }
658 public void sendLandObjectOwners(Dictionary<LLUUID, int> ownersAndCount)
659 {
660 }
648 } 661 }
649} 662}