LandData.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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. using System;
  28. using System.Collections.Generic;
  29. using OpenMetaverse;
  30. namespace OpenSim.Framework
  31. {
  32. /// <summary>
  33. /// Details of a Parcel of land
  34. /// </summary>
  35. public class LandData
  36. {
  37. private Vector3 _AABBMax = new Vector3();
  38. private Vector3 _AABBMin = new Vector3();
  39. private int _area = 0;
  40. private uint _auctionID = 0; //Unemplemented. If set to 0, not being auctioned
  41. private UUID _authBuyerID = UUID.Zero; //Unemplemented. Authorized Buyer's UUID
  42. private ParcelCategory _category = ParcelCategory.None; //Unemplemented. Parcel's chosen category
  43. private int _claimDate = 0;
  44. private int _claimPrice = 0; //Unemplemented
  45. private UUID _globalID = UUID.Zero;
  46. private UUID _groupID = UUID.Zero;
  47. private int _groupPrims = 0;
  48. private bool _isGroupOwned = false;
  49. private byte[] _bitmap = new byte[512];
  50. private string _description = String.Empty;
  51. private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark |
  52. (uint) ParcelFlags.AllowAPrimitiveEntry |
  53. (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform |
  54. (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts |
  55. (uint) ParcelFlags.SoundLocal;
  56. private byte _landingType = 0;
  57. private string _name = "Your Parcel";
  58. private ParcelStatus _status = ParcelStatus.Leased;
  59. private int _localID = 0;
  60. private byte _mediaAutoScale = 0;
  61. private UUID _mediaID = UUID.Zero;
  62. private string _mediaURL = String.Empty;
  63. private string _musicURL = String.Empty;
  64. private int _otherPrims = 0;
  65. private UUID _ownerID = UUID.Zero;
  66. private int _ownerPrims = 0;
  67. private List<ParcelManager.ParcelAccessEntry> _parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
  68. private float _passHours = 0;
  69. private int _passPrice = 0;
  70. private int _salePrice = 0; //Unemeplemented. Parcels price.
  71. private int _selectedPrims = 0;
  72. private int _simwideArea = 0;
  73. private int _simwidePrims = 0;
  74. private UUID _snapshotID = UUID.Zero;
  75. private Vector3 _userLocation = new Vector3();
  76. private Vector3 _userLookAt = new Vector3();
  77. private int _dwell = 0;
  78. private int _otherCleanTime = 0;
  79. /// <summary>
  80. /// Upper corner of the AABB for the parcel
  81. /// </summary>
  82. public Vector3 AABBMax {
  83. get {
  84. return _AABBMax;
  85. }
  86. set {
  87. _AABBMax = value;
  88. }
  89. }
  90. /// <summary>
  91. /// Lower corner of the AABB for the parcel
  92. /// </summary>
  93. public Vector3 AABBMin {
  94. get {
  95. return _AABBMin;
  96. }
  97. set {
  98. _AABBMin = value;
  99. }
  100. }
  101. /// <summary>
  102. /// Area in meters^2 the parcel contains
  103. /// </summary>
  104. public int Area {
  105. get {
  106. return _area;
  107. }
  108. set {
  109. _area = value;
  110. }
  111. }
  112. /// <summary>
  113. /// ID of auction (3rd Party Integration) when parcel is being auctioned
  114. /// </summary>
  115. public uint AuctionID {
  116. get {
  117. return _auctionID;
  118. }
  119. set {
  120. _auctionID = value;
  121. }
  122. }
  123. /// <summary>
  124. /// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it.
  125. /// </summary>
  126. public UUID AuthBuyerID {
  127. get {
  128. return _authBuyerID;
  129. }
  130. set {
  131. _authBuyerID = value;
  132. }
  133. }
  134. /// <summary>
  135. /// Category of parcel. Used for classifying the parcel in classified listings
  136. /// </summary>
  137. public ParcelCategory Category {
  138. get {
  139. return _category;
  140. }
  141. set {
  142. _category = value;
  143. }
  144. }
  145. /// <summary>
  146. /// Date that the current owner purchased or claimed the parcel
  147. /// </summary>
  148. public int ClaimDate {
  149. get {
  150. return _claimDate;
  151. }
  152. set {
  153. _claimDate = value;
  154. }
  155. }
  156. /// <summary>
  157. /// The last price that the parcel was sold at
  158. /// </summary>
  159. public int ClaimPrice {
  160. get {
  161. return _claimPrice;
  162. }
  163. set {
  164. _claimPrice = value;
  165. }
  166. }
  167. /// <summary>
  168. /// Global ID for the parcel. (3rd Party Integration)
  169. /// </summary>
  170. public UUID GlobalID {
  171. get {
  172. return _globalID;
  173. }
  174. set {
  175. _globalID = value;
  176. }
  177. }
  178. /// <summary>
  179. /// Unique ID of the Group that owns
  180. /// </summary>
  181. public UUID GroupID {
  182. get {
  183. return _groupID;
  184. }
  185. set {
  186. _groupID = value;
  187. }
  188. }
  189. /// <summary>
  190. /// Number of SceneObjectPart that are owned by a Group
  191. /// </summary>
  192. public int GroupPrims {
  193. get {
  194. return _groupPrims;
  195. }
  196. set {
  197. _groupPrims = value;
  198. }
  199. }
  200. /// <summary>
  201. /// Returns true if the Land Parcel is owned by a group
  202. /// </summary>
  203. public bool IsGroupOwned {
  204. get {
  205. return _isGroupOwned;
  206. }
  207. set {
  208. _isGroupOwned = value;
  209. }
  210. }
  211. /// <summary>
  212. /// jp2 data for the image representative of the parcel in the parcel dialog
  213. /// </summary>
  214. public byte[] Bitmap {
  215. get {
  216. return _bitmap;
  217. }
  218. set {
  219. _bitmap = value;
  220. }
  221. }
  222. /// <summary>
  223. /// Parcel Description
  224. /// </summary>
  225. public string Description {
  226. get {
  227. return _description;
  228. }
  229. set {
  230. _description = value;
  231. }
  232. }
  233. /// <summary>
  234. /// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags
  235. /// </summary>
  236. public uint Flags {
  237. get {
  238. return _flags;
  239. }
  240. set {
  241. _flags = value;
  242. }
  243. }
  244. /// <summary>
  245. /// Determines if people are able to teleport where they please on the parcel or if they
  246. /// get constrainted to a specific point on teleport within the parcel
  247. /// </summary>
  248. public byte LandingType {
  249. get {
  250. return _landingType;
  251. }
  252. set {
  253. _landingType = value;
  254. }
  255. }
  256. /// <summary>
  257. /// Parcel Name
  258. /// </summary>
  259. public string Name {
  260. get {
  261. return _name;
  262. }
  263. set {
  264. _name = value;
  265. }
  266. }
  267. /// <summary>
  268. /// Status of Parcel, Leased, Abandoned, For Sale
  269. /// </summary>
  270. public ParcelStatus Status {
  271. get {
  272. return _status;
  273. }
  274. set {
  275. _status = value;
  276. }
  277. }
  278. /// <summary>
  279. /// Internal ID of the parcel. Sometimes the client will try to use this value
  280. /// </summary>
  281. public int LocalID {
  282. get {
  283. return _localID;
  284. }
  285. set {
  286. _localID = value;
  287. }
  288. }
  289. /// <summary>
  290. /// Determines if we scale the media based on the surface it's on
  291. /// </summary>
  292. public byte MediaAutoScale {
  293. get {
  294. return _mediaAutoScale;
  295. }
  296. set {
  297. _mediaAutoScale = value;
  298. }
  299. }
  300. /// <summary>
  301. /// Texture Guid to replace with the output of the media stream
  302. /// </summary>
  303. public UUID MediaID {
  304. get {
  305. return _mediaID;
  306. }
  307. set {
  308. _mediaID = value;
  309. }
  310. }
  311. /// <summary>
  312. /// URL to the media file to display
  313. /// </summary>
  314. public string MediaURL {
  315. get {
  316. return _mediaURL;
  317. }
  318. set {
  319. _mediaURL = value;
  320. }
  321. }
  322. /// <summary>
  323. /// URL to the shoutcast music stream to play on the parcel
  324. /// </summary>
  325. public string MusicURL {
  326. get {
  327. return _musicURL;
  328. }
  329. set {
  330. _musicURL = value;
  331. }
  332. }
  333. /// <summary>
  334. /// Number of SceneObjectPart that are owned by users who do not own the parcel
  335. /// and don't have the 'group. These are elegable for AutoReturn collection
  336. /// </summary>
  337. public int OtherPrims {
  338. get {
  339. return _otherPrims;
  340. }
  341. set {
  342. _otherPrims = value;
  343. }
  344. }
  345. /// <summary>
  346. /// Owner Avatar or Group of the parcel. Naturally, all land masses must be
  347. /// owned by someone
  348. /// </summary>
  349. public UUID OwnerID {
  350. get {
  351. return _ownerID;
  352. }
  353. set {
  354. _ownerID = value;
  355. }
  356. }
  357. /// <summary>
  358. /// Number of SceneObjectPart that are owned by the owner of the parcel
  359. /// </summary>
  360. public int OwnerPrims {
  361. get {
  362. return _ownerPrims;
  363. }
  364. set {
  365. _ownerPrims = value;
  366. }
  367. }
  368. /// <summary>
  369. /// List of access data for the parcel. User data, some bitflags, and a time
  370. /// </summary>
  371. public List<ParcelManager.ParcelAccessEntry> ParcelAccessList {
  372. get {
  373. return _parcelAccessList;
  374. }
  375. set {
  376. _parcelAccessList = value;
  377. }
  378. }
  379. /// <summary>
  380. /// How long in hours a Pass to the parcel is given
  381. /// </summary>
  382. public float PassHours {
  383. get {
  384. return _passHours;
  385. }
  386. set {
  387. _passHours = value;
  388. }
  389. }
  390. /// <summary>
  391. /// Price to purchase a Pass to a restricted parcel
  392. /// </summary>
  393. public int PassPrice {
  394. get {
  395. return _passPrice;
  396. }
  397. set {
  398. _passPrice = value;
  399. }
  400. }
  401. /// <summary>
  402. /// When the parcel is being sold, this is the price to purchase the parcel
  403. /// </summary>
  404. public int SalePrice {
  405. get {
  406. return _salePrice;
  407. }
  408. set {
  409. _salePrice = value;
  410. }
  411. }
  412. /// <summary>
  413. /// Number of SceneObjectPart that are currently selected by avatar
  414. /// </summary>
  415. public int SelectedPrims {
  416. get {
  417. return _selectedPrims;
  418. }
  419. set {
  420. _selectedPrims = value;
  421. }
  422. }
  423. /// <summary>
  424. /// Number of meters^2 in the Simulator
  425. /// </summary>
  426. public int SimwideArea {
  427. get {
  428. return _simwideArea;
  429. }
  430. set {
  431. _simwideArea = value;
  432. }
  433. }
  434. /// <summary>
  435. /// Number of SceneObjectPart in the Simulator
  436. /// </summary>
  437. public int SimwidePrims {
  438. get {
  439. return _simwidePrims;
  440. }
  441. set {
  442. _simwidePrims = value;
  443. }
  444. }
  445. /// <summary>
  446. /// ID of the snapshot used in the client parcel dialog of the parcel
  447. /// </summary>
  448. public UUID SnapshotID {
  449. get {
  450. return _snapshotID;
  451. }
  452. set {
  453. _snapshotID = value;
  454. }
  455. }
  456. /// <summary>
  457. /// When teleporting is restricted to a certain point, this is the location
  458. /// that the user will be redirected to
  459. /// </summary>
  460. public Vector3 UserLocation {
  461. get {
  462. return _userLocation;
  463. }
  464. set {
  465. _userLocation = value;
  466. }
  467. }
  468. /// <summary>
  469. /// When teleporting is restricted to a certain point, this is the rotation
  470. /// that the user will be positioned
  471. /// </summary>
  472. public Vector3 UserLookAt {
  473. get {
  474. return _userLookAt;
  475. }
  476. set {
  477. _userLookAt = value;
  478. }
  479. }
  480. /// <summary>
  481. /// Deprecated idea. Number of visitors ~= free money
  482. /// </summary>
  483. public int Dwell {
  484. get {
  485. return _dwell;
  486. }
  487. set {
  488. _dwell = value;
  489. }
  490. }
  491. /// <summary>
  492. /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
  493. /// the parcel and isn't set to the same 'group' as the parcel.
  494. /// </summary>
  495. public int OtherCleanTime {
  496. get {
  497. return _otherCleanTime;
  498. }
  499. set {
  500. _otherCleanTime = value;
  501. }
  502. }
  503. public LandData()
  504. {
  505. _globalID = UUID.Random();
  506. }
  507. /// <summary>
  508. /// Make a new copy of the land data
  509. /// </summary>
  510. /// <returns></returns>
  511. public LandData Copy()
  512. {
  513. LandData landData = new LandData();
  514. landData._AABBMax = _AABBMax;
  515. landData._AABBMin = _AABBMin;
  516. landData._area = _area;
  517. landData._auctionID = _auctionID;
  518. landData._authBuyerID = _authBuyerID;
  519. landData._category = _category;
  520. landData._claimDate = _claimDate;
  521. landData._claimPrice = _claimPrice;
  522. landData._globalID = _globalID;
  523. landData._groupID = _groupID;
  524. landData._groupPrims = _groupPrims;
  525. landData._otherPrims = _otherPrims;
  526. landData._ownerPrims = _ownerPrims;
  527. landData._selectedPrims = _selectedPrims;
  528. landData._isGroupOwned = _isGroupOwned;
  529. landData._localID = _localID;
  530. landData._landingType = _landingType;
  531. landData._mediaAutoScale = _mediaAutoScale;
  532. landData._mediaID = _mediaID;
  533. landData._mediaURL = _mediaURL;
  534. landData._musicURL = _musicURL;
  535. landData._ownerID = _ownerID;
  536. landData._bitmap = (byte[]) _bitmap.Clone();
  537. landData._description = _description;
  538. landData._flags = _flags;
  539. landData._name = _name;
  540. landData._status = _status;
  541. landData._passHours = _passHours;
  542. landData._passPrice = _passPrice;
  543. landData._salePrice = _salePrice;
  544. landData._snapshotID = _snapshotID;
  545. landData._userLocation = _userLocation;
  546. landData._userLookAt = _userLookAt;
  547. landData._otherCleanTime = _otherCleanTime;
  548. landData._dwell = _dwell;
  549. landData._parcelAccessList.Clear();
  550. foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
  551. {
  552. ParcelManager.ParcelAccessEntry newEntry = new ParcelManager.ParcelAccessEntry();
  553. newEntry.AgentID = entry.AgentID;
  554. newEntry.Flags = entry.Flags;
  555. newEntry.Time = entry.Time;
  556. landData._parcelAccessList.Add(newEntry);
  557. }
  558. return landData;
  559. }
  560. }
  561. }