diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.API.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 538 |
1 files changed, 284 insertions, 254 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 24962f8..7dcf1e8 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -32,10 +32,8 @@ using System.Text; | |||
32 | using Axiom.Math; | 32 | using Axiom.Math; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using libsecondlife.Packets; | 34 | using libsecondlife.Packets; |
35 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework.Interfaces; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Console; | ||
39 | 37 | ||
40 | namespace OpenSim.Region.ClientStack | 38 | namespace OpenSim.Region.ClientStack |
41 | { | 39 | { |
@@ -116,26 +114,18 @@ namespace OpenSim.Region.ClientStack | |||
116 | /// </summary> | 114 | /// </summary> |
117 | public LLVector3 StartPos | 115 | public LLVector3 StartPos |
118 | { | 116 | { |
119 | get | 117 | get { return startpos; } |
120 | { | 118 | set { startpos = value; } |
121 | return startpos; | ||
122 | } | ||
123 | set | ||
124 | { | ||
125 | startpos = value; | ||
126 | } | ||
127 | } | 119 | } |
128 | 120 | ||
129 | /// <summary> | 121 | /// <summary> |
130 | /// | 122 | /// |
131 | /// </summary> | 123 | /// </summary> |
132 | private LLUUID m_agentId; | 124 | private LLUUID m_agentId; |
125 | |||
133 | public LLUUID AgentId | 126 | public LLUUID AgentId |
134 | { | 127 | { |
135 | get | 128 | get { return m_agentId; } |
136 | { | ||
137 | return m_agentId; | ||
138 | } | ||
139 | } | 129 | } |
140 | 130 | ||
141 | /// <summary> | 131 | /// <summary> |
@@ -143,11 +133,7 @@ namespace OpenSim.Region.ClientStack | |||
143 | /// </summary> | 133 | /// </summary> |
144 | public string FirstName | 134 | public string FirstName |
145 | { | 135 | { |
146 | get | 136 | get { return firstName; } |
147 | { | ||
148 | return this.firstName; | ||
149 | } | ||
150 | |||
151 | } | 137 | } |
152 | 138 | ||
153 | /// <summary> | 139 | /// <summary> |
@@ -155,10 +141,7 @@ namespace OpenSim.Region.ClientStack | |||
155 | /// </summary> | 141 | /// </summary> |
156 | public string LastName | 142 | public string LastName |
157 | { | 143 | { |
158 | get | 144 | get { return lastName; } |
159 | { | ||
160 | return this.lastName; | ||
161 | } | ||
162 | } | 145 | } |
163 | 146 | ||
164 | #region Scene/Avatar to Client | 147 | #region Scene/Avatar to Client |
@@ -182,11 +165,11 @@ namespace OpenSim.Region.ClientStack | |||
182 | handshake.RegionInfo.TerrainStartHeight01 = regionInfo.EstateSettings.terrainStartHeight1; | 165 | handshake.RegionInfo.TerrainStartHeight01 = regionInfo.EstateSettings.terrainStartHeight1; |
183 | handshake.RegionInfo.TerrainStartHeight10 = regionInfo.EstateSettings.terrainStartHeight2; | 166 | handshake.RegionInfo.TerrainStartHeight10 = regionInfo.EstateSettings.terrainStartHeight2; |
184 | handshake.RegionInfo.TerrainStartHeight11 = regionInfo.EstateSettings.terrainStartHeight3; | 167 | handshake.RegionInfo.TerrainStartHeight11 = regionInfo.EstateSettings.terrainStartHeight3; |
185 | handshake.RegionInfo.SimAccess = (byte)regionInfo.EstateSettings.simAccess; | 168 | handshake.RegionInfo.SimAccess = (byte) regionInfo.EstateSettings.simAccess; |
186 | handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight; | 169 | handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight; |
187 | 170 | ||
188 | 171 | ||
189 | handshake.RegionInfo.RegionFlags = (uint)regionInfo.EstateSettings.regionFlags; | 172 | handshake.RegionInfo.RegionFlags = (uint) regionInfo.EstateSettings.regionFlags; |
190 | 173 | ||
191 | handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0"); | 174 | handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0"); |
192 | handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID; | 175 | handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID; |
@@ -200,7 +183,7 @@ namespace OpenSim.Region.ClientStack | |||
200 | handshake.RegionInfo.TerrainDetail3 = regionInfo.EstateSettings.terrainDetail3; | 183 | handshake.RegionInfo.TerrainDetail3 = regionInfo.EstateSettings.terrainDetail3; |
201 | handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? | 184 | handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting? |
202 | 185 | ||
203 | this.OutPacket(handshake); | 186 | OutPacket(handshake); |
204 | } | 187 | } |
205 | 188 | ||
206 | /// <summary> | 189 | /// <summary> |
@@ -210,14 +193,14 @@ namespace OpenSim.Region.ClientStack | |||
210 | public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) | 193 | public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) |
211 | { | 194 | { |
212 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); | 195 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); |
213 | mov.AgentData.SessionID = this.m_sessionId; | 196 | mov.AgentData.SessionID = m_sessionId; |
214 | mov.AgentData.AgentID = this.AgentId; | 197 | mov.AgentData.AgentID = AgentId; |
215 | mov.Data.RegionHandle = regInfo.RegionHandle; | 198 | mov.Data.RegionHandle = regInfo.RegionHandle; |
216 | mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this | 199 | mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this |
217 | 200 | ||
218 | if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) | 201 | if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) |
219 | { | 202 | { |
220 | mov.Data.Position = this.startpos; | 203 | mov.Data.Position = startpos; |
221 | } | 204 | } |
222 | else | 205 | else |
223 | { | 206 | { |
@@ -255,7 +238,7 @@ namespace OpenSim.Region.ClientStack | |||
255 | reply.ChatData.OwnerID = fromAgentID; | 238 | reply.ChatData.OwnerID = fromAgentID; |
256 | reply.ChatData.SourceID = fromAgentID; | 239 | reply.ChatData.SourceID = fromAgentID; |
257 | 240 | ||
258 | this.OutPacket(reply); | 241 | OutPacket(reply); |
259 | } | 242 | } |
260 | 243 | ||
261 | /// <summary> | 244 | /// <summary> |
@@ -264,27 +247,27 @@ namespace OpenSim.Region.ClientStack | |||
264 | /// <remarks>TODO</remarks> | 247 | /// <remarks>TODO</remarks> |
265 | /// <param name="message"></param> | 248 | /// <param name="message"></param> |
266 | /// <param name="target"></param> | 249 | /// <param name="target"></param> |
267 | public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) | 250 | public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, |
251 | LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) | ||
268 | { | 252 | { |
269 | 253 | Encoding enc = Encoding.ASCII; | |
270 | Encoding enc = Encoding.ASCII; | 254 | ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); |
271 | ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); | 255 | msg.AgentData.AgentID = fromAgent; |
272 | msg.AgentData.AgentID = fromAgent; | 256 | msg.AgentData.SessionID = fromAgentSession; |
273 | msg.AgentData.SessionID = fromAgentSession; | 257 | msg.MessageBlock.FromAgentName = enc.GetBytes(fromName + " \0"); |
274 | msg.MessageBlock.FromAgentName = enc.GetBytes(fromName + " \0"); | 258 | msg.MessageBlock.Dialog = dialog; |
275 | msg.MessageBlock.Dialog = dialog; | 259 | msg.MessageBlock.FromGroup = false; |
276 | msg.MessageBlock.FromGroup = false; | 260 | msg.MessageBlock.ID = imSessionID; |
277 | msg.MessageBlock.ID = imSessionID; | 261 | msg.MessageBlock.Offline = 0; |
278 | msg.MessageBlock.Offline = 0; | 262 | msg.MessageBlock.ParentEstateID = 0; |
279 | msg.MessageBlock.ParentEstateID = 0; | 263 | msg.MessageBlock.Position = new LLVector3(); |
280 | msg.MessageBlock.Position = new LLVector3(); | 264 | msg.MessageBlock.RegionID = LLUUID.Random(); |
281 | msg.MessageBlock.RegionID = LLUUID.Random(); | 265 | msg.MessageBlock.Timestamp = timeStamp; |
282 | msg.MessageBlock.Timestamp = timeStamp; | 266 | msg.MessageBlock.ToAgentID = toAgent; |
283 | msg.MessageBlock.ToAgentID = toAgent; | 267 | msg.MessageBlock.Message = enc.GetBytes(message + "\0"); |
284 | msg.MessageBlock.Message = enc.GetBytes(message + "\0"); | 268 | msg.MessageBlock.BinaryBucket = new byte[0]; |
285 | msg.MessageBlock.BinaryBucket = new byte[0]; | 269 | |
286 | 270 | OutPacket(msg); | |
287 | this.OutPacket(msg); | ||
288 | } | 271 | } |
289 | 272 | ||
290 | /// <summary> | 273 | /// <summary> |
@@ -301,10 +284,10 @@ namespace OpenSim.Region.ClientStack | |||
301 | { | 284 | { |
302 | for (int x = 0; x < 16; x = x + 4) | 285 | for (int x = 0; x < 16; x = x + 4) |
303 | { | 286 | { |
304 | patches[0] = x + 0 + y * 16; | 287 | patches[0] = x + 0 + y*16; |
305 | patches[1] = x + 1 + y * 16; | 288 | patches[1] = x + 1 + y*16; |
306 | patches[2] = x + 2 + y * 16; | 289 | patches[2] = x + 2 + y*16; |
307 | patches[3] = x + 3 + y * 16; | 290 | patches[3] = x + 3 + y*16; |
308 | 291 | ||
309 | Packet layerpack = TerrainManager.CreateLandPacket(map, patches); | 292 | Packet layerpack = TerrainManager.CreateLandPacket(map, patches); |
310 | OutPacket(layerpack); | 293 | OutPacket(layerpack); |
@@ -313,7 +296,8 @@ namespace OpenSim.Region.ClientStack | |||
313 | } | 296 | } |
314 | catch (Exception e) | 297 | catch (Exception e) |
315 | { | 298 | { |
316 | MainLog.Instance.Warn("client", "ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString()); | 299 | MainLog.Instance.Warn("client", |
300 | "ClientView API.cs: SendLayerData() - Failed with exception " + e.ToString()); | ||
317 | } | 301 | } |
318 | } | 302 | } |
319 | 303 | ||
@@ -332,14 +316,15 @@ namespace OpenSim.Region.ClientStack | |||
332 | patchx = px; | 316 | patchx = px; |
333 | patchy = py; | 317 | patchy = py; |
334 | 318 | ||
335 | patches[0] = patchx + 0 + patchy * 16; | 319 | patches[0] = patchx + 0 + patchy*16; |
336 | 320 | ||
337 | Packet layerpack = TerrainManager.CreateLandPacket(map, patches); | 321 | Packet layerpack = TerrainManager.CreateLandPacket(map, patches); |
338 | OutPacket(layerpack); | 322 | OutPacket(layerpack); |
339 | } | 323 | } |
340 | catch (Exception e) | 324 | catch (Exception e) |
341 | { | 325 | { |
342 | MainLog.Instance.Warn("client", "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); | 326 | MainLog.Instance.Warn("client", |
327 | "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString()); | ||
343 | } | 328 | } |
344 | } | 329 | } |
345 | 330 | ||
@@ -352,17 +337,17 @@ namespace OpenSim.Region.ClientStack | |||
352 | public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint) | 337 | public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint) |
353 | { | 338 | { |
354 | IPAddress neighbourIP = neighbourEndPoint.Address; | 339 | IPAddress neighbourIP = neighbourEndPoint.Address; |
355 | ushort neighbourPort = (ushort)neighbourEndPoint.Port; | 340 | ushort neighbourPort = (ushort) neighbourEndPoint.Port; |
356 | 341 | ||
357 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | 342 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); |
358 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | 343 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); |
359 | enablesimpacket.SimulatorInfo.Handle = neighbourHandle; | 344 | enablesimpacket.SimulatorInfo.Handle = neighbourHandle; |
360 | 345 | ||
361 | byte[] byteIP = neighbourIP.GetAddressBytes(); | 346 | byte[] byteIP = neighbourIP.GetAddressBytes(); |
362 | enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24; | 347 | enablesimpacket.SimulatorInfo.IP = (uint) byteIP[3] << 24; |
363 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16; | 348 | enablesimpacket.SimulatorInfo.IP += (uint) byteIP[2] << 16; |
364 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8; | 349 | enablesimpacket.SimulatorInfo.IP += (uint) byteIP[1] << 8; |
365 | enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0]; | 350 | enablesimpacket.SimulatorInfo.IP += (uint) byteIP[0]; |
366 | enablesimpacket.SimulatorInfo.Port = neighbourPort; | 351 | enablesimpacket.SimulatorInfo.Port = neighbourPort; |
367 | OutPacket(enablesimpacket); | 352 | OutPacket(enablesimpacket); |
368 | } | 353 | } |
@@ -374,46 +359,48 @@ namespace OpenSim.Region.ClientStack | |||
374 | public AgentCircuitData RequestClientInfo() | 359 | public AgentCircuitData RequestClientInfo() |
375 | { | 360 | { |
376 | AgentCircuitData agentData = new AgentCircuitData(); | 361 | AgentCircuitData agentData = new AgentCircuitData(); |
377 | agentData.AgentID = this.AgentId; | 362 | agentData.AgentID = AgentId; |
378 | agentData.SessionID = this.m_sessionId; | 363 | agentData.SessionID = m_sessionId; |
379 | agentData.SecureSessionID = this.SecureSessionID; | 364 | agentData.SecureSessionID = SecureSessionID; |
380 | agentData.circuitcode = this.m_circuitCode; | 365 | agentData.circuitcode = m_circuitCode; |
381 | agentData.child = false; | 366 | agentData.child = false; |
382 | agentData.firstname = this.firstName; | 367 | agentData.firstname = firstName; |
383 | agentData.lastname = this.lastName; | 368 | agentData.lastname = lastName; |
384 | agentData.CapsPath = ""; | 369 | agentData.CapsPath = ""; |
385 | return agentData; | 370 | return agentData; |
386 | } | 371 | } |
387 | 372 | ||
388 | public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint, string capsURL) | 373 | public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint, |
374 | string capsURL) | ||
389 | { | 375 | { |
390 | LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10); | 376 | LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10); |
391 | 377 | ||
392 | CrossedRegionPacket newSimPack = new CrossedRegionPacket(); | 378 | CrossedRegionPacket newSimPack = new CrossedRegionPacket(); |
393 | newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); | 379 | newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); |
394 | newSimPack.AgentData.AgentID = this.AgentId; | 380 | newSimPack.AgentData.AgentID = AgentId; |
395 | newSimPack.AgentData.SessionID = this.m_sessionId; | 381 | newSimPack.AgentData.SessionID = m_sessionId; |
396 | newSimPack.Info = new CrossedRegionPacket.InfoBlock(); | 382 | newSimPack.Info = new CrossedRegionPacket.InfoBlock(); |
397 | newSimPack.Info.Position = pos; | 383 | newSimPack.Info.Position = pos; |
398 | newSimPack.Info.LookAt = look; // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! | 384 | newSimPack.Info.LookAt = look; |
385 | // new LLVector3(0.0f, 0.0f, 0.0f); // copied from Avatar.cs - SHOULD BE DYNAMIC!!!!!!!!!! | ||
399 | newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock(); | 386 | newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock(); |
400 | newSimPack.RegionData.RegionHandle = newRegionHandle; | 387 | newSimPack.RegionData.RegionHandle = newRegionHandle; |
401 | byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes(); | 388 | byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes(); |
402 | newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24; | 389 | newSimPack.RegionData.SimIP = (uint) byteIP[3] << 24; |
403 | newSimPack.RegionData.SimIP += (uint)byteIP[2] << 16; | 390 | newSimPack.RegionData.SimIP += (uint) byteIP[2] << 16; |
404 | newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8; | 391 | newSimPack.RegionData.SimIP += (uint) byteIP[1] << 8; |
405 | newSimPack.RegionData.SimIP += (uint)byteIP[0]; | 392 | newSimPack.RegionData.SimIP += (uint) byteIP[0]; |
406 | newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port; | 393 | newSimPack.RegionData.SimPort = (ushort) externalIPEndPoint.Port; |
407 | //newSimPack.RegionData.SeedCapability = new byte[0]; | 394 | //newSimPack.RegionData.SeedCapability = new byte[0]; |
408 | newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL); | 395 | newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL); |
409 | 396 | ||
410 | this.OutPacket(newSimPack); | 397 | OutPacket(newSimPack); |
411 | } | 398 | } |
412 | 399 | ||
413 | public void SendMapBlock(List<MapBlockData> mapBlocks) | 400 | public void SendMapBlock(List<MapBlockData> mapBlocks) |
414 | { | 401 | { |
415 | MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); | 402 | MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); |
416 | mapReply.AgentData.AgentID = this.AgentId; | 403 | mapReply.AgentData.AgentID = AgentId; |
417 | mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; | 404 | mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; |
418 | mapReply.AgentData.Flags = 0; | 405 | mapReply.AgentData.Flags = 0; |
419 | 406 | ||
@@ -429,13 +416,13 @@ namespace OpenSim.Region.ClientStack | |||
429 | mapReply.Data[i].Access = mapBlocks[i].Access; | 416 | mapReply.Data[i].Access = mapBlocks[i].Access; |
430 | mapReply.Data[i].Agents = mapBlocks[i].Agents; | 417 | mapReply.Data[i].Agents = mapBlocks[i].Agents; |
431 | } | 418 | } |
432 | this.OutPacket(mapReply); | 419 | OutPacket(mapReply); |
433 | } | 420 | } |
434 | 421 | ||
435 | public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) | 422 | public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) |
436 | { | 423 | { |
437 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | 424 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); |
438 | tpLocal.Info.AgentID = this.AgentId; | 425 | tpLocal.Info.AgentID = AgentId; |
439 | tpLocal.Info.TeleportFlags = flags; | 426 | tpLocal.Info.TeleportFlags = flags; |
440 | tpLocal.Info.LocationID = 2; | 427 | tpLocal.Info.LocationID = 2; |
441 | tpLocal.Info.LookAt = lookAt; | 428 | tpLocal.Info.LookAt = lookAt; |
@@ -443,10 +430,11 @@ namespace OpenSim.Region.ClientStack | |||
443 | OutPacket(tpLocal); | 430 | OutPacket(tpLocal); |
444 | } | 431 | } |
445 | 432 | ||
446 | public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags, string capsURL) | 433 | public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, |
434 | uint flags, string capsURL) | ||
447 | { | 435 | { |
448 | TeleportFinishPacket teleport = new TeleportFinishPacket(); | 436 | TeleportFinishPacket teleport = new TeleportFinishPacket(); |
449 | teleport.Info.AgentID = this.AgentId; | 437 | teleport.Info.AgentID = AgentId; |
450 | teleport.Info.RegionHandle = regionHandle; | 438 | teleport.Info.RegionHandle = regionHandle; |
451 | teleport.Info.SimAccess = simAccess; | 439 | teleport.Info.SimAccess = simAccess; |
452 | 440 | ||
@@ -455,13 +443,13 @@ namespace OpenSim.Region.ClientStack | |||
455 | 443 | ||
456 | IPAddress oIP = newRegionEndPoint.Address; | 444 | IPAddress oIP = newRegionEndPoint.Address; |
457 | byte[] byteIP = oIP.GetAddressBytes(); | 445 | byte[] byteIP = oIP.GetAddressBytes(); |
458 | uint ip = (uint)byteIP[3] << 24; | 446 | uint ip = (uint) byteIP[3] << 24; |
459 | ip += (uint)byteIP[2] << 16; | 447 | ip += (uint) byteIP[2] << 16; |
460 | ip += (uint)byteIP[1] << 8; | 448 | ip += (uint) byteIP[1] << 8; |
461 | ip += (uint)byteIP[0]; | 449 | ip += (uint) byteIP[0]; |
462 | 450 | ||
463 | teleport.Info.SimIP = ip; | 451 | teleport.Info.SimIP = ip; |
464 | teleport.Info.SimPort = (ushort)newRegionEndPoint.Port; | 452 | teleport.Info.SimPort = (ushort) newRegionEndPoint.Port; |
465 | teleport.Info.LocationID = 4; | 453 | teleport.Info.LocationID = 4; |
466 | teleport.Info.TeleportFlags = 1 << 4; | 454 | teleport.Info.TeleportFlags = 1 << 4; |
467 | OutPacket(teleport); | 455 | OutPacket(teleport); |
@@ -473,8 +461,8 @@ namespace OpenSim.Region.ClientStack | |||
473 | public void SendTeleportCancel() | 461 | public void SendTeleportCancel() |
474 | { | 462 | { |
475 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | 463 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); |
476 | tpCancel.Info.SessionID = this.m_sessionId; | 464 | tpCancel.Info.SessionID = m_sessionId; |
477 | tpCancel.Info.AgentID = this.AgentId; | 465 | tpCancel.Info.AgentID = AgentId; |
478 | 466 | ||
479 | OutPacket(tpCancel); | 467 | OutPacket(tpCancel); |
480 | } | 468 | } |
@@ -492,7 +480,7 @@ namespace OpenSim.Region.ClientStack | |||
492 | public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) | 480 | public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) |
493 | { | 481 | { |
494 | MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket(); | 482 | MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket(); |
495 | money.MoneyData.AgentID = this.AgentId; | 483 | money.MoneyData.AgentID = AgentId; |
496 | money.MoneyData.TransactionID = transaction; | 484 | money.MoneyData.TransactionID = transaction; |
497 | money.MoneyData.TransactionSuccess = success; | 485 | money.MoneyData.TransactionSuccess = success; |
498 | money.MoneyData.Description = description; | 486 | money.MoneyData.Description = description; |
@@ -506,7 +494,6 @@ namespace OpenSim.Region.ClientStack | |||
506 | pc.PingID.PingID = seq; | 494 | pc.PingID.PingID = seq; |
507 | pc.Header.Reliable = false; | 495 | pc.Header.Reliable = false; |
508 | OutPacket(pc); | 496 | OutPacket(pc); |
509 | |||
510 | } | 497 | } |
511 | 498 | ||
512 | public void SendKillObject(ulong regionHandle, uint localID) | 499 | public void SendKillObject(ulong regionHandle, uint localID) |
@@ -522,8 +509,8 @@ namespace OpenSim.Region.ClientStack | |||
522 | { | 509 | { |
523 | Encoding enc = Encoding.ASCII; | 510 | Encoding enc = Encoding.ASCII; |
524 | uint FULL_MASK_PERMISSIONS = 2147483647; | 511 | uint FULL_MASK_PERMISSIONS = 2147483647; |
525 | InventoryDescendentsPacket descend = this.CreateInventoryDescendentsPacket(ownerID, folderID); | 512 | InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); |
526 | 513 | ||
527 | int count = 0; | 514 | int count = 0; |
528 | if (items.Count < 40) | 515 | if (items.Count < 40) |
529 | { | 516 | { |
@@ -550,25 +537,30 @@ namespace OpenSim.Region.ClientStack | |||
550 | descend.ItemData[i].FolderID = item.parentFolderID; | 537 | descend.ItemData[i].FolderID = item.parentFolderID; |
551 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 538 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
552 | descend.ItemData[i].GroupMask = 0; | 539 | descend.ItemData[i].GroupMask = 0; |
553 | descend.ItemData[i].InvType = (sbyte)item.invType; | 540 | descend.ItemData[i].InvType = (sbyte) item.invType; |
554 | descend.ItemData[i].Name = enc.GetBytes(item.inventoryName + "\0"); | 541 | descend.ItemData[i].Name = enc.GetBytes(item.inventoryName + "\0"); |
555 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; | 542 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; |
556 | descend.ItemData[i].OwnerID = item.avatarID; | 543 | descend.ItemData[i].OwnerID = item.avatarID; |
557 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; | 544 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; |
558 | descend.ItemData[i].SalePrice = 0; | 545 | descend.ItemData[i].SalePrice = 0; |
559 | descend.ItemData[i].SaleType = 0; | 546 | descend.ItemData[i].SaleType = 0; |
560 | descend.ItemData[i].Type = (sbyte)item.assetType; | 547 | descend.ItemData[i].Type = (sbyte) item.assetType; |
561 | descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type, descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100, descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | 548 | descend.ItemData[i].CRC = |
549 | Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type, | ||
550 | descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100, | ||
551 | descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, | ||
552 | descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, | ||
553 | 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | ||
562 | 554 | ||
563 | i++; | 555 | i++; |
564 | count++; | 556 | count++; |
565 | if (i == 40) | 557 | if (i == 40) |
566 | { | 558 | { |
567 | this.OutPacket(descend); | 559 | OutPacket(descend); |
568 | 560 | ||
569 | if ((items.Count - count) > 0) | 561 | if ((items.Count - count) > 0) |
570 | { | 562 | { |
571 | descend = this.CreateInventoryDescendentsPacket(ownerID, folderID); | 563 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); |
572 | if ((items.Count - count) < 40) | 564 | if ((items.Count - count) < 40) |
573 | { | 565 | { |
574 | descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count]; | 566 | descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count]; |
@@ -586,15 +578,14 @@ namespace OpenSim.Region.ClientStack | |||
586 | 578 | ||
587 | if (i < 40) | 579 | if (i < 40) |
588 | { | 580 | { |
589 | this.OutPacket(descend); | 581 | OutPacket(descend); |
590 | } | 582 | } |
591 | |||
592 | } | 583 | } |
593 | 584 | ||
594 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) | 585 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) |
595 | { | 586 | { |
596 | InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); | 587 | InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); |
597 | descend.AgentData.AgentID = this.AgentId; | 588 | descend.AgentData.AgentID = AgentId; |
598 | descend.AgentData.OwnerID = ownerID; | 589 | descend.AgentData.OwnerID = ownerID; |
599 | descend.AgentData.FolderID = folderID; | 590 | descend.AgentData.FolderID = folderID; |
600 | descend.AgentData.Version = 0; | 591 | descend.AgentData.Version = 0; |
@@ -607,31 +598,39 @@ namespace OpenSim.Region.ClientStack | |||
607 | Encoding enc = Encoding.ASCII; | 598 | Encoding enc = Encoding.ASCII; |
608 | uint FULL_MASK_PERMISSIONS = 2147483647; | 599 | uint FULL_MASK_PERMISSIONS = 2147483647; |
609 | FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket(); | 600 | FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket(); |
610 | inventoryReply.AgentData.AgentID = this.AgentId; | 601 | inventoryReply.AgentData.AgentID = AgentId; |
611 | inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; | 602 | inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; |
612 | inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); | 603 | inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); |
613 | inventoryReply.InventoryData[0].ItemID = item.inventoryID; | 604 | inventoryReply.InventoryData[0].ItemID = item.inventoryID; |
614 | inventoryReply.InventoryData[0].AssetID = item.assetID; | 605 | inventoryReply.InventoryData[0].AssetID = item.assetID; |
615 | inventoryReply.InventoryData[0].CreatorID = item.creatorsID; | 606 | inventoryReply.InventoryData[0].CreatorID = item.creatorsID; |
616 | inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions; | 607 | inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions; |
617 | inventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | 608 | inventoryReply.InventoryData[0].CreationDate = |
609 | (int) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; | ||
618 | inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0"); | 610 | inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0"); |
619 | inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions; | 611 | inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions; |
620 | inventoryReply.InventoryData[0].Flags = 0; | 612 | inventoryReply.InventoryData[0].Flags = 0; |
621 | inventoryReply.InventoryData[0].FolderID = item.parentFolderID; | 613 | inventoryReply.InventoryData[0].FolderID = item.parentFolderID; |
622 | inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 614 | inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
623 | inventoryReply.InventoryData[0].GroupMask = 0; | 615 | inventoryReply.InventoryData[0].GroupMask = 0; |
624 | inventoryReply.InventoryData[0].InvType = (sbyte)item.invType; | 616 | inventoryReply.InventoryData[0].InvType = (sbyte) item.invType; |
625 | inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0"); | 617 | inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0"); |
626 | inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions; | 618 | inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions; |
627 | inventoryReply.InventoryData[0].OwnerID = item.avatarID; | 619 | inventoryReply.InventoryData[0].OwnerID = item.avatarID; |
628 | inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions; | 620 | inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions; |
629 | inventoryReply.InventoryData[0].SalePrice = 0; | 621 | inventoryReply.InventoryData[0].SalePrice = 0; |
630 | inventoryReply.InventoryData[0].SaleType = 0; | 622 | inventoryReply.InventoryData[0].SaleType = 0; |
631 | inventoryReply.InventoryData[0].Type = (sbyte)item.assetType; | 623 | inventoryReply.InventoryData[0].Type = (sbyte) item.assetType; |
632 | inventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, inventoryReply.InventoryData[0].GroupID, 100, inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID, inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | 624 | inventoryReply.InventoryData[0].CRC = |
633 | 625 | Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, | |
634 | this.OutPacket(inventoryReply); | 626 | inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, |
627 | inventoryReply.InventoryData[0].GroupID, 100, | ||
628 | inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID, | ||
629 | inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID, | ||
630 | FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, | ||
631 | FULL_MASK_PERMISSIONS); | ||
632 | |||
633 | OutPacket(inventoryReply); | ||
635 | } | 634 | } |
636 | 635 | ||
637 | public void SendInventoryItemUpdate(InventoryItemBase Item) | 636 | public void SendInventoryItemUpdate(InventoryItemBase Item) |
@@ -639,7 +638,7 @@ namespace OpenSim.Region.ClientStack | |||
639 | Encoding enc = Encoding.ASCII; | 638 | Encoding enc = Encoding.ASCII; |
640 | uint FULL_MASK_PERMISSIONS = 2147483647; | 639 | uint FULL_MASK_PERMISSIONS = 2147483647; |
641 | UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); | 640 | UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); |
642 | InventoryReply.AgentData.AgentID = this.AgentId; | 641 | InventoryReply.AgentData.AgentID = AgentId; |
643 | InventoryReply.AgentData.SimApproved = true; | 642 | InventoryReply.AgentData.SimApproved = true; |
644 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | 643 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; |
645 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); | 644 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); |
@@ -654,15 +653,22 @@ namespace OpenSim.Region.ClientStack | |||
654 | InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; | 653 | InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; |
655 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 654 | InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
656 | InventoryReply.InventoryData[0].GroupMask = 0; | 655 | InventoryReply.InventoryData[0].GroupMask = 0; |
657 | InventoryReply.InventoryData[0].InvType = (sbyte)Item.invType; | 656 | InventoryReply.InventoryData[0].InvType = (sbyte) Item.invType; |
658 | InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0"); | 657 | InventoryReply.InventoryData[0].Name = enc.GetBytes(Item.inventoryName + "\0"); |
659 | InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions; | 658 | InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions; |
660 | InventoryReply.InventoryData[0].OwnerID = Item.avatarID; | 659 | InventoryReply.InventoryData[0].OwnerID = Item.avatarID; |
661 | InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions; | 660 | InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions; |
662 | InventoryReply.InventoryData[0].SalePrice = 100; | 661 | InventoryReply.InventoryData[0].SalePrice = 100; |
663 | InventoryReply.InventoryData[0].SaleType = 0; | 662 | InventoryReply.InventoryData[0].SaleType = 0; |
664 | InventoryReply.InventoryData[0].Type = (sbyte)Item.assetType; | 663 | InventoryReply.InventoryData[0].Type = (sbyte) Item.assetType; |
665 | InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); | 664 | InventoryReply.InventoryData[0].CRC = |
665 | Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, | ||
666 | InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, | ||
667 | InventoryReply.InventoryData[0].GroupID, 100, | ||
668 | InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, | ||
669 | InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, | ||
670 | FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, | ||
671 | FULL_MASK_PERMISSIONS); | ||
666 | 672 | ||
667 | OutPacket(InventoryReply); | 673 | OutPacket(InventoryReply); |
668 | } | 674 | } |
@@ -670,8 +676,8 @@ namespace OpenSim.Region.ClientStack | |||
670 | public void SendRemoveInventoryItem(LLUUID itemID) | 676 | public void SendRemoveInventoryItem(LLUUID itemID) |
671 | { | 677 | { |
672 | RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); | 678 | RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); |
673 | remove.AgentData.AgentID = this.AgentId; | 679 | remove.AgentData.AgentID = AgentId; |
674 | remove.AgentData.SessionID = this.m_sessionId; | 680 | remove.AgentData.SessionID = m_sessionId; |
675 | remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; | 681 | remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; |
676 | remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock(); | 682 | remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock(); |
677 | remove.InventoryData[0].ItemID = itemID; | 683 | remove.InventoryData[0].ItemID = itemID; |
@@ -716,13 +722,14 @@ namespace OpenSim.Region.ClientStack | |||
716 | public void SendAgentAlertMessage(string message, bool modal) | 722 | public void SendAgentAlertMessage(string message, bool modal) |
717 | { | 723 | { |
718 | AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket(); | 724 | AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket(); |
719 | alertPack.AgentData.AgentID = this.AgentId; | 725 | alertPack.AgentData.AgentID = AgentId; |
720 | alertPack.AlertData.Message = Helpers.StringToField(message); | 726 | alertPack.AlertData.Message = Helpers.StringToField(message); |
721 | alertPack.AlertData.Modal = modal; | 727 | alertPack.AlertData.Modal = modal; |
722 | OutPacket(alertPack); | 728 | OutPacket(alertPack); |
723 | } | 729 | } |
724 | 730 | ||
725 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) | 731 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, |
732 | string url) | ||
726 | { | 733 | { |
727 | LoadURLPacket loadURL = new LoadURLPacket(); | 734 | LoadURLPacket loadURL = new LoadURLPacket(); |
728 | loadURL.Data.ObjectName = Helpers.StringToField(objectname); | 735 | loadURL.Data.ObjectName = Helpers.StringToField(objectname); |
@@ -761,14 +768,13 @@ namespace OpenSim.Region.ClientStack | |||
761 | 768 | ||
762 | public void SendViewerTime(int phase) | 769 | public void SendViewerTime(int phase) |
763 | { | 770 | { |
764 | |||
765 | SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); | 771 | SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); |
766 | //viewertime.TimeInfo.SecPerDay = 86400; | 772 | //viewertime.TimeInfo.SecPerDay = 86400; |
767 | // viewertime.TimeInfo.SecPerYear = 31536000; | 773 | // viewertime.TimeInfo.SecPerYear = 31536000; |
768 | viewertime.TimeInfo.SecPerDay = 1000; | 774 | viewertime.TimeInfo.SecPerDay = 1000; |
769 | viewertime.TimeInfo.SecPerYear = 365000; | 775 | viewertime.TimeInfo.SecPerYear = 365000; |
770 | viewertime.TimeInfo.SunPhase = 1; | 776 | viewertime.TimeInfo.SunPhase = 1; |
771 | int sunPhase = (phase + 2) / 2; | 777 | int sunPhase = (phase + 2)/2; |
772 | if ((sunPhase < 6) || (sunPhase > 36)) | 778 | if ((sunPhase < 6) || (sunPhase > 36)) |
773 | { | 779 | { |
774 | viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f); | 780 | viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f); |
@@ -781,27 +787,41 @@ namespace OpenSim.Region.ClientStack | |||
781 | sunPhase = 12; | 787 | sunPhase = 12; |
782 | } | 788 | } |
783 | sunPhase = sunPhase - 12; | 789 | sunPhase = sunPhase - 12; |
784 | float yValue = 0.1f * (sunPhase); | 790 | float yValue = 0.1f*(sunPhase); |
785 | if (yValue > 1.2f) { yValue = yValue - 1.2f; } | 791 | if (yValue > 1.2f) |
786 | if (yValue > 1 ) { yValue = 1; } | 792 | { |
787 | if (yValue < 0) { yValue = 0; } | 793 | yValue = yValue - 1.2f; |
794 | } | ||
795 | if (yValue > 1) | ||
796 | { | ||
797 | yValue = 1; | ||
798 | } | ||
799 | if (yValue < 0) | ||
800 | { | ||
801 | yValue = 0; | ||
802 | } | ||
788 | if (sunPhase < 14) | 803 | if (sunPhase < 14) |
789 | { | 804 | { |
790 | yValue = 1 - yValue; | 805 | yValue = 1 - yValue; |
791 | } | 806 | } |
792 | if (sunPhase < 12) { yValue *= -1; } | 807 | if (sunPhase < 12) |
808 | { | ||
809 | yValue *= -1; | ||
810 | } | ||
793 | viewertime.TimeInfo.SunDirection = new LLVector3(0f, yValue, 0.3f); | 811 | viewertime.TimeInfo.SunDirection = new LLVector3(0f, yValue, 0.3f); |
794 | //Console.WriteLine("sending sun update " + yValue); | 812 | //Console.WriteLine("sending sun update " + yValue); |
795 | } | 813 | } |
796 | viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); | 814 | viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); |
797 | viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch(); | 815 | viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch(); |
798 | OutPacket(viewertime); | 816 | OutPacket(viewertime); |
799 | } | 817 | } |
800 | 818 | ||
801 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) | 819 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, |
820 | string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, | ||
821 | LLUUID partnerID) | ||
802 | { | 822 | { |
803 | AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket(); | 823 | AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket(); |
804 | avatarReply.AgentData.AgentID = this.AgentId; | 824 | avatarReply.AgentData.AgentID = AgentId; |
805 | avatarReply.AgentData.AvatarID = avatarID; | 825 | avatarReply.AgentData.AvatarID = avatarID; |
806 | avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); | 826 | avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); |
807 | avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn); | 827 | avatarReply.PropertiesData.BornOn = Helpers.StringToField(bornOn); |
@@ -827,6 +847,7 @@ namespace OpenSim.Region.ClientStack | |||
827 | 847 | ||
828 | OutPacket(avatarSitResponse); | 848 | OutPacket(avatarSitResponse); |
829 | } | 849 | } |
850 | |||
830 | #endregion | 851 | #endregion |
831 | 852 | ||
832 | #region Appearance/ Wearables Methods | 853 | #region Appearance/ Wearables Methods |
@@ -838,22 +859,22 @@ namespace OpenSim.Region.ClientStack | |||
838 | public void SendWearables(AvatarWearable[] wearables) | 859 | public void SendWearables(AvatarWearable[] wearables) |
839 | { | 860 | { |
840 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | 861 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); |
841 | aw.AgentData.AgentID = this.AgentId; | 862 | aw.AgentData.AgentID = AgentId; |
842 | aw.AgentData.SerialNum = 0; | 863 | aw.AgentData.SerialNum = 0; |
843 | aw.AgentData.SessionID = this.m_sessionId; | 864 | aw.AgentData.SessionID = m_sessionId; |
844 | 865 | ||
845 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | 866 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; |
846 | AgentWearablesUpdatePacket.WearableDataBlock awb; | 867 | AgentWearablesUpdatePacket.WearableDataBlock awb; |
847 | for (int i = 0; i < wearables.Length; i++) | 868 | for (int i = 0; i < wearables.Length; i++) |
848 | { | 869 | { |
849 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | 870 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
850 | awb.WearableType = (byte)i; | 871 | awb.WearableType = (byte) i; |
851 | awb.AssetID = wearables[i].AssetID; | 872 | awb.AssetID = wearables[i].AssetID; |
852 | awb.ItemID = wearables[i].ItemID; | 873 | awb.ItemID = wearables[i].ItemID; |
853 | aw.WearableData[i] = awb; | 874 | aw.WearableData[i] = awb; |
854 | } | 875 | } |
855 | 876 | ||
856 | this.OutPacket(aw); | 877 | OutPacket(aw); |
857 | } | 878 | } |
858 | 879 | ||
859 | /// <summary> | 880 | /// <summary> |
@@ -893,7 +914,7 @@ namespace OpenSim.Region.ClientStack | |||
893 | ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); | 914 | ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); |
894 | ani.AnimationList[0].AnimID = animID; | 915 | ani.AnimationList[0].AnimID = animID; |
895 | ani.AnimationList[0].AnimSequenceID = seq; | 916 | ani.AnimationList[0].AnimSequenceID = seq; |
896 | this.OutPacket(ani); | 917 | OutPacket(ani); |
897 | } | 918 | } |
898 | 919 | ||
899 | #endregion | 920 | #endregion |
@@ -909,25 +930,26 @@ namespace OpenSim.Region.ClientStack | |||
909 | /// <param name="avatarID"></param> | 930 | /// <param name="avatarID"></param> |
910 | /// <param name="avatarLocalID"></param> | 931 | /// <param name="avatarLocalID"></param> |
911 | /// <param name="Pos"></param> | 932 | /// <param name="Pos"></param> |
912 | public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | 933 | public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, |
934 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | ||
913 | { | 935 | { |
914 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | 936 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
915 | objupdate.RegionData.RegionHandle = regionHandle; | 937 | objupdate.RegionData.RegionHandle = regionHandle; |
916 | objupdate.RegionData.TimeDilation = 64096; | 938 | objupdate.RegionData.TimeDilation = 64096; |
917 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 939 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
918 | objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(textureEntry); | 940 | objupdate.ObjectData[0] = CreateDefaultAvatarPacket(textureEntry); |
919 | 941 | ||
920 | //give this avatar object a local id and assign the user a name | 942 | //give this avatar object a local id and assign the user a name |
921 | objupdate.ObjectData[0].ID = avatarLocalID; | 943 | objupdate.ObjectData[0].ID = avatarLocalID; |
922 | objupdate.ObjectData[0].FullID = avatarID; | 944 | objupdate.ObjectData[0].FullID = avatarID; |
923 | objupdate.ObjectData[0].ParentID = parentID; | 945 | objupdate.ObjectData[0].ParentID = parentID; |
924 | objupdate.ObjectData[0].NameValue = Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); | 946 | objupdate.ObjectData[0].NameValue = |
925 | LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); | 947 | Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); |
948 | LLVector3 pos2 = new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); | ||
926 | byte[] pb = pos2.GetBytes(); | 949 | byte[] pb = pos2.GetBytes(); |
927 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | 950 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); |
928 | 951 | ||
929 | OutPacket(objupdate); | 952 | OutPacket(objupdate); |
930 | |||
931 | } | 953 | } |
932 | 954 | ||
933 | /// <summary> | 955 | /// <summary> |
@@ -938,38 +960,41 @@ namespace OpenSim.Region.ClientStack | |||
938 | /// <param name="localID"></param> | 960 | /// <param name="localID"></param> |
939 | /// <param name="position"></param> | 961 | /// <param name="position"></param> |
940 | /// <param name="velocity"></param> | 962 | /// <param name="velocity"></param> |
941 | public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation) | 963 | public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
964 | LLVector3 velocity, LLQuaternion rotation) | ||
942 | { | 965 | { |
943 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity, rotation); | 966 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = |
967 | CreateAvatarImprovedBlock(localID, position, velocity, rotation); | ||
944 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 968 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
945 | terse.RegionData.RegionHandle = regionHandle; | 969 | terse.RegionData.RegionHandle = regionHandle; |
946 | terse.RegionData.TimeDilation = timeDilation; | 970 | terse.RegionData.TimeDilation = timeDilation; |
947 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 971 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
948 | terse.ObjectData[0] = terseBlock; | 972 | terse.ObjectData[0] = terseBlock; |
949 | 973 | ||
950 | this.OutPacket(terse); | 974 | OutPacket(terse); |
951 | } | 975 | } |
952 | 976 | ||
953 | public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) | 977 | public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) |
954 | { | 978 | { |
955 | CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket(); | 979 | CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket(); |
956 | int total = CoarseLocations.Count; | 980 | int total = CoarseLocations.Count; |
957 | CoarseLocationUpdatePacket.IndexBlock ib = | 981 | CoarseLocationUpdatePacket.IndexBlock ib = |
958 | new CoarseLocationUpdatePacket.IndexBlock(); | 982 | new CoarseLocationUpdatePacket.IndexBlock(); |
959 | loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; | 983 | loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; |
960 | for(int i=0; i<total; i++) { | 984 | for (int i = 0; i < total; i++) |
961 | CoarseLocationUpdatePacket.LocationBlock lb = | 985 | { |
962 | new CoarseLocationUpdatePacket.LocationBlock(); | 986 | CoarseLocationUpdatePacket.LocationBlock lb = |
963 | lb.X = (byte)CoarseLocations[i].X; | 987 | new CoarseLocationUpdatePacket.LocationBlock(); |
964 | lb.Y = (byte)CoarseLocations[i].Y; | 988 | lb.X = (byte) CoarseLocations[i].X; |
965 | lb.Z = (byte)(CoarseLocations[i].Z/4); | 989 | lb.Y = (byte) CoarseLocations[i].Y; |
966 | loc.Location[i] = lb; | 990 | lb.Z = (byte) (CoarseLocations[i].Z/4); |
967 | } | 991 | loc.Location[i] = lb; |
968 | ib.You = -1; | 992 | } |
969 | ib.Prey = -1; | 993 | ib.You = -1; |
970 | loc.Index = ib; | 994 | ib.Prey = -1; |
971 | this.OutPacket(loc); | 995 | loc.Index = ib; |
972 | } | 996 | OutPacket(loc); |
997 | } | ||
973 | 998 | ||
974 | #endregion | 999 | #endregion |
975 | 1000 | ||
@@ -984,27 +1009,28 @@ namespace OpenSim.Region.ClientStack | |||
984 | public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) | 1009 | public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) |
985 | { | 1010 | { |
986 | ObjectAttachPacket attach = new ObjectAttachPacket(); | 1011 | ObjectAttachPacket attach = new ObjectAttachPacket(); |
987 | attach.AgentData.AgentID = this.AgentId; | 1012 | attach.AgentData.AgentID = AgentId; |
988 | attach.AgentData.SessionID = this.m_sessionId; | 1013 | attach.AgentData.SessionID = m_sessionId; |
989 | attach.AgentData.AttachmentPoint = attachPoint; | 1014 | attach.AgentData.AttachmentPoint = attachPoint; |
990 | attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; | 1015 | attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; |
991 | attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); | 1016 | attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); |
992 | attach.ObjectData[0].ObjectLocalID = localID; | 1017 | attach.ObjectData[0].ObjectLocalID = localID; |
993 | attach.ObjectData[0].Rotation = rotation; | 1018 | attach.ObjectData[0].Rotation = rotation; |
994 | 1019 | ||
995 | this.OutPacket(attach); | 1020 | OutPacket(attach); |
996 | } | 1021 | } |
997 | 1022 | ||
998 | public void SendPrimitiveToClient( | 1023 | public void SendPrimitiveToClient( |
999 | ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, | 1024 | ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, |
1025 | uint flags, | ||
1000 | LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) | 1026 | LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation) |
1001 | { | 1027 | { |
1002 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | 1028 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); |
1003 | outPacket.RegionData.RegionHandle = regionHandle; | 1029 | outPacket.RegionData.RegionHandle = regionHandle; |
1004 | outPacket.RegionData.TimeDilation = timeDilation; | 1030 | outPacket.RegionData.TimeDilation = timeDilation; |
1005 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 1031 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
1006 | 1032 | ||
1007 | outPacket.ObjectData[0] = this.CreatePrimUpdateBlock(primShape, flags); | 1033 | outPacket.ObjectData[0] = CreatePrimUpdateBlock(primShape, flags); |
1008 | 1034 | ||
1009 | outPacket.ObjectData[0].ID = localID; | 1035 | outPacket.ObjectData[0].ID = localID; |
1010 | outPacket.ObjectData[0].FullID = objectID; | 1036 | outPacket.ObjectData[0].FullID = objectID; |
@@ -1033,35 +1059,38 @@ namespace OpenSim.Region.ClientStack | |||
1033 | /// <param name="localID"></param> | 1059 | /// <param name="localID"></param> |
1034 | /// <param name="position"></param> | 1060 | /// <param name="position"></param> |
1035 | /// <param name="rotation"></param> | 1061 | /// <param name="rotation"></param> |
1036 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) | 1062 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
1063 | LLQuaternion rotation) | ||
1037 | { | 1064 | { |
1038 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 1065 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); |
1039 | terse.RegionData.RegionHandle = regionHandle; | 1066 | terse.RegionData.RegionHandle = regionHandle; |
1040 | terse.RegionData.TimeDilation = timeDilation; | 1067 | terse.RegionData.TimeDilation = timeDilation; |
1041 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1068 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
1042 | terse.ObjectData[0] = this.CreatePrimImprovedBlock(localID, position, rotation); | 1069 | terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation); |
1043 | 1070 | ||
1044 | this.OutPacket(terse); | 1071 | OutPacket(terse); |
1045 | } | 1072 | } |
1046 | 1073 | ||
1047 | #endregion | 1074 | #endregion |
1048 | 1075 | ||
1049 | #region Helper Methods | 1076 | #region Helper Methods |
1050 | 1077 | ||
1051 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity, LLQuaternion rotation) | 1078 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, |
1079 | LLVector3 velocity, | ||
1080 | LLQuaternion rotation) | ||
1052 | { | 1081 | { |
1053 | byte[] bytes = new byte[60]; | 1082 | byte[] bytes = new byte[60]; |
1054 | int i = 0; | 1083 | int i = 0; |
1055 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | 1084 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); |
1056 | 1085 | ||
1057 | dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry; | 1086 | dat.TextureEntry = new byte[0]; // AvatarTemplate.TextureEntry; |
1058 | 1087 | ||
1059 | uint ID = localID; | 1088 | uint ID = localID; |
1060 | 1089 | ||
1061 | bytes[i++] = (byte)(ID % 256); | 1090 | bytes[i++] = (byte) (ID%256); |
1062 | bytes[i++] = (byte)((ID >> 8) % 256); | 1091 | bytes[i++] = (byte) ((ID >> 8)%256); |
1063 | bytes[i++] = (byte)((ID >> 16) % 256); | 1092 | bytes[i++] = (byte) ((ID >> 16)%256); |
1064 | bytes[i++] = (byte)((ID >> 24) % 256); | 1093 | bytes[i++] = (byte) ((ID >> 24)%256); |
1065 | bytes[i++] = 0; | 1094 | bytes[i++] = 0; |
1066 | bytes[i++] = 1; | 1095 | bytes[i++] = 1; |
1067 | i += 14; | 1096 | i += 14; |
@@ -1078,55 +1107,55 @@ namespace OpenSim.Region.ClientStack | |||
1078 | 1107 | ||
1079 | internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z); | 1108 | internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z); |
1080 | 1109 | ||
1081 | internDirec = internDirec / 128.0f; | 1110 | internDirec = internDirec/128.0f; |
1082 | internDirec.x += 1; | 1111 | internDirec.x += 1; |
1083 | internDirec.y += 1; | 1112 | internDirec.y += 1; |
1084 | internDirec.z += 1; | 1113 | internDirec.z += 1; |
1085 | 1114 | ||
1086 | InternVelocityX = (ushort)(32768 * internDirec.x); | 1115 | InternVelocityX = (ushort) (32768*internDirec.x); |
1087 | InternVelocityY = (ushort)(32768 * internDirec.y); | 1116 | InternVelocityY = (ushort) (32768*internDirec.y); |
1088 | InternVelocityZ = (ushort)(32768 * internDirec.z); | 1117 | InternVelocityZ = (ushort) (32768*internDirec.z); |
1089 | 1118 | ||
1090 | ushort ac = 32767; | 1119 | ushort ac = 32767; |
1091 | bytes[i++] = (byte)(InternVelocityX % 256); | 1120 | bytes[i++] = (byte) (InternVelocityX%256); |
1092 | bytes[i++] = (byte)((InternVelocityX >> 8) % 256); | 1121 | bytes[i++] = (byte) ((InternVelocityX >> 8)%256); |
1093 | bytes[i++] = (byte)(InternVelocityY % 256); | 1122 | bytes[i++] = (byte) (InternVelocityY%256); |
1094 | bytes[i++] = (byte)((InternVelocityY >> 8) % 256); | 1123 | bytes[i++] = (byte) ((InternVelocityY >> 8)%256); |
1095 | bytes[i++] = (byte)(InternVelocityZ % 256); | 1124 | bytes[i++] = (byte) (InternVelocityZ%256); |
1096 | bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); | 1125 | bytes[i++] = (byte) ((InternVelocityZ >> 8)%256); |
1097 | 1126 | ||
1098 | //accel | 1127 | //accel |
1099 | bytes[i++] = (byte)(ac % 256); | 1128 | bytes[i++] = (byte) (ac%256); |
1100 | bytes[i++] = (byte)((ac >> 8) % 256); | 1129 | bytes[i++] = (byte) ((ac >> 8)%256); |
1101 | bytes[i++] = (byte)(ac % 256); | 1130 | bytes[i++] = (byte) (ac%256); |
1102 | bytes[i++] = (byte)((ac >> 8) % 256); | 1131 | bytes[i++] = (byte) ((ac >> 8)%256); |
1103 | bytes[i++] = (byte)(ac % 256); | 1132 | bytes[i++] = (byte) (ac%256); |
1104 | bytes[i++] = (byte)((ac >> 8) % 256); | 1133 | bytes[i++] = (byte) ((ac >> 8)%256); |
1105 | 1134 | ||
1106 | //rotation | 1135 | //rotation |
1107 | ushort rw, rx, ry, rz; | 1136 | ushort rw, rx, ry, rz; |
1108 | rw = (ushort)(32768 * (rotation.W + 1)); | 1137 | rw = (ushort) (32768*(rotation.W + 1)); |
1109 | rx = (ushort)(32768 * (rotation.X + 1)); | 1138 | rx = (ushort) (32768*(rotation.X + 1)); |
1110 | ry = (ushort)(32768 * (rotation.Y + 1)); | 1139 | ry = (ushort) (32768*(rotation.Y + 1)); |
1111 | rz = (ushort)(32768 * (rotation.Z + 1)); | 1140 | rz = (ushort) (32768*(rotation.Z + 1)); |
1112 | 1141 | ||
1113 | //rot | 1142 | //rot |
1114 | bytes[i++] = (byte)(rx % 256); | 1143 | bytes[i++] = (byte) (rx%256); |
1115 | bytes[i++] = (byte)((rx >> 8) % 256); | 1144 | bytes[i++] = (byte) ((rx >> 8)%256); |
1116 | bytes[i++] = (byte)(ry % 256); | 1145 | bytes[i++] = (byte) (ry%256); |
1117 | bytes[i++] = (byte)((ry >> 8) % 256); | 1146 | bytes[i++] = (byte) ((ry >> 8)%256); |
1118 | bytes[i++] = (byte)(rz % 256); | 1147 | bytes[i++] = (byte) (rz%256); |
1119 | bytes[i++] = (byte)((rz >> 8) % 256); | 1148 | bytes[i++] = (byte) ((rz >> 8)%256); |
1120 | bytes[i++] = (byte)(rw % 256); | 1149 | bytes[i++] = (byte) (rw%256); |
1121 | bytes[i++] = (byte)((rw >> 8) % 256); | 1150 | bytes[i++] = (byte) ((rw >> 8)%256); |
1122 | 1151 | ||
1123 | //rotation vel | 1152 | //rotation vel |
1124 | bytes[i++] = (byte)(ac % 256); | 1153 | bytes[i++] = (byte) (ac%256); |
1125 | bytes[i++] = (byte)((ac >> 8) % 256); | 1154 | bytes[i++] = (byte) ((ac >> 8)%256); |
1126 | bytes[i++] = (byte)(ac % 256); | 1155 | bytes[i++] = (byte) (ac%256); |
1127 | bytes[i++] = (byte)((ac >> 8) % 256); | 1156 | bytes[i++] = (byte) ((ac >> 8)%256); |
1128 | bytes[i++] = (byte)(ac % 256); | 1157 | bytes[i++] = (byte) (ac%256); |
1129 | bytes[i++] = (byte)((ac >> 8) % 256); | 1158 | bytes[i++] = (byte) ((ac >> 8)%256); |
1130 | 1159 | ||
1131 | dat.Data = bytes; | 1160 | dat.Data = bytes; |
1132 | 1161 | ||
@@ -1140,7 +1169,9 @@ namespace OpenSim.Region.ClientStack | |||
1140 | /// <param name="position"></param> | 1169 | /// <param name="position"></param> |
1141 | /// <param name="rotation"></param> | 1170 | /// <param name="rotation"></param> |
1142 | /// <returns></returns> | 1171 | /// <returns></returns> |
1143 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, LLVector3 position, LLQuaternion rotation) | 1172 | protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, |
1173 | LLVector3 position, | ||
1174 | LLQuaternion rotation) | ||
1144 | { | 1175 | { |
1145 | uint ID = localID; | 1176 | uint ID = localID; |
1146 | byte[] bytes = new byte[60]; | 1177 | byte[] bytes = new byte[60]; |
@@ -1148,10 +1179,10 @@ namespace OpenSim.Region.ClientStack | |||
1148 | int i = 0; | 1179 | int i = 0; |
1149 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | 1180 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); |
1150 | dat.TextureEntry = new byte[0]; | 1181 | dat.TextureEntry = new byte[0]; |
1151 | bytes[i++] = (byte)(ID % 256); | 1182 | bytes[i++] = (byte) (ID%256); |
1152 | bytes[i++] = (byte)((ID >> 8) % 256); | 1183 | bytes[i++] = (byte) ((ID >> 8)%256); |
1153 | bytes[i++] = (byte)((ID >> 16) % 256); | 1184 | bytes[i++] = (byte) ((ID >> 16)%256); |
1154 | bytes[i++] = (byte)((ID >> 24) % 256); | 1185 | bytes[i++] = (byte) ((ID >> 24)%256); |
1155 | bytes[i++] = 0; | 1186 | bytes[i++] = 0; |
1156 | bytes[i++] = 0; | 1187 | bytes[i++] = 0; |
1157 | 1188 | ||
@@ -1161,44 +1192,44 @@ namespace OpenSim.Region.ClientStack | |||
1161 | ushort ac = 32767; | 1192 | ushort ac = 32767; |
1162 | 1193 | ||
1163 | //vel | 1194 | //vel |
1164 | bytes[i++] = (byte)(ac % 256); | 1195 | bytes[i++] = (byte) (ac%256); |
1165 | bytes[i++] = (byte)((ac >> 8) % 256); | 1196 | bytes[i++] = (byte) ((ac >> 8)%256); |
1166 | bytes[i++] = (byte)(ac % 256); | 1197 | bytes[i++] = (byte) (ac%256); |
1167 | bytes[i++] = (byte)((ac >> 8) % 256); | 1198 | bytes[i++] = (byte) ((ac >> 8)%256); |
1168 | bytes[i++] = (byte)(ac % 256); | 1199 | bytes[i++] = (byte) (ac%256); |
1169 | bytes[i++] = (byte)((ac >> 8) % 256); | 1200 | bytes[i++] = (byte) ((ac >> 8)%256); |
1170 | 1201 | ||
1171 | //accel | 1202 | //accel |
1172 | bytes[i++] = (byte)(ac % 256); | 1203 | bytes[i++] = (byte) (ac%256); |
1173 | bytes[i++] = (byte)((ac >> 8) % 256); | 1204 | bytes[i++] = (byte) ((ac >> 8)%256); |
1174 | bytes[i++] = (byte)(ac % 256); | 1205 | bytes[i++] = (byte) (ac%256); |
1175 | bytes[i++] = (byte)((ac >> 8) % 256); | 1206 | bytes[i++] = (byte) ((ac >> 8)%256); |
1176 | bytes[i++] = (byte)(ac % 256); | 1207 | bytes[i++] = (byte) (ac%256); |
1177 | bytes[i++] = (byte)((ac >> 8) % 256); | 1208 | bytes[i++] = (byte) ((ac >> 8)%256); |
1178 | 1209 | ||
1179 | ushort rw, rx, ry, rz; | 1210 | ushort rw, rx, ry, rz; |
1180 | rw = (ushort)(32768 * (rotation.W + 1)); | 1211 | rw = (ushort) (32768*(rotation.W + 1)); |
1181 | rx = (ushort)(32768 * (rotation.X + 1)); | 1212 | rx = (ushort) (32768*(rotation.X + 1)); |
1182 | ry = (ushort)(32768 * (rotation.Y + 1)); | 1213 | ry = (ushort) (32768*(rotation.Y + 1)); |
1183 | rz = (ushort)(32768 * (rotation.Z + 1)); | 1214 | rz = (ushort) (32768*(rotation.Z + 1)); |
1184 | 1215 | ||
1185 | //rot | 1216 | //rot |
1186 | bytes[i++] = (byte)(rx % 256); | 1217 | bytes[i++] = (byte) (rx%256); |
1187 | bytes[i++] = (byte)((rx >> 8) % 256); | 1218 | bytes[i++] = (byte) ((rx >> 8)%256); |
1188 | bytes[i++] = (byte)(ry % 256); | 1219 | bytes[i++] = (byte) (ry%256); |
1189 | bytes[i++] = (byte)((ry >> 8) % 256); | 1220 | bytes[i++] = (byte) ((ry >> 8)%256); |
1190 | bytes[i++] = (byte)(rz % 256); | 1221 | bytes[i++] = (byte) (rz%256); |
1191 | bytes[i++] = (byte)((rz >> 8) % 256); | 1222 | bytes[i++] = (byte) ((rz >> 8)%256); |
1192 | bytes[i++] = (byte)(rw % 256); | 1223 | bytes[i++] = (byte) (rw%256); |
1193 | bytes[i++] = (byte)((rw >> 8) % 256); | 1224 | bytes[i++] = (byte) ((rw >> 8)%256); |
1194 | 1225 | ||
1195 | //rotation vel | 1226 | //rotation vel |
1196 | bytes[i++] = (byte)(ac % 256); | 1227 | bytes[i++] = (byte) (ac%256); |
1197 | bytes[i++] = (byte)((ac >> 8) % 256); | 1228 | bytes[i++] = (byte) ((ac >> 8)%256); |
1198 | bytes[i++] = (byte)(ac % 256); | 1229 | bytes[i++] = (byte) (ac%256); |
1199 | bytes[i++] = (byte)((ac >> 8) % 256); | 1230 | bytes[i++] = (byte) ((ac >> 8)%256); |
1200 | bytes[i++] = (byte)(ac % 256); | 1231 | bytes[i++] = (byte) (ac%256); |
1201 | bytes[i++] = (byte)((ac >> 8) % 256); | 1232 | bytes[i++] = (byte) ((ac >> 8)%256); |
1202 | 1233 | ||
1203 | dat.Data = bytes; | 1234 | dat.Data = bytes; |
1204 | return dat; | 1235 | return dat; |
@@ -1212,16 +1243,15 @@ namespace OpenSim.Region.ClientStack | |||
1212 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, uint flags) | 1243 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, uint flags) |
1213 | { | 1244 | { |
1214 | ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); | 1245 | ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); |
1215 | this.SetDefaultPrimPacketValues(objupdate); | 1246 | SetDefaultPrimPacketValues(objupdate); |
1216 | objupdate.UpdateFlags = flags; | 1247 | objupdate.UpdateFlags = flags; |
1217 | this.SetPrimPacketShapeData(objupdate, primShape); | 1248 | SetPrimPacketShapeData(objupdate, primShape); |
1218 | 1249 | ||
1219 | return objupdate; | 1250 | return objupdate; |
1220 | } | 1251 | } |
1221 | 1252 | ||
1222 | protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) | 1253 | protected void SetPrimPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData, PrimitiveBaseShape primData) |
1223 | { | 1254 | { |
1224 | |||
1225 | objectData.TextureEntry = primData.TextureEntry; | 1255 | objectData.TextureEntry = primData.TextureEntry; |
1226 | objectData.PCode = primData.PCode; | 1256 | objectData.PCode = primData.PCode; |
1227 | objectData.PathBegin = primData.PathBegin; | 1257 | objectData.PathBegin = primData.PathBegin; |
@@ -1278,10 +1308,11 @@ namespace OpenSim.Region.ClientStack | |||
1278 | /// <returns></returns> | 1308 | /// <returns></returns> |
1279 | protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) | 1309 | protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) |
1280 | { | 1310 | { |
1281 | ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | 1311 | ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); |
1312 | // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | ||
1282 | 1313 | ||
1283 | SetDefaultAvatarPacketValues(ref objdata); | 1314 | SetDefaultAvatarPacketValues(ref objdata); |
1284 | objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); | 1315 | objdata.UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); |
1285 | objdata.PathCurve = 16; | 1316 | objdata.PathCurve = 16; |
1286 | objdata.ProfileCurve = 1; | 1317 | objdata.ProfileCurve = 1; |
1287 | objdata.PathScaleX = 100; | 1318 | objdata.PathScaleX = 100; |
@@ -1353,6 +1384,5 @@ namespace OpenSim.Region.ClientStack | |||
1353 | } | 1384 | } |
1354 | 1385 | ||
1355 | #endregion | 1386 | #endregion |
1356 | |||
1357 | } | 1387 | } |
1358 | } | 1388 | } \ No newline at end of file |