aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs1012
1 files changed, 506 insertions, 506 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs
index e181b91..6bfa73b 100644
--- a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs
+++ b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs
@@ -1,506 +1,506 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenMetaverse.StructuredData; 33using OpenMetaverse.StructuredData;
34 34
35namespace OpenSim.Region.Framework.Scenes 35namespace OpenSim.Region.Framework.Scenes
36{ 36{
37 public interface IAgentData 37 public interface IAgentData
38 { 38 {
39 UUID AgentID { get; set; } 39 UUID AgentID { get; set; }
40 40
41 OSDMap PackUpdateMessage(); 41 OSDMap PackUpdateMessage();
42 void UnpackUpdateMessage(OSDMap map); 42 void UnpackUpdateMessage(OSDMap map);
43 } 43 }
44 44
45 /// <summary> 45 /// <summary>
46 /// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms. 46 /// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms.
47 /// </summary> 47 /// </summary>
48 public class AgentPosition : IAgentData 48 public class AgentPosition : IAgentData
49 { 49 {
50 private UUID m_id; 50 private UUID m_id;
51 public UUID AgentID 51 public UUID AgentID
52 { 52 {
53 get { return m_id; } 53 get { return m_id; }
54 set { m_id = value; } 54 set { m_id = value; }
55 } 55 }
56 56
57 public ulong RegionHandle; 57 public ulong RegionHandle;
58 public uint CircuitCode; 58 public uint CircuitCode;
59 public UUID SessionID; 59 public UUID SessionID;
60 60
61 public float Far; 61 public float Far;
62 public Vector3 Position; 62 public Vector3 Position;
63 public Vector3 Velocity; 63 public Vector3 Velocity;
64 public Vector3 Center; 64 public Vector3 Center;
65 public Vector3 Size; 65 public Vector3 Size;
66 public Vector3 AtAxis; 66 public Vector3 AtAxis;
67 public Vector3 LeftAxis; 67 public Vector3 LeftAxis;
68 public Vector3 UpAxis; 68 public Vector3 UpAxis;
69 public bool ChangedGrid; 69 public bool ChangedGrid;
70 70
71 // This probably shouldn't be here 71 // This probably shouldn't be here
72 public byte[] Throttles; 72 public byte[] Throttles;
73 73
74 74
75 public OSDMap PackUpdateMessage() 75 public OSDMap PackUpdateMessage()
76 { 76 {
77 OSDMap args = new OSDMap(); 77 OSDMap args = new OSDMap();
78 args["message_type"] = OSD.FromString("AgentPosition"); 78 args["message_type"] = OSD.FromString("AgentPosition");
79 79
80 args["region_handle"] = OSD.FromString(RegionHandle.ToString()); 80 args["region_handle"] = OSD.FromString(RegionHandle.ToString());
81 args["circuit_code"] = OSD.FromString(CircuitCode.ToString()); 81 args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
82 args["agent_uuid"] = OSD.FromUUID(AgentID); 82 args["agent_uuid"] = OSD.FromUUID(AgentID);
83 args["session_uuid"] = OSD.FromUUID(SessionID); 83 args["session_uuid"] = OSD.FromUUID(SessionID);
84 84
85 args["position"] = OSD.FromString(Position.ToString()); 85 args["position"] = OSD.FromString(Position.ToString());
86 args["velocity"] = OSD.FromString(Velocity.ToString()); 86 args["velocity"] = OSD.FromString(Velocity.ToString());
87 args["center"] = OSD.FromString(Center.ToString()); 87 args["center"] = OSD.FromString(Center.ToString());
88 args["size"] = OSD.FromString(Size.ToString()); 88 args["size"] = OSD.FromString(Size.ToString());
89 args["at_axis"] = OSD.FromString(AtAxis.ToString()); 89 args["at_axis"] = OSD.FromString(AtAxis.ToString());
90 args["left_axis"] = OSD.FromString(LeftAxis.ToString()); 90 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
91 args["up_axis"] = OSD.FromString(UpAxis.ToString()); 91 args["up_axis"] = OSD.FromString(UpAxis.ToString());
92 92
93 args["far"] = OSD.FromReal(Far); 93 args["far"] = OSD.FromReal(Far);
94 args["changed_grid"] = OSD.FromBoolean(ChangedGrid); 94 args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
95 95
96 if ((Throttles != null) && (Throttles.Length > 0)) 96 if ((Throttles != null) && (Throttles.Length > 0))
97 args["throttles"] = OSD.FromBinary(Throttles); 97 args["throttles"] = OSD.FromBinary(Throttles);
98 98
99 return args; 99 return args;
100 } 100 }
101 101
102 public void UnpackUpdateMessage(OSDMap args) 102 public void UnpackUpdateMessage(OSDMap args)
103 { 103 {
104 if (args.ContainsKey("region_handle")) 104 if (args.ContainsKey("region_handle"))
105 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); 105 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
106 106
107 if (args["circuit_code"] != null) 107 if (args["circuit_code"] != null)
108 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode); 108 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
109 109
110 if (args["agent_uuid"] != null) 110 if (args["agent_uuid"] != null)
111 AgentID = args["agent_uuid"].AsUUID(); 111 AgentID = args["agent_uuid"].AsUUID();
112 112
113 if (args["session_uuid"] != null) 113 if (args["session_uuid"] != null)
114 SessionID = args["session_uuid"].AsUUID(); 114 SessionID = args["session_uuid"].AsUUID();
115 115
116 if (args["position"] != null) 116 if (args["position"] != null)
117 Vector3.TryParse(args["position"].AsString(), out Position); 117 Vector3.TryParse(args["position"].AsString(), out Position);
118 118
119 if (args["velocity"] != null) 119 if (args["velocity"] != null)
120 Vector3.TryParse(args["velocity"].AsString(), out Velocity); 120 Vector3.TryParse(args["velocity"].AsString(), out Velocity);
121 121
122 if (args["center"] != null) 122 if (args["center"] != null)
123 Vector3.TryParse(args["center"].AsString(), out Center); 123 Vector3.TryParse(args["center"].AsString(), out Center);
124 124
125 if (args["size"] != null) 125 if (args["size"] != null)
126 Vector3.TryParse(args["size"].AsString(), out Size); 126 Vector3.TryParse(args["size"].AsString(), out Size);
127 127
128 if (args["at_axis"] != null) 128 if (args["at_axis"] != null)
129 Vector3.TryParse(args["at_axis"].AsString(), out AtAxis); 129 Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
130 130
131 if (args["left_axis"] != null) 131 if (args["left_axis"] != null)
132 Vector3.TryParse(args["left_axis"].AsString(), out AtAxis); 132 Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
133 133
134 if (args["up_axis"] != null) 134 if (args["up_axis"] != null)
135 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis); 135 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
136 136
137 if (args["changed_grid"] != null) 137 if (args["changed_grid"] != null)
138 ChangedGrid = args["changed_grid"].AsBoolean(); 138 ChangedGrid = args["changed_grid"].AsBoolean();
139 139
140 if (args["far"] != null) 140 if (args["far"] != null)
141 Far = (float)(args["far"].AsReal()); 141 Far = (float)(args["far"].AsReal());
142 142
143 if (args["throttles"] != null) 143 if (args["throttles"] != null)
144 Throttles = args["throttles"].AsBinary(); 144 Throttles = args["throttles"].AsBinary();
145 } 145 }
146 146
147 /// <summary> 147 /// <summary>
148 /// Soon to be decommissioned 148 /// Soon to be decommissioned
149 /// </summary> 149 /// </summary>
150 /// <param name="cAgent"></param> 150 /// <param name="cAgent"></param>
151 public void CopyFrom(ChildAgentDataUpdate cAgent) 151 public void CopyFrom(ChildAgentDataUpdate cAgent)
152 { 152 {
153 AgentID = new UUID(cAgent.AgentID); 153 AgentID = new UUID(cAgent.AgentID);
154 154
155 // next: ??? 155 // next: ???
156 Size = new Vector3(); 156 Size = new Vector3();
157 Size.Z = cAgent.AVHeight; 157 Size.Z = cAgent.AVHeight;
158 158
159 Center = new Vector3(cAgent.cameraPosition.x, cAgent.cameraPosition.y, cAgent.cameraPosition.z); 159 Center = new Vector3(cAgent.cameraPosition.x, cAgent.cameraPosition.y, cAgent.cameraPosition.z);
160 Far = cAgent.drawdistance; 160 Far = cAgent.drawdistance;
161 Position = new Vector3(cAgent.Position.x, cAgent.Position.y, cAgent.Position.z); 161 Position = new Vector3(cAgent.Position.x, cAgent.Position.y, cAgent.Position.z);
162 RegionHandle = cAgent.regionHandle; 162 RegionHandle = cAgent.regionHandle;
163 Throttles = cAgent.throttles; 163 Throttles = cAgent.throttles;
164 Velocity = new Vector3(cAgent.Velocity.x, cAgent.Velocity.y, cAgent.Velocity.z); 164 Velocity = new Vector3(cAgent.Velocity.x, cAgent.Velocity.y, cAgent.Velocity.z);
165 } 165 }
166 166
167 } 167 }
168 168
169 public class AgentGroupData 169 public class AgentGroupData
170 { 170 {
171 public UUID GroupID; 171 public UUID GroupID;
172 public ulong GroupPowers; 172 public ulong GroupPowers;
173 public bool AcceptNotices; 173 public bool AcceptNotices;
174 174
175 public AgentGroupData(UUID id, ulong powers, bool notices) 175 public AgentGroupData(UUID id, ulong powers, bool notices)
176 { 176 {
177 GroupID = id; 177 GroupID = id;
178 GroupPowers = powers; 178 GroupPowers = powers;
179 AcceptNotices = notices; 179 AcceptNotices = notices;
180 } 180 }
181 181
182 public AgentGroupData(OSDMap args) 182 public AgentGroupData(OSDMap args)
183 { 183 {
184 UnpackUpdateMessage(args); 184 UnpackUpdateMessage(args);
185 } 185 }
186 186
187 public OSDMap PackUpdateMessage() 187 public OSDMap PackUpdateMessage()
188 { 188 {
189 OSDMap groupdata = new OSDMap(); 189 OSDMap groupdata = new OSDMap();
190 groupdata["group_id"] = OSD.FromUUID(GroupID); 190 groupdata["group_id"] = OSD.FromUUID(GroupID);
191 groupdata["group_powers"] = OSD.FromString(GroupPowers.ToString()); 191 groupdata["group_powers"] = OSD.FromString(GroupPowers.ToString());
192 groupdata["accept_notices"] = OSD.FromBoolean(AcceptNotices); 192 groupdata["accept_notices"] = OSD.FromBoolean(AcceptNotices);
193 193
194 return groupdata; 194 return groupdata;
195 } 195 }
196 196
197 public void UnpackUpdateMessage(OSDMap args) 197 public void UnpackUpdateMessage(OSDMap args)
198 { 198 {
199 if (args["group_id"] != null) 199 if (args["group_id"] != null)
200 GroupID = args["group_id"].AsUUID(); 200 GroupID = args["group_id"].AsUUID();
201 if (args["group_powers"] != null) 201 if (args["group_powers"] != null)
202 UInt64.TryParse((string)args["group_powers"].AsString(), out GroupPowers); 202 UInt64.TryParse((string)args["group_powers"].AsString(), out GroupPowers);
203 if (args["accept_notices"] != null) 203 if (args["accept_notices"] != null)
204 AcceptNotices = args["accept_notices"].AsBoolean(); 204 AcceptNotices = args["accept_notices"].AsBoolean();
205 } 205 }
206 } 206 }
207 207
208 //public class AgentAnimationData 208 //public class AgentAnimationData
209 //{ 209 //{
210 // public UUID Animation; 210 // public UUID Animation;
211 // public UUID ObjectID; 211 // public UUID ObjectID;
212 212
213 // public AgentAnimationData(UUID anim, UUID obj) 213 // public AgentAnimationData(UUID anim, UUID obj)
214 // { 214 // {
215 // Animation = anim; 215 // Animation = anim;
216 // ObjectID = obj; 216 // ObjectID = obj;
217 // } 217 // }
218 218
219 // public AgentAnimationData(OSDMap args) 219 // public AgentAnimationData(OSDMap args)
220 // { 220 // {
221 // UnpackUpdateMessage(args); 221 // UnpackUpdateMessage(args);
222 // } 222 // }
223 223
224 // public OSDMap PackUpdateMessage() 224 // public OSDMap PackUpdateMessage()
225 // { 225 // {
226 // OSDMap anim = new OSDMap(); 226 // OSDMap anim = new OSDMap();
227 // anim["animation"] = OSD.FromUUID(Animation); 227 // anim["animation"] = OSD.FromUUID(Animation);
228 // anim["object_id"] = OSD.FromUUID(ObjectID); 228 // anim["object_id"] = OSD.FromUUID(ObjectID);
229 // return anim; 229 // return anim;
230 // } 230 // }
231 231
232 // public void UnpackUpdateMessage(OSDMap args) 232 // public void UnpackUpdateMessage(OSDMap args)
233 // { 233 // {
234 // if (args["animation"] != null) 234 // if (args["animation"] != null)
235 // Animation = args["animation"].AsUUID(); 235 // Animation = args["animation"].AsUUID();
236 // if (args["object_id"] != null) 236 // if (args["object_id"] != null)
237 // ObjectID = args["object_id"].AsUUID(); 237 // ObjectID = args["object_id"].AsUUID();
238 // } 238 // }
239 //} 239 //}
240 240
241 public class AgentData : IAgentData 241 public class AgentData : IAgentData
242 { 242 {
243 private UUID m_id; 243 private UUID m_id;
244 public UUID AgentID 244 public UUID AgentID
245 { 245 {
246 get { return m_id; } 246 get { return m_id; }
247 set { m_id = value; } 247 set { m_id = value; }
248 } 248 }
249 public ulong RegionHandle; 249 public ulong RegionHandle;
250 public uint CircuitCode; 250 public uint CircuitCode;
251 public UUID SessionID; 251 public UUID SessionID;
252 252
253 public Vector3 Position; 253 public Vector3 Position;
254 public Vector3 Velocity; 254 public Vector3 Velocity;
255 public Vector3 Center; 255 public Vector3 Center;
256 public Vector3 Size; 256 public Vector3 Size;
257 public Vector3 AtAxis; 257 public Vector3 AtAxis;
258 public Vector3 LeftAxis; 258 public Vector3 LeftAxis;
259 public Vector3 UpAxis; 259 public Vector3 UpAxis;
260 public bool ChangedGrid; 260 public bool ChangedGrid;
261 261
262 public float Far; 262 public float Far;
263 public float Aspect; 263 public float Aspect;
264 //public int[] Throttles; 264 //public int[] Throttles;
265 public byte[] Throttles; 265 public byte[] Throttles;
266 266
267 public uint LocomotionState; 267 public uint LocomotionState;
268 public Quaternion HeadRotation; 268 public Quaternion HeadRotation;
269 public Quaternion BodyRotation; 269 public Quaternion BodyRotation;
270 public uint ControlFlags; 270 public uint ControlFlags;
271 public float EnergyLevel; 271 public float EnergyLevel;
272 public Byte GodLevel; 272 public Byte GodLevel;
273 public bool AlwaysRun; 273 public bool AlwaysRun;
274 public UUID PreyAgent; 274 public UUID PreyAgent;
275 public Byte AgentAccess; 275 public Byte AgentAccess;
276 public UUID[] AgentTextures; 276 public UUID[] AgentTextures;
277 public UUID ActiveGroupID; 277 public UUID ActiveGroupID;
278 278
279 public AgentGroupData[] Groups; 279 public AgentGroupData[] Groups;
280 public Animation[] Anims; 280 public Animation[] Anims;
281 281
282 public UUID GranterID; 282 public UUID GranterID;
283 public Dictionary<string, string> NVPairs; 283 public Dictionary<string, string> NVPairs;
284 284
285 public byte[] VisualParams; 285 public byte[] VisualParams;
286 286
287 public string CallbackURI; 287 public string CallbackURI;
288 288
289 public OSDMap PackUpdateMessage() 289 public OSDMap PackUpdateMessage()
290 { 290 {
291 OSDMap args = new OSDMap(); 291 OSDMap args = new OSDMap();
292 args["message_type"] = OSD.FromString("AgentData"); 292 args["message_type"] = OSD.FromString("AgentData");
293 293
294 args["region_handle"] = OSD.FromString(RegionHandle.ToString()); 294 args["region_handle"] = OSD.FromString(RegionHandle.ToString());
295 args["circuit_code"] = OSD.FromString(CircuitCode.ToString()); 295 args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
296 args["agent_uuid"] = OSD.FromUUID(AgentID); 296 args["agent_uuid"] = OSD.FromUUID(AgentID);
297 args["session_uuid"] = OSD.FromUUID(SessionID); 297 args["session_uuid"] = OSD.FromUUID(SessionID);
298 298
299 args["position"] = OSD.FromString(Position.ToString()); 299 args["position"] = OSD.FromString(Position.ToString());
300 args["velocity"] = OSD.FromString(Velocity.ToString()); 300 args["velocity"] = OSD.FromString(Velocity.ToString());
301 args["center"] = OSD.FromString(Center.ToString()); 301 args["center"] = OSD.FromString(Center.ToString());
302 args["size"] = OSD.FromString(Size.ToString()); 302 args["size"] = OSD.FromString(Size.ToString());
303 args["at_axis"] = OSD.FromString(AtAxis.ToString()); 303 args["at_axis"] = OSD.FromString(AtAxis.ToString());
304 args["left_axis"] = OSD.FromString(LeftAxis.ToString()); 304 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
305 args["up_axis"] = OSD.FromString(UpAxis.ToString()); 305 args["up_axis"] = OSD.FromString(UpAxis.ToString());
306 306
307 args["changed_grid"] = OSD.FromBoolean(ChangedGrid); 307 args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
308 args["far"] = OSD.FromReal(Far); 308 args["far"] = OSD.FromReal(Far);
309 args["aspect"] = OSD.FromReal(Aspect); 309 args["aspect"] = OSD.FromReal(Aspect);
310 310
311 if ((Throttles != null) && (Throttles.Length > 0)) 311 if ((Throttles != null) && (Throttles.Length > 0))
312 args["throttles"] = OSD.FromBinary(Throttles); 312 args["throttles"] = OSD.FromBinary(Throttles);
313 313
314 args["locomotion_state"] = OSD.FromString(LocomotionState.ToString()); 314 args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
315 args["head_rotation"] = OSD.FromString(HeadRotation.ToString()); 315 args["head_rotation"] = OSD.FromString(HeadRotation.ToString());
316 args["body_rotation"] = OSD.FromString(BodyRotation.ToString()); 316 args["body_rotation"] = OSD.FromString(BodyRotation.ToString());
317 args["control_flags"] = OSD.FromString(ControlFlags.ToString()); 317 args["control_flags"] = OSD.FromString(ControlFlags.ToString());
318 318
319 args["energy_level"] = OSD.FromReal(EnergyLevel); 319 args["energy_level"] = OSD.FromReal(EnergyLevel);
320 args["god_level"] = OSD.FromString(GodLevel.ToString()); 320 args["god_level"] = OSD.FromString(GodLevel.ToString());
321 args["always_run"] = OSD.FromBoolean(AlwaysRun); 321 args["always_run"] = OSD.FromBoolean(AlwaysRun);
322 args["prey_agent"] = OSD.FromUUID(PreyAgent); 322 args["prey_agent"] = OSD.FromUUID(PreyAgent);
323 args["agent_access"] = OSD.FromString(AgentAccess.ToString()); 323 args["agent_access"] = OSD.FromString(AgentAccess.ToString());
324 324
325 if ((AgentTextures != null) && (AgentTextures.Length > 0)) 325 if ((AgentTextures != null) && (AgentTextures.Length > 0))
326 { 326 {
327 OSDArray textures = new OSDArray(AgentTextures.Length); 327 OSDArray textures = new OSDArray(AgentTextures.Length);
328 foreach (UUID uuid in AgentTextures) 328 foreach (UUID uuid in AgentTextures)
329 textures.Add(OSD.FromUUID(uuid)); 329 textures.Add(OSD.FromUUID(uuid));
330 args["agent_textures"] = textures; 330 args["agent_textures"] = textures;
331 } 331 }
332 332
333 args["active_group_id"] = OSD.FromUUID(ActiveGroupID); 333 args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
334 334
335 if ((Groups != null) && (Groups.Length > 0)) 335 if ((Groups != null) && (Groups.Length > 0))
336 { 336 {
337 OSDArray groups = new OSDArray(Groups.Length); 337 OSDArray groups = new OSDArray(Groups.Length);
338 foreach (AgentGroupData agd in Groups) 338 foreach (AgentGroupData agd in Groups)
339 groups.Add(agd.PackUpdateMessage()); 339 groups.Add(agd.PackUpdateMessage());
340 args["groups"] = groups; 340 args["groups"] = groups;
341 } 341 }
342 342
343 if ((Anims != null) && (Anims.Length > 0)) 343 if ((Anims != null) && (Anims.Length > 0))
344 { 344 {
345 OSDArray anims = new OSDArray(Anims.Length); 345 OSDArray anims = new OSDArray(Anims.Length);
346 foreach (Animation aanim in Anims) 346 foreach (Animation aanim in Anims)
347 anims.Add(aanim.PackUpdateMessage()); 347 anims.Add(aanim.PackUpdateMessage());
348 args["animations"] = anims; 348 args["animations"] = anims;
349 } 349 }
350 350
351 if ((VisualParams != null) && (VisualParams.Length > 0)) 351 if ((VisualParams != null) && (VisualParams.Length > 0))
352 args["visual_params"] = OSD.FromBinary(VisualParams); 352 args["visual_params"] = OSD.FromBinary(VisualParams);
353 353
354 // Last few fields are still missing: granter and NVPais 354 // Last few fields are still missing: granter and NVPais
355 355
356 if ((CallbackURI != null) && (!CallbackURI.Equals(""))) 356 if ((CallbackURI != null) && (!CallbackURI.Equals("")))
357 args["callback_uri"] = OSD.FromString(CallbackURI); 357 args["callback_uri"] = OSD.FromString(CallbackURI);
358 358
359 return args; 359 return args;
360 } 360 }
361 361
362 /// <summary> 362 /// <summary>
363 /// Deserialization of agent data. 363 /// Deserialization of agent data.
364 /// Avoiding reflection makes it painful to write, but that's the price! 364 /// Avoiding reflection makes it painful to write, but that's the price!
365 /// </summary> 365 /// </summary>
366 /// <param name="hash"></param> 366 /// <param name="hash"></param>
367 public void UnpackUpdateMessage(OSDMap args) 367 public void UnpackUpdateMessage(OSDMap args)
368 { 368 {
369 if (args.ContainsKey("region_handle")) 369 if (args.ContainsKey("region_handle"))
370 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); 370 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
371 371
372 if (args["circuit_code"] != null) 372 if (args["circuit_code"] != null)
373 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode); 373 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
374 374
375 if (args["agent_uuid"] != null) 375 if (args["agent_uuid"] != null)
376 AgentID = args["agent_uuid"].AsUUID(); 376 AgentID = args["agent_uuid"].AsUUID();
377 377
378 if (args["session_uuid"] != null) 378 if (args["session_uuid"] != null)
379 SessionID = args["session_uuid"].AsUUID(); 379 SessionID = args["session_uuid"].AsUUID();
380 380
381 if (args["position"] != null) 381 if (args["position"] != null)
382 Vector3.TryParse(args["position"].AsString(), out Position); 382 Vector3.TryParse(args["position"].AsString(), out Position);
383 383
384 if (args["velocity"] != null) 384 if (args["velocity"] != null)
385 Vector3.TryParse(args["velocity"].AsString(), out Velocity); 385 Vector3.TryParse(args["velocity"].AsString(), out Velocity);
386 386
387 if (args["center"] != null) 387 if (args["center"] != null)
388 Vector3.TryParse(args["center"].AsString(), out Center); 388 Vector3.TryParse(args["center"].AsString(), out Center);
389 389
390 if (args["size"] != null) 390 if (args["size"] != null)
391 Vector3.TryParse(args["size"].AsString(), out Size); 391 Vector3.TryParse(args["size"].AsString(), out Size);
392 392
393 if (args["at_axis"] != null) 393 if (args["at_axis"] != null)
394 Vector3.TryParse(args["at_axis"].AsString(), out AtAxis); 394 Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
395 395
396 if (args["left_axis"] != null) 396 if (args["left_axis"] != null)
397 Vector3.TryParse(args["left_axis"].AsString(), out AtAxis); 397 Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
398 398
399 if (args["up_axis"] != null) 399 if (args["up_axis"] != null)
400 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis); 400 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
401 401
402 if (args["changed_grid"] != null) 402 if (args["changed_grid"] != null)
403 ChangedGrid = args["changed_grid"].AsBoolean(); 403 ChangedGrid = args["changed_grid"].AsBoolean();
404 404
405 if (args["far"] != null) 405 if (args["far"] != null)
406 Far = (float)(args["far"].AsReal()); 406 Far = (float)(args["far"].AsReal());
407 407
408 if (args["aspect"] != null) 408 if (args["aspect"] != null)
409 Aspect = (float)args["aspect"].AsReal(); 409 Aspect = (float)args["aspect"].AsReal();
410 410
411 if (args["throttles"] != null) 411 if (args["throttles"] != null)
412 Throttles = args["throttles"].AsBinary(); 412 Throttles = args["throttles"].AsBinary();
413 413
414 if (args["locomotion_state"] != null) 414 if (args["locomotion_state"] != null)
415 UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState); 415 UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState);
416 416
417 if (args["head_rotation"] != null) 417 if (args["head_rotation"] != null)
418 Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation); 418 Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation);
419 419
420 if (args["body_rotation"] != null) 420 if (args["body_rotation"] != null)
421 Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation); 421 Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation);
422 422
423 if (args["control_flags"] != null) 423 if (args["control_flags"] != null)
424 UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags); 424 UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags);
425 425
426 if (args["energy_level"] != null) 426 if (args["energy_level"] != null)
427 EnergyLevel = (float)(args["energy_level"].AsReal()); 427 EnergyLevel = (float)(args["energy_level"].AsReal());
428 428
429 if (args["god_level"] != null) 429 if (args["god_level"] != null)
430 Byte.TryParse(args["god_level"].AsString(), out GodLevel); 430 Byte.TryParse(args["god_level"].AsString(), out GodLevel);
431 431
432 if (args["always_run"] != null) 432 if (args["always_run"] != null)
433 AlwaysRun = args["always_run"].AsBoolean(); 433 AlwaysRun = args["always_run"].AsBoolean();
434 434
435 if (args["prey_agent"] != null) 435 if (args["prey_agent"] != null)
436 PreyAgent = args["prey_agent"].AsUUID(); 436 PreyAgent = args["prey_agent"].AsUUID();
437 437
438 if (args["agent_access"] != null) 438 if (args["agent_access"] != null)
439 Byte.TryParse(args["agent_access"].AsString(), out AgentAccess); 439 Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
440 440
441 if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) 441 if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
442 { 442 {
443 OSDArray textures = (OSDArray)(args["agent_textures"]); 443 OSDArray textures = (OSDArray)(args["agent_textures"]);
444 AgentTextures = new UUID[textures.Count]; 444 AgentTextures = new UUID[textures.Count];
445 int i = 0; 445 int i = 0;
446 foreach (OSD o in textures) 446 foreach (OSD o in textures)
447 AgentTextures[i++] = o.AsUUID(); 447 AgentTextures[i++] = o.AsUUID();
448 } 448 }
449 449
450 if (args["active_group_id"] != null) 450 if (args["active_group_id"] != null)
451 ActiveGroupID = args["active_group_id"].AsUUID(); 451 ActiveGroupID = args["active_group_id"].AsUUID();
452 452
453 if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array) 453 if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array)
454 { 454 {
455 OSDArray groups = (OSDArray)(args["groups"]); 455 OSDArray groups = (OSDArray)(args["groups"]);
456 Groups = new AgentGroupData[groups.Count]; 456 Groups = new AgentGroupData[groups.Count];
457 int i = 0; 457 int i = 0;
458 foreach (OSD o in groups) 458 foreach (OSD o in groups)
459 { 459 {
460 if (o.Type == OSDType.Map) 460 if (o.Type == OSDType.Map)
461 { 461 {
462 Groups[i++] = new AgentGroupData((OSDMap)o); 462 Groups[i++] = new AgentGroupData((OSDMap)o);
463 } 463 }
464 } 464 }
465 } 465 }
466 466
467 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array) 467 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
468 { 468 {
469 OSDArray anims = (OSDArray)(args["animations"]); 469 OSDArray anims = (OSDArray)(args["animations"]);
470 Anims = new Animation[anims.Count]; 470 Anims = new Animation[anims.Count];
471 int i = 0; 471 int i = 0;
472 foreach (OSD o in anims) 472 foreach (OSD o in anims)
473 { 473 {
474 if (o.Type == OSDType.Map) 474 if (o.Type == OSDType.Map)
475 { 475 {
476 Anims[i++] = new Animation((OSDMap)o); 476 Anims[i++] = new Animation((OSDMap)o);
477 } 477 }
478 } 478 }
479 } 479 }
480 480
481 if (args["visual_params"] != null) 481 if (args["visual_params"] != null)
482 VisualParams = args["visual_params"].AsBinary(); 482 VisualParams = args["visual_params"].AsBinary();
483 483
484 if (args["callback_uri"] != null) 484 if (args["callback_uri"] != null)
485 CallbackURI = args["callback_uri"].AsString(); 485 CallbackURI = args["callback_uri"].AsString();
486 } 486 }
487 487
488 public AgentData() 488 public AgentData()
489 { 489 {
490 } 490 }
491 491
492 public AgentData(Hashtable hash) 492 public AgentData(Hashtable hash)
493 { 493 {
494 //UnpackUpdateMessage(hash); 494 //UnpackUpdateMessage(hash);
495 } 495 }
496 496
497 public void Dump() 497 public void Dump()
498 { 498 {
499 System.Console.WriteLine("------------ AgentData ------------"); 499 System.Console.WriteLine("------------ AgentData ------------");
500 System.Console.WriteLine("UUID: " + AgentID); 500 System.Console.WriteLine("UUID: " + AgentID);
501 System.Console.WriteLine("Region: " + RegionHandle); 501 System.Console.WriteLine("Region: " + RegionHandle);
502 System.Console.WriteLine("Position: " + Position); 502 System.Console.WriteLine("Position: " + Position);
503 } 503 }
504 } 504 }
505 505
506} 506}