aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandObject.cs259
2 files changed, 38 insertions, 227 deletions
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()