opensim-development – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 eva 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  
28 using System;
29 using System.Collections.Generic;
30 using System.Xml;
31 using System.Xml.Serialization;
32  
33 using OpenMetaverse;
34  
35 namespace OpenSim.Framework
36 {
37 public class LandAccessEntry
38 {
39 public UUID AgentID;
40 public int Expires;
41 public AccessList Flags;
42 }
43  
44 /// <summary>
45 /// Details of a Parcel of land
46 /// </summary>
47 public class LandData
48 {
49 // use only one serializer to give the runtime a chance to
50 // optimize it (it won't do that if you use a new instance
51 // every time)
52 private static XmlSerializer serializer = new XmlSerializer(typeof(LandData));
53  
54 private Vector3 _AABBMax = new Vector3();
55 private Vector3 _AABBMin = new Vector3();
56 private int _area = 0;
57 private uint _auctionID = 0; //Unemplemented. If set to 0, not being auctioned
58 private UUID _authBuyerID = UUID.Zero; //Unemplemented. Authorized Buyer's UUID
59 private ParcelCategory _category = ParcelCategory.None; //Unemplemented. Parcel's chosen category
60 private int _claimDate = 0;
61 private int _claimPrice = 0; //Unemplemented
62 private UUID _globalID = UUID.Zero;
63 private UUID _groupID = UUID.Zero;
64 private bool _isGroupOwned = false;
65 private byte[] _bitmap = new byte[512];
66 private string _description = String.Empty;
67  
68 private uint _flags = (uint)ParcelFlags.AllowFly | (uint)ParcelFlags.AllowLandmark |
69 (uint)ParcelFlags.AllowAPrimitiveEntry |
70 (uint)ParcelFlags.AllowDeedToGroup | (uint)ParcelFlags.AllowTerraform |
71 (uint)ParcelFlags.CreateObjects | (uint)ParcelFlags.AllowOtherScripts |
72 (uint)ParcelFlags.SoundLocal | (uint)ParcelFlags.AllowVoiceChat;
73  
74 private byte _landingType = 0;
75 private string _name = "Your Parcel";
76 private ParcelStatus _status = ParcelStatus.Leased;
77 private int _localID = 0;
78 private byte _mediaAutoScale = 0;
79 private UUID _mediaID = UUID.Zero;
80 private string _mediaURL = String.Empty;
81 private string _musicURL = String.Empty;
82 private UUID _ownerID = UUID.Zero;
83 private List<LandAccessEntry> _parcelAccessList = new List<LandAccessEntry>();
84 private float _passHours = 0;
85 private int _passPrice = 0;
86 private int _salePrice = 0; //Unemeplemented. Parcels price.
87 private int _simwideArea = 0;
88 private int _simwidePrims = 0;
89 private UUID _snapshotID = UUID.Zero;
90 private Vector3 _userLocation = new Vector3();
91 private Vector3 _userLookAt = new Vector3();
92 private int _otherCleanTime = 0;
93 private string _mediaType = "none/none";
94 private string _mediaDescription = "";
95 private int _mediaHeight = 0;
96 private int _mediaWidth = 0;
97 private bool _mediaLoop = false;
98 private bool _obscureMusic = false;
99 private bool _obscureMedia = false;
100 private float _dwell = 0;
101  
102 /// <summary>
103 /// Traffic count of parcel
104 /// </summary>
105 [XmlIgnore]
106 public float Dwell
107 {
108 get
109 {
110 return _dwell;
111 }
112 set
113 {
114 _dwell = value;
115 }
116 }
117  
118 /// <summary>
119 /// Whether to obscure parcel media URL
120 /// </summary>
121 [XmlIgnore]
122 public bool ObscureMedia
123 {
124 get
125 {
126 return _obscureMedia;
127 }
128 set
129 {
130 _obscureMedia = value;
131 }
132 }
133  
134 /// <summary>
135 /// Whether to obscure parcel music URL
136 /// </summary>
137 [XmlIgnore]
138 public bool ObscureMusic
139 {
140 get
141 {
142 return _obscureMusic;
143 }
144 set
145 {
146 _obscureMusic = value;
147 }
148 }
149  
150 /// <summary>
151 /// Whether to loop parcel media
152 /// </summary>
153 [XmlIgnore]
154 public bool MediaLoop
155 {
156 get
157 {
158 return _mediaLoop;
159 }
160 set
161 {
162 _mediaLoop = value;
163 }
164 }
165  
166 /// <summary>
167 /// Height of parcel media render
168 /// </summary>
169 [XmlIgnore]
170 public int MediaHeight
171 {
172 get
173 {
174 return _mediaHeight;
175 }
176 set
177 {
178 _mediaHeight = value;
179 }
180 }
181  
182 /// <summary>
183 /// Width of parcel media render
184 /// </summary>
185 [XmlIgnore]
186 public int MediaWidth
187 {
188 get
189 {
190 return _mediaWidth;
191 }
192 set
193 {
194 _mediaWidth = value;
195 }
196 }
197  
198 /// <summary>
199 /// Upper corner of the AABB for the parcel
200 /// </summary>
201 [XmlIgnore]
202 public Vector3 AABBMax
203 {
204 get
205 {
206 return _AABBMax;
207 }
208 set
209 {
210 _AABBMax = value;
211 }
212 }
213 /// <summary>
214 /// Lower corner of the AABB for the parcel
215 /// </summary>
216 [XmlIgnore]
217 public Vector3 AABBMin
218 {
219 get
220 {
221 return _AABBMin;
222 }
223 set
224 {
225 _AABBMin = value;
226 }
227 }
228  
229 /// <summary>
230 /// Area in meters^2 the parcel contains
231 /// </summary>
232 public int Area
233 {
234 get
235 {
236 return _area;
237 }
238 set
239 {
240 _area = value;
241 }
242 }
243  
244 /// <summary>
245 /// ID of auction (3rd Party Integration) when parcel is being auctioned
246 /// </summary>
247 public uint AuctionID
248 {
249 get
250 {
251 return _auctionID;
252 }
253 set
254 {
255 _auctionID = value;
256 }
257 }
258  
259 /// <summary>
260 /// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it.
261 /// </summary>
262 public UUID AuthBuyerID
263 {
264 get
265 {
266 return _authBuyerID;
267 }
268 set
269 {
270 _authBuyerID = value;
271 }
272 }
273  
274 /// <summary>
275 /// Category of parcel. Used for classifying the parcel in classified listings
276 /// </summary>
277 public ParcelCategory Category
278 {
279 get
280 {
281 return _category;
282 }
283 set
284 {
285 _category = value;
286 }
287 }
288  
289 /// <summary>
290 /// Date that the current owner purchased or claimed the parcel
291 /// </summary>
292 public int ClaimDate
293 {
294 get
295 {
296 return _claimDate;
297 }
298 set
299 {
300 _claimDate = value;
301 }
302 }
303  
304 /// <summary>
305 /// The last price that the parcel was sold at
306 /// </summary>
307 public int ClaimPrice
308 {
309 get
310 {
311 return _claimPrice;
312 }
313 set
314 {
315 _claimPrice = value;
316 }
317 }
318  
319 /// <summary>
320 /// Global ID for the parcel. (3rd Party Integration)
321 /// </summary>
322 public UUID GlobalID
323 {
324 get
325 {
326 return _globalID;
327 }
328 set
329 {
330 _globalID = value;
331 }
332 }
333  
334 /// <summary>
335 /// Unique ID of the Group that owns
336 /// </summary>
337 public UUID GroupID
338 {
339 get
340 {
341 return _groupID;
342 }
343 set
344 {
345 _groupID = value;
346 }
347 }
348  
349 /// <summary>
350 /// Returns true if the Land Parcel is owned by a group
351 /// </summary>
352 public bool IsGroupOwned
353 {
354 get
355 {
356 return _isGroupOwned;
357 }
358 set
359 {
360 _isGroupOwned = value;
361 }
362 }
363  
364 /// <summary>
365 /// jp2 data for the image representative of the parcel in the parcel dialog
366 /// </summary>
367 public byte[] Bitmap
368 {
369 get
370 {
371 return _bitmap;
372 }
373 set
374 {
375 _bitmap = value;
376 }
377 }
378  
379 /// <summary>
380 /// Parcel Description
381 /// </summary>
382 public string Description
383 {
384 get
385 {
386 return _description;
387 }
388 set
389 {
390 _description = value;
391 }
392 }
393  
394 /// <summary>
395 /// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags
396 /// </summary>
397 public uint Flags
398 {
399 get
400 {
401 return _flags;
402 }
403 set
404 {
405 _flags = value;
406 }
407 }
408  
409 /// <summary>
410 /// Determines if people are able to teleport where they please on the parcel or if they
411 /// get constrainted to a specific point on teleport within the parcel
412 /// </summary>
413 public byte LandingType
414 {
415 get
416 {
417 return _landingType;
418 }
419 set
420 {
421 _landingType = value;
422 }
423 }
424  
425 /// <summary>
426 /// Parcel Name
427 /// </summary>
428 public string Name
429 {
430 get
431 {
432 return _name;
433 }
434 set
435 {
436 _name = value;
437 }
438 }
439  
440 /// <summary>
441 /// Status of Parcel, Leased, Abandoned, For Sale
442 /// </summary>
443 public ParcelStatus Status
444 {
445 get
446 {
447 return _status;
448 }
449 set
450 {
451 _status = value;
452 }
453 }
454  
455 /// <summary>
456 /// Internal ID of the parcel. Sometimes the client will try to use this value
457 /// </summary>
458 public int LocalID
459 {
460 get
461 {
462 return _localID;
463 }
464 set
465 {
466 _localID = value;
467 }
468 }
469  
470 /// <summary>
471 /// Determines if we scale the media based on the surface it's on
472 /// </summary>
473 public byte MediaAutoScale
474 {
475 get
476 {
477 return _mediaAutoScale;
478 }
479 set
480 {
481 _mediaAutoScale = value;
482 }
483 }
484  
485 /// <summary>
486 /// Texture Guid to replace with the output of the media stream
487 /// </summary>
488 public UUID MediaID
489 {
490 get
491 {
492 return _mediaID;
493 }
494 set
495 {
496 _mediaID = value;
497 }
498 }
499  
500 /// <summary>
501 /// URL to the media file to display
502 /// </summary>
503 public string MediaURL
504 {
505 get
506 {
507 return _mediaURL;
508 }
509 set
510 {
511 _mediaURL = value;
512 }
513 }
514  
515 public string MediaType
516 {
517 get
518 {
519 return _mediaType;
520 }
521 set
522 {
523 _mediaType = value;
524 }
525 }
526  
527 /// <summary>
528 /// URL to the shoutcast music stream to play on the parcel
529 /// </summary>
530 public string MusicURL
531 {
532 get
533 {
534 return _musicURL;
535 }
536 set
537 {
538 _musicURL = value;
539 }
540 }
541  
542 /// <summary>
543 /// Owner Avatar or Group of the parcel. Naturally, all land masses must be
544 /// owned by someone
545 /// </summary>
546 public UUID OwnerID
547 {
548 get
549 {
550 return _ownerID;
551 }
552 set
553 {
554 _ownerID = value;
555 }
556 }
557  
558 /// <summary>
559 /// List of access data for the parcel. User data, some bitflags, and a time
560 /// </summary>
561 public List<LandAccessEntry> ParcelAccessList
562 {
563 get
564 {
565 return _parcelAccessList;
566 }
567 set
568 {
569 _parcelAccessList = value;
570 }
571 }
572  
573 /// <summary>
574 /// How long in hours a Pass to the parcel is given
575 /// </summary>
576 public float PassHours
577 {
578 get
579 {
580 return _passHours;
581 }
582 set
583 {
584 _passHours = value;
585 }
586 }
587  
588 /// <summary>
589 /// Price to purchase a Pass to a restricted parcel
590 /// </summary>
591 public int PassPrice
592 {
593 get
594 {
595 return _passPrice;
596 }
597 set
598 {
599 _passPrice = value;
600 }
601 }
602  
603 /// <summary>
604 /// When the parcel is being sold, this is the price to purchase the parcel
605 /// </summary>
606 public int SalePrice
607 {
608 get
609 {
610 return _salePrice;
611 }
612 set
613 {
614 _salePrice = value;
615 }
616 }
617  
618 /// <summary>
619 /// Number of meters^2 in the Simulator
620 /// </summary>
621 [XmlIgnore]
622 public int SimwideArea
623 {
624 get
625 {
626 return _simwideArea;
627 }
628 set
629 {
630 _simwideArea = value;
631 }
632 }
633  
634 /// <summary>
635 /// Number of SceneObjectPart in the Simulator
636 /// </summary>
637 [XmlIgnore]
638 public int SimwidePrims
639 {
640 get
641 {
642 return _simwidePrims;
643 }
644 set
645 {
646 _simwidePrims = value;
647 }
648 }
649  
650 /// <summary>
651 /// ID of the snapshot used in the client parcel dialog of the parcel
652 /// </summary>
653 public UUID SnapshotID
654 {
655 get
656 {
657 return _snapshotID;
658 }
659 set
660 {
661 _snapshotID = value;
662 }
663 }
664  
665 /// <summary>
666 /// When teleporting is restricted to a certain point, this is the location
667 /// that the user will be redirected to
668 /// </summary>
669 public Vector3 UserLocation
670 {
671 get
672 {
673 return _userLocation;
674 }
675 set
676 {
677 _userLocation = value;
678 }
679 }
680  
681 /// <summary>
682 /// When teleporting is restricted to a certain point, this is the rotation
683 /// that the user will be positioned
684 /// </summary>
685 public Vector3 UserLookAt
686 {
687 get
688 {
689 return _userLookAt;
690 }
691 set
692 {
693 _userLookAt = value;
694 }
695 }
696  
697 /// <summary>
698 /// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
699 /// the parcel and isn't set to the same 'group' as the parcel.
700 /// </summary>
701 public int OtherCleanTime
702 {
703 get
704 {
705 return _otherCleanTime;
706 }
707 set
708 {
709 _otherCleanTime = value;
710 }
711 }
712  
713 /// <summary>
714 /// parcel media description
715 /// </summary>
716 public string MediaDescription
717 {
718 get
719 {
720 return _mediaDescription;
721 }
722 set
723 {
724 _mediaDescription = value;
725 }
726 }
727  
728 public LandData()
729 {
730 _globalID = UUID.Random();
731 }
732  
733 /// <summary>
734 /// Make a new copy of the land data
735 /// </summary>
736 /// <returns></returns>
737 public LandData Copy()
738 {
739 LandData landData = new LandData();
740  
741 landData._AABBMax = _AABBMax;
742 landData._AABBMin = _AABBMin;
743 landData._area = _area;
744 landData._auctionID = _auctionID;
745 landData._authBuyerID = _authBuyerID;
746 landData._category = _category;
747 landData._claimDate = _claimDate;
748 landData._claimPrice = _claimPrice;
749 landData._globalID = _globalID;
750 landData._groupID = _groupID;
751 landData._isGroupOwned = _isGroupOwned;
752 landData._localID = _localID;
753 landData._landingType = _landingType;
754 landData._mediaAutoScale = _mediaAutoScale;
755 landData._mediaID = _mediaID;
756 landData._mediaURL = _mediaURL;
757 landData._musicURL = _musicURL;
758 landData._ownerID = _ownerID;
759 landData._bitmap = (byte[])_bitmap.Clone();
760 landData._description = _description;
761 landData._flags = _flags;
762 landData._name = _name;
763 landData._status = _status;
764 landData._passHours = _passHours;
765 landData._passPrice = _passPrice;
766 landData._salePrice = _salePrice;
767 landData._snapshotID = _snapshotID;
768 landData._userLocation = _userLocation;
769 landData._userLookAt = _userLookAt;
770 landData._otherCleanTime = _otherCleanTime;
771 landData._mediaType = _mediaType;
772 landData._mediaDescription = _mediaDescription;
773 landData._mediaWidth = _mediaWidth;
774 landData._mediaHeight = _mediaHeight;
775 landData._mediaLoop = _mediaLoop;
776 landData._obscureMusic = _obscureMusic;
777 landData._obscureMedia = _obscureMedia;
778 landData._simwideArea = _simwideArea;
779 landData._simwidePrims = _simwidePrims;
780 landData._dwell = _dwell;
781  
782 landData._parcelAccessList.Clear();
783 foreach (LandAccessEntry entry in _parcelAccessList)
784 {
785 LandAccessEntry newEntry = new LandAccessEntry();
786 newEntry.AgentID = entry.AgentID;
787 newEntry.Flags = entry.Flags;
788 newEntry.Expires = entry.Expires;
789  
790 landData._parcelAccessList.Add(newEntry);
791 }
792  
793 return landData;
794 }
795  
796 public void ToXml(XmlWriter xmlWriter)
797 {
798 serializer.Serialize(xmlWriter, this);
799 }
800  
801 /// <summary>
802 /// Restore a LandData object from the serialized xml representation.
803 /// </summary>
804 /// <param name="xmlReader"></param>
805 /// <returns></returns>
806 public static LandData FromXml(XmlReader xmlReader)
807 {
808 LandData land = (LandData)serializer.Deserialize(xmlReader);
809  
810 return land;
811 }
812 }
813 }