28 using System.Collections.Generic;
30 using OpenMetaverse.StructuredData;
31 using NUnit.Framework;
32 using OpenSim.Tests.Common;
41 private byte[] VisualParams;
42 private UUID BaseFolder;
43 private string CapsPath;
44 private Dictionary<ulong, string> ChildrenCapsPaths;
45 private uint circuitcode = 0949030;
46 private string firstname;
47 private string lastname;
48 private UUID SecureSessionId;
49 private UUID SessionId;
50 private Vector3 StartPos;
56 AgentId = UUID.Random();
57 BaseFolder = UUID.Random();
58 CapsPath =
"http://www.opensimulator.org/Caps/Foo";
59 ChildrenCapsPaths =
new Dictionary<ulong, string>();
60 ChildrenCapsPaths.Add(ulong.MaxValue,
"http://www.opensimulator.org/Caps/Foo2");
61 firstname =
"CoolAvatarTest";
63 StartPos =
new Vector3(5,23,125);
65 SecureSessionId = UUID.Random();
66 SessionId = UUID.Random();
69 VisualParams =
new byte[218];
73 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_THICKNESS] = 00;
77 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_TORSO_MUSCLES] = 48;
79 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_NECK_LENGTH] = 255;
81 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_CHEST_MALE_NO_PECS] = 199;
83 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_HAND_SIZE] = 33;
85 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_LOVE_HANDLES] = 0;
89 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_LEG_MUSCLES] = 82;
91 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_HIP_WIDTH] = 84;
93 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_BUTT_SIZE] = 64;
95 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_BOWED_LEGS] = 127;
100 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_HEAD_SIZE] = 255;
102 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_HEAD_SHAPE] = 155;
104 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255;
106 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_FACE_SHEAR] = 127;
108 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_BIG_BROW] = 94;
110 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 122;
116 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_EYE_SIZE] = 105;
118 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_EYE_SPACING] = 184;
120 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_EYELID_INNER_CORNER_UP] = 120;
122 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_UPPER_EYELID_FOLD] = 69;
124 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_EYELASHES_LONG] = 127;
127 VisualParams[(
int)AvatarAppearance.VPElement.EYES_EYE_COLOR] = 25;
131 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_BIG_EARS] = 255;
133 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_ATTACHED_EARLOBES] = 127;
137 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_NOSE_BIG_OUT] = 79;
139 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_BROAD_NOSTRILS] = 86;
141 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE] = 25;
143 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_LOWER_BRIDGE_NOSE] = 25;
145 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_UPTURNED_NOSE_TIP] = 107;
147 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_CROOKED_NOSE] = 127;
152 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_TALL_LIPS] = 10;
154 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_LIP_RATIO] = 137;
156 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_MOUTH_CORNER] = 140;
158 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_WIDE_LIP_CLEFT] = 84;
163 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_WEAK_CHIN] = 119;
165 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_DEEP_CHIN] = 132;
167 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_JAW_JUT] = 100;
169 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN] = 89;
171 VisualParams[(
int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 0;
176 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_RAINBOW_COLOR_39] = 0;
178 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_RED_HAIR] = 0;
182 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_HAIR_FRONT] = 153;
184 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_HAIR_BACK] = 170;
186 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_TOP] = 117;
188 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_FRONT_FRINGE] = 0;
190 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_BACK_FRINGE] = 0;
192 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_HAIR_SWEEP] = 0;
194 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_BACK] = 0;
196 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_BACK] = 0;
198 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_PIGTAILS] = 0;
200 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_HAIR_SPIKED] = 0;
202 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_HAIR_PART_MIDDLE] = 0;
204 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_HAIR_PART_LEFT] = 0;
208 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_EYEBROW_SIZE] = 20;
210 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_LOWER_EYEBROWS] = 200;
212 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_POINTY_EYEBROWS] = 65;
216 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_SIDEBURNS] = 235;
218 VisualParams[(
int)AvatarAppearance.VPElement.HAIR_CHIN_CURTAINS] = 140;
221 AvAppearance.VisualParams = VisualParams;
223 List<byte> wearbyte =
new List<byte>();
224 for (
int i = 0; i < VisualParams.Length; i++)
226 wearbyte.Add(VisualParams[i]);
229 AvAppearance.SetAppearance(AvAppearance.Texture, (byte[])VisualParams.Clone());
241 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>\"}";
243 Agent1Data.AgentID =
new UUID(
"522675bd-8214-40c1-b3ca-9c7f7fd170be");
244 Agent1Data.Appearance = AvAppearance;
245 Agent1Data.BaseFolder =
new UUID(
"c40b5f5f-476f-496b-bd69-b5a539c434d8");
246 Agent1Data.CapsPath = CapsPath;
247 Agent1Data.child =
false;
248 Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths;
249 Agent1Data.circuitcode = circuitcode;
250 Agent1Data.firstname = firstname;
251 Agent1Data.InventoryFolder =
new UUID(
"c40b5f5f-476f-496b-bd69-b5a539c434d8");
252 Agent1Data.lastname = lastname;
253 Agent1Data.SecureSessionID =
new UUID(
"1e608e2b-0ddb-41f6-be0f-926f61cd3e0a");
254 Agent1Data.SessionID =
new UUID(
"aa06f798-9d70-4bdb-9bbf-012a02ee2baf");
255 Agent1Data.startpos = StartPos;
261 map2 = (
OSDMap) OSDParser.DeserializeJson(oldSerialization);
265 Agent2Data.UnpackAgentCircuitData(map2);
267 Assert.That((Agent1Data.AgentID == Agent2Data.AgentID));
268 Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder));
270 Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath));
271 Assert.That((Agent1Data.child == Agent2Data.child));
272 Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count));
273 Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode));
274 Assert.That((Agent1Data.firstname == Agent2Data.firstname));
275 Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder));
276 Assert.That((Agent1Data.lastname == Agent2Data.lastname));
277 Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID));
278 Assert.That((Agent1Data.SessionID == Agent2Data.SessionID));
279 Assert.That((Agent1Data.startpos == Agent2Data.startpos));
281 catch (LitJson.JsonException)
300 Agent1Data.AgentID = AgentId;
301 Agent1Data.Appearance = AvAppearance;
302 Agent1Data.BaseFolder = BaseFolder;
303 Agent1Data.CapsPath = CapsPath;
304 Agent1Data.child =
false;
305 Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths;
306 Agent1Data.circuitcode = circuitcode;
307 Agent1Data.firstname = firstname;
308 Agent1Data.InventoryFolder = BaseFolder;
309 Agent1Data.lastname = lastname;
310 Agent1Data.SecureSessionID = SecureSessionId;
311 Agent1Data.SessionID = SessionId;
312 Agent1Data.startpos = StartPos;
316 OSDMap map = Agent1Data.PackAgentCircuitData(ctx);
319 string str = OSDParser.SerializeJsonString(map);
321 map2 = (
OSDMap) OSDParser.DeserializeJson(str);
323 catch (System.NullReferenceException)
332 Agent2Data.UnpackAgentCircuitData(map2);
334 Assert.That((Agent1Data.AgentID == Agent2Data.AgentID));
335 Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder));
337 Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath));
338 Assert.That((Agent1Data.child == Agent2Data.child));
339 Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count));
340 Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode));
341 Assert.That((Agent1Data.firstname == Agent2Data.firstname));
342 Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder));
343 Assert.That((Agent1Data.lastname == Agent2Data.lastname));
344 Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID));
345 Assert.That((Agent1Data.SessionID == Agent2Data.SessionID));
346 Assert.That((Agent1Data.startpos == Agent2Data.startpos));
void TestAgentCircuitDataOSDConversion()
Test to ensure that the packing and unpacking methods work.
Contains the Avatar's Appearance and methods to manipulate the appearance.
OpenMetaverse.StructuredData.OSDMap OSDMap
Circuit data for an agent. Connection information shared between regions that accept UDP connections ...
Interactive OpenSim region server
void HistoricalAgentCircuitDataOSDConversion()
Test to ensure that the serialization format is the same and the underlying types don't change withou...
VPElement
Viewer Params Array Element for AgentSetAppearance Generated from LibOMV's Visual Params list ...