diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 538 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs | 89 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.PacketQueue.cs | 39 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 270 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 86 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/PacketServer.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/RegionApplicationBase.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/UDPServer.cs | 60 |
9 files changed, 613 insertions, 533 deletions
diff --git a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs index 3960c19..4b44ead 100644 --- a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs +++ b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs | |||
@@ -29,12 +29,10 @@ using System.Net.Sockets; | |||
29 | 29 | ||
30 | namespace OpenSim.Region.ClientStack | 30 | namespace OpenSim.Region.ClientStack |
31 | { | 31 | { |
32 | |||
33 | public interface ClientStackNetworkHandler | 32 | public interface ClientStackNetworkHandler |
34 | { | 33 | { |
35 | void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); | 34 | void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender); |
36 | void RemoveClientCircuit(uint circuitcode); | 35 | void RemoveClientCircuit(uint circuitcode); |
37 | void RegisterPacketServer(PacketServer server); | 36 | void RegisterPacketServer(PacketServer server); |
38 | } | 37 | } |
39 | 38 | } \ No newline at end of file | |
40 | } | ||
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 |
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs index 0771a4a..d589a7b 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs | |||
@@ -27,9 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | using libsecondlife; | 28 | using libsecondlife; |
29 | using libsecondlife.Packets; | 29 | using libsecondlife.Packets; |
30 | using OpenSim.Framework.Console; | ||
31 | using OpenSim.Framework.Interfaces; | ||
32 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Console; | ||
33 | 32 | ||
34 | namespace OpenSim.Region.ClientStack | 33 | namespace OpenSim.Region.ClientStack |
35 | { | 34 | { |
@@ -37,17 +36,17 @@ namespace OpenSim.Region.ClientStack | |||
37 | { | 36 | { |
38 | protected virtual void RegisterLocalPacketHandlers() | 37 | protected virtual void RegisterLocalPacketHandlers() |
39 | { | 38 | { |
40 | this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); | 39 | AddLocalPacketHandler(PacketType.LogoutRequest, Logout); |
41 | this.AddLocalPacketHandler(PacketType.ViewerEffect, this.HandleViewerEffect); | 40 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); |
42 | this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); | 41 | AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); |
43 | this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); | 42 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); |
44 | } | 43 | } |
45 | 44 | ||
46 | private bool HandleViewerEffect(IClientAPI sender, Packet Pack) | 45 | private bool HandleViewerEffect(IClientAPI sender, Packet Pack) |
47 | { | 46 | { |
48 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; | 47 | ViewerEffectPacket viewer = (ViewerEffectPacket) Pack; |
49 | 48 | ||
50 | if( OnViewerEffect != null ) | 49 | if (OnViewerEffect != null) |
51 | { | 50 | { |
52 | OnViewerEffect(sender, viewer.Effect); | 51 | OnViewerEffect(sender, viewer.Effect); |
53 | } | 52 | } |
@@ -59,7 +58,7 @@ namespace OpenSim.Region.ClientStack | |||
59 | { | 58 | { |
60 | MainLog.Instance.Verbose("CLIENT", "Got a logout request"); | 59 | MainLog.Instance.Verbose("CLIENT", "Got a logout request"); |
61 | 60 | ||
62 | if( OnLogout != null ) | 61 | if (OnLogout != null) |
63 | { | 62 | { |
64 | OnLogout(client); | 63 | OnLogout(client); |
65 | } | 64 | } |
@@ -70,13 +69,14 @@ namespace OpenSim.Region.ClientStack | |||
70 | protected bool AgentTextureCached(IClientAPI simclient, Packet packet) | 69 | protected bool AgentTextureCached(IClientAPI simclient, Packet packet) |
71 | { | 70 | { |
72 | //System.Console.WriteLine("texture cached: " + packet.ToString()); | 71 | //System.Console.WriteLine("texture cached: " + packet.ToString()); |
73 | AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet; | 72 | AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet; |
74 | AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); | 73 | AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); |
75 | cachedresp.AgentData.AgentID = this.AgentId; | 74 | cachedresp.AgentData.AgentID = AgentId; |
76 | cachedresp.AgentData.SessionID = this.m_sessionId; | 75 | cachedresp.AgentData.SessionID = m_sessionId; |
77 | cachedresp.AgentData.SerialNum = this.cachedtextureserial; | 76 | cachedresp.AgentData.SerialNum = cachedtextureserial; |
78 | this.cachedtextureserial++; | 77 | cachedtextureserial++; |
79 | cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; | 78 | cachedresp.WearableData = |
79 | new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; | ||
80 | for (int i = 0; i < chechedtex.WearableData.Length; i++) | 80 | for (int i = 0; i < chechedtex.WearableData.Length; i++) |
81 | { | 81 | { |
82 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 82 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); |
@@ -84,17 +84,18 @@ namespace OpenSim.Region.ClientStack | |||
84 | cachedresp.WearableData[i].TextureID = LLUUID.Zero; | 84 | cachedresp.WearableData[i].TextureID = LLUUID.Zero; |
85 | cachedresp.WearableData[i].HostName = new byte[0]; | 85 | cachedresp.WearableData[i].HostName = new byte[0]; |
86 | } | 86 | } |
87 | this.OutPacket(cachedresp); | 87 | OutPacket(cachedresp); |
88 | return true; | 88 | return true; |
89 | } | 89 | } |
90 | 90 | ||
91 | protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet) | 91 | protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet) |
92 | { | 92 | { |
93 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; | 93 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket) packet; |
94 | // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); | 94 | // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); |
95 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) | 95 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) |
96 | { | 96 | { |
97 | #region position | 97 | #region position |
98 | |||
98 | if (multipleupdate.ObjectData[i].Type == 9) //change position | 99 | if (multipleupdate.ObjectData[i].Type == 9) //change position |
99 | { | 100 | { |
100 | if (OnUpdatePrimGroupPosition != null) | 101 | if (OnUpdatePrimGroupPosition != null) |
@@ -102,20 +103,20 @@ namespace OpenSim.Region.ClientStack | |||
102 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 103 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
103 | OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | 104 | OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); |
104 | } | 105 | } |
105 | |||
106 | } | 106 | } |
107 | else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position | 107 | else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position |
108 | { | 108 | { |
109 | if (OnUpdatePrimSinglePosition != null) | 109 | if (OnUpdatePrimSinglePosition != null) |
110 | { | 110 | { |
111 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 111 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
112 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 112 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); |
113 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | 113 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | #endregion position | 116 | #endregion position |
117 | #region rotation | 117 | #region rotation |
118 | else if (multipleupdate.ObjectData[i].Type == 2)// single item of group rotation from tab | 118 | |
119 | else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab | ||
119 | { | 120 | { |
120 | if (OnUpdatePrimSingleRotation != null) | 121 | if (OnUpdatePrimSingleRotation != null) |
121 | { | 122 | { |
@@ -124,38 +125,39 @@ namespace OpenSim.Region.ClientStack | |||
124 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | 125 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); |
125 | } | 126 | } |
126 | } | 127 | } |
127 | else if (multipleupdate.ObjectData[i].Type == 3)// single item of group rotation from mouse | 128 | else if (multipleupdate.ObjectData[i].Type == 3) // single item of group rotation from mouse |
128 | { | 129 | { |
129 | if (OnUpdatePrimSingleRotation != null) | 130 | if (OnUpdatePrimSingleRotation != null) |
130 | { | 131 | { |
131 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); | 132 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); |
132 | //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | 133 | //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); |
133 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | 134 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); |
134 | } | 135 | } |
135 | } | 136 | } |
136 | else if (multipleupdate.ObjectData[i].Type == 10)//group rotation from object tab | 137 | else if (multipleupdate.ObjectData[i].Type == 10) //group rotation from object tab |
137 | { | 138 | { |
138 | if (OnUpdatePrimGroupRotation != null) | 139 | if (OnUpdatePrimGroupRotation != null) |
139 | { | 140 | { |
140 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); | 141 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); |
141 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | 142 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); |
142 | OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | 143 | OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); |
143 | } | 144 | } |
144 | } | 145 | } |
145 | else if (multipleupdate.ObjectData[i].Type == 11)//group rotation from mouse | 146 | else if (multipleupdate.ObjectData[i].Type == 11) //group rotation from mouse |
146 | { | 147 | { |
147 | if (OnUpdatePrimGroupMouseRotation != null) | 148 | if (OnUpdatePrimGroupMouseRotation != null) |
148 | { | 149 | { |
149 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 150 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
150 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); | 151 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); |
151 | //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 152 | //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); |
152 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | 153 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); |
153 | OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); | 154 | OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); |
154 | } | 155 | } |
155 | } | 156 | } |
156 | #endregion | 157 | #endregion |
157 | #region scale | 158 | #region scale |
158 | else if (multipleupdate.ObjectData[i].Type == 13)//group scale from object tab | 159 | |
160 | else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab | ||
159 | { | 161 | { |
160 | if (OnUpdatePrimScale != null) | 162 | if (OnUpdatePrimScale != null) |
161 | { | 163 | { |
@@ -164,40 +166,41 @@ namespace OpenSim.Region.ClientStack | |||
164 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | 166 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); |
165 | 167 | ||
166 | // Change the position based on scale (for bug number 246) | 168 | // Change the position based on scale (for bug number 246) |
167 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 169 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
168 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 170 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); |
169 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | 171 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); |
170 | } | 172 | } |
171 | } | 173 | } |
172 | else if (multipleupdate.ObjectData[i].Type == 29)//group scale from mouse | 174 | else if (multipleupdate.ObjectData[i].Type == 29) //group scale from mouse |
173 | { | 175 | { |
174 | if (OnUpdatePrimScale != null) | 176 | if (OnUpdatePrimScale != null) |
175 | { | 177 | { |
176 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | 178 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); |
177 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); | 179 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); |
178 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | 180 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); |
179 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 181 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
180 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | 182 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); |
181 | } | 183 | } |
182 | } | 184 | } |
183 | else if (multipleupdate.ObjectData[i].Type == 5)//single prim scale from object tab | 185 | else if (multipleupdate.ObjectData[i].Type == 5) //single prim scale from object tab |
184 | { | 186 | { |
185 | if (OnUpdatePrimScale != null) | 187 | if (OnUpdatePrimScale != null) |
186 | { | 188 | { |
187 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | 189 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); |
188 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 190 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); |
189 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | 191 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); |
190 | } | 192 | } |
191 | } | 193 | } |
192 | else if (multipleupdate.ObjectData[i].Type == 21)//single prim scale from mouse | 194 | else if (multipleupdate.ObjectData[i].Type == 21) //single prim scale from mouse |
193 | { | 195 | { |
194 | if (OnUpdatePrimScale != null) | 196 | if (OnUpdatePrimScale != null) |
195 | { | 197 | { |
196 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | 198 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); |
197 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 199 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); |
198 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | 200 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); |
199 | } | 201 | } |
200 | } | 202 | } |
203 | |||
201 | #endregion | 204 | #endregion |
202 | } | 205 | } |
203 | return true; | 206 | return true; |
@@ -208,7 +211,7 @@ namespace OpenSim.Region.ClientStack | |||
208 | //should be getting the map layer from the grid server | 211 | //should be getting the map layer from the grid server |
209 | //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) | 212 | //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) |
210 | MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); | 213 | MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); |
211 | mapReply.AgentData.AgentID = this.AgentId; | 214 | mapReply.AgentData.AgentID = AgentId; |
212 | mapReply.AgentData.Flags = 0; | 215 | mapReply.AgentData.Flags = 0; |
213 | mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; | 216 | mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; |
214 | mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); | 217 | mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); |
@@ -217,7 +220,7 @@ namespace OpenSim.Region.ClientStack | |||
217 | mapReply.LayerData[0].Top = 30000; | 220 | mapReply.LayerData[0].Top = 30000; |
218 | mapReply.LayerData[0].Right = 30000; | 221 | mapReply.LayerData[0].Right = 30000; |
219 | mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); | 222 | mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); |
220 | this.OutPacket(mapReply); | 223 | OutPacket(mapReply); |
221 | } | 224 | } |
222 | 225 | ||
223 | public void RequestMapBlocks(int minX, int minY, int maxX, int maxY) | 226 | public void RequestMapBlocks(int minX, int minY, int maxX, int maxY) |
@@ -251,4 +254,4 @@ namespace OpenSim.Region.ClientStack | |||
251 | */ | 254 | */ |
252 | } | 255 | } |
253 | } | 256 | } |
254 | } | 257 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs index 5cd30ce..efeff29 100644 --- a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs +++ b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs | |||
@@ -32,13 +32,12 @@ using System.Net.Sockets; | |||
32 | using System.Timers; | 32 | using System.Timers; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using libsecondlife.Packets; | 34 | using libsecondlife.Packets; |
35 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
37 | using OpenSim.Region.Environment; | 36 | using OpenSim.Framework.Console; |
38 | 37 | ||
39 | namespace OpenSim.Region.ClientStack | 38 | namespace OpenSim.Region.ClientStack |
40 | { | 39 | { |
41 | public partial class ClientView | 40 | public partial class ClientView |
42 | { | 41 | { |
43 | protected BlockingQueue<QueItem> PacketQueue; | 42 | protected BlockingQueue<QueItem> PacketQueue; |
44 | protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); | 43 | protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); |
@@ -84,7 +83,7 @@ namespace OpenSim.Region.ClientStack | |||
84 | Pack.Header.Sequence = Sequence; | 83 | Pack.Header.Sequence = Sequence; |
85 | } | 84 | } |
86 | 85 | ||
87 | if (Pack.Header.Reliable) //DIRTY HACK | 86 | if (Pack.Header.Reliable) //DIRTY HACK |
88 | { | 87 | { |
89 | lock (NeedAck) | 88 | lock (NeedAck) |
90 | { | 89 | { |
@@ -148,19 +147,21 @@ namespace OpenSim.Region.ClientStack | |||
148 | if (Pack.Header.Zerocoded) | 147 | if (Pack.Header.Zerocoded) |
149 | { | 148 | { |
150 | int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); | 149 | int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); |
151 | m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);//userEP); | 150 | m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); //userEP); |
152 | } | 151 | } |
153 | else | 152 | else |
154 | { | 153 | { |
155 | m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); //userEP); | 154 | m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); |
155 | //userEP); | ||
156 | } | 156 | } |
157 | } | 157 | } |
158 | catch (Exception) | 158 | catch (Exception) |
159 | { | 159 | { |
160 | MainLog.Instance.Warn("client", "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); | 160 | MainLog.Instance.Warn("client", |
161 | this.KillThread(); | 161 | "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + |
162 | userEP.ToString() + " - killing thread"); | ||
163 | KillThread(); | ||
162 | } | 164 | } |
163 | |||
164 | } | 165 | } |
165 | 166 | ||
166 | public virtual void InPacket(Packet NewPack) | 167 | public virtual void InPacket(Packet NewPack) |
@@ -180,7 +181,7 @@ namespace OpenSim.Region.ClientStack | |||
180 | // Handle PacketAck packets | 181 | // Handle PacketAck packets |
181 | if (NewPack.Type == PacketType.PacketAck) | 182 | if (NewPack.Type == PacketType.PacketAck) |
182 | { | 183 | { |
183 | PacketAckPacket ackPacket = (PacketAckPacket)NewPack; | 184 | PacketAckPacket ackPacket = (PacketAckPacket) NewPack; |
184 | 185 | ||
185 | lock (NeedAck) | 186 | lock (NeedAck) |
186 | { | 187 | { |
@@ -193,7 +194,7 @@ namespace OpenSim.Region.ClientStack | |||
193 | else if ((NewPack.Type == PacketType.StartPingCheck)) | 194 | else if ((NewPack.Type == PacketType.StartPingCheck)) |
194 | { | 195 | { |
195 | //reply to pingcheck | 196 | //reply to pingcheck |
196 | StartPingCheckPacket startPing = (StartPingCheckPacket)NewPack; | 197 | StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack; |
197 | CompletePingCheckPacket endPing = new CompletePingCheckPacket(); | 198 | CompletePingCheckPacket endPing = new CompletePingCheckPacket(); |
198 | endPing.PingID.PingID = startPing.PingID.PingID; | 199 | endPing.PingID.PingID = startPing.PingID.PingID; |
199 | OutPacket(endPing); | 200 | OutPacket(endPing); |
@@ -203,9 +204,8 @@ namespace OpenSim.Region.ClientStack | |||
203 | QueItem item = new QueItem(); | 204 | QueItem item = new QueItem(); |
204 | item.Packet = NewPack; | 205 | item.Packet = NewPack; |
205 | item.Incoming = true; | 206 | item.Incoming = true; |
206 | this.PacketQueue.Enqueue(item); | 207 | PacketQueue.Enqueue(item); |
207 | } | 208 | } |
208 | |||
209 | } | 209 | } |
210 | 210 | ||
211 | public virtual void OutPacket(Packet NewPack) | 211 | public virtual void OutPacket(Packet NewPack) |
@@ -213,7 +213,7 @@ namespace OpenSim.Region.ClientStack | |||
213 | QueItem item = new QueItem(); | 213 | QueItem item = new QueItem(); |
214 | item.Packet = NewPack; | 214 | item.Packet = NewPack; |
215 | item.Incoming = false; | 215 | item.Incoming = false; |
216 | this.PacketQueue.Enqueue(item); | 216 | PacketQueue.Enqueue(item); |
217 | } | 217 | } |
218 | 218 | ||
219 | # region Low Level Packet Methods | 219 | # region Low Level Packet Methods |
@@ -229,7 +229,6 @@ namespace OpenSim.Region.ClientStack | |||
229 | ack_it.Header.Reliable = false; | 229 | ack_it.Header.Reliable = false; |
230 | 230 | ||
231 | OutPacket(ack_it); | 231 | OutPacket(ack_it); |
232 | |||
233 | } | 232 | } |
234 | /* | 233 | /* |
235 | if (Pack.Header.Reliable) | 234 | if (Pack.Header.Reliable) |
@@ -252,8 +251,8 @@ namespace OpenSim.Region.ClientStack | |||
252 | { | 251 | { |
253 | if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) | 252 | if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) |
254 | { | 253 | { |
255 | MainLog.Instance.Verbose( "Resending " + packet.Type.ToString() + " packet, " + | 254 | MainLog.Instance.Verbose("Resending " + packet.Type.ToString() + " packet, " + |
256 | (now - packet.TickCount) + "ms have passed"); | 255 | (now - packet.TickCount) + "ms have passed"); |
257 | 256 | ||
258 | packet.Header.Resent = true; | 257 | packet.Header.Resent = true; |
259 | OutPacket(packet); | 258 | OutPacket(packet); |
@@ -271,7 +270,7 @@ namespace OpenSim.Region.ClientStack | |||
271 | if (PendingAcks.Count > 250) | 270 | if (PendingAcks.Count > 250) |
272 | { | 271 | { |
273 | // FIXME: Handle the odd case where we have too many pending ACKs queued up | 272 | // FIXME: Handle the odd case where we have too many pending ACKs queued up |
274 | MainLog.Instance.Verbose( "Too many ACKs queued up!"); | 273 | MainLog.Instance.Verbose("Too many ACKs queued up!"); |
275 | return; | 274 | return; |
276 | } | 275 | } |
277 | 276 | ||
@@ -302,6 +301,7 @@ namespace OpenSim.Region.ClientStack | |||
302 | SendAcks(); | 301 | SendAcks(); |
303 | ResendUnacked(); | 302 | ResendUnacked(); |
304 | } | 303 | } |
304 | |||
305 | #endregion | 305 | #endregion |
306 | 306 | ||
307 | #region Nested Classes | 307 | #region Nested Classes |
@@ -315,6 +315,7 @@ namespace OpenSim.Region.ClientStack | |||
315 | public Packet Packet; | 315 | public Packet Packet; |
316 | public bool Incoming; | 316 | public bool Incoming; |
317 | } | 317 | } |
318 | |||
318 | #endregion | 319 | #endregion |
319 | } | 320 | } |
320 | } | 321 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 13e8b43..dd2562c 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -31,8 +31,6 @@ using System.Text; | |||
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Region.Environment.Scenes; | ||
36 | 34 | ||
37 | namespace OpenSim.Region.ClientStack | 35 | namespace OpenSim.Region.ClientStack |
38 | { | 36 | { |
@@ -63,7 +61,7 @@ namespace OpenSim.Region.ClientStack | |||
63 | { | 61 | { |
64 | ack_pack(Pack); | 62 | ack_pack(Pack); |
65 | 63 | ||
66 | if (this.ProcessPacketMethod(Pack)) | 64 | if (ProcessPacketMethod(Pack)) |
67 | { | 65 | { |
68 | //there is a handler registered that handled this packet type | 66 | //there is a handler registered that handled this packet type |
69 | return; | 67 | return; |
@@ -74,16 +72,17 @@ namespace OpenSim.Region.ClientStack | |||
74 | 72 | ||
75 | switch (Pack.Type) | 73 | switch (Pack.Type) |
76 | { | 74 | { |
77 | #region Scene/Avatar | 75 | #region Scene/Avatar |
76 | |||
78 | case PacketType.AvatarPropertiesRequest: | 77 | case PacketType.AvatarPropertiesRequest: |
79 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | 78 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket) Pack; |
80 | if (OnRequestAvatarProperties != null) | 79 | if (OnRequestAvatarProperties != null) |
81 | { | 80 | { |
82 | OnRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); | 81 | OnRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); |
83 | } | 82 | } |
84 | break; | 83 | break; |
85 | case PacketType.ChatFromViewer: | 84 | case PacketType.ChatFromViewer: |
86 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | 85 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack; |
87 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") | 86 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") |
88 | { | 87 | { |
89 | //empty message so don't bother with it | 88 | //empty message so don't bother with it |
@@ -103,30 +102,32 @@ namespace OpenSim.Region.ClientStack | |||
103 | args.Channel = channel; | 102 | args.Channel = channel; |
104 | args.From = fromName; | 103 | args.From = fromName; |
105 | args.Message = Util.FieldToString(message); | 104 | args.Message = Util.FieldToString(message); |
106 | args.Type = (ChatTypeEnum)type; | 105 | args.Type = (ChatTypeEnum) type; |
107 | args.Position = fromPos; | 106 | args.Position = fromPos; |
108 | 107 | ||
109 | args.Scene = Scene; | 108 | args.Scene = Scene; |
110 | args.Sender = this; | 109 | args.Sender = this; |
111 | 110 | ||
112 | this.OnChatFromViewer(this, args); | 111 | OnChatFromViewer(this, args); |
113 | } | 112 | } |
114 | break; | 113 | break; |
115 | case PacketType.ImprovedInstantMessage: | 114 | case PacketType.ImprovedInstantMessage: |
116 | ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; | 115 | ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack; |
117 | string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); | 116 | string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); |
118 | string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); | 117 | string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); |
119 | if (OnInstantMessage != null) | 118 | if (OnInstantMessage != null) |
120 | { | 119 | { |
121 | this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID, | 120 | OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, |
122 | msgpack.MessageBlock.Timestamp, IMfromName, IMmessage, msgpack.MessageBlock.Dialog); | 121 | msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID, |
122 | msgpack.MessageBlock.Timestamp, IMfromName, IMmessage, | ||
123 | msgpack.MessageBlock.Dialog); | ||
123 | } | 124 | } |
124 | break; | 125 | break; |
125 | case PacketType.RezObject: | 126 | case PacketType.RezObject: |
126 | RezObjectPacket rezPacket = (RezObjectPacket)Pack; | 127 | RezObjectPacket rezPacket = (RezObjectPacket) Pack; |
127 | if (OnRezObject != null) | 128 | if (OnRezObject != null) |
128 | { | 129 | { |
129 | this.OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd); | 130 | OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd); |
130 | } | 131 | } |
131 | break; | 132 | break; |
132 | case PacketType.DeRezObject: | 133 | case PacketType.DeRezObject: |
@@ -136,13 +137,15 @@ namespace OpenSim.Region.ClientStack | |||
136 | } | 137 | } |
137 | break; | 138 | break; |
138 | case PacketType.ModifyLand: | 139 | case PacketType.ModifyLand: |
139 | ModifyLandPacket modify = (ModifyLandPacket)Pack; | 140 | ModifyLandPacket modify = (ModifyLandPacket) Pack; |
140 | if (modify.ParcelData.Length > 0) | 141 | if (modify.ParcelData.Length > 0) |
141 | { | 142 | { |
142 | if (OnModifyTerrain != null) | 143 | if (OnModifyTerrain != null) |
143 | { | 144 | { |
144 | OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, | 145 | OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, |
145 | modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West, this); | 146 | modify.ModifyBlock.BrushSize, |
147 | modify.ModifyBlock.Action, modify.ParcelData[0].North, | ||
148 | modify.ParcelData[0].West, this); | ||
146 | } | 149 | } |
147 | } | 150 | } |
148 | break; | 151 | break; |
@@ -164,7 +167,7 @@ namespace OpenSim.Region.ClientStack | |||
164 | break; | 167 | break; |
165 | case PacketType.AgentSetAppearance: | 168 | case PacketType.AgentSetAppearance: |
166 | //OpenSim.Framework.Console.MainLog.Instance.Verbose("set appear", Pack.ToString()); | 169 | //OpenSim.Framework.Console.MainLog.Instance.Verbose("set appear", Pack.ToString()); |
167 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; | 170 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket) Pack; |
168 | if (OnSetAppearance != null) | 171 | if (OnSetAppearance != null) |
169 | { | 172 | { |
170 | OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); | 173 | OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); |
@@ -179,17 +182,16 @@ namespace OpenSim.Region.ClientStack | |||
179 | case PacketType.AgentUpdate: | 182 | case PacketType.AgentUpdate: |
180 | if (OnAgentUpdate != null) | 183 | if (OnAgentUpdate != null) |
181 | { | 184 | { |
182 | AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; | 185 | AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack; |
183 | OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); | 186 | OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); |
184 | } | 187 | } |
185 | break; | 188 | break; |
186 | case PacketType.AgentAnimation: | 189 | case PacketType.AgentAnimation: |
187 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; | 190 | AgentAnimationPacket AgentAni = (AgentAnimationPacket) Pack; |
188 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | 191 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) |
189 | { | 192 | { |
190 | if (AgentAni.AnimationList[i].StartAnim) | 193 | if (AgentAni.AnimationList[i].StartAnim) |
191 | { | 194 | { |
192 | |||
193 | if (OnStartAnim != null) | 195 | if (OnStartAnim != null) |
194 | { | 196 | { |
195 | OnStartAnim(this, AgentAni.AnimationList[i].AnimID, 1); | 197 | OnStartAnim(this, AgentAni.AnimationList[i].AnimID, 1); |
@@ -198,27 +200,29 @@ namespace OpenSim.Region.ClientStack | |||
198 | } | 200 | } |
199 | break; | 201 | break; |
200 | case PacketType.AgentRequestSit: | 202 | case PacketType.AgentRequestSit: |
201 | AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack; | 203 | AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket) Pack; |
202 | SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); | 204 | SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); |
203 | if (OnAgentRequestSit != null) | 205 | if (OnAgentRequestSit != null) |
204 | { | 206 | { |
205 | OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, agentRequestSit.TargetObject.TargetID); | 207 | OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, |
208 | agentRequestSit.TargetObject.TargetID); | ||
206 | } | 209 | } |
207 | break; | 210 | break; |
208 | case PacketType.AgentSit: | 211 | case PacketType.AgentSit: |
209 | if (OnAgentSit != null) | 212 | if (OnAgentSit != null) |
210 | { | 213 | { |
211 | AgentSitPacket agentSit = (AgentSitPacket)Pack; | 214 | AgentSitPacket agentSit = (AgentSitPacket) Pack; |
212 | OnAgentSit(this, agentSit.AgentData.AgentID); | 215 | OnAgentSit(this, agentSit.AgentData.AgentID); |
213 | } | 216 | } |
214 | break; | 217 | break; |
215 | 218 | ||
216 | #endregion | 219 | #endregion |
220 | |||
221 | #region Objects/m_sceneObjects | ||
217 | 222 | ||
218 | #region Objects/m_sceneObjects | ||
219 | case PacketType.ObjectLink: | 223 | case PacketType.ObjectLink: |
220 | // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); | 224 | // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); |
221 | ObjectLinkPacket link = (ObjectLinkPacket)Pack; | 225 | ObjectLinkPacket link = (ObjectLinkPacket) Pack; |
222 | uint parentprimid = 0; | 226 | uint parentprimid = 0; |
223 | List<uint> childrenprims = new List<uint>(); | 227 | List<uint> childrenprims = new List<uint>(); |
224 | if (link.ObjectData.Length > 1) | 228 | if (link.ObjectData.Length > 1) |
@@ -238,13 +242,13 @@ namespace OpenSim.Region.ClientStack | |||
238 | case PacketType.ObjectAdd: | 242 | case PacketType.ObjectAdd: |
239 | if (OnAddPrim != null) | 243 | if (OnAddPrim != null) |
240 | { | 244 | { |
241 | ObjectAddPacket addPacket = (ObjectAddPacket)Pack; | 245 | ObjectAddPacket addPacket = (ObjectAddPacket) Pack; |
242 | PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); | 246 | PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); |
243 | OnAddPrim(this.AgentId, addPacket.ObjectData.RayEnd, shape); | 247 | OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, shape); |
244 | } | 248 | } |
245 | break; | 249 | break; |
246 | case PacketType.ObjectShape: | 250 | case PacketType.ObjectShape: |
247 | ObjectShapePacket shapePacket = (ObjectShapePacket)Pack; | 251 | ObjectShapePacket shapePacket = (ObjectShapePacket) Pack; |
248 | for (int i = 0; i < shapePacket.ObjectData.Length; i++) | 252 | for (int i = 0; i < shapePacket.ObjectData.Length; i++) |
249 | { | 253 | { |
250 | if (OnUpdatePrimShape != null) | 254 | if (OnUpdatePrimShape != null) |
@@ -254,26 +258,28 @@ namespace OpenSim.Region.ClientStack | |||
254 | } | 258 | } |
255 | break; | 259 | break; |
256 | case PacketType.ObjectExtraParams: | 260 | case PacketType.ObjectExtraParams: |
257 | ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack; | 261 | ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket) Pack; |
258 | if (OnUpdateExtraParams != null) | 262 | if (OnUpdateExtraParams != null) |
259 | { | 263 | { |
260 | OnUpdateExtraParams(extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType, extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); | 264 | OnUpdateExtraParams(extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType, |
265 | extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); | ||
261 | } | 266 | } |
262 | break; | 267 | break; |
263 | case PacketType.ObjectDuplicate: | 268 | case PacketType.ObjectDuplicate: |
264 | ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; | 269 | ObjectDuplicatePacket dupe = (ObjectDuplicatePacket) Pack; |
265 | for (int i = 0; i < dupe.ObjectData.Length; i++) | 270 | for (int i = 0; i < dupe.ObjectData.Length; i++) |
266 | { | 271 | { |
267 | if (OnObjectDuplicate != null) | 272 | if (OnObjectDuplicate != null) |
268 | { | 273 | { |
269 | OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags); | 274 | OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, |
275 | dupe.SharedData.DuplicateFlags); | ||
270 | } | 276 | } |
271 | } | 277 | } |
272 | 278 | ||
273 | break; | 279 | break; |
274 | 280 | ||
275 | case PacketType.ObjectSelect: | 281 | case PacketType.ObjectSelect: |
276 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | 282 | ObjectSelectPacket incomingselect = (ObjectSelectPacket) Pack; |
277 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | 283 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) |
278 | { | 284 | { |
279 | if (OnObjectSelect != null) | 285 | if (OnObjectSelect != null) |
@@ -283,7 +289,7 @@ namespace OpenSim.Region.ClientStack | |||
283 | } | 289 | } |
284 | break; | 290 | break; |
285 | case PacketType.ObjectDeselect: | 291 | case PacketType.ObjectDeselect: |
286 | ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; | 292 | ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket) Pack; |
287 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) | 293 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) |
288 | { | 294 | { |
289 | if (OnObjectDeselect != null) | 295 | if (OnObjectDeselect != null) |
@@ -293,55 +299,58 @@ namespace OpenSim.Region.ClientStack | |||
293 | } | 299 | } |
294 | break; | 300 | break; |
295 | case PacketType.ObjectFlagUpdate: | 301 | case PacketType.ObjectFlagUpdate: |
296 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; | 302 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket) Pack; |
297 | if (OnUpdatePrimFlags != null) | 303 | if (OnUpdatePrimFlags != null) |
298 | { | 304 | { |
299 | OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); | 305 | OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); |
300 | } | 306 | } |
301 | break; | 307 | break; |
302 | case PacketType.ObjectImage: | 308 | case PacketType.ObjectImage: |
303 | ObjectImagePacket imagePack = (ObjectImagePacket)Pack; | 309 | ObjectImagePacket imagePack = (ObjectImagePacket) Pack; |
304 | for (int i = 0; i < imagePack.ObjectData.Length; i++) | 310 | for (int i = 0; i < imagePack.ObjectData.Length; i++) |
305 | { | 311 | { |
306 | if (OnUpdatePrimTexture != null) | 312 | if (OnUpdatePrimTexture != null) |
307 | { | 313 | { |
308 | OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this); | 314 | OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, |
315 | imagePack.ObjectData[i].TextureEntry, this); | ||
309 | } | 316 | } |
310 | } | 317 | } |
311 | break; | 318 | break; |
312 | case PacketType.ObjectGrab: | 319 | case PacketType.ObjectGrab: |
313 | ObjectGrabPacket grab = (ObjectGrabPacket)Pack; | 320 | ObjectGrabPacket grab = (ObjectGrabPacket) Pack; |
314 | if (OnGrabObject != null) | 321 | if (OnGrabObject != null) |
315 | { | 322 | { |
316 | OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this); | 323 | OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this); |
317 | } | 324 | } |
318 | break; | 325 | break; |
319 | case PacketType.ObjectGrabUpdate: | 326 | case PacketType.ObjectGrabUpdate: |
320 | ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack; | 327 | ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket) Pack; |
321 | if (OnGrabUpdate != null) | 328 | if (OnGrabUpdate != null) |
322 | { | 329 | { |
323 | OnGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, grabUpdate.ObjectData.GrabPosition, this); | 330 | OnGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, |
331 | grabUpdate.ObjectData.GrabPosition, this); | ||
324 | } | 332 | } |
325 | break; | 333 | break; |
326 | case PacketType.ObjectDeGrab: | 334 | case PacketType.ObjectDeGrab: |
327 | ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack; | 335 | ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket) Pack; |
328 | if (OnDeGrabObject != null) | 336 | if (OnDeGrabObject != null) |
329 | { | 337 | { |
330 | OnDeGrabObject(deGrab.ObjectData.LocalID, this); | 338 | OnDeGrabObject(deGrab.ObjectData.LocalID, this); |
331 | } | 339 | } |
332 | break; | 340 | break; |
333 | case PacketType.ObjectDescription: | 341 | case PacketType.ObjectDescription: |
334 | ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; | 342 | ObjectDescriptionPacket objDes = (ObjectDescriptionPacket) Pack; |
335 | for (int i = 0; i < objDes.ObjectData.Length; i++) | 343 | for (int i = 0; i < objDes.ObjectData.Length; i++) |
336 | { | 344 | { |
337 | if (OnObjectDescription != null) | 345 | if (OnObjectDescription != null) |
338 | { | 346 | { |
339 | OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description)); | 347 | OnObjectDescription(objDes.ObjectData[i].LocalID, |
348 | enc.GetString(objDes.ObjectData[i].Description)); | ||
340 | } | 349 | } |
341 | } | 350 | } |
342 | break; | 351 | break; |
343 | case PacketType.ObjectName: | 352 | case PacketType.ObjectName: |
344 | ObjectNamePacket objName = (ObjectNamePacket)Pack; | 353 | ObjectNamePacket objName = (ObjectNamePacket) Pack; |
345 | for (int i = 0; i < objName.ObjectData.Length; i++) | 354 | for (int i = 0; i < objName.ObjectData.Length; i++) |
346 | { | 355 | { |
347 | if (OnObjectName != null) | 356 | if (OnObjectName != null) |
@@ -353,15 +362,16 @@ namespace OpenSim.Region.ClientStack | |||
353 | case PacketType.ObjectPermissions: | 362 | case PacketType.ObjectPermissions: |
354 | //Console.WriteLine("permissions set " + Pack.ToString()); | 363 | //Console.WriteLine("permissions set " + Pack.ToString()); |
355 | break; | 364 | break; |
356 | #endregion | ||
357 | 365 | ||
358 | #region Inventory/Asset/Other related packets | 366 | #endregion |
367 | |||
368 | #region Inventory/Asset/Other related packets | ||
369 | |||
359 | case PacketType.RequestImage: | 370 | case PacketType.RequestImage: |
360 | RequestImagePacket imageRequest = (RequestImagePacket)Pack; | 371 | RequestImagePacket imageRequest = (RequestImagePacket) Pack; |
361 | //Console.WriteLine("image request: " + Pack.ToString()); | 372 | //Console.WriteLine("image request: " + Pack.ToString()); |
362 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) | 373 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) |
363 | { | 374 | { |
364 | |||
365 | // still working on the Texture download module so for now using old method | 375 | // still working on the Texture download module so for now using old method |
366 | // TextureRequestArgs args = new TextureRequestArgs(); | 376 | // TextureRequestArgs args = new TextureRequestArgs(); |
367 | // args.RequestedAssetID = imageRequest.RequestImage[i].Image; | 377 | // args.RequestedAssetID = imageRequest.RequestImage[i].Image; |
@@ -373,86 +383,104 @@ namespace OpenSim.Region.ClientStack | |||
373 | // OnRequestTexture(this, args); | 383 | // OnRequestTexture(this, args); |
374 | // } | 384 | // } |
375 | 385 | ||
376 | m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image, imageRequest.RequestImage[i].Packet, imageRequest.RequestImage[i].DiscardLevel); | 386 | m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image, |
387 | imageRequest.RequestImage[i].Packet, | ||
388 | imageRequest.RequestImage[i].DiscardLevel); | ||
377 | } | 389 | } |
378 | break; | 390 | break; |
379 | case PacketType.TransferRequest: | 391 | case PacketType.TransferRequest: |
380 | //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); | 392 | //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); |
381 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | 393 | TransferRequestPacket transfer = (TransferRequestPacket) Pack; |
382 | m_assetCache.AddAssetRequest(this, transfer); | 394 | m_assetCache.AddAssetRequest(this, transfer); |
383 | break; | 395 | break; |
384 | case PacketType.AssetUploadRequest: | 396 | case PacketType.AssetUploadRequest: |
385 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; | 397 | AssetUploadRequestPacket request = (AssetUploadRequestPacket) Pack; |
386 | // Console.WriteLine("upload request " + Pack.ToString()); | 398 | // Console.WriteLine("upload request " + Pack.ToString()); |
387 | // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated()); | 399 | // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated()); |
388 | if (OnAssetUploadRequest != null) | 400 | if (OnAssetUploadRequest != null) |
389 | { | 401 | { |
390 | OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); | 402 | OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(SecureSessionID), |
403 | request.AssetBlock.TransactionID, request.AssetBlock.Type, | ||
404 | request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); | ||
391 | } | 405 | } |
392 | break; | 406 | break; |
393 | case PacketType.RequestXfer: | 407 | case PacketType.RequestXfer: |
394 | RequestXferPacket xferReq = (RequestXferPacket)Pack; | 408 | RequestXferPacket xferReq = (RequestXferPacket) Pack; |
395 | if (OnRequestXfer != null) | 409 | if (OnRequestXfer != null) |
396 | { | 410 | { |
397 | OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); | 411 | OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); |
398 | } | 412 | } |
399 | break; | 413 | break; |
400 | case PacketType.SendXferPacket: | 414 | case PacketType.SendXferPacket: |
401 | SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; | 415 | SendXferPacketPacket xferRec = (SendXferPacketPacket) Pack; |
402 | if (OnXferReceive != null) | 416 | if (OnXferReceive != null) |
403 | { | 417 | { |
404 | OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); | 418 | OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); |
405 | } | 419 | } |
406 | break; | 420 | break; |
407 | case PacketType.ConfirmXferPacket: | 421 | case PacketType.ConfirmXferPacket: |
408 | ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack; | 422 | ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket) Pack; |
409 | if (OnConfirmXfer != null) | 423 | if (OnConfirmXfer != null) |
410 | { | 424 | { |
411 | OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); | 425 | OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); |
412 | } | 426 | } |
413 | break; | 427 | break; |
414 | case PacketType.CreateInventoryFolder: | 428 | case PacketType.CreateInventoryFolder: |
415 | if (this.OnCreateNewInventoryFolder != null) | 429 | if (OnCreateNewInventoryFolder != null) |
416 | { | 430 | { |
417 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | 431 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket) Pack; |
418 | this.OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | 432 | OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, |
433 | (ushort) invFolder.FolderData.Type, | ||
434 | Util.FieldToString(invFolder.FolderData.Name), | ||
435 | invFolder.FolderData.ParentID); | ||
419 | } | 436 | } |
420 | break; | 437 | break; |
421 | case PacketType.CreateInventoryItem: | 438 | case PacketType.CreateInventoryItem: |
422 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; | 439 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack; |
423 | if (this.OnCreateNewInventoryItem != null) | 440 | if (OnCreateNewInventoryItem != null) |
424 | { | 441 | { |
425 | this.OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, createItem.InventoryBlock.FolderID, createItem.InventoryBlock.CallbackID, | 442 | OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, |
426 | Util.FieldToString(createItem.InventoryBlock.Description), Util.FieldToString(createItem.InventoryBlock.Name), createItem.InventoryBlock.InvType, | 443 | createItem.InventoryBlock.FolderID, |
427 | createItem.InventoryBlock.Type, createItem.InventoryBlock.WearableType, createItem.InventoryBlock.NextOwnerMask); | 444 | createItem.InventoryBlock.CallbackID, |
445 | Util.FieldToString(createItem.InventoryBlock.Description), | ||
446 | Util.FieldToString(createItem.InventoryBlock.Name), | ||
447 | createItem.InventoryBlock.InvType, | ||
448 | createItem.InventoryBlock.Type, | ||
449 | createItem.InventoryBlock.WearableType, | ||
450 | createItem.InventoryBlock.NextOwnerMask); | ||
428 | } | 451 | } |
429 | break; | 452 | break; |
430 | case PacketType.FetchInventory: | 453 | case PacketType.FetchInventory: |
431 | if (this.OnFetchInventory != null) | 454 | if (OnFetchInventory != null) |
432 | { | 455 | { |
433 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; | 456 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket) Pack; |
434 | for (int i = 0; i < FetchInventory.InventoryData.Length; i++) | 457 | for (int i = 0; i < FetchInventory.InventoryData.Length; i++) |
435 | { | 458 | { |
436 | this.OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID, FetchInventory.InventoryData[i].OwnerID); | 459 | OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID, |
460 | FetchInventory.InventoryData[i].OwnerID); | ||
437 | } | 461 | } |
438 | } | 462 | } |
439 | break; | 463 | break; |
440 | case PacketType.FetchInventoryDescendents: | 464 | case PacketType.FetchInventoryDescendents: |
441 | if (this.OnFetchInventoryDescendents != null) | 465 | if (OnFetchInventoryDescendents != null) |
442 | { | 466 | { |
443 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | 467 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket) Pack; |
444 | this.OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, Fetch.InventoryData.SortOrder); | 468 | OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, |
469 | Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, | ||
470 | Fetch.InventoryData.SortOrder); | ||
445 | } | 471 | } |
446 | break; | 472 | break; |
447 | case PacketType.UpdateInventoryItem: | 473 | case PacketType.UpdateInventoryItem: |
448 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; | 474 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket) Pack; |
449 | if (OnUpdateInventoryItem != null) | 475 | if (OnUpdateInventoryItem != null) |
450 | { | 476 | { |
451 | for (int i = 0; i < update.InventoryData.Length; i++) | 477 | for (int i = 0; i < update.InventoryData.Length; i++) |
452 | { | 478 | { |
453 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) | 479 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) |
454 | { | 480 | { |
455 | OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, update.InventoryData[i].TransactionID.Combine(this.SecureSessionID), update.InventoryData[i].ItemID); | 481 | OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, |
482 | update.InventoryData[i].TransactionID.Combine(SecureSessionID), | ||
483 | update.InventoryData[i].ItemID); | ||
456 | } | 484 | } |
457 | } | 485 | } |
458 | } | 486 | } |
@@ -488,25 +516,26 @@ namespace OpenSim.Region.ClientStack | |||
488 | }*/ | 516 | }*/ |
489 | break; | 517 | break; |
490 | case PacketType.RequestTaskInventory: | 518 | case PacketType.RequestTaskInventory: |
491 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; | 519 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket) Pack; |
492 | if (this.OnRequestTaskInventory != null) | 520 | if (OnRequestTaskInventory != null) |
493 | { | 521 | { |
494 | this.OnRequestTaskInventory(this, requesttask.InventoryData.LocalID); | 522 | OnRequestTaskInventory(this, requesttask.InventoryData.LocalID); |
495 | } | 523 | } |
496 | break; | 524 | break; |
497 | case PacketType.UpdateTaskInventory: | 525 | case PacketType.UpdateTaskInventory: |
498 | //Console.WriteLine(Pack.ToString()); | 526 | //Console.WriteLine(Pack.ToString()); |
499 | UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; | 527 | UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket) Pack; |
500 | if (OnUpdateTaskInventory != null) | 528 | if (OnUpdateTaskInventory != null) |
501 | { | 529 | { |
502 | if (updatetask.UpdateData.Key == 0) | 530 | if (updatetask.UpdateData.Key == 0) |
503 | { | 531 | { |
504 | OnUpdateTaskInventory(this, updatetask.InventoryData.ItemID, updatetask.InventoryData.FolderID, updatetask.UpdateData.LocalID); | 532 | OnUpdateTaskInventory(this, updatetask.InventoryData.ItemID, |
533 | updatetask.InventoryData.FolderID, updatetask.UpdateData.LocalID); | ||
505 | } | 534 | } |
506 | } | 535 | } |
507 | break; | 536 | break; |
508 | case PacketType.RemoveTaskInventory: | 537 | case PacketType.RemoveTaskInventory: |
509 | RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack; | 538 | RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket) Pack; |
510 | if (OnRemoveTaskItem != null) | 539 | if (OnRemoveTaskItem != null) |
511 | { | 540 | { |
512 | OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID); | 541 | OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID); |
@@ -517,38 +546,39 @@ namespace OpenSim.Region.ClientStack | |||
517 | break; | 546 | break; |
518 | case PacketType.RezScript: | 547 | case PacketType.RezScript: |
519 | //Console.WriteLine(Pack.ToString()); | 548 | //Console.WriteLine(Pack.ToString()); |
520 | RezScriptPacket rezScript = (RezScriptPacket)Pack; | 549 | RezScriptPacket rezScript = (RezScriptPacket) Pack; |
521 | if (OnRezScript != null) | 550 | if (OnRezScript != null) |
522 | { | 551 | { |
523 | OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID); | 552 | OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID); |
524 | } | 553 | } |
525 | break; | 554 | break; |
526 | case PacketType.MapLayerRequest: | 555 | case PacketType.MapLayerRequest: |
527 | this.RequestMapLayer(); | 556 | RequestMapLayer(); |
528 | break; | 557 | break; |
529 | case PacketType.MapBlockRequest: | 558 | case PacketType.MapBlockRequest: |
530 | MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; | 559 | MapBlockRequestPacket MapRequest = (MapBlockRequestPacket) Pack; |
531 | if (OnRequestMapBlocks != null) | 560 | if (OnRequestMapBlocks != null) |
532 | { | 561 | { |
533 | OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); | 562 | OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, |
563 | MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); | ||
534 | } | 564 | } |
535 | break; | 565 | break; |
536 | case PacketType.TeleportLandmarkRequest: | 566 | case PacketType.TeleportLandmarkRequest: |
537 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; | 567 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack; |
538 | 568 | ||
539 | TeleportStartPacket tpStart = new TeleportStartPacket(); | 569 | TeleportStartPacket tpStart = new TeleportStartPacket(); |
540 | tpStart.Info.TeleportFlags = 8; // tp via lm | 570 | tpStart.Info.TeleportFlags = 8; // tp via lm |
541 | this.OutPacket(tpStart); | 571 | OutPacket(tpStart); |
542 | 572 | ||
543 | TeleportProgressPacket tpProgress = new TeleportProgressPacket(); | 573 | TeleportProgressPacket tpProgress = new TeleportProgressPacket(); |
544 | tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); | 574 | tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); |
545 | tpProgress.Info.TeleportFlags = 8; | 575 | tpProgress.Info.TeleportFlags = 8; |
546 | tpProgress.AgentData.AgentID = tpReq.Info.AgentID; | 576 | tpProgress.AgentData.AgentID = tpReq.Info.AgentID; |
547 | this.OutPacket(tpProgress); | 577 | OutPacket(tpProgress); |
548 | 578 | ||
549 | // Fetch landmark | 579 | // Fetch landmark |
550 | LLUUID lmid = tpReq.Info.LandmarkID; | 580 | LLUUID lmid = tpReq.Info.LandmarkID; |
551 | AssetBase lma = this.m_assetCache.GetAsset(lmid); | 581 | AssetBase lma = m_assetCache.GetAsset(lmid); |
552 | if (lma != null) | 582 | if (lma != null) |
553 | { | 583 | { |
554 | AssetLandmark lm = new AssetLandmark(lma); | 584 | AssetLandmark lm = new AssetLandmark(lma); |
@@ -558,7 +588,7 @@ namespace OpenSim.Region.ClientStack | |||
558 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | 588 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); |
559 | 589 | ||
560 | tpLocal.Info.AgentID = tpReq.Info.AgentID; | 590 | tpLocal.Info.AgentID = tpReq.Info.AgentID; |
561 | tpLocal.Info.TeleportFlags = 8; // Teleport via landmark | 591 | tpLocal.Info.TeleportFlags = 8; // Teleport via landmark |
562 | tpLocal.Info.LocationID = 2; | 592 | tpLocal.Info.LocationID = 2; |
563 | tpLocal.Info.Position = lm.Position; | 593 | tpLocal.Info.Position = lm.Position; |
564 | OutPacket(tpLocal); | 594 | OutPacket(tpLocal); |
@@ -582,12 +612,13 @@ namespace OpenSim.Region.ClientStack | |||
582 | } | 612 | } |
583 | break; | 613 | break; |
584 | case PacketType.TeleportLocationRequest: | 614 | case PacketType.TeleportLocationRequest: |
585 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; | 615 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket) Pack; |
586 | // Console.WriteLine(tpLocReq.ToString()); | 616 | // Console.WriteLine(tpLocReq.ToString()); |
587 | 617 | ||
588 | if (OnTeleportLocationRequest != null) | 618 | if (OnTeleportLocationRequest != null) |
589 | { | 619 | { |
590 | OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); | 620 | OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, |
621 | tpLocReq.Info.LookAt, 16); | ||
591 | } | 622 | } |
592 | else | 623 | else |
593 | { | 624 | { |
@@ -598,76 +629,94 @@ namespace OpenSim.Region.ClientStack | |||
598 | OutPacket(tpCancel); | 629 | OutPacket(tpCancel); |
599 | } | 630 | } |
600 | break; | 631 | break; |
601 | #endregion | 632 | |
633 | #endregion | ||
602 | 634 | ||
603 | case PacketType.MoneyBalanceRequest: | 635 | case PacketType.MoneyBalanceRequest: |
604 | SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance); | 636 | SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance); |
605 | break; | 637 | break; |
606 | case PacketType.UUIDNameRequest: | 638 | case PacketType.UUIDNameRequest: |
607 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; | 639 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket) Pack; |
608 | foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) | 640 | foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) |
609 | { | 641 | { |
610 | OnNameFromUUIDRequest(UUIDBlock.ID, this); | 642 | OnNameFromUUIDRequest(UUIDBlock.ID, this); |
611 | } | 643 | } |
612 | break; | 644 | break; |
613 | #region Parcel related packets | 645 | |
646 | #region Parcel related packets | ||
647 | |||
614 | case PacketType.ParcelPropertiesRequest: | 648 | case PacketType.ParcelPropertiesRequest: |
615 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; | 649 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket) Pack; |
616 | if (OnParcelPropertiesRequest != null) | 650 | if (OnParcelPropertiesRequest != null) |
617 | { | 651 | { |
618 | OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this); | 652 | OnParcelPropertiesRequest((int) Math.Round(propertiesRequest.ParcelData.West), |
653 | (int) Math.Round(propertiesRequest.ParcelData.South), | ||
654 | (int) Math.Round(propertiesRequest.ParcelData.East), | ||
655 | (int) Math.Round(propertiesRequest.ParcelData.North), | ||
656 | propertiesRequest.ParcelData.SequenceID, | ||
657 | propertiesRequest.ParcelData.SnapSelection, this); | ||
619 | } | 658 | } |
620 | break; | 659 | break; |
621 | case PacketType.ParcelDivide: | 660 | case PacketType.ParcelDivide: |
622 | ParcelDividePacket landDivide = (ParcelDividePacket)Pack; | 661 | ParcelDividePacket landDivide = (ParcelDividePacket) Pack; |
623 | if (OnParcelDivideRequest != null) | 662 | if (OnParcelDivideRequest != null) |
624 | { | 663 | { |
625 | OnParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West), (int)Math.Round(landDivide.ParcelData.South), (int)Math.Round(landDivide.ParcelData.East), (int)Math.Round(landDivide.ParcelData.North), this); | 664 | OnParcelDivideRequest((int) Math.Round(landDivide.ParcelData.West), |
665 | (int) Math.Round(landDivide.ParcelData.South), | ||
666 | (int) Math.Round(landDivide.ParcelData.East), | ||
667 | (int) Math.Round(landDivide.ParcelData.North), this); | ||
626 | } | 668 | } |
627 | break; | 669 | break; |
628 | case PacketType.ParcelJoin: | 670 | case PacketType.ParcelJoin: |
629 | ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack; | 671 | ParcelJoinPacket landJoin = (ParcelJoinPacket) Pack; |
630 | if (OnParcelJoinRequest != null) | 672 | if (OnParcelJoinRequest != null) |
631 | { | 673 | { |
632 | OnParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West), (int)Math.Round(landJoin.ParcelData.South), (int)Math.Round(landJoin.ParcelData.East), (int)Math.Round(landJoin.ParcelData.North), this); | 674 | OnParcelJoinRequest((int) Math.Round(landJoin.ParcelData.West), |
675 | (int) Math.Round(landJoin.ParcelData.South), | ||
676 | (int) Math.Round(landJoin.ParcelData.East), | ||
677 | (int) Math.Round(landJoin.ParcelData.North), this); | ||
633 | } | 678 | } |
634 | break; | 679 | break; |
635 | case PacketType.ParcelPropertiesUpdate: | 680 | case PacketType.ParcelPropertiesUpdate: |
636 | ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; | 681 | ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket) Pack; |
637 | if (OnParcelPropertiesUpdateRequest != null) | 682 | if (OnParcelPropertiesUpdateRequest != null) |
638 | { | 683 | { |
639 | OnParcelPropertiesUpdateRequest(updatePacket, this); | 684 | OnParcelPropertiesUpdateRequest(updatePacket, this); |
640 | |||
641 | } | 685 | } |
642 | break; | 686 | break; |
643 | case PacketType.ParcelSelectObjects: | 687 | case PacketType.ParcelSelectObjects: |
644 | ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; | 688 | ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket) Pack; |
645 | if (OnParcelSelectObjects != null) | 689 | if (OnParcelSelectObjects != null) |
646 | { | 690 | { |
647 | OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); | 691 | OnParcelSelectObjects(selectPacket.ParcelData.LocalID, |
692 | Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); | ||
648 | } | 693 | } |
649 | break; | 694 | break; |
650 | 695 | ||
651 | case PacketType.ParcelObjectOwnersRequest: | 696 | case PacketType.ParcelObjectOwnersRequest: |
652 | ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack; | 697 | ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket) Pack; |
653 | if (OnParcelObjectOwnerRequest != null) | 698 | if (OnParcelObjectOwnerRequest != null) |
654 | { | 699 | { |
655 | OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); | 700 | OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); |
656 | } | 701 | } |
657 | break; | 702 | break; |
658 | #endregion | ||
659 | 703 | ||
660 | #region Estate Packets | 704 | #endregion |
705 | |||
706 | #region Estate Packets | ||
707 | |||
661 | case PacketType.EstateOwnerMessage: | 708 | case PacketType.EstateOwnerMessage: |
662 | EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; | 709 | EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket) Pack; |
663 | if (OnEstateOwnerMessage != null) | 710 | if (OnEstateOwnerMessage != null) |
664 | { | 711 | { |
665 | OnEstateOwnerMessage(messagePacket, this); | 712 | OnEstateOwnerMessage(messagePacket, this); |
666 | } | 713 | } |
667 | break; | 714 | break; |
668 | #endregion | ||
669 | 715 | ||
670 | #region unimplemented handlers | 716 | #endregion |
717 | |||
718 | #region unimplemented handlers | ||
719 | |||
671 | case PacketType.AgentIsNowWearing: | 720 | case PacketType.AgentIsNowWearing: |
672 | // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; | 721 | // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; |
673 | //Console.WriteLine(Pack.ToString()); | 722 | //Console.WriteLine(Pack.ToString()); |
@@ -675,7 +724,8 @@ namespace OpenSim.Region.ClientStack | |||
675 | case PacketType.ObjectScale: | 724 | case PacketType.ObjectScale: |
676 | //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); | 725 | //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); |
677 | break; | 726 | break; |
678 | #endregion | 727 | |
728 | #endregion | ||
679 | } | 729 | } |
680 | } | 730 | } |
681 | } | 731 | } |
@@ -721,4 +771,4 @@ namespace OpenSim.Region.ClientStack | |||
721 | OutPacket(logReply); | 771 | OutPacket(logReply); |
722 | } | 772 | } |
723 | } | 773 | } |
724 | } | 774 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 6d49e34..55f50a4 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -36,7 +36,7 @@ using libsecondlife.Packets; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications.Cache; | 37 | using OpenSim.Framework.Communications.Cache; |
38 | using OpenSim.Framework.Console; | 38 | using OpenSim.Framework.Console; |
39 | using Timer = System.Timers.Timer; | 39 | using Timer=System.Timers.Timer; |
40 | 40 | ||
41 | namespace OpenSim.Region.ClientStack | 41 | namespace OpenSim.Region.ClientStack |
42 | { | 42 | { |
@@ -50,8 +50,11 @@ namespace OpenSim.Region.ClientStack | |||
50 | { | 50 | { |
51 | public static TerrainManager TerrainManager; | 51 | public static TerrainManager TerrainManager; |
52 | 52 | ||
53 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients | 53 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = |
54 | protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); //local handlers for this instance | 54 | new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients |
55 | |||
56 | protected Dictionary<PacketType, PacketMethod> m_packetHandlers = new Dictionary<PacketType, PacketMethod>(); | ||
57 | //local handlers for this instance | ||
55 | 58 | ||
56 | private LLUUID m_sessionId; | 59 | private LLUUID m_sessionId; |
57 | public LLUUID SecureSessionID = LLUUID.Zero; | 60 | public LLUUID SecureSessionID = LLUUID.Zero; |
@@ -84,7 +87,9 @@ namespace OpenSim.Region.ClientStack | |||
84 | private int probesWithNoIngressPackets = 0; | 87 | private int probesWithNoIngressPackets = 0; |
85 | private int lastPacketsReceived = 0; | 88 | private int lastPacketsReceived = 0; |
86 | 89 | ||
87 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) | 90 | public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, |
91 | IScene scene, AssetCache assetCache, PacketServer packServer, | ||
92 | AgentCircuitManager authenSessions) | ||
88 | { | 93 | { |
89 | m_moneyBalance = 1000; | 94 | m_moneyBalance = 1000; |
90 | 95 | ||
@@ -96,11 +101,11 @@ namespace OpenSim.Region.ClientStack | |||
96 | // m_inventoryCache = inventoryCache; | 101 | // m_inventoryCache = inventoryCache; |
97 | m_authenticateSessionsHandler = authenSessions; | 102 | m_authenticateSessionsHandler = authenSessions; |
98 | 103 | ||
99 | MainLog.Instance.Verbose("CLIENT","Started up new client thread to handle incoming request"); | 104 | MainLog.Instance.Verbose("CLIENT", "Started up new client thread to handle incoming request"); |
100 | cirpack = initialcirpack; | 105 | cirpack = initialcirpack; |
101 | userEP = remoteEP; | 106 | userEP = remoteEP; |
102 | 107 | ||
103 | this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); | 108 | startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); |
104 | 109 | ||
105 | PacketQueue = new BlockingQueue<QueItem>(); | 110 | PacketQueue = new BlockingQueue<QueItem>(); |
106 | 111 | ||
@@ -109,7 +114,7 @@ namespace OpenSim.Region.ClientStack | |||
109 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | 114 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); |
110 | AckTimer.Start(); | 115 | AckTimer.Start(); |
111 | 116 | ||
112 | this.RegisterLocalPacketHandlers(); | 117 | RegisterLocalPacketHandlers(); |
113 | 118 | ||
114 | ClientThread = new Thread(new ThreadStart(AuthUser)); | 119 | ClientThread = new Thread(new ThreadStart(AuthUser)); |
115 | ClientThread.IsBackground = true; | 120 | ClientThread.IsBackground = true; |
@@ -121,7 +126,7 @@ namespace OpenSim.Region.ClientStack | |||
121 | get { return m_sessionId; } | 126 | get { return m_sessionId; } |
122 | } | 127 | } |
123 | 128 | ||
124 | public void SetDebug(int newDebug) | 129 | public void SetDebug(int newDebug) |
125 | { | 130 | { |
126 | debug = newDebug; | 131 | debug = newDebug; |
127 | } | 132 | } |
@@ -132,14 +137,15 @@ namespace OpenSim.Region.ClientStack | |||
132 | { | 137 | { |
133 | clientPingTimer.Stop(); | 138 | clientPingTimer.Stop(); |
134 | 139 | ||
135 | m_scene.RemoveClient(this.AgentId); | 140 | m_scene.RemoveClient(AgentId); |
136 | 141 | ||
137 | this.ClientThread.Abort(); | 142 | ClientThread.Abort(); |
138 | } | 143 | } |
139 | 144 | ||
140 | #endregion | 145 | #endregion |
141 | 146 | ||
142 | # region Packet Handling | 147 | # region Packet Handling |
148 | |||
143 | public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) | 149 | public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) |
144 | { | 150 | { |
145 | bool result = false; | 151 | bool result = false; |
@@ -195,23 +201,27 @@ namespace OpenSim.Region.ClientStack | |||
195 | 201 | ||
196 | protected void DebugPacket(string direction, Packet packet) | 202 | protected void DebugPacket(string direction, Packet packet) |
197 | { | 203 | { |
198 | if (debug > 0) { | 204 | if (debug > 0) |
205 | { | ||
199 | string info; | 206 | string info; |
200 | if (debug < 255 && packet.Type == PacketType.AgentUpdate) | 207 | if (debug < 255 && packet.Type == PacketType.AgentUpdate) |
201 | return; | 208 | return; |
202 | if (debug < 254 && packet.Type == PacketType.ViewerEffect) | 209 | if (debug < 254 && packet.Type == PacketType.ViewerEffect) |
203 | return; | 210 | return; |
204 | if (debug < 253 && ( | 211 | if (debug < 253 && ( |
205 | packet.Type == PacketType.CompletePingCheck || | 212 | packet.Type == PacketType.CompletePingCheck || |
206 | packet.Type == PacketType.StartPingCheck | 213 | packet.Type == PacketType.StartPingCheck |
207 | ) ) | 214 | )) |
208 | return; | 215 | return; |
209 | if (debug < 252 && packet.Type == PacketType.PacketAck) | 216 | if (debug < 252 && packet.Type == PacketType.PacketAck) |
210 | return; | 217 | return; |
211 | 218 | ||
212 | if (debug > 1) { | 219 | if (debug > 1) |
220 | { | ||
213 | info = packet.ToString(); | 221 | info = packet.ToString(); |
214 | } else { | 222 | } |
223 | else | ||
224 | { | ||
215 | info = packet.Type.ToString(); | 225 | info = packet.Type.ToString(); |
216 | } | 226 | } |
217 | Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); | 227 | Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); |
@@ -242,6 +252,7 @@ namespace OpenSim.Region.ClientStack | |||
242 | } | 252 | } |
243 | } | 253 | } |
244 | } | 254 | } |
255 | |||
245 | # endregion | 256 | # endregion |
246 | 257 | ||
247 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) | 258 | protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) |
@@ -251,7 +262,7 @@ namespace OpenSim.Region.ClientStack | |||
251 | probesWithNoIngressPackets++; | 262 | probesWithNoIngressPackets++; |
252 | if (probesWithNoIngressPackets > 30) | 263 | if (probesWithNoIngressPackets > 30) |
253 | { | 264 | { |
254 | if( OnConnectionClosed != null ) | 265 | if (OnConnectionClosed != null) |
255 | { | 266 | { |
256 | OnConnectionClosed(this); | 267 | OnConnectionClosed(this); |
257 | } | 268 | } |
@@ -278,14 +289,16 @@ namespace OpenSim.Region.ClientStack | |||
278 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); | 289 | clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); |
279 | clientPingTimer.Enabled = true; | 290 | clientPingTimer.Enabled = true; |
280 | 291 | ||
281 | MainLog.Instance.Verbose("CLIENT","Adding viewer agent to scene"); | 292 | MainLog.Instance.Verbose("CLIENT", "Adding viewer agent to scene"); |
282 | this.m_scene.AddNewClient(this, true); | 293 | m_scene.AddNewClient(this, true); |
283 | } | 294 | } |
284 | 295 | ||
285 | protected virtual void AuthUser() | 296 | protected virtual void AuthUser() |
286 | { | 297 | { |
287 | // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.m_circuitCode.m_sessionId, cirpack.m_circuitCode.ID, cirpack.m_circuitCode.Code); | 298 | // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.m_circuitCode.m_sessionId, cirpack.m_circuitCode.ID, cirpack.m_circuitCode.Code); |
288 | AuthenticateResponse sessionInfo = this.m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); | 299 | AuthenticateResponse sessionInfo = |
300 | m_authenticateSessionsHandler.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, | ||
301 | cirpack.CircuitCode.Code); | ||
289 | if (!sessionInfo.Authorised) | 302 | if (!sessionInfo.Authorised) |
290 | { | 303 | { |
291 | //session/circuit not authorised | 304 | //session/circuit not authorised |
@@ -297,27 +310,26 @@ namespace OpenSim.Region.ClientStack | |||
297 | MainLog.Instance.Notice("CLIENT", "Got authenticated connection from " + userEP.ToString()); | 310 | MainLog.Instance.Notice("CLIENT", "Got authenticated connection from " + userEP.ToString()); |
298 | //session is authorised | 311 | //session is authorised |
299 | m_agentId = cirpack.CircuitCode.ID; | 312 | m_agentId = cirpack.CircuitCode.ID; |
300 | this.m_sessionId = cirpack.CircuitCode.SessionID; | 313 | m_sessionId = cirpack.CircuitCode.SessionID; |
301 | this.m_circuitCode = cirpack.CircuitCode.Code; | 314 | m_circuitCode = cirpack.CircuitCode.Code; |
302 | this.firstName = sessionInfo.LoginInfo.First; | 315 | firstName = sessionInfo.LoginInfo.First; |
303 | this.lastName = sessionInfo.LoginInfo.Last; | 316 | lastName = sessionInfo.LoginInfo.Last; |
304 | 317 | ||
305 | if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) | 318 | if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) |
306 | { | 319 | { |
307 | this.SecureSessionID = sessionInfo.LoginInfo.SecureSession; | 320 | SecureSessionID = sessionInfo.LoginInfo.SecureSession; |
308 | } | 321 | } |
309 | InitNewClient(); | 322 | InitNewClient(); |
310 | 323 | ||
311 | ClientLoop(); | 324 | ClientLoop(); |
312 | } | 325 | } |
313 | } | 326 | } |
314 | # endregion | ||
315 | 327 | ||
328 | # endregion | ||
316 | 329 | ||
317 | protected void KillThread() | 330 | protected void KillThread() |
318 | { | 331 | { |
319 | this.ClientThread.Abort(); | 332 | ClientThread.Abort(); |
320 | } | 333 | } |
321 | |||
322 | } | 334 | } |
323 | } | 335 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 1b64602..f75536a 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs | |||
@@ -25,15 +25,11 @@ | |||
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 | */ |
28 | using System.Collections.Generic; | ||
29 | using System.Net; | 28 | using System.Net; |
30 | using System.Net.Sockets; | 29 | using System.Net.Sockets; |
31 | using libsecondlife.Packets; | 30 | using libsecondlife.Packets; |
32 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications.Cache; | 32 | using OpenSim.Framework.Communications.Cache; |
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Interfaces; | ||
36 | using libsecondlife; | ||
37 | 33 | ||
38 | namespace OpenSim.Region.ClientStack | 34 | namespace OpenSim.Region.ClientStack |
39 | { | 35 | { |
@@ -56,10 +52,7 @@ namespace OpenSim.Region.ClientStack | |||
56 | 52 | ||
57 | public IScene LocalScene | 53 | public IScene LocalScene |
58 | { | 54 | { |
59 | set | 55 | set { m_scene = value; } |
60 | { | ||
61 | this.m_scene = value; | ||
62 | } | ||
63 | } | 56 | } |
64 | 57 | ||
65 | /// <summary> | 58 | /// <summary> |
@@ -72,17 +65,21 @@ namespace OpenSim.Region.ClientStack | |||
72 | m_scene.ClientManager.InPacket(circuitCode, packet); | 65 | m_scene.ClientManager.InPacket(circuitCode, packet); |
73 | } | 66 | } |
74 | 67 | ||
75 | protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, ClientManager clientManager, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) | 68 | protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, |
69 | ClientManager clientManager, IScene scene, AssetCache assetCache, | ||
70 | PacketServer packServer, AgentCircuitManager authenSessions) | ||
76 | { | 71 | { |
77 | return new ClientView(remoteEP, initialcirpack, clientManager, scene, assetCache, packServer, authenSessions ); | 72 | return |
73 | new ClientView(remoteEP, initialcirpack, clientManager, scene, assetCache, packServer, authenSessions); | ||
78 | } | 74 | } |
79 | 75 | ||
80 | public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, AgentCircuitManager authenticateSessionsClass) | 76 | public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, |
77 | AgentCircuitManager authenticateSessionsClass) | ||
81 | { | 78 | { |
82 | IClientAPI newuser; | 79 | IClientAPI newuser; |
83 | 80 | ||
84 | if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser)) | 81 | if (m_scene.ClientManager.TryGetClient(useCircuit.CircuitCode.Code, out newuser)) |
85 | { | 82 | { |
86 | return false; | 83 | return false; |
87 | } | 84 | } |
88 | else | 85 | else |
@@ -104,7 +101,7 @@ namespace OpenSim.Region.ClientStack | |||
104 | { | 101 | { |
105 | client.SendLogoutPacket(); | 102 | client.SendLogoutPacket(); |
106 | 103 | ||
107 | CloseClient( client ); | 104 | CloseClient(client); |
108 | } | 105 | } |
109 | 106 | ||
110 | 107 | ||
@@ -117,7 +114,7 @@ namespace OpenSim.Region.ClientStack | |||
117 | /// <param name="circuitcode"></param> | 114 | /// <param name="circuitcode"></param> |
118 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) | 115 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) |
119 | { | 116 | { |
120 | this.m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode); | 117 | m_networkHandler.SendPacketTo(buffer, size, flags, circuitcode); |
121 | } | 118 | } |
122 | 119 | ||
123 | /// <summary> | 120 | /// <summary> |
@@ -126,13 +123,13 @@ namespace OpenSim.Region.ClientStack | |||
126 | /// <param name="circuitcode"></param> | 123 | /// <param name="circuitcode"></param> |
127 | public virtual void CloseCircuit(uint circuitcode) | 124 | public virtual void CloseCircuit(uint circuitcode) |
128 | { | 125 | { |
129 | m_networkHandler.RemoveClientCircuit( circuitcode ); | 126 | m_networkHandler.RemoveClientCircuit(circuitcode); |
130 | m_scene.ClientManager.CloseAllAgents(circuitcode); | 127 | m_scene.ClientManager.CloseAllAgents(circuitcode); |
131 | } | 128 | } |
132 | 129 | ||
133 | public virtual void CloseClient( IClientAPI client ) | 130 | public virtual void CloseClient(IClientAPI client) |
134 | { | 131 | { |
135 | CloseCircuit( client.CircuitCode ); | 132 | CloseCircuit(client.CircuitCode); |
136 | } | 133 | } |
137 | } | 134 | } |
138 | } | 135 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 657af54..7551bff 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -28,17 +28,15 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | 30 | using System.Net; |
31 | using libsecondlife; | ||
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications; | ||
32 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
33 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Region.Physics.Manager; | ||
38 | using OpenSim.Region.Environment; | 37 | using OpenSim.Region.Environment; |
39 | using libsecondlife; | ||
40 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
41 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Region.Physics.Manager; |
42 | 40 | ||
43 | namespace OpenSim.Region.ClientStack | 41 | namespace OpenSim.Region.ClientStack |
44 | { | 42 | { |
@@ -67,9 +65,8 @@ namespace OpenSim.Region.ClientStack | |||
67 | m_startuptime = DateTime.Now; | 65 | m_startuptime = DateTime.Now; |
68 | } | 66 | } |
69 | 67 | ||
70 | virtual public void StartUp() | 68 | public virtual void StartUp() |
71 | { | 69 | { |
72 | |||
73 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); | 70 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); |
74 | 71 | ||
75 | Initialize(); | 72 | Initialize(); |
@@ -116,7 +113,10 @@ namespace OpenSim.Region.ClientStack | |||
116 | scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D()); | 113 | scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D()); |
117 | 114 | ||
118 | //Master Avatar Setup | 115 | //Master Avatar Setup |
119 | UserProfileData masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword); | 116 | UserProfileData masterAvatar = |
117 | m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, | ||
118 | scene.RegionInfo.MasterAvatarLastName, | ||
119 | scene.RegionInfo.MasterAvatarSandboxPassword); | ||
120 | if (masterAvatar != null) | 120 | if (masterAvatar != null) |
121 | { | 121 | { |
122 | m_log.Verbose("PARCEL", "Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]"); | 122 | m_log.Verbose("PARCEL", "Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]"); |
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ClientStack | |||
126 | else | 126 | else |
127 | { | 127 | { |
128 | m_log.Verbose("PARCEL", "No master avatar found, using null."); | 128 | m_log.Verbose("PARCEL", "No master avatar found, using null."); |
129 | scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero; | 129 | scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero; |
130 | //TODO: Load parcels from storageManager | 130 | //TODO: Load parcels from storageManager |
131 | } | 131 | } |
132 | 132 | ||
@@ -138,8 +138,7 @@ namespace OpenSim.Region.ClientStack | |||
138 | return scene; | 138 | return scene; |
139 | } | 139 | } |
140 | 140 | ||
141 | protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager); | 141 | protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, |
142 | 142 | AgentCircuitManager circuitManager); | |
143 | |||
144 | } | 143 | } |
145 | } | 144 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 584b80c..e5965cb 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs | |||
@@ -32,13 +32,10 @@ using System.Net.Sockets; | |||
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
37 | using OpenSim.Framework.Interfaces; | ||
38 | 36 | ||
39 | namespace OpenSim.Region.ClientStack | 37 | namespace OpenSim.Region.ClientStack |
40 | { | 38 | { |
41 | |||
42 | public class UDPServer : ClientStackNetworkHandler | 39 | public class UDPServer : ClientStackNetworkHandler |
43 | { | 40 | { |
44 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); | 41 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); |
@@ -59,22 +56,16 @@ namespace OpenSim.Region.ClientStack | |||
59 | 56 | ||
60 | public PacketServer PacketServer | 57 | public PacketServer PacketServer |
61 | { | 58 | { |
62 | get | 59 | get { return m_packetServer; } |
63 | { | 60 | set { m_packetServer = value; } |
64 | return m_packetServer; | ||
65 | } | ||
66 | set | ||
67 | { | ||
68 | m_packetServer = value; | ||
69 | } | ||
70 | } | 61 | } |
71 | 62 | ||
72 | public IScene LocalScene | 63 | public IScene LocalScene |
73 | { | 64 | { |
74 | set | 65 | set |
75 | { | 66 | { |
76 | this.m_localScene = value; | 67 | m_localScene = value; |
77 | this.m_packetServer.LocalScene = this.m_localScene; | 68 | m_packetServer.LocalScene = m_localScene; |
78 | } | 69 | } |
79 | } | 70 | } |
80 | 71 | ||
@@ -85,10 +76,10 @@ namespace OpenSim.Region.ClientStack | |||
85 | public UDPServer(int port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass) | 76 | public UDPServer(int port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass) |
86 | { | 77 | { |
87 | listenPort = port; | 78 | listenPort = port; |
88 | this.m_assetCache = assetCache; | 79 | m_assetCache = assetCache; |
89 | this.m_log = console; | 80 | m_log = console; |
90 | this.m_authenticateSessionsClass = authenticateClass; | 81 | m_authenticateSessionsClass = authenticateClass; |
91 | this.CreatePacketServer(); | 82 | CreatePacketServer(); |
92 | } | 83 | } |
93 | 84 | ||
94 | protected virtual void CreatePacketServer() | 85 | protected virtual void CreatePacketServer() |
@@ -99,7 +90,7 @@ namespace OpenSim.Region.ClientStack | |||
99 | protected virtual void OnReceivedData(IAsyncResult result) | 90 | protected virtual void OnReceivedData(IAsyncResult result) |
100 | { | 91 | { |
101 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | 92 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); |
102 | epSender = (EndPoint)ipeSender; | 93 | epSender = (EndPoint) ipeSender; |
103 | Packet packet = null; | 94 | Packet packet = null; |
104 | 95 | ||
105 | int numBytes; | 96 | int numBytes; |
@@ -108,7 +99,7 @@ namespace OpenSim.Region.ClientStack | |||
108 | { | 99 | { |
109 | numBytes = Server.EndReceiveFrom(result, ref epSender); | 100 | numBytes = Server.EndReceiveFrom(result, ref epSender); |
110 | } | 101 | } |
111 | catch (System.Net.Sockets.SocketException e) | 102 | catch (SocketException e) |
112 | { | 103 | { |
113 | // TODO : Actually only handle those states that we have control over, re-throw everything else, | 104 | // TODO : Actually only handle those states that we have control over, re-throw everything else, |
114 | // TODO: implement cases as we encounter them. | 105 | // TODO: implement cases as we encounter them. |
@@ -134,7 +125,7 @@ namespace OpenSim.Region.ClientStack | |||
134 | if (clientCircuits.TryGetValue(epSender, out circuit)) | 125 | if (clientCircuits.TryGetValue(epSender, out circuit)) |
135 | { | 126 | { |
136 | //if so then send packet to the packetserver | 127 | //if so then send packet to the packetserver |
137 | this.m_packetServer.InPacket(circuit, packet); | 128 | m_packetServer.InPacket(circuit, packet); |
138 | } | 129 | } |
139 | else if (packet.Type == PacketType.UseCircuitCode) | 130 | else if (packet.Type == PacketType.UseCircuitCode) |
140 | { | 131 | { |
@@ -142,7 +133,8 @@ namespace OpenSim.Region.ClientStack | |||
142 | AddNewClient(packet); | 133 | AddNewClient(packet); |
143 | } | 134 | } |
144 | else | 135 | else |
145 | { // invalid client | 136 | { |
137 | // invalid client | ||
146 | m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString()); | 138 | m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString()); |
147 | } | 139 | } |
148 | 140 | ||
@@ -160,10 +152,10 @@ namespace OpenSim.Region.ClientStack | |||
160 | 152 | ||
161 | protected virtual void AddNewClient(Packet packet) | 153 | protected virtual void AddNewClient(Packet packet) |
162 | { | 154 | { |
163 | UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; | 155 | UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet; |
164 | this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); | 156 | clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); |
165 | 157 | ||
166 | this.PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass); | 158 | PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass); |
167 | } | 159 | } |
168 | 160 | ||
169 | public void ServerListener() | 161 | public void ServerListener() |
@@ -177,24 +169,24 @@ namespace OpenSim.Region.ClientStack | |||
177 | m_log.Verbose("SERVER", "UDP socket bound, getting ready to listen"); | 169 | m_log.Verbose("SERVER", "UDP socket bound, getting ready to listen"); |
178 | 170 | ||
179 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | 171 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); |
180 | epSender = (EndPoint)ipeSender; | 172 | epSender = (EndPoint) ipeSender; |
181 | ReceivedData = new AsyncCallback(this.OnReceivedData); | 173 | ReceivedData = new AsyncCallback(OnReceivedData); |
182 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | 174 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); |
183 | 175 | ||
184 | m_log.Status("SERVER", "Listening..."); | 176 | m_log.Status("SERVER", "Listening..."); |
185 | |||
186 | } | 177 | } |
187 | 178 | ||
188 | public virtual void RegisterPacketServer(PacketServer server) | 179 | public virtual void RegisterPacketServer(PacketServer server) |
189 | { | 180 | { |
190 | this.m_packetServer = server; | 181 | m_packetServer = server; |
191 | } | 182 | } |
192 | 183 | ||
193 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)//EndPoint packetSender) | 184 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) |
185 | //EndPoint packetSender) | ||
194 | { | 186 | { |
195 | // find the endpoint for this circuit | 187 | // find the endpoint for this circuit |
196 | EndPoint sendto = null; | 188 | EndPoint sendto = null; |
197 | foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) | 189 | foreach (KeyValuePair<EndPoint, uint> p in clientCircuits) |
198 | { | 190 | { |
199 | if (p.Value == circuitcode) | 191 | if (p.Value == circuitcode) |
200 | { | 192 | { |
@@ -205,22 +197,20 @@ namespace OpenSim.Region.ClientStack | |||
205 | if (sendto != null) | 197 | if (sendto != null) |
206 | { | 198 | { |
207 | //we found the endpoint so send the packet to it | 199 | //we found the endpoint so send the packet to it |
208 | this.Server.SendTo(buffer, size, flags, sendto); | 200 | Server.SendTo(buffer, size, flags, sendto); |
209 | } | 201 | } |
210 | } | 202 | } |
211 | 203 | ||
212 | public virtual void RemoveClientCircuit(uint circuitcode) | 204 | public virtual void RemoveClientCircuit(uint circuitcode) |
213 | { | 205 | { |
214 | foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) | 206 | foreach (KeyValuePair<EndPoint, uint> p in clientCircuits) |
215 | { | 207 | { |
216 | if (p.Value == circuitcode) | 208 | if (p.Value == circuitcode) |
217 | { | 209 | { |
218 | this.clientCircuits.Remove(p.Key); | 210 | clientCircuits.Remove(p.Key); |
219 | break; | 211 | break; |
220 | } | 212 | } |
221 | } | 213 | } |
222 | } | 214 | } |
223 | |||
224 | |||
225 | } | 215 | } |
226 | } \ No newline at end of file | 216 | } \ No newline at end of file |