ClientView.ProcessPackets.cs 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. /*
  2. * Copyright (c) Contributors, http://www.openmetaverse.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. *
  27. */
  28. using System;
  29. using System.Collections.Generic;
  30. using System.Text;
  31. using libsecondlife;
  32. using libsecondlife.Packets;
  33. using OpenSim.Framework.Inventory;
  34. using OpenSim.Framework.Types;
  35. using OpenSim.Framework.Utilities;
  36. namespace OpenSim.Region.ClientStack
  37. {
  38. public partial class ClientView
  39. {
  40. protected override void ProcessInPacket(Packet Pack)
  41. {
  42. ack_pack(Pack);
  43. if (debug)
  44. {
  45. if (Pack.Type != PacketType.AgentUpdate)
  46. {
  47. Console.WriteLine(CircuitCode + ":IN: " + Pack.Type.ToString());
  48. }
  49. }
  50. if (this.ProcessPacketMethod(Pack))
  51. {
  52. //there is a handler registered that handled this packet type
  53. return;
  54. }
  55. else
  56. {
  57. Encoding _enc = Encoding.ASCII;
  58. switch (Pack.Type)
  59. {
  60. case PacketType.ViewerEffect:
  61. ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
  62. foreach (ClientView client in m_clientThreads.Values)
  63. {
  64. if (client.AgentID != this.AgentID)
  65. {
  66. viewer.AgentData.AgentID = client.AgentID;
  67. viewer.AgentData.SessionID = client.SessionID;
  68. client.OutPacket(viewer);
  69. }
  70. }
  71. break;
  72. #region World/Avatar
  73. case PacketType.ChatFromViewer:
  74. ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
  75. if (Util.FieldToString(inchatpack.ChatData.Message) == "")
  76. {
  77. //empty message so don't bother with it
  78. break;
  79. }
  80. string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
  81. byte[] message = inchatpack.ChatData.Message;
  82. byte type = inchatpack.ChatData.Type;
  83. LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos;
  84. LLUUID fromAgentID = AgentID;
  85. if (OnChatFromViewer != null)
  86. {
  87. this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID);
  88. }
  89. break;
  90. case PacketType.ImprovedInstantMessage:
  91. ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
  92. string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
  93. string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message);
  94. if (OnInstantMessage != null)
  95. {
  96. this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.MessageBlock.ToAgentID,
  97. msgpack.MessageBlock.Timestamp, IMfromName, IMmessage);
  98. }
  99. break;
  100. case PacketType.RezObject:
  101. RezObjectPacket rezPacket = (RezObjectPacket)Pack;
  102. AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
  103. if (inven != null)
  104. {
  105. if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID))
  106. {
  107. AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID);
  108. if (asset != null)
  109. {
  110. if (OnRezObject != null)
  111. {
  112. this.OnRezObject(asset, rezPacket.RezData.RayEnd);
  113. this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID);
  114. }
  115. }
  116. }
  117. }
  118. break;
  119. case PacketType.DeRezObject:
  120. if (OnDeRezObject != null)
  121. {
  122. OnDeRezObject(Pack, this);
  123. }
  124. break;
  125. case PacketType.ModifyLand:
  126. ModifyLandPacket modify = (ModifyLandPacket)Pack;
  127. if (modify.ParcelData.Length > 0)
  128. {
  129. if (OnModifyTerrain != null)
  130. {
  131. OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize,
  132. modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West);
  133. }
  134. }
  135. break;
  136. case PacketType.RegionHandshakeReply:
  137. if (OnRegionHandShakeReply != null)
  138. {
  139. OnRegionHandShakeReply(this);
  140. }
  141. break;
  142. case PacketType.AgentWearablesRequest:
  143. if (OnRequestWearables != null)
  144. {
  145. OnRequestWearables(this);
  146. }
  147. if (OnRequestAvatarsData != null)
  148. {
  149. OnRequestAvatarsData(this);
  150. }
  151. break;
  152. case PacketType.AgentSetAppearance:
  153. AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
  154. if (OnSetAppearance != null)
  155. {
  156. OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
  157. }
  158. break;
  159. case PacketType.CompleteAgentMovement:
  160. if (OnCompleteMovementToRegion != null)
  161. {
  162. OnCompleteMovementToRegion();
  163. }
  164. break;
  165. case PacketType.AgentUpdate:
  166. if (OnAgentUpdate != null)
  167. {
  168. AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
  169. OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation);
  170. }
  171. break;
  172. case PacketType.AgentAnimation:
  173. if (!m_child)
  174. {
  175. AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
  176. for (int i = 0; i < AgentAni.AnimationList.Length; i++)
  177. {
  178. if (AgentAni.AnimationList[i].StartAnim)
  179. {
  180. if (OnStartAnim != null)
  181. {
  182. OnStartAnim(AgentAni.AnimationList[i].AnimID, 1);
  183. }
  184. }
  185. }
  186. }
  187. break;
  188. #endregion
  189. #region Objects/Prims
  190. case PacketType.ObjectLink:
  191. // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString());
  192. ObjectLinkPacket link = (ObjectLinkPacket)Pack;
  193. uint parentprimid = 0;
  194. List<uint> childrenprims = new List<uint>();
  195. if (link.ObjectData.Length > 1)
  196. {
  197. parentprimid = link.ObjectData[0].ObjectLocalID;
  198. for (int i = 1; i < link.ObjectData.Length; i++)
  199. {
  200. childrenprims.Add(link.ObjectData[i].ObjectLocalID);
  201. }
  202. }
  203. if (OnLinkObjects != null)
  204. {
  205. OnLinkObjects(parentprimid, childrenprims);
  206. }
  207. break;
  208. case PacketType.ObjectAdd:
  209. if (OnAddPrim != null)
  210. {
  211. OnAddPrim(Pack, this);
  212. }
  213. break;
  214. case PacketType.ObjectShape:
  215. ObjectShapePacket shape = (ObjectShapePacket)Pack;
  216. for (int i = 0; i < shape.ObjectData.Length; i++)
  217. {
  218. if (OnUpdatePrimShape != null)
  219. {
  220. OnUpdatePrimShape(shape.ObjectData[i].ObjectLocalID, shape.ObjectData[i]);
  221. }
  222. }
  223. break;
  224. case PacketType.ObjectDuplicate:
  225. ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack;
  226. for (int i = 0; i < dupe.ObjectData.Length; i++)
  227. {
  228. if (OnObjectDuplicate != null)
  229. {
  230. OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags);
  231. }
  232. }
  233. break;
  234. case PacketType.ObjectSelect:
  235. ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
  236. for (int i = 0; i < incomingselect.ObjectData.Length; i++)
  237. {
  238. if (OnObjectSelect != null)
  239. {
  240. OnObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this);
  241. }
  242. }
  243. break;
  244. case PacketType.ObjectFlagUpdate:
  245. ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
  246. if (OnUpdatePrimFlags != null)
  247. {
  248. OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this);
  249. }
  250. break;
  251. case PacketType.ObjectImage:
  252. ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
  253. for (int i = 0; i < imagePack.ObjectData.Length; i++)
  254. {
  255. if (OnUpdatePrimTexture != null)
  256. {
  257. OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this);
  258. }
  259. }
  260. break;
  261. case PacketType.ObjectGrab:
  262. ObjectGrabPacket grap = (ObjectGrabPacket)Pack;
  263. if (OnGrapObject != null)
  264. {
  265. OnGrapObject(grap.ObjectData.LocalID, grap.ObjectData.GrabOffset, this);
  266. }
  267. break;
  268. case PacketType.ObjectGrabUpdate:
  269. ObjectGrabUpdatePacket grapUpdate = (ObjectGrabUpdatePacket)Pack;
  270. if (OnGrapUpdate != null)
  271. {
  272. OnGrapUpdate(grapUpdate.ObjectData.ObjectID, grapUpdate.ObjectData.GrabOffsetInitial, grapUpdate.ObjectData.GrabPosition, this);
  273. }
  274. break;
  275. case PacketType.ObjectDeGrab:
  276. ObjectDeGrabPacket deGrap = (ObjectDeGrabPacket)Pack;
  277. if (OnDeGrapObject != null)
  278. {
  279. OnDeGrapObject(deGrap.ObjectData.LocalID, this);
  280. }
  281. break;
  282. case PacketType.ObjectDescription:
  283. ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack;
  284. for (int i = 0; i < objDes.ObjectData.Length; i++)
  285. {
  286. if (OnObjectDescription != null)
  287. {
  288. OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description));
  289. }
  290. }
  291. break;
  292. case PacketType.ObjectName:
  293. ObjectNamePacket objName = (ObjectNamePacket)Pack;
  294. for (int i = 0; i < objName.ObjectData.Length; i++)
  295. {
  296. if (OnObjectName != null)
  297. {
  298. OnObjectName(objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name));
  299. }
  300. }
  301. break;
  302. case PacketType.ObjectPermissions:
  303. //Console.WriteLine("permissions set " + Pack.ToString());
  304. break;
  305. #endregion
  306. #region Inventory/Asset/Other related packets
  307. case PacketType.RequestImage:
  308. RequestImagePacket imageRequest = (RequestImagePacket)Pack;
  309. for (int i = 0; i < imageRequest.RequestImage.Length; i++)
  310. {
  311. m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
  312. }
  313. break;
  314. case PacketType.TransferRequest:
  315. //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
  316. TransferRequestPacket transfer = (TransferRequestPacket)Pack;
  317. m_assetCache.AddAssetRequest(this, transfer);
  318. break;
  319. case PacketType.AssetUploadRequest:
  320. AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
  321. this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID));
  322. break;
  323. case PacketType.RequestXfer:
  324. //Console.WriteLine(Pack.ToString());
  325. break;
  326. case PacketType.SendXferPacket:
  327. this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack);
  328. break;
  329. case PacketType.CreateInventoryFolder:
  330. CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
  331. m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
  332. //Console.WriteLine(Pack.ToString());
  333. break;
  334. case PacketType.CreateInventoryItem:
  335. //Console.WriteLine(Pack.ToString());
  336. CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
  337. if (createItem.InventoryBlock.TransactionID != LLUUID.Zero)
  338. {
  339. this.UploadAssets.CreateInventoryItem(createItem);
  340. }
  341. else
  342. {
  343. // Console.Write(Pack.ToString());
  344. this.CreateInventoryItem(createItem);
  345. }
  346. break;
  347. case PacketType.FetchInventory:
  348. //Console.WriteLine("fetch item packet");
  349. FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
  350. m_inventoryCache.FetchInventory(this, FetchInventory);
  351. break;
  352. case PacketType.FetchInventoryDescendents:
  353. FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
  354. m_inventoryCache.FetchInventoryDescendents(this, Fetch);
  355. break;
  356. case PacketType.UpdateInventoryItem:
  357. UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
  358. //Console.WriteLine(Pack.ToString());
  359. for (int i = 0; i < update.InventoryData.Length; i++)
  360. {
  361. if (update.InventoryData[i].TransactionID != LLUUID.Zero)
  362. {
  363. AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
  364. if (asset != null)
  365. {
  366. // Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache");
  367. m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
  368. }
  369. else
  370. {
  371. asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
  372. if (asset != null)
  373. {
  374. //Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache");
  375. m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset);
  376. }
  377. else
  378. {
  379. //Console.WriteLine("trying to update inventory item, but asset is null");
  380. }
  381. }
  382. }
  383. else
  384. {
  385. m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ;
  386. }
  387. }
  388. break;
  389. case PacketType.RequestTaskInventory:
  390. // Console.WriteLine(Pack.ToString());
  391. RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
  392. ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
  393. //bool foundent = false;
  394. /* foreach (Entity ent in m_world.Entities.Values)
  395. {
  396. if (ent.localid == requesttask.InventoryData.LocalID)
  397. {
  398. replytask.InventoryData.TaskID = ent.uuid;
  399. replytask.InventoryData.Serial = 0;
  400. replytask.InventoryData.Filename = new byte[0];
  401. foundent = true;
  402. }
  403. }
  404. if (foundent)
  405. {
  406. this.OutPacket(replytask);
  407. }*/
  408. break;
  409. case PacketType.UpdateTaskInventory:
  410. // Console.WriteLine(Pack.ToString());
  411. UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
  412. AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
  413. /*if (myinventory != null)
  414. {
  415. if (updatetask.UpdateData.Key == 0)
  416. {
  417. if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null)
  418. {
  419. if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7)
  420. {
  421. LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID;
  422. AssetBase assBase = this.m_assetCache.GetAsset(noteaid);
  423. if (assBase != null)
  424. {
  425. foreach (Entity ent in m_world.Entities.Values)
  426. {
  427. if (ent.localid == updatetask.UpdateData.LocalID)
  428. {
  429. if (ent is OpenSim.world.Primitive)
  430. {
  431. this.m_world.AddScript(ent, Util.FieldToString(assBase.Data));
  432. }
  433. }
  434. }
  435. }
  436. }
  437. }
  438. }
  439. }*/
  440. break;
  441. case PacketType.MapLayerRequest:
  442. this.RequestMapLayer();
  443. break;
  444. case PacketType.MapBlockRequest:
  445. MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
  446. if (OnRequestMapBlocks != null)
  447. {
  448. OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
  449. }
  450. break;
  451. case PacketType.TeleportLandmarkRequest:
  452. TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
  453. TeleportStartPacket tpStart = new TeleportStartPacket();
  454. tpStart.Info.TeleportFlags = 8; // tp via lm
  455. this.OutPacket(tpStart);
  456. TeleportProgressPacket tpProgress = new TeleportProgressPacket();
  457. tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark");
  458. tpProgress.Info.TeleportFlags = 8;
  459. tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
  460. this.OutPacket(tpProgress);
  461. // Fetch landmark
  462. LLUUID lmid = tpReq.Info.LandmarkID;
  463. AssetBase lma = this.m_assetCache.GetAsset(lmid);
  464. if (lma != null)
  465. {
  466. AssetLandmark lm = new AssetLandmark(lma);
  467. if (lm.RegionID == m_world.RegionInfo.SimUUID)
  468. {
  469. TeleportLocalPacket tpLocal = new TeleportLocalPacket();
  470. tpLocal.Info.AgentID = tpReq.Info.AgentID;
  471. tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
  472. tpLocal.Info.LocationID = 2;
  473. tpLocal.Info.Position = lm.Position;
  474. OutPacket(tpLocal);
  475. }
  476. else
  477. {
  478. TeleportCancelPacket tpCancel = new TeleportCancelPacket();
  479. tpCancel.Info.AgentID = tpReq.Info.AgentID;
  480. tpCancel.Info.SessionID = tpReq.Info.SessionID;
  481. OutPacket(tpCancel);
  482. }
  483. }
  484. else
  485. {
  486. Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
  487. TeleportCancelPacket tpCancel = new TeleportCancelPacket();
  488. tpCancel.Info.AgentID = tpReq.Info.AgentID;
  489. tpCancel.Info.SessionID = tpReq.Info.SessionID;
  490. OutPacket(tpCancel);
  491. }
  492. break;
  493. case PacketType.TeleportLocationRequest:
  494. TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
  495. // Console.WriteLine(tpLocReq.ToString());
  496. if (OnTeleportLocationRequest != null)
  497. {
  498. OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16);
  499. }
  500. else
  501. {
  502. //no event handler so cancel request
  503. TeleportCancelPacket tpCancel = new TeleportCancelPacket();
  504. tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
  505. tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
  506. OutPacket(tpCancel);
  507. }
  508. break;
  509. #endregion
  510. case PacketType.MoneyBalanceRequest:
  511. this.SendMoneyBalance(LLUUID.Zero, true, new byte[0], 1000);
  512. break;
  513. case PacketType.UUIDNameRequest:
  514. UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack;
  515. foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock)
  516. {
  517. OnNameFromUUIDRequest(UUIDBlock.ID, this);
  518. }
  519. break;
  520. #region Parcel related packets
  521. case PacketType.ParcelPropertiesRequest:
  522. ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack;
  523. if (OnParcelPropertiesRequest != null)
  524. {
  525. OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this);
  526. }
  527. break;
  528. case PacketType.ParcelDivide:
  529. ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack;
  530. if (OnParcelDivideRequest != null)
  531. {
  532. OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this);
  533. }
  534. break;
  535. case PacketType.ParcelJoin:
  536. ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack;
  537. if (OnParcelJoinRequest != null)
  538. {
  539. OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this);
  540. }
  541. break;
  542. case PacketType.ParcelPropertiesUpdate:
  543. ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack;
  544. if (OnParcelPropertiesUpdateRequest != null)
  545. {
  546. OnParcelPropertiesUpdateRequest(updatePacket, this);
  547. }
  548. break;
  549. #endregion
  550. #region Estate Packets
  551. case PacketType.EstateOwnerMessage:
  552. EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
  553. if (OnEstateOwnerMessage != null)
  554. {
  555. OnEstateOwnerMessage(messagePacket, this);
  556. }
  557. break;
  558. #endregion
  559. #region unimplemented handlers
  560. case PacketType.AgentIsNowWearing:
  561. // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
  562. //Console.WriteLine(Pack.ToString());
  563. break;
  564. case PacketType.ObjectScale:
  565. //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString());
  566. break;
  567. #endregion
  568. }
  569. }
  570. }
  571. }
  572. }