diff options
author | Diva Canto | 2009-08-13 17:45:17 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-13 17:45:17 -0700 |
commit | ded76723ebbf75c940a6912013860e65052009f4 (patch) | |
tree | f3ce03b251a244430f36db97d75c6bd199b335c4 /OpenSim/Framework | |
parent | Added GetAssetPermissions. Few last bugs nixed. This is ready for testing. (diff) | |
parent | * Adds two tests to OpenSim.Framework.Tests. *AgentCircuitData test to ensure... (diff) | |
download | opensim-SC_OLD-ded76723ebbf75c940a6912013860e65052009f4.zip opensim-SC_OLD-ded76723ebbf75c940a6912013860e65052009f4.tar.gz opensim-SC_OLD-ded76723ebbf75c940a6912013860e65052009f4.tar.bz2 opensim-SC_OLD-ded76723ebbf75c940a6912013860e65052009f4.tar.xz |
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/LandData.cs | 126 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/AgentCircuitDataTest.cs | 339 |
2 files changed, 464 insertions, 1 deletions
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 94c0d3b..a24af04 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs | |||
@@ -83,6 +83,9 @@ namespace OpenSim.Framework | |||
83 | private int _dwell = 0; | 83 | private int _dwell = 0; |
84 | private int _otherCleanTime = 0; | 84 | private int _otherCleanTime = 0; |
85 | 85 | ||
86 | /// <summary> | ||
87 | /// Upper corner of the AABB for the parcel | ||
88 | /// </summary> | ||
86 | public Vector3 AABBMax { | 89 | public Vector3 AABBMax { |
87 | get { | 90 | get { |
88 | return _AABBMax; | 91 | return _AABBMax; |
@@ -91,7 +94,9 @@ namespace OpenSim.Framework | |||
91 | _AABBMax = value; | 94 | _AABBMax = value; |
92 | } | 95 | } |
93 | } | 96 | } |
94 | 97 | /// <summary> | |
98 | /// Lower corner of the AABB for the parcel | ||
99 | /// </summary> | ||
95 | public Vector3 AABBMin { | 100 | public Vector3 AABBMin { |
96 | get { | 101 | get { |
97 | return _AABBMin; | 102 | return _AABBMin; |
@@ -101,6 +106,9 @@ namespace OpenSim.Framework | |||
101 | } | 106 | } |
102 | } | 107 | } |
103 | 108 | ||
109 | /// <summary> | ||
110 | /// Area in meters^2 the parcel contains | ||
111 | /// </summary> | ||
104 | public int Area { | 112 | public int Area { |
105 | get { | 113 | get { |
106 | return _area; | 114 | return _area; |
@@ -110,6 +118,9 @@ namespace OpenSim.Framework | |||
110 | } | 118 | } |
111 | } | 119 | } |
112 | 120 | ||
121 | /// <summary> | ||
122 | /// ID of auction (3rd Party Integration) when parcel is being auctioned | ||
123 | /// </summary> | ||
113 | public uint AuctionID { | 124 | public uint AuctionID { |
114 | get { | 125 | get { |
115 | return _auctionID; | 126 | return _auctionID; |
@@ -119,6 +130,9 @@ namespace OpenSim.Framework | |||
119 | } | 130 | } |
120 | } | 131 | } |
121 | 132 | ||
133 | /// <summary> | ||
134 | /// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it. | ||
135 | /// </summary> | ||
122 | public UUID AuthBuyerID { | 136 | public UUID AuthBuyerID { |
123 | get { | 137 | get { |
124 | return _authBuyerID; | 138 | return _authBuyerID; |
@@ -128,6 +142,9 @@ namespace OpenSim.Framework | |||
128 | } | 142 | } |
129 | } | 143 | } |
130 | 144 | ||
145 | /// <summary> | ||
146 | /// Category of parcel. Used for classifying the parcel in classified listings | ||
147 | /// </summary> | ||
131 | public ParcelCategory Category { | 148 | public ParcelCategory Category { |
132 | get { | 149 | get { |
133 | return _category; | 150 | return _category; |
@@ -137,6 +154,9 @@ namespace OpenSim.Framework | |||
137 | } | 154 | } |
138 | } | 155 | } |
139 | 156 | ||
157 | /// <summary> | ||
158 | /// Date that the current owner purchased or claimed the parcel | ||
159 | /// </summary> | ||
140 | public int ClaimDate { | 160 | public int ClaimDate { |
141 | get { | 161 | get { |
142 | return _claimDate; | 162 | return _claimDate; |
@@ -146,6 +166,9 @@ namespace OpenSim.Framework | |||
146 | } | 166 | } |
147 | } | 167 | } |
148 | 168 | ||
169 | /// <summary> | ||
170 | /// The last price that the parcel was sold at | ||
171 | /// </summary> | ||
149 | public int ClaimPrice { | 172 | public int ClaimPrice { |
150 | get { | 173 | get { |
151 | return _claimPrice; | 174 | return _claimPrice; |
@@ -155,6 +178,9 @@ namespace OpenSim.Framework | |||
155 | } | 178 | } |
156 | } | 179 | } |
157 | 180 | ||
181 | /// <summary> | ||
182 | /// Global ID for the parcel. (3rd Party Integration) | ||
183 | /// </summary> | ||
158 | public UUID GlobalID { | 184 | public UUID GlobalID { |
159 | get { | 185 | get { |
160 | return _globalID; | 186 | return _globalID; |
@@ -164,6 +190,9 @@ namespace OpenSim.Framework | |||
164 | } | 190 | } |
165 | } | 191 | } |
166 | 192 | ||
193 | /// <summary> | ||
194 | /// Unique ID of the Group that owns | ||
195 | /// </summary> | ||
167 | public UUID GroupID { | 196 | public UUID GroupID { |
168 | get { | 197 | get { |
169 | return _groupID; | 198 | return _groupID; |
@@ -173,6 +202,9 @@ namespace OpenSim.Framework | |||
173 | } | 202 | } |
174 | } | 203 | } |
175 | 204 | ||
205 | /// <summary> | ||
206 | /// Number of SceneObjectPart that are owned by a Group | ||
207 | /// </summary> | ||
176 | public int GroupPrims { | 208 | public int GroupPrims { |
177 | get { | 209 | get { |
178 | return _groupPrims; | 210 | return _groupPrims; |
@@ -182,6 +214,9 @@ namespace OpenSim.Framework | |||
182 | } | 214 | } |
183 | } | 215 | } |
184 | 216 | ||
217 | /// <summary> | ||
218 | /// Returns true if the Land Parcel is owned by a group | ||
219 | /// </summary> | ||
185 | public bool IsGroupOwned { | 220 | public bool IsGroupOwned { |
186 | get { | 221 | get { |
187 | return _isGroupOwned; | 222 | return _isGroupOwned; |
@@ -191,6 +226,9 @@ namespace OpenSim.Framework | |||
191 | } | 226 | } |
192 | } | 227 | } |
193 | 228 | ||
229 | /// <summary> | ||
230 | /// jp2 data for the image representative of the parcel in the parcel dialog | ||
231 | /// </summary> | ||
194 | public byte[] Bitmap { | 232 | public byte[] Bitmap { |
195 | get { | 233 | get { |
196 | return _bitmap; | 234 | return _bitmap; |
@@ -200,6 +238,9 @@ namespace OpenSim.Framework | |||
200 | } | 238 | } |
201 | } | 239 | } |
202 | 240 | ||
241 | /// <summary> | ||
242 | /// Parcel Description | ||
243 | /// </summary> | ||
203 | public string Description { | 244 | public string Description { |
204 | get { | 245 | get { |
205 | return _description; | 246 | return _description; |
@@ -209,6 +250,9 @@ namespace OpenSim.Framework | |||
209 | } | 250 | } |
210 | } | 251 | } |
211 | 252 | ||
253 | /// <summary> | ||
254 | /// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags | ||
255 | /// </summary> | ||
212 | public uint Flags { | 256 | public uint Flags { |
213 | get { | 257 | get { |
214 | return _flags; | 258 | return _flags; |
@@ -218,6 +262,10 @@ namespace OpenSim.Framework | |||
218 | } | 262 | } |
219 | } | 263 | } |
220 | 264 | ||
265 | /// <summary> | ||
266 | /// Determines if people are able to teleport where they please on the parcel or if they | ||
267 | /// get constrainted to a specific point on teleport within the parcel | ||
268 | /// </summary> | ||
221 | public byte LandingType { | 269 | public byte LandingType { |
222 | get { | 270 | get { |
223 | return _landingType; | 271 | return _landingType; |
@@ -227,6 +275,9 @@ namespace OpenSim.Framework | |||
227 | } | 275 | } |
228 | } | 276 | } |
229 | 277 | ||
278 | /// <summary> | ||
279 | /// Parcel Name | ||
280 | /// </summary> | ||
230 | public string Name { | 281 | public string Name { |
231 | get { | 282 | get { |
232 | return _name; | 283 | return _name; |
@@ -236,6 +287,9 @@ namespace OpenSim.Framework | |||
236 | } | 287 | } |
237 | } | 288 | } |
238 | 289 | ||
290 | /// <summary> | ||
291 | /// Status of Parcel, Leased, Abandoned, For Sale | ||
292 | /// </summary> | ||
239 | public ParcelStatus Status { | 293 | public ParcelStatus Status { |
240 | get { | 294 | get { |
241 | return _status; | 295 | return _status; |
@@ -245,6 +299,9 @@ namespace OpenSim.Framework | |||
245 | } | 299 | } |
246 | } | 300 | } |
247 | 301 | ||
302 | /// <summary> | ||
303 | /// Internal ID of the parcel. Sometimes the client will try to use this value | ||
304 | /// </summary> | ||
248 | public int LocalID { | 305 | public int LocalID { |
249 | get { | 306 | get { |
250 | return _localID; | 307 | return _localID; |
@@ -254,6 +311,9 @@ namespace OpenSim.Framework | |||
254 | } | 311 | } |
255 | } | 312 | } |
256 | 313 | ||
314 | /// <summary> | ||
315 | /// Determines if we scale the media based on the surface it's on | ||
316 | /// </summary> | ||
257 | public byte MediaAutoScale { | 317 | public byte MediaAutoScale { |
258 | get { | 318 | get { |
259 | return _mediaAutoScale; | 319 | return _mediaAutoScale; |
@@ -263,6 +323,9 @@ namespace OpenSim.Framework | |||
263 | } | 323 | } |
264 | } | 324 | } |
265 | 325 | ||
326 | /// <summary> | ||
327 | /// Texture Guid to replace with the output of the media stream | ||
328 | /// </summary> | ||
266 | public UUID MediaID { | 329 | public UUID MediaID { |
267 | get { | 330 | get { |
268 | return _mediaID; | 331 | return _mediaID; |
@@ -272,6 +335,9 @@ namespace OpenSim.Framework | |||
272 | } | 335 | } |
273 | } | 336 | } |
274 | 337 | ||
338 | /// <summary> | ||
339 | /// URL to the media file to display | ||
340 | /// </summary> | ||
275 | public string MediaURL { | 341 | public string MediaURL { |
276 | get { | 342 | get { |
277 | return _mediaURL; | 343 | return _mediaURL; |
@@ -281,6 +347,9 @@ namespace OpenSim.Framework | |||
281 | } | 347 | } |
282 | } | 348 | } |
283 | 349 | ||
350 | /// <summary> | ||
351 | /// URL to the shoutcast music stream to play on the parcel | ||
352 | /// </summary> | ||
284 | public string MusicURL { | 353 | public string MusicURL { |
285 | get { | 354 | get { |
286 | return _musicURL; | 355 | return _musicURL; |
@@ -290,6 +359,10 @@ namespace OpenSim.Framework | |||
290 | } | 359 | } |
291 | } | 360 | } |
292 | 361 | ||
362 | /// <summary> | ||
363 | /// Number of SceneObjectPart that are owned by users who do not own the parcel | ||
364 | /// and don't have the 'group. These are elegable for AutoReturn collection | ||
365 | /// </summary> | ||
293 | public int OtherPrims { | 366 | public int OtherPrims { |
294 | get { | 367 | get { |
295 | return _otherPrims; | 368 | return _otherPrims; |
@@ -299,6 +372,10 @@ namespace OpenSim.Framework | |||
299 | } | 372 | } |
300 | } | 373 | } |
301 | 374 | ||
375 | /// <summary> | ||
376 | /// Owner Avatar or Group of the parcel. Naturally, all land masses must be | ||
377 | /// owned by someone | ||
378 | /// </summary> | ||
302 | public UUID OwnerID { | 379 | public UUID OwnerID { |
303 | get { | 380 | get { |
304 | return _ownerID; | 381 | return _ownerID; |
@@ -308,6 +385,9 @@ namespace OpenSim.Framework | |||
308 | } | 385 | } |
309 | } | 386 | } |
310 | 387 | ||
388 | /// <summary> | ||
389 | /// Number of SceneObjectPart that are owned by the owner of the parcel | ||
390 | /// </summary> | ||
311 | public int OwnerPrims { | 391 | public int OwnerPrims { |
312 | get { | 392 | get { |
313 | return _ownerPrims; | 393 | return _ownerPrims; |
@@ -317,6 +397,9 @@ namespace OpenSim.Framework | |||
317 | } | 397 | } |
318 | } | 398 | } |
319 | 399 | ||
400 | /// <summary> | ||
401 | /// List of access data for the parcel. User data, some bitflags, and a time | ||
402 | /// </summary> | ||
320 | public List<ParcelManager.ParcelAccessEntry> ParcelAccessList { | 403 | public List<ParcelManager.ParcelAccessEntry> ParcelAccessList { |
321 | get { | 404 | get { |
322 | return _parcelAccessList; | 405 | return _parcelAccessList; |
@@ -326,6 +409,9 @@ namespace OpenSim.Framework | |||
326 | } | 409 | } |
327 | } | 410 | } |
328 | 411 | ||
412 | /// <summary> | ||
413 | /// How long in hours a Pass to the parcel is given | ||
414 | /// </summary> | ||
329 | public float PassHours { | 415 | public float PassHours { |
330 | get { | 416 | get { |
331 | return _passHours; | 417 | return _passHours; |
@@ -335,6 +421,9 @@ namespace OpenSim.Framework | |||
335 | } | 421 | } |
336 | } | 422 | } |
337 | 423 | ||
424 | /// <summary> | ||
425 | /// Price to purchase a Pass to a restricted parcel | ||
426 | /// </summary> | ||
338 | public int PassPrice { | 427 | public int PassPrice { |
339 | get { | 428 | get { |
340 | return _passPrice; | 429 | return _passPrice; |
@@ -344,6 +433,9 @@ namespace OpenSim.Framework | |||
344 | } | 433 | } |
345 | } | 434 | } |
346 | 435 | ||
436 | /// <summary> | ||
437 | /// When the parcel is being sold, this is the price to purchase the parcel | ||
438 | /// </summary> | ||
347 | public int SalePrice { | 439 | public int SalePrice { |
348 | get { | 440 | get { |
349 | return _salePrice; | 441 | return _salePrice; |
@@ -353,6 +445,9 @@ namespace OpenSim.Framework | |||
353 | } | 445 | } |
354 | } | 446 | } |
355 | 447 | ||
448 | /// <summary> | ||
449 | /// Number of SceneObjectPart that are currently selected by avatar | ||
450 | /// </summary> | ||
356 | public int SelectedPrims { | 451 | public int SelectedPrims { |
357 | get { | 452 | get { |
358 | return _selectedPrims; | 453 | return _selectedPrims; |
@@ -362,6 +457,9 @@ namespace OpenSim.Framework | |||
362 | } | 457 | } |
363 | } | 458 | } |
364 | 459 | ||
460 | /// <summary> | ||
461 | /// Number of meters^2 in the Simulator | ||
462 | /// </summary> | ||
365 | public int SimwideArea { | 463 | public int SimwideArea { |
366 | get { | 464 | get { |
367 | return _simwideArea; | 465 | return _simwideArea; |
@@ -371,6 +469,9 @@ namespace OpenSim.Framework | |||
371 | } | 469 | } |
372 | } | 470 | } |
373 | 471 | ||
472 | /// <summary> | ||
473 | /// Number of SceneObjectPart in the Simulator | ||
474 | /// </summary> | ||
374 | public int SimwidePrims { | 475 | public int SimwidePrims { |
375 | get { | 476 | get { |
376 | return _simwidePrims; | 477 | return _simwidePrims; |
@@ -380,6 +481,9 @@ namespace OpenSim.Framework | |||
380 | } | 481 | } |
381 | } | 482 | } |
382 | 483 | ||
484 | /// <summary> | ||
485 | /// ID of the snapshot used in the client parcel dialog of the parcel | ||
486 | /// </summary> | ||
383 | public UUID SnapshotID { | 487 | public UUID SnapshotID { |
384 | get { | 488 | get { |
385 | return _snapshotID; | 489 | return _snapshotID; |
@@ -389,6 +493,10 @@ namespace OpenSim.Framework | |||
389 | } | 493 | } |
390 | } | 494 | } |
391 | 495 | ||
496 | /// <summary> | ||
497 | /// When teleporting is restricted to a certain point, this is the location | ||
498 | /// that the user will be redirected to | ||
499 | /// </summary> | ||
392 | public Vector3 UserLocation { | 500 | public Vector3 UserLocation { |
393 | get { | 501 | get { |
394 | return _userLocation; | 502 | return _userLocation; |
@@ -398,6 +506,10 @@ namespace OpenSim.Framework | |||
398 | } | 506 | } |
399 | } | 507 | } |
400 | 508 | ||
509 | /// <summary> | ||
510 | /// When teleporting is restricted to a certain point, this is the rotation | ||
511 | /// that the user will be positioned | ||
512 | /// </summary> | ||
401 | public Vector3 UserLookAt { | 513 | public Vector3 UserLookAt { |
402 | get { | 514 | get { |
403 | return _userLookAt; | 515 | return _userLookAt; |
@@ -407,6 +519,9 @@ namespace OpenSim.Framework | |||
407 | } | 519 | } |
408 | } | 520 | } |
409 | 521 | ||
522 | /// <summary> | ||
523 | /// Depreciated idea. Number of visitors ~= free money | ||
524 | /// </summary> | ||
410 | public int Dwell { | 525 | public int Dwell { |
411 | get { | 526 | get { |
412 | return _dwell; | 527 | return _dwell; |
@@ -416,6 +531,10 @@ namespace OpenSim.Framework | |||
416 | } | 531 | } |
417 | } | 532 | } |
418 | 533 | ||
534 | /// <summary> | ||
535 | /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own | ||
536 | /// the parcel and isn't set to the same 'group' as the parcel. | ||
537 | /// </summary> | ||
419 | public int OtherCleanTime { | 538 | public int OtherCleanTime { |
420 | get { | 539 | get { |
421 | return _otherCleanTime; | 540 | return _otherCleanTime; |
@@ -425,11 +544,16 @@ namespace OpenSim.Framework | |||
425 | } | 544 | } |
426 | } | 545 | } |
427 | 546 | ||
547 | |||
428 | public LandData() | 548 | public LandData() |
429 | { | 549 | { |
430 | _globalID = UUID.Random(); | 550 | _globalID = UUID.Random(); |
431 | } | 551 | } |
432 | 552 | ||
553 | /// <summary> | ||
554 | /// Make a new copy of the land data | ||
555 | /// </summary> | ||
556 | /// <returns></returns> | ||
433 | public LandData Copy() | 557 | public LandData Copy() |
434 | { | 558 | { |
435 | LandData landData = new LandData(); | 559 | LandData landData = new LandData(); |
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs new file mode 100644 index 0000000..0bf8f64 --- /dev/null +++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs | |||
@@ -0,0 +1,339 @@ | |||
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.Collections.Generic; | ||
28 | using OpenMetaverse; | ||
29 | using OpenMetaverse.StructuredData; | ||
30 | using NUnit.Framework; | ||
31 | |||
32 | |||
33 | namespace OpenSim.Framework.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class AgentCircuitDataTest | ||
37 | { | ||
38 | private UUID AgentId; | ||
39 | private AvatarAppearance AvAppearance; | ||
40 | private byte[] VisualParams; | ||
41 | private UUID BaseFolder; | ||
42 | private string CapsPath; | ||
43 | private Dictionary<ulong, string> ChildrenCapsPaths; | ||
44 | private uint circuitcode = 0949030; | ||
45 | private string firstname; | ||
46 | private string lastname; | ||
47 | private UUID SecureSessionId; | ||
48 | private UUID SessionId; | ||
49 | private Vector3 StartPos; | ||
50 | |||
51 | |||
52 | [SetUp] | ||
53 | public void setup() | ||
54 | { | ||
55 | AgentId = UUID.Random(); | ||
56 | BaseFolder = UUID.Random(); | ||
57 | CapsPath = "http://www.opensimulator.org/Caps/Foo"; | ||
58 | ChildrenCapsPaths = new Dictionary<ulong, string>(); | ||
59 | ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2"); | ||
60 | firstname = "CoolAvatarTest"; | ||
61 | lastname = "test"; | ||
62 | StartPos = new Vector3(5,23,125); | ||
63 | |||
64 | SecureSessionId = UUID.Random(); | ||
65 | SessionId = UUID.Random(); | ||
66 | |||
67 | AvAppearance = new AvatarAppearance(AgentId); | ||
68 | AvAppearance.SetDefaultWearables(); | ||
69 | VisualParams = new byte[218]; | ||
70 | AvAppearance.SetDefaultParams(VisualParams); | ||
71 | |||
72 | //body | ||
73 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEIGHT] = 155; | ||
74 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_THICKNESS] = 00; | ||
75 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BODY_FAT] = 0; | ||
76 | |||
77 | //Torso | ||
78 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_MUSCLES] = 48; | ||
79 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_THICKNESS] = 43; | ||
80 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_LENGTH] = 255; | ||
81 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHOULDERS] = 94; | ||
82 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CHEST_MALE_NO_PECS] = 199; | ||
83 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ARM_LENGTH] = 255; | ||
84 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HAND_SIZE] = 33; | ||
85 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_LENGTH] = 240; | ||
86 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOVE_HANDLES] = 0; | ||
87 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BELLY_SIZE] = 0; | ||
88 | |||
89 | // legs | ||
90 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_MUSCLES] = 82; | ||
91 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_LENGTH] = 255; | ||
92 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_WIDTH] = 84; | ||
93 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_LENGTH] = 166; | ||
94 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BUTT_SIZE] = 64; | ||
95 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SADDLEBAGS] = 89; | ||
96 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BOWED_LEGS] = 127; | ||
97 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOOT_SIZE] = 45; | ||
98 | |||
99 | |||
100 | // head | ||
101 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SIZE] = 255; | ||
102 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUASH_STRETCH_HEAD] = 0; // head stretch | ||
103 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SHAPE] = 155; | ||
104 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EGG_HEAD] = 127; | ||
105 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; | ||
106 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_LENGTH] = 45; | ||
107 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FACE_SHEAR] = 127; | ||
108 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOREHEAD_ANGLE] = 104; | ||
109 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_BROW] = 94; | ||
110 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_PUFFY_UPPER_CHEEKS] = 0; // upper cheeks | ||
111 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 122; // lower cheeks | ||
112 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIGH_CHEEK_BONES] = 130; | ||
113 | |||
114 | |||
115 | |||
116 | // eyes | ||
117 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SIZE] = 105; | ||
118 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_EYES] = 135; | ||
119 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SPACING] = 184; | ||
120 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_CORNER_UP] = 230; | ||
121 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_INNER_CORNER_UP] = 120; | ||
122 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_DEPTH] = 158; | ||
123 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPPER_EYELID_FOLD] = 69; | ||
124 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BAGGY_EYES] = 38; | ||
125 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELASHES_LONG] = 127; | ||
126 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POP_EYE] = 127; | ||
127 | |||
128 | VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_COLOR] = 25; | ||
129 | VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_LIGHTNESS] = 127; | ||
130 | |||
131 | // ears | ||
132 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_EARS] = 255; | ||
133 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EARS_OUT] = 127; | ||
134 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ATTACHED_EARLOBES] = 127; | ||
135 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; | ||
136 | |||
137 | // nose | ||
138 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOSE_BIG_OUT] = 79; | ||
139 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE] = 35; | ||
140 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BROAD_NOSTRILS] = 86; | ||
141 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOW_SEPTUM_NOSE] = 112; // nostril division | ||
142 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE] = 25; | ||
143 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOBLE_NOSE_BRIDGE] = 25; // upper bridge | ||
144 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOWER_BRIDGE_NOSE] = 25; // lower bridge | ||
145 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE_BRIDGE] = 25; | ||
146 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPTURNED_NOSE_TIP] = 107; | ||
147 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE_TIP] = 25; | ||
148 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CROOKED_NOSE] = 127; | ||
149 | |||
150 | |||
151 | // Mouth | ||
152 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_WIDTH] = 122; | ||
153 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TALL_LIPS] = 10; // lip fullness | ||
154 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_THICKNESS] = 112; | ||
155 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_RATIO] = 137; | ||
156 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_HEIGHT] = 176; | ||
157 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_CORNER] = 140; // Sad --> happy | ||
158 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_CLEFT_DEEP] = 84; | ||
159 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_LIP_CLEFT] = 84; | ||
160 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHIFT_MOUTH] = 127; | ||
161 | |||
162 | |||
163 | // chin | ||
164 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WEAK_CHIN] = 119; | ||
165 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUARE_JAW] = 5; | ||
166 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DEEP_CHIN] = 132; | ||
167 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_ANGLE] = 153; | ||
168 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_JUT] = 100; | ||
169 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JOWLS] = 38; | ||
170 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN] = 89; | ||
171 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN_UPPER] = 89; | ||
172 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 0; | ||
173 | |||
174 | |||
175 | // hair color | ||
176 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_WHITE_HAIR] = 0; | ||
177 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_RAINBOW_COLOR_39] = 0; | ||
178 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BLONDE_HAIR] = 24; | ||
179 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_RED_HAIR] = 0; | ||
180 | |||
181 | // hair style | ||
182 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_VOLUME] = 160; | ||
183 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_FRONT] = 153; | ||
184 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES] = 153; | ||
185 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BACK] = 170; | ||
186 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_FRONT] = 0; | ||
187 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_TOP] = 117; | ||
188 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_BACK] = 170; | ||
189 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_FRONT_FRINGE] = 0; | ||
190 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDE_FRINGE] = 142; | ||
191 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BACK_FRINGE] = 0; | ||
192 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES_FULL] = 146; | ||
193 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SWEEP] = 0; | ||
194 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_FRONT] = 0; | ||
195 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_BACK] = 0; | ||
196 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_FRONT] = 0; | ||
197 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_BACK] = 0; | ||
198 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_RUMPLED] = 0; | ||
199 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_PIGTAILS] = 0; | ||
200 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_PONYTAIL] = 0; | ||
201 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SPIKED] = 0; | ||
202 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TILT] = 0; | ||
203 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_MIDDLE] = 0; | ||
204 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_RIGHT] = 0; | ||
205 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_LEFT] = 0; | ||
206 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BANGS_PART_MIDDLE] = 155; | ||
207 | |||
208 | //Eyebrows | ||
209 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_SIZE] = 20; | ||
210 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_DENSITY] = 140; | ||
211 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_LOWER_EYEBROWS] = 200; // eyebrow height | ||
212 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_ARCED_EYEBROWS] = 124; | ||
213 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_POINTY_EYEBROWS] = 65; | ||
214 | |||
215 | //Facial hair | ||
216 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_THICKNESS] = 65; | ||
217 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDEBURNS] = 235; | ||
218 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_MOUSTACHE] = 75; | ||
219 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_CHIN_CURTAINS] = 140; | ||
220 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SOULPATCH] = 0; | ||
221 | |||
222 | AvAppearance.VisualParams = VisualParams; | ||
223 | |||
224 | List<byte> wearbyte = new List<byte>(); | ||
225 | for (int i = 0; i < VisualParams.Length; i++) | ||
226 | { | ||
227 | wearbyte.Add(VisualParams[i]); | ||
228 | } | ||
229 | |||
230 | |||
231 | AvAppearance.SetAppearance(AvAppearance.Texture.GetBytes(), wearbyte); | ||
232 | } | ||
233 | |||
234 | /// <summary> | ||
235 | /// Test to ensure that the serialization format is the same and the underlying types don't change without notice | ||
236 | /// oldSerialization is just a json serialization of the OSDMap packed for the AgentCircuitData. | ||
237 | /// The idea is that if the current json serializer cannot parse the old serialization, then the underlying types | ||
238 | /// have changed and are incompatible. | ||
239 | /// </summary> | ||
240 | [Test] | ||
241 | public void HistoricalAgentCircuitDataOSDConversion() | ||
242 | { | ||
243 | string oldSerialization = "{\"agent_id\":\"522675bd-8214-40c1-b3ca-9c7f7fd170be\",\"base_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"caps_path\":\"http://www.opensimulator.org/Caps/Foo\",\"children_seeds\":[{\"handle\":\"18446744073709551615\",\"seed\":\"http://www.opensimulator.org/Caps/Foo2\"}],\"child\":false,\"circuit_code\":\"949030\",\"first_name\":\"CoolAvatarTest\",\"last_name\":\"test\",\"inventory_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"secure_session_id\":\"1e608e2b-0ddb-41f6-be0f-926f61cd3e0a\",\"session_id\":\"aa06f798-9d70-4bdb-9bbf-012a02ee2baf\",\"start_pos\":\"<5, 23, 125>\"}"; | ||
244 | AgentCircuitData Agent1Data = new AgentCircuitData(); | ||
245 | Agent1Data.AgentID = new UUID("522675bd-8214-40c1-b3ca-9c7f7fd170be"); | ||
246 | Agent1Data.Appearance = AvAppearance; | ||
247 | Agent1Data.BaseFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); | ||
248 | Agent1Data.CapsPath = CapsPath; | ||
249 | Agent1Data.child = false; | ||
250 | Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; | ||
251 | Agent1Data.circuitcode = circuitcode; | ||
252 | Agent1Data.firstname = firstname; | ||
253 | Agent1Data.InventoryFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); | ||
254 | Agent1Data.lastname = lastname; | ||
255 | Agent1Data.SecureSessionID = new UUID("1e608e2b-0ddb-41f6-be0f-926f61cd3e0a"); | ||
256 | Agent1Data.SessionID = new UUID("aa06f798-9d70-4bdb-9bbf-012a02ee2baf"); | ||
257 | Agent1Data.startpos = StartPos; | ||
258 | |||
259 | OSDMap map2 = (OSDMap)OSDParser.DeserializeJson(oldSerialization); | ||
260 | |||
261 | |||
262 | AgentCircuitData Agent2Data = new AgentCircuitData(); | ||
263 | Agent2Data.UnpackAgentCircuitData(map2); | ||
264 | |||
265 | Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); | ||
266 | Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); | ||
267 | |||
268 | Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); | ||
269 | Assert.That((Agent1Data.child == Agent2Data.child)); | ||
270 | Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); | ||
271 | Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); | ||
272 | Assert.That((Agent1Data.firstname == Agent2Data.firstname)); | ||
273 | Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); | ||
274 | Assert.That((Agent1Data.lastname == Agent2Data.lastname)); | ||
275 | Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); | ||
276 | Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); | ||
277 | Assert.That((Agent1Data.startpos == Agent2Data.startpos)); | ||
278 | /* | ||
279 | Enable this once VisualParams go in the packing method | ||
280 | for (int i=0;i<208;i++) | ||
281 | Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); | ||
282 | */ | ||
283 | } | ||
284 | |||
285 | /// <summary> | ||
286 | /// Test to ensure that the packing and unpacking methods work. | ||
287 | /// </summary> | ||
288 | [Test] | ||
289 | public void TestAgentCircuitDataOSDConversion() | ||
290 | { | ||
291 | AgentCircuitData Agent1Data = new AgentCircuitData(); | ||
292 | Agent1Data.AgentID = AgentId; | ||
293 | Agent1Data.Appearance = AvAppearance; | ||
294 | Agent1Data.BaseFolder = BaseFolder; | ||
295 | Agent1Data.CapsPath = CapsPath; | ||
296 | Agent1Data.child = false; | ||
297 | Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; | ||
298 | Agent1Data.circuitcode = circuitcode; | ||
299 | Agent1Data.firstname = firstname; | ||
300 | Agent1Data.InventoryFolder = BaseFolder; | ||
301 | Agent1Data.lastname = lastname; | ||
302 | Agent1Data.SecureSessionID = SecureSessionId; | ||
303 | Agent1Data.SessionID = SessionId; | ||
304 | Agent1Data.startpos = StartPos; | ||
305 | |||
306 | |||
307 | OSDMap map = Agent1Data.PackAgentCircuitData(); | ||
308 | string str = OSDParser.SerializeJsonString(map); | ||
309 | //System.Console.WriteLine(str); | ||
310 | OSDMap map2 = (OSDMap)OSDParser.DeserializeJson(str); | ||
311 | |||
312 | |||
313 | AgentCircuitData Agent2Data = new AgentCircuitData(); | ||
314 | Agent2Data.UnpackAgentCircuitData(map2); | ||
315 | |||
316 | Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); | ||
317 | Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); | ||
318 | |||
319 | Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); | ||
320 | Assert.That((Agent1Data.child == Agent2Data.child)); | ||
321 | Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); | ||
322 | Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); | ||
323 | Assert.That((Agent1Data.firstname == Agent2Data.firstname)); | ||
324 | Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); | ||
325 | Assert.That((Agent1Data.lastname == Agent2Data.lastname)); | ||
326 | Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); | ||
327 | Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); | ||
328 | Assert.That((Agent1Data.startpos == Agent2Data.startpos)); | ||
329 | |||
330 | /* | ||
331 | Enable this once VisualParams go in the packing method | ||
332 | for (int i = 0; i < 208; i++) | ||
333 | Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); | ||
334 | */ | ||
335 | |||
336 | |||
337 | } | ||
338 | } | ||
339 | } | ||