diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 220 |
1 files changed, 217 insertions, 3 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: |