PageRenderTime 94ms CodeModel.GetById 19ms RepoModel.GetById 2ms app.codeStats 1ms

/OpenMetaverse/Modules/Messages/LindenMessages.cs

https://bitbucket.org/VirtualReality/3rdparty-addon-modules
C# | 5118 lines | 3318 code | 633 blank | 1167 comment | 230 complexity | ce551f116872504928a4a59e327729de MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. * Copyright (c) 2009, openmetaverse.org
  3. * All rights reserved.
  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. *
  8. * - Redistributions of source code must retain the above copyright notice, this
  9. * list of conditions and the following disclaimer.
  10. * - Neither the name of the openmetaverse.org nor the names
  11. * of its contributors may be used to endorse or promote products derived from
  12. * this software without specific prior written permission.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  15. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  17. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  18. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  19. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  20. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  21. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  22. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  23. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  24. * POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. using System;
  27. using System.Collections.Generic;
  28. using System.Net;
  29. using OpenMetaverse.StructuredData;
  30. using OpenMetaverse.Interfaces;
  31. namespace OpenMetaverse.Messages.Linden
  32. {
  33. #region Teleport/Region/Movement Messages
  34. /// <summary>
  35. /// Sent to the client to indicate a teleport request has completed
  36. /// </summary>
  37. public class TeleportFinishMessage : IMessage
  38. {
  39. /// <summary>The <see cref="UUID"/> of the agent</summary>
  40. public UUID AgentID;
  41. /// <summary></summary>
  42. public int LocationID;
  43. /// <summary>The simulators handle the agent teleported to</summary>
  44. public ulong RegionHandle;
  45. /// <summary>A Uri which contains a list of Capabilities the simulator supports</summary>
  46. public Uri SeedCapability;
  47. /// <summary>Indicates the level of access required
  48. /// to access the simulator, or the content rating, or the simulators
  49. /// map status</summary>
  50. public SimAccess SimAccess;
  51. /// <summary>The IP Address of the simulator</summary>
  52. public IPAddress IP;
  53. /// <summary>The UDP Port the simulator will listen for UDP traffic on</summary>
  54. public int Port;
  55. /// <summary>Status flags indicating the state of the Agent upon arrival, Flying, etc.</summary>
  56. public TeleportFlags Flags;
  57. /// <summary>
  58. /// Serialize the object
  59. /// </summary>
  60. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  61. public OSDMap Serialize()
  62. {
  63. OSDMap map = new OSDMap(1);
  64. OSDArray infoArray = new OSDArray(1);
  65. OSDMap info = new OSDMap(8);
  66. info.Add("AgentID", OSD.FromUUID(AgentID));
  67. info.Add("LocationID", OSD.FromInteger(LocationID)); // Unused by the client
  68. info.Add("RegionHandle", OSD.FromULong(RegionHandle));
  69. info.Add("SeedCapability", OSD.FromUri(SeedCapability));
  70. info.Add("SimAccess", OSD.FromInteger((byte)SimAccess));
  71. info.Add("SimIP", MessageUtils.FromIP(IP));
  72. info.Add("SimPort", OSD.FromInteger(Port));
  73. info.Add("TeleportFlags", OSD.FromUInteger((uint)Flags));
  74. infoArray.Add(info);
  75. map.Add("Info", infoArray);
  76. return map;
  77. }
  78. /// <summary>
  79. /// Deserialize the message
  80. /// </summary>
  81. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  82. public void Deserialize(OSDMap map)
  83. {
  84. OSDArray array = (OSDArray)map["Info"];
  85. OSDMap blockMap = (OSDMap)array[0];
  86. AgentID = blockMap["AgentID"].AsUUID();
  87. LocationID = blockMap["LocationID"].AsInteger();
  88. RegionHandle = blockMap["RegionHandle"].AsULong();
  89. SeedCapability = blockMap["SeedCapability"].AsUri();
  90. SimAccess = (SimAccess)blockMap["SimAccess"].AsInteger();
  91. IP = MessageUtils.ToIP(blockMap["SimIP"]);
  92. Port = blockMap["SimPort"].AsInteger();
  93. Flags = (TeleportFlags)blockMap["TeleportFlags"].AsUInteger();
  94. }
  95. }
  96. /// <summary>
  97. /// Sent to the viewer when a neighboring simulator is requesting the agent make a connection to it.
  98. /// </summary>
  99. public class EstablishAgentCommunicationMessage : IMessage
  100. {
  101. public UUID AgentID;
  102. public IPAddress Address;
  103. public int Port;
  104. public Uri SeedCapability;
  105. /// <summary>
  106. /// Serialize the object
  107. /// </summary>
  108. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  109. public OSDMap Serialize()
  110. {
  111. OSDMap map = new OSDMap(3);
  112. map["agent-id"] = OSD.FromUUID(AgentID);
  113. map["sim-ip-and-port"] = OSD.FromString(String.Format("{0}:{1}", Address, Port));
  114. map["seed-capability"] = OSD.FromUri(SeedCapability);
  115. return map;
  116. }
  117. /// <summary>
  118. /// Deserialize the message
  119. /// </summary>
  120. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  121. public void Deserialize(OSDMap map)
  122. {
  123. string ipAndPort = map["sim-ip-and-port"].AsString();
  124. int i = ipAndPort.IndexOf(':');
  125. AgentID = map["agent-id"].AsUUID();
  126. Address = IPAddress.Parse(ipAndPort.Substring(0, i));
  127. Port = Int32.Parse(ipAndPort.Substring(i + 1));
  128. SeedCapability = map["seed-capability"].AsUri();
  129. }
  130. }
  131. public class CrossedRegionMessage : IMessage
  132. {
  133. public Vector3 LookAt;
  134. public Vector3 Position;
  135. public UUID AgentID;
  136. public UUID SessionID;
  137. public ulong RegionHandle;
  138. public Uri SeedCapability;
  139. public IPAddress IP;
  140. public int Port;
  141. /// <summary>
  142. /// Serialize the object
  143. /// </summary>
  144. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  145. public OSDMap Serialize()
  146. {
  147. OSDMap map = new OSDMap(3);
  148. OSDArray infoArray = new OSDArray(1);
  149. OSDMap infoMap = new OSDMap(2);
  150. infoMap["LookAt"] = OSD.FromVector3(LookAt);
  151. infoMap["Position"] = OSD.FromVector3(Position);
  152. infoArray.Add(infoMap);
  153. map["Info"] = infoArray;
  154. OSDArray agentDataArray = new OSDArray(1);
  155. OSDMap agentDataMap = new OSDMap(2);
  156. agentDataMap["AgentID"] = OSD.FromUUID(AgentID);
  157. agentDataMap["SessionID"] = OSD.FromUUID(SessionID);
  158. agentDataArray.Add(agentDataMap);
  159. map["AgentData"] = agentDataArray;
  160. OSDArray regionDataArray = new OSDArray(1);
  161. OSDMap regionDataMap = new OSDMap(4);
  162. regionDataMap["RegionHandle"] = OSD.FromULong(RegionHandle);
  163. regionDataMap["SeedCapability"] = OSD.FromUri(SeedCapability);
  164. regionDataMap["SimIP"] = MessageUtils.FromIP(IP);
  165. regionDataMap["SimPort"] = OSD.FromInteger(Port);
  166. regionDataArray.Add(regionDataMap);
  167. map["RegionData"] = regionDataArray;
  168. return map;
  169. }
  170. /// <summary>
  171. /// Deserialize the message
  172. /// </summary>
  173. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  174. public void Deserialize(OSDMap map)
  175. {
  176. OSDMap infoMap = (OSDMap)((OSDArray)map["Info"])[0];
  177. LookAt = infoMap["LookAt"].AsVector3();
  178. Position = infoMap["Position"].AsVector3();
  179. OSDMap agentDataMap = (OSDMap)((OSDArray)map["AgentData"])[0];
  180. AgentID = agentDataMap["AgentID"].AsUUID();
  181. SessionID = agentDataMap["SessionID"].AsUUID();
  182. OSDMap regionDataMap = (OSDMap)((OSDArray)map["RegionData"])[0];
  183. RegionHandle = regionDataMap["RegionHandle"].AsULong();
  184. SeedCapability = regionDataMap["SeedCapability"].AsUri();
  185. IP = MessageUtils.ToIP(regionDataMap["SimIP"]);
  186. Port = regionDataMap["SimPort"].AsInteger();
  187. }
  188. }
  189. public class EnableSimulatorMessage : IMessage
  190. {
  191. public class SimulatorInfoBlock
  192. {
  193. public ulong RegionHandle;
  194. public IPAddress IP;
  195. public int Port;
  196. }
  197. public SimulatorInfoBlock[] Simulators;
  198. /// <summary>
  199. /// Serialize the object
  200. /// </summary>
  201. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  202. public OSDMap Serialize()
  203. {
  204. OSDMap map = new OSDMap(1);
  205. OSDArray array = new OSDArray(Simulators.Length);
  206. for (int i = 0; i < Simulators.Length; i++)
  207. {
  208. SimulatorInfoBlock block = Simulators[i];
  209. OSDMap blockMap = new OSDMap(3);
  210. blockMap["Handle"] = OSD.FromULong(block.RegionHandle);
  211. blockMap["IP"] = MessageUtils.FromIP(block.IP);
  212. blockMap["Port"] = OSD.FromInteger(block.Port);
  213. array.Add(blockMap);
  214. }
  215. map["SimulatorInfo"] = array;
  216. return map;
  217. }
  218. /// <summary>
  219. /// Deserialize the message
  220. /// </summary>
  221. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  222. public void Deserialize(OSDMap map)
  223. {
  224. OSDArray array = (OSDArray)map["SimulatorInfo"];
  225. Simulators = new SimulatorInfoBlock[array.Count];
  226. for (int i = 0; i < array.Count; i++)
  227. {
  228. OSDMap blockMap = (OSDMap)array[i];
  229. SimulatorInfoBlock block = new SimulatorInfoBlock();
  230. block.RegionHandle = blockMap["Handle"].AsULong();
  231. block.IP = MessageUtils.ToIP(blockMap["IP"]);
  232. block.Port = blockMap["Port"].AsInteger();
  233. Simulators[i] = block;
  234. }
  235. }
  236. }
  237. /// <summary>
  238. /// A message sent to the client which indicates a teleport request has failed
  239. /// and contains some information on why it failed
  240. /// </summary>
  241. public class TeleportFailedMessage : IMessage
  242. {
  243. /// <summary></summary>
  244. public string ExtraParams;
  245. /// <summary>A string key of the reason the teleport failed e.g. CouldntTPCloser
  246. /// Which could be used to look up a value in a dictionary or enum</summary>
  247. public string MessageKey;
  248. /// <summary>The <see cref="UUID"/> of the Agent</summary>
  249. public UUID AgentID;
  250. /// <summary>A string human readable message containing the reason </summary>
  251. /// <remarks>An example: Could not teleport closer to destination</remarks>
  252. public string Reason;
  253. /// <summary>
  254. /// Serialize the object
  255. /// </summary>
  256. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  257. public OSDMap Serialize()
  258. {
  259. OSDMap map = new OSDMap(2);
  260. OSDMap alertInfoMap = new OSDMap(2);
  261. alertInfoMap["ExtraParams"] = OSD.FromString(ExtraParams);
  262. alertInfoMap["Message"] = OSD.FromString(MessageKey);
  263. OSDArray alertArray = new OSDArray();
  264. alertArray.Add(alertInfoMap);
  265. map["AlertInfo"] = alertArray;
  266. OSDMap infoMap = new OSDMap(2);
  267. infoMap["AgentID"] = OSD.FromUUID(AgentID);
  268. infoMap["Reason"] = OSD.FromString(Reason);
  269. OSDArray infoArray = new OSDArray();
  270. infoArray.Add(infoMap);
  271. map["Info"] = infoArray;
  272. return map;
  273. }
  274. /// <summary>
  275. /// Deserialize the message
  276. /// </summary>
  277. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  278. public void Deserialize(OSDMap map)
  279. {
  280. OSDArray alertInfoArray = (OSDArray)map["AlertInfo"];
  281. OSDMap alertInfoMap = (OSDMap)alertInfoArray[0];
  282. ExtraParams = alertInfoMap["ExtraParams"].AsString();
  283. MessageKey = alertInfoMap["Message"].AsString();
  284. OSDArray infoArray = (OSDArray)map["Info"];
  285. OSDMap infoMap = (OSDMap)infoArray[0];
  286. AgentID = infoMap["AgentID"].AsUUID();
  287. Reason = infoMap["Reason"].AsString();
  288. }
  289. }
  290. public class LandStatReplyMessage : IMessage
  291. {
  292. public uint ReportType;
  293. public uint RequestFlags;
  294. public uint TotalObjectCount;
  295. public class ReportDataBlock
  296. {
  297. public Vector3 Location;
  298. public string OwnerName;
  299. public float Score;
  300. public UUID TaskID;
  301. public uint TaskLocalID;
  302. public string TaskName;
  303. public float MonoScore;
  304. public DateTime TimeStamp;
  305. }
  306. public ReportDataBlock[] ReportDataBlocks;
  307. /// <summary>
  308. /// Serialize the object
  309. /// </summary>
  310. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  311. public OSDMap Serialize()
  312. {
  313. OSDMap map = new OSDMap(3);
  314. OSDMap requestDataMap = new OSDMap(3);
  315. requestDataMap["ReportType"] = OSD.FromUInteger(this.ReportType);
  316. requestDataMap["RequestFlags"] = OSD.FromUInteger(this.RequestFlags);
  317. requestDataMap["TotalObjectCount"] = OSD.FromUInteger(this.TotalObjectCount);
  318. OSDArray requestDatArray = new OSDArray();
  319. requestDatArray.Add(requestDataMap);
  320. map["RequestData"] = requestDatArray;
  321. OSDArray reportDataArray = new OSDArray();
  322. OSDArray dataExtendedArray = new OSDArray();
  323. for (int i = 0; i < ReportDataBlocks.Length; i++)
  324. {
  325. OSDMap reportMap = new OSDMap(8);
  326. reportMap["LocationX"] = OSD.FromReal(ReportDataBlocks[i].Location.X);
  327. reportMap["LocationY"] = OSD.FromReal(ReportDataBlocks[i].Location.Y);
  328. reportMap["LocationZ"] = OSD.FromReal(ReportDataBlocks[i].Location.Z);
  329. reportMap["OwnerName"] = OSD.FromString(ReportDataBlocks[i].OwnerName);
  330. reportMap["Score"] = OSD.FromReal(ReportDataBlocks[i].Score);
  331. reportMap["TaskID"] = OSD.FromUUID(ReportDataBlocks[i].TaskID);
  332. reportMap["TaskLocalID"] = OSD.FromReal(ReportDataBlocks[i].TaskLocalID);
  333. reportMap["TaskName"] = OSD.FromString(ReportDataBlocks[i].TaskName);
  334. reportDataArray.Add(reportMap);
  335. OSDMap extendedMap = new OSDMap(2);
  336. extendedMap["MonoScore"] = OSD.FromReal(ReportDataBlocks[i].MonoScore);
  337. extendedMap["TimeStamp"] = OSD.FromDate(ReportDataBlocks[i].TimeStamp);
  338. dataExtendedArray.Add(extendedMap);
  339. }
  340. map["ReportData"] = reportDataArray;
  341. map["DataExtended"] = dataExtendedArray;
  342. return map;
  343. }
  344. /// <summary>
  345. /// Deserialize the message
  346. /// </summary>
  347. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  348. public void Deserialize(OSDMap map)
  349. {
  350. OSDArray requestDataArray = (OSDArray)map["RequestData"];
  351. OSDMap requestMap = (OSDMap)requestDataArray[0];
  352. this.ReportType = requestMap["ReportType"].AsUInteger();
  353. this.RequestFlags = requestMap["RequestFlags"].AsUInteger();
  354. this.TotalObjectCount = requestMap["TotalObjectCount"].AsUInteger();
  355. if (TotalObjectCount < 1)
  356. {
  357. ReportDataBlocks = new ReportDataBlock[0];
  358. return;
  359. }
  360. OSDArray dataArray = (OSDArray)map["ReportData"];
  361. OSDArray dataExtendedArray = (OSDArray)map["DataExtended"];
  362. ReportDataBlocks = new ReportDataBlock[dataArray.Count];
  363. for (int i = 0; i < dataArray.Count; i++)
  364. {
  365. OSDMap blockMap = (OSDMap)dataArray[i];
  366. OSDMap extMap = (OSDMap)dataExtendedArray[i];
  367. ReportDataBlock block = new ReportDataBlock();
  368. block.Location = new Vector3(
  369. (float)blockMap["LocationX"].AsReal(),
  370. (float)blockMap["LocationY"].AsReal(),
  371. (float)blockMap["LocationZ"].AsReal());
  372. block.OwnerName = blockMap["OwnerName"].AsString();
  373. block.Score = (float)blockMap["Score"].AsReal();
  374. block.TaskID = blockMap["TaskID"].AsUUID();
  375. block.TaskLocalID = blockMap["TaskLocalID"].AsUInteger();
  376. block.TaskName = blockMap["TaskName"].AsString();
  377. block.MonoScore = (float)extMap["MonoScore"].AsReal();
  378. block.TimeStamp = Utils.UnixTimeToDateTime(extMap["TimeStamp"].AsUInteger());
  379. ReportDataBlocks[i] = block;
  380. }
  381. }
  382. }
  383. #endregion
  384. #region Parcel Messages
  385. /// <summary>
  386. /// Contains a list of prim owner information for a specific parcel in a simulator
  387. /// </summary>
  388. /// <remarks>
  389. /// A Simulator will always return at least 1 entry
  390. /// If agent does not have proper permission the OwnerID will be UUID.Zero
  391. /// If agent does not have proper permission OR there are no primitives on parcel
  392. /// the DataBlocksExtended map will not be sent from the simulator
  393. /// </remarks>
  394. public class ParcelObjectOwnersReplyMessage : IMessage
  395. {
  396. /// <summary>
  397. /// Prim ownership information for a specified owner on a single parcel
  398. /// </summary>
  399. public class PrimOwner
  400. {
  401. /// <summary>The <see cref="UUID"/> of the prim owner,
  402. /// UUID.Zero if agent has no permission to view prim owner information</summary>
  403. public UUID OwnerID;
  404. /// <summary>The total number of prims</summary>
  405. public int Count;
  406. /// <summary>True if the OwnerID is a <see cref="Group"/></summary>
  407. public bool IsGroupOwned;
  408. /// <summary>True if the owner is online
  409. /// <remarks>This is no longer used by the LL Simulators</remarks></summary>
  410. public bool OnlineStatus;
  411. /// <summary>The date the most recent prim was rezzed</summary>
  412. public DateTime TimeStamp;
  413. }
  414. /// <summary>An Array of <see cref="PrimOwner"/> objects</summary>
  415. public PrimOwner[] PrimOwnersBlock;
  416. /// <summary>
  417. /// Serialize the object
  418. /// </summary>
  419. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  420. public OSDMap Serialize()
  421. {
  422. OSDArray dataArray = new OSDArray(PrimOwnersBlock.Length);
  423. OSDArray dataExtendedArray = new OSDArray();
  424. for (int i = 0; i < PrimOwnersBlock.Length; i++)
  425. {
  426. OSDMap dataMap = new OSDMap(4);
  427. dataMap["OwnerID"] = OSD.FromUUID(PrimOwnersBlock[i].OwnerID);
  428. dataMap["Count"] = OSD.FromInteger(PrimOwnersBlock[i].Count);
  429. dataMap["IsGroupOwned"] = OSD.FromBoolean(PrimOwnersBlock[i].IsGroupOwned);
  430. dataMap["OnlineStatus"] = OSD.FromBoolean(PrimOwnersBlock[i].OnlineStatus);
  431. dataArray.Add(dataMap);
  432. OSDMap dataExtendedMap = new OSDMap(1);
  433. dataExtendedMap["TimeStamp"] = OSD.FromDate(PrimOwnersBlock[i].TimeStamp);
  434. dataExtendedArray.Add(dataExtendedMap);
  435. }
  436. OSDMap map = new OSDMap();
  437. map.Add("Data", dataArray);
  438. if (dataExtendedArray.Count > 0)
  439. map.Add("DataExtended", dataExtendedArray);
  440. return map;
  441. }
  442. /// <summary>
  443. /// Deserialize the message
  444. /// </summary>
  445. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  446. public void Deserialize(OSDMap map)
  447. {
  448. OSDArray dataArray = (OSDArray)map["Data"];
  449. // DataExtended is optional, will not exist of parcel contains zero prims
  450. OSDArray dataExtendedArray;
  451. if (map.ContainsKey("DataExtended"))
  452. {
  453. dataExtendedArray = (OSDArray)map["DataExtended"];
  454. }
  455. else
  456. {
  457. dataExtendedArray = new OSDArray();
  458. }
  459. PrimOwnersBlock = new PrimOwner[dataArray.Count];
  460. for (int i = 0; i < dataArray.Count; i++)
  461. {
  462. OSDMap dataMap = (OSDMap)dataArray[i];
  463. PrimOwner block = new PrimOwner();
  464. block.OwnerID = dataMap["OwnerID"].AsUUID();
  465. block.Count = dataMap["Count"].AsInteger();
  466. block.IsGroupOwned = dataMap["IsGroupOwned"].AsBoolean();
  467. block.OnlineStatus = dataMap["OnlineStatus"].AsBoolean(); // deprecated
  468. /* if the agent has no permissions, or there are no prims, the counts
  469. * should not match up, so we don't decode the DataExtended map */
  470. if (dataExtendedArray.Count == dataArray.Count)
  471. {
  472. OSDMap dataExtendedMap = (OSDMap)dataExtendedArray[i];
  473. block.TimeStamp = Utils.UnixTimeToDateTime(dataExtendedMap["TimeStamp"].AsUInteger());
  474. }
  475. PrimOwnersBlock[i] = block;
  476. }
  477. }
  478. }
  479. /// <summary>
  480. /// The details of a single parcel in a region, also contains some regionwide globals
  481. /// </summary>
  482. [Serializable]
  483. public class ParcelPropertiesMessage : IMessage
  484. {
  485. /// <summary>Simulator-local ID of this parcel</summary>
  486. public int LocalID;
  487. /// <summary>Maximum corner of the axis-aligned bounding box for this
  488. /// parcel</summary>
  489. public Vector3 AABBMax;
  490. /// <summary>Minimum corner of the axis-aligned bounding box for this
  491. /// parcel</summary>
  492. public Vector3 AABBMin;
  493. /// <summary>Total parcel land area</summary>
  494. public int Area;
  495. /// <summary></summary>
  496. public uint AuctionID;
  497. /// <summary>Key of authorized buyer</summary>
  498. public UUID AuthBuyerID;
  499. /// <summary>Bitmap describing land layout in 4x4m squares across the
  500. /// entire region</summary>
  501. public byte[] Bitmap;
  502. /// <summary></summary>
  503. public ParcelCategory Category;
  504. /// <summary>Date land was claimed</summary>
  505. public DateTime ClaimDate;
  506. /// <summary>Appears to always be zero</summary>
  507. public int ClaimPrice;
  508. /// <summary>Parcel Description</summary>
  509. public string Desc;
  510. /// <summary></summary>
  511. public ParcelFlags ParcelFlags;
  512. /// <summary></summary>
  513. public UUID GroupID;
  514. /// <summary>Total number of primitives owned by the parcel group on
  515. /// this parcel</summary>
  516. public int GroupPrims;
  517. /// <summary>Whether the land is deeded to a group or not</summary>
  518. public bool IsGroupOwned;
  519. /// <summary></summary>
  520. public LandingType LandingType;
  521. /// <summary>Maximum number of primitives this parcel supports</summary>
  522. public int MaxPrims;
  523. /// <summary>The Asset UUID of the Texture which when applied to a
  524. /// primitive will display the media</summary>
  525. public UUID MediaID;
  526. /// <summary>A URL which points to any Quicktime supported media type</summary>
  527. public string MediaURL;
  528. /// <summary>A byte, if 0x1 viewer should auto scale media to fit object</summary>
  529. public bool MediaAutoScale;
  530. /// <summary>URL For Music Stream</summary>
  531. public string MusicURL;
  532. /// <summary>Parcel Name</summary>
  533. public string Name;
  534. /// <summary>Autoreturn value in minutes for others' objects</summary>
  535. public int OtherCleanTime;
  536. /// <summary></summary>
  537. public int OtherCount;
  538. /// <summary>Total number of other primitives on this parcel</summary>
  539. public int OtherPrims;
  540. /// <summary>UUID of the owner of this parcel</summary>
  541. public UUID OwnerID;
  542. /// <summary>Total number of primitives owned by the parcel owner on
  543. /// this parcel</summary>
  544. public int OwnerPrims;
  545. /// <summary></summary>
  546. public float ParcelPrimBonus;
  547. /// <summary>How long is pass valid for</summary>
  548. public float PassHours;
  549. /// <summary>Price for a temporary pass</summary>
  550. public int PassPrice;
  551. /// <summary></summary>
  552. public int PublicCount;
  553. /// <summary>Disallows people outside the parcel from being able to see in</summary>
  554. public bool Privacy;
  555. /// <summary></summary>
  556. public bool RegionDenyAnonymous;
  557. /// <summary></summary>
  558. public bool RegionDenyIdentified;
  559. /// <summary></summary>
  560. public bool RegionDenyTransacted;
  561. /// <summary>True if the region denies access to age unverified users</summary>
  562. public bool RegionDenyAgeUnverified;
  563. /// <summary></summary>
  564. public bool RegionPushOverride;
  565. /// <summary>This field is no longer used</summary>
  566. public int RentPrice;
  567. /// The result of a request for parcel properties
  568. public ParcelResult RequestResult;
  569. /// <summary>Sale price of the parcel, only useful if ForSale is set</summary>
  570. /// <remarks>The SalePrice will remain the same after an ownership
  571. /// transfer (sale), so it can be used to see the purchase price after
  572. /// a sale if the new owner has not changed it</remarks>
  573. public int SalePrice;
  574. /// <summary>
  575. /// Number of primitives your avatar is currently
  576. /// selecting and sitting on in this parcel
  577. /// </summary>
  578. public int SelectedPrims;
  579. /// <summary></summary>
  580. public int SelfCount;
  581. /// <summary>
  582. /// A number which increments by 1, starting at 0 for each ParcelProperties request.
  583. /// Can be overriden by specifying the sequenceID with the ParcelPropertiesRequest being sent.
  584. /// a Negative number indicates the action in <seealso cref="ParcelPropertiesStatus"/> has occurred.
  585. /// </summary>
  586. public int SequenceID;
  587. /// <summary>Maximum primitives across the entire simulator</summary>
  588. public int SimWideMaxPrims;
  589. /// <summary>Total primitives across the entire simulator</summary>
  590. public int SimWideTotalPrims;
  591. /// <summary></summary>
  592. public bool SnapSelection;
  593. /// <summary>Key of parcel snapshot</summary>
  594. public UUID SnapshotID;
  595. /// <summary>Parcel ownership status</summary>
  596. public ParcelStatus Status;
  597. /// <summary>Total number of primitives on this parcel</summary>
  598. public int TotalPrims;
  599. /// <summary></summary>
  600. public Vector3 UserLocation;
  601. /// <summary></summary>
  602. public Vector3 UserLookAt;
  603. /// <summary>A description of the media</summary>
  604. public string MediaDesc;
  605. /// <summary>An Integer which represents the height of the media</summary>
  606. public int MediaHeight;
  607. /// <summary>An integer which represents the width of the media</summary>
  608. public int MediaWidth;
  609. /// <summary>A boolean, if true the viewer should loop the media</summary>
  610. public bool MediaLoop;
  611. /// <summary>A string which contains the mime type of the media</summary>
  612. public string MediaType;
  613. /// <summary>true to obscure (hide) media url</summary>
  614. public bool ObscureMedia;
  615. /// <summary>true to obscure (hide) music url</summary>
  616. public bool ObscureMusic;
  617. /// <summary>
  618. /// Serialize the object
  619. /// </summary>
  620. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  621. public OSDMap Serialize()
  622. {
  623. OSDMap map = new OSDMap(3);
  624. OSDArray dataArray = new OSDArray(1);
  625. OSDMap parcelDataMap = new OSDMap(47);
  626. parcelDataMap["LocalID"] = OSD.FromInteger(LocalID);
  627. parcelDataMap["AABBMax"] = OSD.FromVector3(AABBMax);
  628. parcelDataMap["AABBMin"] = OSD.FromVector3(AABBMin);
  629. parcelDataMap["Area"] = OSD.FromInteger(Area);
  630. parcelDataMap["AuctionID"] = OSD.FromInteger(AuctionID);
  631. parcelDataMap["AuthBuyerID"] = OSD.FromUUID(AuthBuyerID);
  632. parcelDataMap["Bitmap"] = OSD.FromBinary(Bitmap);
  633. parcelDataMap["Category"] = OSD.FromInteger((int)Category);
  634. parcelDataMap["ClaimDate"] = OSD.FromDate(ClaimDate);
  635. parcelDataMap["ClaimPrice"] = OSD.FromInteger(ClaimPrice);
  636. parcelDataMap["Desc"] = OSD.FromString(Desc);
  637. parcelDataMap["ParcelFlags"] = OSD.FromUInteger((uint)ParcelFlags);
  638. parcelDataMap["GroupID"] = OSD.FromUUID(GroupID);
  639. parcelDataMap["GroupPrims"] = OSD.FromInteger(GroupPrims);
  640. parcelDataMap["IsGroupOwned"] = OSD.FromBoolean(IsGroupOwned);
  641. parcelDataMap["LandingType"] = OSD.FromInteger((int)LandingType);
  642. parcelDataMap["MaxPrims"] = OSD.FromInteger(MaxPrims);
  643. parcelDataMap["MediaID"] = OSD.FromUUID(MediaID);
  644. parcelDataMap["MediaURL"] = OSD.FromString(MediaURL);
  645. parcelDataMap["MediaAutoScale"] = OSD.FromBoolean(MediaAutoScale);
  646. parcelDataMap["MusicURL"] = OSD.FromString(MusicURL);
  647. parcelDataMap["Name"] = OSD.FromString(Name);
  648. parcelDataMap["OtherCleanTime"] = OSD.FromInteger(OtherCleanTime);
  649. parcelDataMap["OtherCount"] = OSD.FromInteger(OtherCount);
  650. parcelDataMap["OtherPrims"] = OSD.FromInteger(OtherPrims);
  651. parcelDataMap["OwnerID"] = OSD.FromUUID(OwnerID);
  652. parcelDataMap["OwnerPrims"] = OSD.FromInteger(OwnerPrims);
  653. parcelDataMap["ParcelPrimBonus"] = OSD.FromReal((float)ParcelPrimBonus);
  654. parcelDataMap["PassHours"] = OSD.FromReal((float)PassHours);
  655. parcelDataMap["PassPrice"] = OSD.FromInteger(PassPrice);
  656. parcelDataMap["PublicCount"] = OSD.FromInteger(PublicCount);
  657. parcelDataMap["Privacy"] = OSD.FromBoolean(Privacy);
  658. parcelDataMap["RegionDenyAnonymous"] = OSD.FromBoolean(RegionDenyAnonymous);
  659. parcelDataMap["RegionDenyIdentified"] = OSD.FromBoolean(RegionDenyIdentified);
  660. parcelDataMap["RegionDenyTransacted"] = OSD.FromBoolean(RegionDenyTransacted);
  661. parcelDataMap["RegionPushOverride"] = OSD.FromBoolean(RegionPushOverride);
  662. parcelDataMap["RentPrice"] = OSD.FromInteger(RentPrice);
  663. parcelDataMap["RequestResult"] = OSD.FromInteger((int)RequestResult);
  664. parcelDataMap["SalePrice"] = OSD.FromInteger(SalePrice);
  665. parcelDataMap["SelectedPrims"] = OSD.FromInteger(SelectedPrims);
  666. parcelDataMap["SelfCount"] = OSD.FromInteger(SelfCount);
  667. parcelDataMap["SequenceID"] = OSD.FromInteger(SequenceID);
  668. parcelDataMap["SimWideMaxPrims"] = OSD.FromInteger(SimWideMaxPrims);
  669. parcelDataMap["SimWideTotalPrims"] = OSD.FromInteger(SimWideTotalPrims);
  670. parcelDataMap["SnapSelection"] = OSD.FromBoolean(SnapSelection);
  671. parcelDataMap["SnapshotID"] = OSD.FromUUID(SnapshotID);
  672. parcelDataMap["Status"] = OSD.FromInteger((int)Status);
  673. parcelDataMap["TotalPrims"] = OSD.FromInteger(TotalPrims);
  674. parcelDataMap["UserLocation"] = OSD.FromVector3(UserLocation);
  675. parcelDataMap["UserLookAt"] = OSD.FromVector3(UserLookAt);
  676. dataArray.Add(parcelDataMap);
  677. map["ParcelData"] = dataArray;
  678. OSDArray mediaDataArray = new OSDArray(1);
  679. OSDMap mediaDataMap = new OSDMap(7);
  680. mediaDataMap["MediaDesc"] = OSD.FromString(MediaDesc);
  681. mediaDataMap["MediaHeight"] = OSD.FromInteger(MediaHeight);
  682. mediaDataMap["MediaWidth"] = OSD.FromInteger(MediaWidth);
  683. mediaDataMap["MediaLoop"] = OSD.FromBoolean(MediaLoop);
  684. mediaDataMap["MediaType"] = OSD.FromString(MediaType);
  685. mediaDataMap["ObscureMedia"] = OSD.FromBoolean(ObscureMedia);
  686. mediaDataMap["ObscureMusic"] = OSD.FromBoolean(ObscureMusic);
  687. mediaDataArray.Add(mediaDataMap);
  688. map["MediaData"] = mediaDataArray;
  689. OSDArray ageVerificationBlockArray = new OSDArray(1);
  690. OSDMap ageVerificationBlockMap = new OSDMap(1);
  691. ageVerificationBlockMap["RegionDenyAgeUnverified"] = OSD.FromBoolean(RegionDenyAgeUnverified);
  692. ageVerificationBlockArray.Add(ageVerificationBlockMap);
  693. map["AgeVerificationBlock"] = ageVerificationBlockArray;
  694. return map;
  695. }
  696. /// <summary>
  697. /// Deserialize the message
  698. /// </summary>
  699. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  700. public void Deserialize(OSDMap map)
  701. {
  702. OSDMap parcelDataMap = (OSDMap)((OSDArray)map["ParcelData"])[0];
  703. LocalID = parcelDataMap["LocalID"].AsInteger();
  704. AABBMax = parcelDataMap["AABBMax"].AsVector3();
  705. AABBMin = parcelDataMap["AABBMin"].AsVector3();
  706. Area = parcelDataMap["Area"].AsInteger();
  707. AuctionID = (uint)parcelDataMap["AuctionID"].AsInteger();
  708. AuthBuyerID = parcelDataMap["AuthBuyerID"].AsUUID();
  709. Bitmap = parcelDataMap["Bitmap"].AsBinary();
  710. Category = (ParcelCategory)parcelDataMap["Category"].AsInteger();
  711. ClaimDate = Utils.UnixTimeToDateTime((uint)parcelDataMap["ClaimDate"].AsInteger());
  712. ClaimPrice = parcelDataMap["ClaimPrice"].AsInteger();
  713. Desc = parcelDataMap["Desc"].AsString();
  714. // LL sends this as binary, we'll convert it here
  715. if (parcelDataMap["ParcelFlags"].Type == OSDType.Binary)
  716. {
  717. byte[] bytes = parcelDataMap["ParcelFlags"].AsBinary();
  718. if (BitConverter.IsLittleEndian)
  719. Array.Reverse(bytes);
  720. ParcelFlags = (ParcelFlags)BitConverter.ToUInt32(bytes, 0);
  721. }
  722. else
  723. {
  724. ParcelFlags = (ParcelFlags)parcelDataMap["ParcelFlags"].AsUInteger();
  725. }
  726. GroupID = parcelDataMap["GroupID"].AsUUID();
  727. GroupPrims = parcelDataMap["GroupPrims"].AsInteger();
  728. IsGroupOwned = parcelDataMap["IsGroupOwned"].AsBoolean();
  729. LandingType = (LandingType)parcelDataMap["LandingType"].AsInteger();
  730. MaxPrims = parcelDataMap["MaxPrims"].AsInteger();
  731. MediaID = parcelDataMap["MediaID"].AsUUID();
  732. MediaURL = parcelDataMap["MediaURL"].AsString();
  733. MediaAutoScale = parcelDataMap["MediaAutoScale"].AsBoolean(); // 0x1 = yes
  734. MusicURL = parcelDataMap["MusicURL"].AsString();
  735. Name = parcelDataMap["Name"].AsString();
  736. OtherCleanTime = parcelDataMap["OtherCleanTime"].AsInteger();
  737. OtherCount = parcelDataMap["OtherCount"].AsInteger();
  738. OtherPrims = parcelDataMap["OtherPrims"].AsInteger();
  739. OwnerID = parcelDataMap["OwnerID"].AsUUID();
  740. OwnerPrims = parcelDataMap["OwnerPrims"].AsInteger();
  741. ParcelPrimBonus = (float)parcelDataMap["ParcelPrimBonus"].AsReal();
  742. PassHours = (float)parcelDataMap["PassHours"].AsReal();
  743. PassPrice = parcelDataMap["PassPrice"].AsInteger();
  744. PublicCount = parcelDataMap["PublicCount"].AsInteger();
  745. Privacy = parcelDataMap["Privacy"].AsBoolean();
  746. RegionDenyAnonymous = parcelDataMap["RegionDenyAnonymous"].AsBoolean();
  747. RegionDenyIdentified = parcelDataMap["RegionDenyIdentified"].AsBoolean();
  748. RegionDenyTransacted = parcelDataMap["RegionDenyTransacted"].AsBoolean();
  749. RegionPushOverride = parcelDataMap["RegionPushOverride"].AsBoolean();
  750. RentPrice = parcelDataMap["RentPrice"].AsInteger();
  751. RequestResult = (ParcelResult)parcelDataMap["RequestResult"].AsInteger();
  752. SalePrice = parcelDataMap["SalePrice"].AsInteger();
  753. SelectedPrims = parcelDataMap["SelectedPrims"].AsInteger();
  754. SelfCount = parcelDataMap["SelfCount"].AsInteger();
  755. SequenceID = parcelDataMap["SequenceID"].AsInteger();
  756. SimWideMaxPrims = parcelDataMap["SimWideMaxPrims"].AsInteger();
  757. SimWideTotalPrims = parcelDataMap["SimWideTotalPrims"].AsInteger();
  758. SnapSelection = parcelDataMap["SnapSelection"].AsBoolean();
  759. SnapshotID = parcelDataMap["SnapshotID"].AsUUID();
  760. Status = (ParcelStatus)parcelDataMap["Status"].AsInteger();
  761. TotalPrims = parcelDataMap["TotalPrims"].AsInteger();
  762. UserLocation = parcelDataMap["UserLocation"].AsVector3();
  763. UserLookAt = parcelDataMap["UserLookAt"].AsVector3();
  764. if (map.ContainsKey("MediaData")) // temporary, OpenSim doesn't send this block
  765. {
  766. OSDMap mediaDataMap = (OSDMap)((OSDArray)map["MediaData"])[0];
  767. MediaDesc = mediaDataMap["MediaDesc"].AsString();
  768. MediaHeight = mediaDataMap["MediaHeight"].AsInteger();
  769. MediaWidth = mediaDataMap["MediaWidth"].AsInteger();
  770. MediaLoop = mediaDataMap["MediaLoop"].AsBoolean();
  771. MediaType = mediaDataMap["MediaType"].AsString();
  772. ObscureMedia = mediaDataMap["ObscureMedia"].AsBoolean();
  773. ObscureMusic = mediaDataMap["ObscureMusic"].AsBoolean();
  774. }
  775. OSDMap ageVerificationBlockMap = (OSDMap)((OSDArray)map["AgeVerificationBlock"])[0];
  776. RegionDenyAgeUnverified = ageVerificationBlockMap["RegionDenyAgeUnverified"].AsBoolean();
  777. }
  778. }
  779. /// <summary>A message sent from the viewer to the simulator to updated a specific parcels settings</summary>
  780. public class ParcelPropertiesUpdateMessage : IMessage
  781. {
  782. /// <summary>The <seealso cref="UUID"/> of the agent authorized to purchase this
  783. /// parcel of land or a NULL <seealso cref="UUID"/> if the sale is authorized to anyone</summary>
  784. public UUID AuthBuyerID;
  785. /// <summary>true to enable auto scaling of the parcel media</summary>
  786. public bool MediaAutoScale;
  787. /// <summary>The category of this parcel used when search is enabled to restrict
  788. /// search results</summary>
  789. public ParcelCategory Category;
  790. /// <summary>A string containing the description to set</summary>
  791. public string Desc;
  792. /// <summary>The <seealso cref="UUID"/> of the <seealso cref="Group"/> which allows for additional
  793. /// powers and restrictions.</summary>
  794. public UUID GroupID;
  795. /// <summary>The <seealso cref="LandingType"/> which specifies how avatars which teleport
  796. /// to this parcel are handled</summary>
  797. public LandingType Landing;
  798. /// <summary>The LocalID of the parcel to update settings on</summary>
  799. public int LocalID;
  800. /// <summary>A string containing the description of the media which can be played
  801. /// to visitors</summary>
  802. public string MediaDesc;
  803. /// <summary></summary>
  804. public int MediaHeight;
  805. /// <summary></summary>
  806. public bool MediaLoop;
  807. /// <summary></summary>
  808. public UUID MediaID;
  809. /// <summary></summary>
  810. public string MediaType;
  811. /// <summary></summary>
  812. public string MediaURL;
  813. /// <summary></summary>
  814. public int MediaWidth;
  815. /// <summary></summary>
  816. public string MusicURL;
  817. /// <summary></summary>
  818. public string Name;
  819. /// <summary></summary>
  820. public bool ObscureMedia;
  821. /// <summary></summary>
  822. public bool ObscureMusic;
  823. /// <summary></summary>
  824. public ParcelFlags ParcelFlags;
  825. /// <summary></summary>
  826. public float PassHours;
  827. /// <summary></summary>
  828. public uint PassPrice;
  829. /// <summary></summary>
  830. public bool Privacy;
  831. /// <summary></summary>
  832. public uint SalePrice;
  833. /// <summary></summary>
  834. public UUID SnapshotID;
  835. /// <summary></summary>
  836. public Vector3 UserLocation;
  837. /// <summary></summary>
  838. public Vector3 UserLookAt;
  839. /// <summary>
  840. /// Deserialize the message
  841. /// </summary>
  842. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  843. public void Deserialize(OSDMap map)
  844. {
  845. AuthBuyerID = map["auth_buyer_id"].AsUUID();
  846. MediaAutoScale = map["auto_scale"].AsBoolean();
  847. Category = (ParcelCategory)map["category"].AsInteger();
  848. Desc = map["description"].AsString();
  849. GroupID = map["group_id"].AsUUID();
  850. Landing = (LandingType)map["landing_type"].AsUInteger();
  851. LocalID = map["local_id"].AsInteger();
  852. MediaDesc = map["media_desc"].AsString();
  853. MediaHeight = map["media_height"].AsInteger();
  854. MediaLoop = map["media_loop"].AsBoolean();
  855. MediaID = map["media_id"].AsUUID();
  856. MediaType = map["media_type"].AsString();
  857. MediaURL = map["media_url"].AsString();
  858. MediaWidth = map["media_width"].AsInteger();
  859. MusicURL = map["music_url"].AsString();
  860. Name = map["name"].AsString();
  861. ObscureMedia = map["obscure_media"].AsBoolean();
  862. ObscureMusic = map["obscure_music"].AsBoolean();
  863. ParcelFlags = (ParcelFlags)map["parcel_flags"].AsUInteger();
  864. PassHours = (float)map["pass_hours"].AsReal();
  865. PassPrice = map["pass_price"].AsUInteger();
  866. Privacy = map["privacy"].AsBoolean();
  867. SalePrice = map["sale_price"].AsUInteger();
  868. SnapshotID = map["snapshot_id"].AsUUID();
  869. UserLocation = map["user_location"].AsVector3();
  870. UserLookAt = map["user_look_at"].AsVector3();
  871. }
  872. /// <summary>
  873. /// Serialize the object
  874. /// </summary>
  875. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  876. public OSDMap Serialize()
  877. {
  878. OSDMap map = new OSDMap();
  879. map["auth_buyer_id"] = OSD.FromUUID(AuthBuyerID);
  880. map["auto_scale"] = OSD.FromBoolean(MediaAutoScale);
  881. map["category"] = OSD.FromInteger((byte)Category);
  882. map["description"] = OSD.FromString(Desc);
  883. map["flags"] = OSD.FromBinary(Utils.EmptyBytes);
  884. map["group_id"] = OSD.FromUUID(GroupID);
  885. map["landing_type"] = OSD.FromInteger((byte)Landing);
  886. map["local_id"] = OSD.FromInteger(LocalID);
  887. map["media_desc"] = OSD.FromString(MediaDesc);
  888. map["media_height"] = OSD.FromInteger(MediaHeight);
  889. map["media_id"] = OSD.FromUUID(MediaID);
  890. map["media_loop"] = OSD.FromBoolean(MediaLoop);
  891. map["media_type"] = OSD.FromString(MediaType);
  892. map["media_url"] = OSD.FromString(MediaURL);
  893. map["media_width"] = OSD.FromInteger(MediaWidth);
  894. map["music_url"] = OSD.FromString(MusicURL);
  895. map["name"] = OSD.FromString(Name);
  896. map["obscure_media"] = OSD.FromBoolean(ObscureMedia);
  897. map["obscure_music"] = OSD.FromBoolean(ObscureMusic);
  898. map["parcel_flags"] = OSD.FromUInteger((uint)ParcelFlags);
  899. map["pass_hours"] = OSD.FromReal(PassHours);
  900. map["privacy"] = OSD.FromBoolean(Privacy);
  901. map["pass_price"] = OSD.FromInteger(PassPrice);
  902. map["sale_price"] = OSD.FromInteger(SalePrice);
  903. map["snapshot_id"] = OSD.FromUUID(SnapshotID);
  904. map["user_location"] = OSD.FromVector3(UserLocation);
  905. map["user_look_at"] = OSD.FromVector3(UserLookAt);
  906. return map;
  907. }
  908. }
  909. /// <summary>Base class used for the RemoteParcelRequest message</summary>
  910. [Serializable]
  911. public abstract class RemoteParcelRequestBlock
  912. {
  913. public abstract OSDMap Serialize();
  914. public abstract void Deserialize(OSDMap map);
  915. }
  916. /// <summary>
  917. /// A message sent from the viewer to the simulator to request information
  918. /// on a remote parcel
  919. /// </summary>
  920. public class RemoteParcelRequestRequest : RemoteParcelRequestBlock
  921. {
  922. /// <summary>Local sim position of the parcel we are looking up</summary>
  923. public Vector3 Location;
  924. /// <summary>Region handle of the parcel we are looking up</summary>
  925. public ulong RegionHandle;
  926. /// <summary>Region <see cref="UUID"/> of the parcel we are looking up</summary>
  927. public UUID RegionID;
  928. /// <summary>
  929. /// Serialize the object
  930. /// </summary>
  931. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  932. public override OSDMap Serialize()
  933. {
  934. OSDMap map = new OSDMap(3);
  935. map["location"] = OSD.FromVector3(Location);
  936. map["region_handle"] = OSD.FromULong(RegionHandle);
  937. map["region_id"] = OSD.FromUUID(RegionID);
  938. return map;
  939. }
  940. /// <summary>
  941. /// Deserialize the message
  942. /// </summary>
  943. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  944. public override void Deserialize(OSDMap map)
  945. {
  946. Location = map["location"].AsVector3();
  947. RegionHandle = map["region_handle"].AsULong();
  948. RegionID = map["region_id"].AsUUID();
  949. }
  950. }
  951. /// <summary>
  952. /// A message sent from the simulator to the viewer in response to a <see cref="RemoteParcelRequestRequest"/>
  953. /// which will contain parcel information
  954. /// </summary>
  955. [Serializable]
  956. public class RemoteParcelRequestReply : RemoteParcelRequestBlock
  957. {
  958. /// <summary>The grid-wide unique parcel ID</summary>
  959. public UUID ParcelID;
  960. /// <summary>
  961. /// Serialize the object
  962. /// </summary>
  963. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  964. public override OSDMap Serialize()
  965. {
  966. OSDMap map = new OSDMap(1);
  967. map["parcel_id"] = OSD.FromUUID(ParcelID);
  968. return map;
  969. }
  970. /// <summary>
  971. /// Deserialize the message
  972. /// </summary>
  973. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  974. public override void Deserialize(OSDMap map)
  975. {
  976. if (map == null || !map.ContainsKey("parcel_id"))
  977. ParcelID = UUID.Zero;
  978. else
  979. ParcelID = map["parcel_id"].AsUUID();
  980. }
  981. }
  982. /// <summary>
  983. /// A message containing a request for a remote parcel from a viewer, or a response
  984. /// from the simulator to that request
  985. /// </summary>
  986. [Serializable]
  987. public class RemoteParcelRequestMessage : IMessage
  988. {
  989. /// <summary>The request or response details block</summary>
  990. public RemoteParcelRequestBlock Request;
  991. /// <summary>
  992. /// Serialize the object
  993. /// </summary>
  994. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  995. public OSDMap Serialize()
  996. {
  997. return Request.Serialize();
  998. }
  999. /// <summary>
  1000. /// Deserialize the message
  1001. /// </summary>
  1002. /// <param name="map">An <see cref="OSDMap"/> containing the data</param>
  1003. public void Deserialize(OSDMap map)
  1004. {
  1005. if (map.ContainsKey("parcel_id"))
  1006. Request = new RemoteParcelRequestReply();
  1007. else if (map.ContainsKey("location"))
  1008. Request = new RemoteParcelRequestRequest();
  1009. else
  1010. Logger.Log("Unable to deserialize RemoteParcelRequest: No message handler exists for method: " + map.AsString(), Helpers.LogLevel.Warning);
  1011. if (Request != null)
  1012. Request.Deserialize(map);
  1013. }
  1014. }
  1015. #endregion
  1016. #region Inventory Messages
  1017. public class NewFileAgentInventoryMessage : IMessage
  1018. {
  1019. public UUID FolderID;
  1020. public AssetType AssetType;
  1021. public InventoryType InventoryType;
  1022. public string Name;
  1023. public string Description;
  1024. public PermissionMask EveryoneMask;
  1025. public PermissionMask GroupMask;
  1026. public PermissionMask NextOwnerMask;
  1027. /// <summary>
  1028. /// Serialize the object
  1029. /// </summary>
  1030. /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
  1031. public OSDMap Serialize()
  1032. {
  1033. OSDMap map = new OSDMap(5);
  1034. map["folder_id"] = OSD.FromUUID(FolderID);
  1035. map["asset_type"] = OSD.FromString(Utils.AssetTypeToString(AssetType));
  1036. map["inventory_type"] = OSD.FromString(Utils.InventoryTypeToString(InventoryType));
  1037. map["name"] = OSD.FromString(Name);
  1038. map["description"] = OSD.FromString(Description);
  1039. map["everyone_mask"] = OSD.FromInteger((int)EveryoneMask)

Large files files are truncated, but you can click here to view the full file