aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs782
1 files changed, 390 insertions, 392 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 24157ae..23160cd 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -39,7 +39,7 @@ using OpenSim.Framework;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Region.Environment.Scenes; 41using OpenSim.Region.Environment.Scenes;
42using Timer=System.Timers.Timer; 42using Timer = System.Timers.Timer;
43 43
44namespace OpenSim.Region.ClientStack 44namespace OpenSim.Region.ClientStack
45{ 45{
@@ -73,7 +73,7 @@ namespace OpenSim.Region.ClientStack
73 private readonly uint m_circuitCode; 73 private readonly uint m_circuitCode;
74 private int m_moneyBalance; 74 private int m_moneyBalance;
75 75
76 private readonly byte[] m_channelVersion = new byte[] {0x00}; // Dummy value needed by libSL 76 private readonly byte[] m_channelVersion = new byte[] { 0x00 }; // Dummy value needed by libSL
77 77
78 /* protected variables */ 78 /* protected variables */
79 79
@@ -224,7 +224,7 @@ namespace OpenSim.Region.ClientStack
224 { 224 {
225 m_scene.RemoveClient(AgentId); 225 m_scene.RemoveClient(AgentId);
226 // Send the STOP packet 226 // Send the STOP packet
227 DisableSimulatorPacket disable = (DisableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.DisableSimulator); 227 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
228 OutPacket(disable, ThrottleOutPacketType.Task); 228 OutPacket(disable, ThrottleOutPacketType.Task);
229 229
230 230
@@ -574,7 +574,7 @@ namespace OpenSim.Region.ClientStack
574 /// <param name="regionInfo"></param> 574 /// <param name="regionInfo"></param>
575 public void SendRegionHandshake(RegionInfo regionInfo) 575 public void SendRegionHandshake(RegionInfo regionInfo)
576 { 576 {
577 RegionHandshakePacket handshake = (RegionHandshakePacket) PacketPool.Instance.GetPacket(PacketType.RegionHandshake); 577 RegionHandshakePacket handshake = (RegionHandshakePacket)PacketPool.Instance.GetPacket(PacketType.RegionHandshake);
578 578
579 handshake.RegionInfo.BillableFactor = regionInfo.EstateSettings.billableFactor; 579 handshake.RegionInfo.BillableFactor = regionInfo.EstateSettings.billableFactor;
580 handshake.RegionInfo.IsEstateManager = false; 580 handshake.RegionInfo.IsEstateManager = false;
@@ -586,10 +586,10 @@ namespace OpenSim.Region.ClientStack
586 handshake.RegionInfo.TerrainStartHeight01 = regionInfo.EstateSettings.terrainStartHeight1; 586 handshake.RegionInfo.TerrainStartHeight01 = regionInfo.EstateSettings.terrainStartHeight1;
587 handshake.RegionInfo.TerrainStartHeight10 = regionInfo.EstateSettings.terrainStartHeight2; 587 handshake.RegionInfo.TerrainStartHeight10 = regionInfo.EstateSettings.terrainStartHeight2;
588 handshake.RegionInfo.TerrainStartHeight11 = regionInfo.EstateSettings.terrainStartHeight3; 588 handshake.RegionInfo.TerrainStartHeight11 = regionInfo.EstateSettings.terrainStartHeight3;
589 handshake.RegionInfo.SimAccess = (byte) regionInfo.EstateSettings.simAccess; 589 handshake.RegionInfo.SimAccess = (byte)regionInfo.EstateSettings.simAccess;
590 handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight; 590 handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight;
591 591
592 handshake.RegionInfo.RegionFlags = (uint) regionInfo.EstateSettings.regionFlags; 592 handshake.RegionInfo.RegionFlags = (uint)regionInfo.EstateSettings.regionFlags;
593 handshake.RegionInfo.SimName = Helpers.StringToField(regionInfo.RegionName); 593 handshake.RegionInfo.SimName = Helpers.StringToField(regionInfo.RegionName);
594 handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID; 594 handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID;
595 handshake.RegionInfo.TerrainBase0 = regionInfo.EstateSettings.terrainBase0; 595 handshake.RegionInfo.TerrainBase0 = regionInfo.EstateSettings.terrainBase0;
@@ -611,7 +611,7 @@ namespace OpenSim.Region.ClientStack
611 /// <param name="regInfo"></param> 611 /// <param name="regInfo"></param>
612 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) 612 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
613 { 613 {
614 AgentMovementCompletePacket mov = (AgentMovementCompletePacket) PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); 614 AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
615 mov.SimData.ChannelVersion = m_channelVersion; 615 mov.SimData.ChannelVersion = m_channelVersion;
616 mov.AgentData.SessionID = m_sessionId; 616 mov.AgentData.SessionID = m_sessionId;
617 mov.AgentData.AgentID = AgentId; 617 mov.AgentData.AgentID = AgentId;
@@ -646,7 +646,7 @@ namespace OpenSim.Region.ClientStack
646 646
647 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 647 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
648 { 648 {
649 ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); 649 ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator);
650 reply.ChatData.Audible = 1; 650 reply.ChatData.Audible = 1;
651 reply.ChatData.Message = message; 651 reply.ChatData.Message = message;
652 reply.ChatData.ChatType = type; 652 reply.ChatData.ChatType = type;
@@ -667,7 +667,7 @@ namespace OpenSim.Region.ClientStack
667 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, 667 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
668 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) 668 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
669 { 669 {
670 ImprovedInstantMessagePacket msg = (ImprovedInstantMessagePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); 670 ImprovedInstantMessagePacket msg = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
671 msg.AgentData.AgentID = fromAgent; 671 msg.AgentData.AgentID = fromAgent;
672 msg.AgentData.SessionID = fromAgentSession; 672 msg.AgentData.SessionID = fromAgentSession;
673 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName); 673 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
@@ -700,10 +700,10 @@ namespace OpenSim.Region.ClientStack
700 { 700 {
701 for (int x = 0; x < 16; x += 4) 701 for (int x = 0; x < 16; x += 4)
702 { 702 {
703 patches[0] = x + 0 + y*16; 703 patches[0] = x + 0 + y * 16;
704 patches[1] = x + 1 + y*16; 704 patches[1] = x + 1 + y * 16;
705 patches[2] = x + 2 + y*16; 705 patches[2] = x + 2 + y * 16;
706 patches[3] = x + 3 + y*16; 706 patches[3] = x + 3 + y * 16;
707 707
708 Packet layerpack = TerrainManager.CreateLandPacket(map, patches); 708 Packet layerpack = TerrainManager.CreateLandPacket(map, patches);
709 OutPacket(layerpack, ThrottleOutPacketType.Land); 709 OutPacket(layerpack, ThrottleOutPacketType.Land);
@@ -732,7 +732,7 @@ namespace OpenSim.Region.ClientStack
732 patchx = px; 732 patchx = px;
733 patchy = py; 733 patchy = py;
734 734
735 patches[0] = patchx + 0 + patchy*16; 735 patches[0] = patchx + 0 + patchy * 16;
736 736
737 Packet layerpack = TerrainManager.CreateLandPacket(map, patches); 737 Packet layerpack = TerrainManager.CreateLandPacket(map, patches);
738 OutPacket(layerpack, ThrottleOutPacketType.Land); 738 OutPacket(layerpack, ThrottleOutPacketType.Land);
@@ -753,18 +753,18 @@ namespace OpenSim.Region.ClientStack
753 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint) 753 public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint)
754 { 754 {
755 IPAddress neighbourIP = neighbourEndPoint.Address; 755 IPAddress neighbourIP = neighbourEndPoint.Address;
756 ushort neighbourPort = (ushort) neighbourEndPoint.Port; 756 ushort neighbourPort = (ushort)neighbourEndPoint.Port;
757 757
758 EnableSimulatorPacket enablesimpacket = (EnableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.EnableSimulator); 758 EnableSimulatorPacket enablesimpacket = (EnableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.EnableSimulator);
759 // TODO: don't create new blocks if recycling an old packet 759 // TODO: don't create new blocks if recycling an old packet
760 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); 760 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
761 enablesimpacket.SimulatorInfo.Handle = neighbourHandle; 761 enablesimpacket.SimulatorInfo.Handle = neighbourHandle;
762 762
763 byte[] byteIP = neighbourIP.GetAddressBytes(); 763 byte[] byteIP = neighbourIP.GetAddressBytes();
764 enablesimpacket.SimulatorInfo.IP = (uint) byteIP[3] << 24; 764 enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
765 enablesimpacket.SimulatorInfo.IP += (uint) byteIP[2] << 16; 765 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
766 enablesimpacket.SimulatorInfo.IP += (uint) byteIP[1] << 8; 766 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
767 enablesimpacket.SimulatorInfo.IP += (uint) byteIP[0]; 767 enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
768 enablesimpacket.SimulatorInfo.Port = neighbourPort; 768 enablesimpacket.SimulatorInfo.Port = neighbourPort;
769 OutPacket(enablesimpacket, ThrottleOutPacketType.Task); 769 OutPacket(enablesimpacket, ThrottleOutPacketType.Task);
770 } 770 }
@@ -790,9 +790,9 @@ namespace OpenSim.Region.ClientStack
790 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint, 790 public void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint externalIPEndPoint,
791 string capsURL) 791 string capsURL)
792 { 792 {
793 LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10); 793 LLVector3 look = new LLVector3(lookAt.X * 10, lookAt.Y * 10, lookAt.Z * 10);
794 794
795 CrossedRegionPacket newSimPack = (CrossedRegionPacket) PacketPool.Instance.GetPacket(PacketType.CrossedRegion); 795 CrossedRegionPacket newSimPack = (CrossedRegionPacket)PacketPool.Instance.GetPacket(PacketType.CrossedRegion);
796 // TODO: don't create new blocks if recycling an old packet 796 // TODO: don't create new blocks if recycling an old packet
797 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); 797 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
798 newSimPack.AgentData.AgentID = AgentId; 798 newSimPack.AgentData.AgentID = AgentId;
@@ -803,11 +803,11 @@ namespace OpenSim.Region.ClientStack
803 newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock(); 803 newSimPack.RegionData = new CrossedRegionPacket.RegionDataBlock();
804 newSimPack.RegionData.RegionHandle = newRegionHandle; 804 newSimPack.RegionData.RegionHandle = newRegionHandle;
805 byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes(); 805 byte[] byteIP = externalIPEndPoint.Address.GetAddressBytes();
806 newSimPack.RegionData.SimIP = (uint) byteIP[3] << 24; 806 newSimPack.RegionData.SimIP = (uint)byteIP[3] << 24;
807 newSimPack.RegionData.SimIP += (uint) byteIP[2] << 16; 807 newSimPack.RegionData.SimIP += (uint)byteIP[2] << 16;
808 newSimPack.RegionData.SimIP += (uint) byteIP[1] << 8; 808 newSimPack.RegionData.SimIP += (uint)byteIP[1] << 8;
809 newSimPack.RegionData.SimIP += (uint) byteIP[0]; 809 newSimPack.RegionData.SimIP += (uint)byteIP[0];
810 newSimPack.RegionData.SimPort = (ushort) externalIPEndPoint.Port; 810 newSimPack.RegionData.SimPort = (ushort)externalIPEndPoint.Port;
811 newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL); 811 newSimPack.RegionData.SeedCapability = Helpers.StringToField(capsURL);
812 812
813 OutPacket(newSimPack, ThrottleOutPacketType.Task); 813 OutPacket(newSimPack, ThrottleOutPacketType.Task);
@@ -815,7 +815,7 @@ namespace OpenSim.Region.ClientStack
815 815
816 public void SendMapBlock(List<MapBlockData> mapBlocks) 816 public void SendMapBlock(List<MapBlockData> mapBlocks)
817 { 817 {
818 MapBlockReplyPacket mapReply = (MapBlockReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapBlockReply); 818 MapBlockReplyPacket mapReply = (MapBlockReplyPacket)PacketPool.Instance.GetPacket(PacketType.MapBlockReply);
819 // TODO: don't create new blocks if recycling an old packet 819 // TODO: don't create new blocks if recycling an old packet
820 mapReply.AgentData.AgentID = AgentId; 820 mapReply.AgentData.AgentID = AgentId;
821 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; 821 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
@@ -838,7 +838,7 @@ namespace OpenSim.Region.ClientStack
838 838
839 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) 839 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
840 { 840 {
841 TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal); 841 TeleportLocalPacket tpLocal = (TeleportLocalPacket)PacketPool.Instance.GetPacket(PacketType.TeleportLocal);
842 tpLocal.Info.AgentID = AgentId; 842 tpLocal.Info.AgentID = AgentId;
843 tpLocal.Info.TeleportFlags = flags; 843 tpLocal.Info.TeleportFlags = flags;
844 tpLocal.Info.LocationID = 2; 844 tpLocal.Info.LocationID = 2;
@@ -850,7 +850,7 @@ namespace OpenSim.Region.ClientStack
850 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, 850 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID,
851 uint flags, string capsURL) 851 uint flags, string capsURL)
852 { 852 {
853 TeleportFinishPacket teleport = (TeleportFinishPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFinish); 853 TeleportFinishPacket teleport = (TeleportFinishPacket)PacketPool.Instance.GetPacket(PacketType.TeleportFinish);
854 teleport.Info.AgentID = AgentId; 854 teleport.Info.AgentID = AgentId;
855 teleport.Info.RegionHandle = regionHandle; 855 teleport.Info.RegionHandle = regionHandle;
856 teleport.Info.SimAccess = simAccess; 856 teleport.Info.SimAccess = simAccess;
@@ -859,13 +859,13 @@ namespace OpenSim.Region.ClientStack
859 859
860 IPAddress oIP = newRegionEndPoint.Address; 860 IPAddress oIP = newRegionEndPoint.Address;
861 byte[] byteIP = oIP.GetAddressBytes(); 861 byte[] byteIP = oIP.GetAddressBytes();
862 uint ip = (uint) byteIP[3] << 24; 862 uint ip = (uint)byteIP[3] << 24;
863 ip += (uint) byteIP[2] << 16; 863 ip += (uint)byteIP[2] << 16;
864 ip += (uint) byteIP[1] << 8; 864 ip += (uint)byteIP[1] << 8;
865 ip += (uint) byteIP[0]; 865 ip += (uint)byteIP[0];
866 866
867 teleport.Info.SimIP = ip; 867 teleport.Info.SimIP = ip;
868 teleport.Info.SimPort = (ushort) newRegionEndPoint.Port; 868 teleport.Info.SimPort = (ushort)newRegionEndPoint.Port;
869 teleport.Info.LocationID = 4; 869 teleport.Info.LocationID = 4;
870 teleport.Info.TeleportFlags = 1 << 4; 870 teleport.Info.TeleportFlags = 1 << 4;
871 OutPacket(teleport, ThrottleOutPacketType.Task); 871 OutPacket(teleport, ThrottleOutPacketType.Task);
@@ -876,7 +876,7 @@ namespace OpenSim.Region.ClientStack
876 /// </summary> 876 /// </summary>
877 public void SendTeleportFailed() 877 public void SendTeleportFailed()
878 { 878 {
879 TeleportFailedPacket tpFailed = (TeleportFailedPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFailed); 879 TeleportFailedPacket tpFailed = (TeleportFailedPacket)PacketPool.Instance.GetPacket(PacketType.TeleportFailed);
880 tpFailed.Info.AgentID = AgentId; 880 tpFailed.Info.AgentID = AgentId;
881 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport"); 881 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport");
882 OutPacket(tpFailed, ThrottleOutPacketType.Task); 882 OutPacket(tpFailed, ThrottleOutPacketType.Task);
@@ -887,14 +887,14 @@ namespace OpenSim.Region.ClientStack
887 /// </summary> 887 /// </summary>
888 public void SendTeleportLocationStart() 888 public void SendTeleportLocationStart()
889 { 889 {
890 TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart); 890 TeleportStartPacket tpStart = (TeleportStartPacket)PacketPool.Instance.GetPacket(PacketType.TeleportStart);
891 tpStart.Info.TeleportFlags = 16; // Teleport via location 891 tpStart.Info.TeleportFlags = 16; // Teleport via location
892 OutPacket(tpStart, ThrottleOutPacketType.Task); 892 OutPacket(tpStart, ThrottleOutPacketType.Task);
893 } 893 }
894 894
895 public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) 895 public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
896 { 896 {
897 MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket) PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply); 897 MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket)PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply);
898 money.MoneyData.AgentID = AgentId; 898 money.MoneyData.AgentID = AgentId;
899 money.MoneyData.TransactionID = transaction; 899 money.MoneyData.TransactionID = transaction;
900 money.MoneyData.TransactionSuccess = success; 900 money.MoneyData.TransactionSuccess = success;
@@ -905,7 +905,7 @@ namespace OpenSim.Region.ClientStack
905 905
906 public void SendStartPingCheck(byte seq) 906 public void SendStartPingCheck(byte seq)
907 { 907 {
908 StartPingCheckPacket pc = (StartPingCheckPacket) PacketPool.Instance.GetPacket(PacketType.StartPingCheck); 908 StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck);
909 pc.PingID.PingID = seq; 909 pc.PingID.PingID = seq;
910 pc.Header.Reliable = false; 910 pc.Header.Reliable = false;
911 OutPacket(pc, ThrottleOutPacketType.Task); 911 OutPacket(pc, ThrottleOutPacketType.Task);
@@ -913,7 +913,7 @@ namespace OpenSim.Region.ClientStack
913 913
914 public void SendKillObject(ulong regionHandle, uint localID) 914 public void SendKillObject(ulong regionHandle, uint localID)
915 { 915 {
916 KillObjectPacket kill = (KillObjectPacket) PacketPool.Instance.GetPacket(PacketType.KillObject); 916 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
917 // TODO: don't create new blocks if recycling an old packet 917 // TODO: don't create new blocks if recycling an old packet
918 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 918 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
919 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 919 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
@@ -1109,7 +1109,7 @@ namespace OpenSim.Region.ClientStack
1109 1109
1110 private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) 1110 private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID)
1111 { 1111 {
1112 InventoryDescendentsPacket descend = (InventoryDescendentsPacket) PacketPool.Instance.GetPacket(PacketType.InventoryDescendents); 1112 InventoryDescendentsPacket descend = (InventoryDescendentsPacket)PacketPool.Instance.GetPacket(PacketType.InventoryDescendents);
1113 descend.AgentData.AgentID = AgentId; 1113 descend.AgentData.AgentID = AgentId;
1114 descend.AgentData.OwnerID = ownerID; 1114 descend.AgentData.OwnerID = ownerID;
1115 descend.AgentData.FolderID = folderID; 1115 descend.AgentData.FolderID = folderID;
@@ -1122,7 +1122,7 @@ namespace OpenSim.Region.ClientStack
1122 { 1122 {
1123 Encoding enc = Encoding.ASCII; 1123 Encoding enc = Encoding.ASCII;
1124 uint FULL_MASK_PERMISSIONS = 2147483647; 1124 uint FULL_MASK_PERMISSIONS = 2147483647;
1125 FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket) PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply); 1125 FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket)PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply);
1126 // TODO: don't create new blocks if recycling an old packet 1126 // TODO: don't create new blocks if recycling an old packet
1127 inventoryReply.AgentData.AgentID = AgentId; 1127 inventoryReply.AgentData.AgentID = AgentId;
1128 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; 1128 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
@@ -1132,21 +1132,21 @@ namespace OpenSim.Region.ClientStack
1132 inventoryReply.InventoryData[0].CreatorID = item.creatorsID; 1132 inventoryReply.InventoryData[0].CreatorID = item.creatorsID;
1133 inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions; 1133 inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions;
1134 inventoryReply.InventoryData[0].CreationDate = 1134 inventoryReply.InventoryData[0].CreationDate =
1135 (int) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 1135 (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
1136 inventoryReply.InventoryData[0].Description = Helpers.StringToField(item.inventoryDescription); 1136 inventoryReply.InventoryData[0].Description = Helpers.StringToField(item.inventoryDescription);
1137 inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions; 1137 inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions;
1138 inventoryReply.InventoryData[0].Flags = 0; 1138 inventoryReply.InventoryData[0].Flags = 0;
1139 inventoryReply.InventoryData[0].FolderID = item.parentFolderID; 1139 inventoryReply.InventoryData[0].FolderID = item.parentFolderID;
1140 inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 1140 inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1141 inventoryReply.InventoryData[0].GroupMask = 0; 1141 inventoryReply.InventoryData[0].GroupMask = 0;
1142 inventoryReply.InventoryData[0].InvType = (sbyte) item.invType; 1142 inventoryReply.InventoryData[0].InvType = (sbyte)item.invType;
1143 inventoryReply.InventoryData[0].Name = Helpers.StringToField(item.inventoryName); 1143 inventoryReply.InventoryData[0].Name = Helpers.StringToField(item.inventoryName);
1144 inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions; 1144 inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions;
1145 inventoryReply.InventoryData[0].OwnerID = item.avatarID; 1145 inventoryReply.InventoryData[0].OwnerID = item.avatarID;
1146 inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions; 1146 inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions;
1147 inventoryReply.InventoryData[0].SalePrice = 0; 1147 inventoryReply.InventoryData[0].SalePrice = 0;
1148 inventoryReply.InventoryData[0].SaleType = 0; 1148 inventoryReply.InventoryData[0].SaleType = 0;
1149 inventoryReply.InventoryData[0].Type = (sbyte) item.assetType; 1149 inventoryReply.InventoryData[0].Type = (sbyte)item.assetType;
1150 inventoryReply.InventoryData[0].CRC = 1150 inventoryReply.InventoryData[0].CRC =
1151 Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, 1151 Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType,
1152 inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, 1152 inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID,
@@ -1164,7 +1164,7 @@ namespace OpenSim.Region.ClientStack
1164 { 1164 {
1165 Encoding enc = Encoding.ASCII; 1165 Encoding enc = Encoding.ASCII;
1166 uint FULL_MASK_PERMISSIONS = 2147483647; 1166 uint FULL_MASK_PERMISSIONS = 2147483647;
1167 UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem); 1167 UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem);
1168 // TODO: don't create new blocks if recycling an old packet 1168 // TODO: don't create new blocks if recycling an old packet
1169 InventoryReply.AgentData.AgentID = AgentId; 1169 InventoryReply.AgentData.AgentID = AgentId;
1170 InventoryReply.AgentData.SimApproved = true; 1170 InventoryReply.AgentData.SimApproved = true;
@@ -1181,14 +1181,14 @@ namespace OpenSim.Region.ClientStack
1181 InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; 1181 InventoryReply.InventoryData[0].FolderID = Item.parentFolderID;
1182 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 1182 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1183 InventoryReply.InventoryData[0].GroupMask = 0; 1183 InventoryReply.InventoryData[0].GroupMask = 0;
1184 InventoryReply.InventoryData[0].InvType = (sbyte) Item.invType; 1184 InventoryReply.InventoryData[0].InvType = (sbyte)Item.invType;
1185 InventoryReply.InventoryData[0].Name = Helpers.StringToField(Item.inventoryName); 1185 InventoryReply.InventoryData[0].Name = Helpers.StringToField(Item.inventoryName);
1186 InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions; 1186 InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions;
1187 InventoryReply.InventoryData[0].OwnerID = Item.avatarID; 1187 InventoryReply.InventoryData[0].OwnerID = Item.avatarID;
1188 InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions; 1188 InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions;
1189 InventoryReply.InventoryData[0].SalePrice = 100; 1189 InventoryReply.InventoryData[0].SalePrice = 100;
1190 InventoryReply.InventoryData[0].SaleType = 0; 1190 InventoryReply.InventoryData[0].SaleType = 0;
1191 InventoryReply.InventoryData[0].Type = (sbyte) Item.assetType; 1191 InventoryReply.InventoryData[0].Type = (sbyte)Item.assetType;
1192 InventoryReply.InventoryData[0].CRC = 1192 InventoryReply.InventoryData[0].CRC =
1193 Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, 1193 Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType,
1194 InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, 1194 InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID,
@@ -1203,7 +1203,7 @@ namespace OpenSim.Region.ClientStack
1203 1203
1204 public void SendRemoveInventoryItem(LLUUID itemID) 1204 public void SendRemoveInventoryItem(LLUUID itemID)
1205 { 1205 {
1206 RemoveInventoryItemPacket remove = (RemoveInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.RemoveInventoryItem); 1206 RemoveInventoryItemPacket remove = (RemoveInventoryItemPacket)PacketPool.Instance.GetPacket(PacketType.RemoveInventoryItem);
1207 // TODO: don't create new blocks if recycling an old packet 1207 // TODO: don't create new blocks if recycling an old packet
1208 remove.AgentData.AgentID = AgentId; 1208 remove.AgentData.AgentID = AgentId;
1209 remove.AgentData.SessionID = m_sessionId; 1209 remove.AgentData.SessionID = m_sessionId;
@@ -1216,7 +1216,7 @@ namespace OpenSim.Region.ClientStack
1216 1216
1217 public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) 1217 public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
1218 { 1218 {
1219 ReplyTaskInventoryPacket replytask = (ReplyTaskInventoryPacket) PacketPool.Instance.GetPacket(PacketType.ReplyTaskInventory); 1219 ReplyTaskInventoryPacket replytask = (ReplyTaskInventoryPacket)PacketPool.Instance.GetPacket(PacketType.ReplyTaskInventory);
1220 replytask.InventoryData.TaskID = taskID; 1220 replytask.InventoryData.TaskID = taskID;
1221 replytask.InventoryData.Serial = serial; 1221 replytask.InventoryData.Serial = serial;
1222 replytask.InventoryData.Filename = fileName; 1222 replytask.InventoryData.Filename = fileName;
@@ -1225,7 +1225,7 @@ namespace OpenSim.Region.ClientStack
1225 1225
1226 public void SendXferPacket(ulong xferID, uint packet, byte[] data) 1226 public void SendXferPacket(ulong xferID, uint packet, byte[] data)
1227 { 1227 {
1228 SendXferPacketPacket sendXfer = (SendXferPacketPacket) PacketPool.Instance.GetPacket(PacketType.SendXferPacket); 1228 SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket);
1229 sendXfer.XferID.ID = xferID; 1229 sendXfer.XferID.ID = xferID;
1230 sendXfer.XferID.Packet = packet; 1230 sendXfer.XferID.Packet = packet;
1231 sendXfer.DataPacket.Data = data; 1231 sendXfer.DataPacket.Data = data;
@@ -1243,7 +1243,7 @@ namespace OpenSim.Region.ClientStack
1243 /// <param name="message"></param> 1243 /// <param name="message"></param>
1244 public void SendAlertMessage(string message) 1244 public void SendAlertMessage(string message)
1245 { 1245 {
1246 AlertMessagePacket alertPack = (AlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AlertMessage); 1246 AlertMessagePacket alertPack = (AlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AlertMessage);
1247 alertPack.AlertData.Message = Helpers.StringToField(message); 1247 alertPack.AlertData.Message = Helpers.StringToField(message);
1248 OutPacket(alertPack, ThrottleOutPacketType.Task); 1248 OutPacket(alertPack, ThrottleOutPacketType.Task);
1249 } 1249 }
@@ -1255,7 +1255,7 @@ namespace OpenSim.Region.ClientStack
1255 /// <param name="modal"></param> 1255 /// <param name="modal"></param>
1256 public void SendAgentAlertMessage(string message, bool modal) 1256 public void SendAgentAlertMessage(string message, bool modal)
1257 { 1257 {
1258 AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage); 1258 AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage);
1259 alertPack.AgentData.AgentID = AgentId; 1259 alertPack.AgentData.AgentID = AgentId;
1260 alertPack.AlertData.Message = Helpers.StringToField(message); 1260 alertPack.AlertData.Message = Helpers.StringToField(message);
1261 alertPack.AlertData.Modal = modal; 1261 alertPack.AlertData.Modal = modal;
@@ -1265,7 +1265,7 @@ namespace OpenSim.Region.ClientStack
1265 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, 1265 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message,
1266 string url) 1266 string url)
1267 { 1267 {
1268 LoadURLPacket loadURL = (LoadURLPacket) PacketPool.Instance.GetPacket(PacketType.LoadURL); 1268 LoadURLPacket loadURL = (LoadURLPacket)PacketPool.Instance.GetPacket(PacketType.LoadURL);
1269 loadURL.Data.ObjectName = Helpers.StringToField(objectname); 1269 loadURL.Data.ObjectName = Helpers.StringToField(objectname);
1270 loadURL.Data.ObjectID = objectID; 1270 loadURL.Data.ObjectID = objectID;
1271 loadURL.Data.OwnerID = ownerID; 1271 loadURL.Data.OwnerID = ownerID;
@@ -1279,7 +1279,7 @@ namespace OpenSim.Region.ClientStack
1279 1279
1280 public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) 1280 public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID)
1281 { 1281 {
1282 PreloadSoundPacket preSound = (PreloadSoundPacket) PacketPool.Instance.GetPacket(PacketType.PreloadSound); 1282 PreloadSoundPacket preSound = (PreloadSoundPacket)PacketPool.Instance.GetPacket(PacketType.PreloadSound);
1283 // TODO: don't create new blocks if recycling an old packet 1283 // TODO: don't create new blocks if recycling an old packet
1284 preSound.DataBlock = new PreloadSoundPacket.DataBlockBlock[1]; 1284 preSound.DataBlock = new PreloadSoundPacket.DataBlockBlock[1];
1285 preSound.DataBlock[0] = new PreloadSoundPacket.DataBlockBlock(); 1285 preSound.DataBlock[0] = new PreloadSoundPacket.DataBlockBlock();
@@ -1291,7 +1291,7 @@ namespace OpenSim.Region.ClientStack
1291 1291
1292 public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) 1292 public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags)
1293 { 1293 {
1294 AttachedSoundPacket sound = (AttachedSoundPacket) PacketPool.Instance.GetPacket(PacketType.AttachedSound); 1294 AttachedSoundPacket sound = (AttachedSoundPacket)PacketPool.Instance.GetPacket(PacketType.AttachedSound);
1295 sound.DataBlock.SoundID = soundID; 1295 sound.DataBlock.SoundID = soundID;
1296 sound.DataBlock.ObjectID = objectID; 1296 sound.DataBlock.ObjectID = objectID;
1297 sound.DataBlock.OwnerID = ownerID; 1297 sound.DataBlock.OwnerID = ownerID;
@@ -1303,23 +1303,23 @@ namespace OpenSim.Region.ClientStack
1303 1303
1304 public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel) 1304 public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel)
1305 { 1305 {
1306 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage); 1306 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
1307 viewertime.TimeInfo.SunDirection = sunPos; 1307 viewertime.TimeInfo.SunDirection = sunPos;
1308 viewertime.TimeInfo.SunAngVelocity = sunVel; 1308 viewertime.TimeInfo.SunAngVelocity = sunVel;
1309 viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch(); 1309 viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch();
1310 OutPacket(viewertime, ThrottleOutPacketType.Task); 1310 OutPacket(viewertime, ThrottleOutPacketType.Task);
1311 } 1311 }
1312 1312
1313 public void SendViewerTime(int phase) 1313 public void SendViewerTime(int phase)
1314 { 1314 {
1315 Console.WriteLine("SunPhase: {0}", phase); 1315 Console.WriteLine("SunPhase: {0}", phase);
1316 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage); 1316 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
1317 //viewertime.TimeInfo.SecPerDay = 86400; 1317 //viewertime.TimeInfo.SecPerDay = 86400;
1318 //viewertime.TimeInfo.SecPerYear = 31536000; 1318 //viewertime.TimeInfo.SecPerYear = 31536000;
1319 viewertime.TimeInfo.SecPerDay = 1000; 1319 viewertime.TimeInfo.SecPerDay = 1000;
1320 viewertime.TimeInfo.SecPerYear = 365000; 1320 viewertime.TimeInfo.SecPerYear = 365000;
1321 viewertime.TimeInfo.SunPhase = 1; 1321 viewertime.TimeInfo.SunPhase = 1;
1322 int sunPhase = (phase + 2)/2; 1322 int sunPhase = (phase + 2) / 2;
1323 if ((sunPhase < 6) || (sunPhase > 36)) 1323 if ((sunPhase < 6) || (sunPhase > 36))
1324 { 1324 {
1325 viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f); 1325 viewertime.TimeInfo.SunDirection = new LLVector3(0f, 0.8f, -0.8f);
@@ -1333,7 +1333,7 @@ namespace OpenSim.Region.ClientStack
1333 } 1333 }
1334 sunPhase = sunPhase - 12; 1334 sunPhase = sunPhase - 12;
1335 1335
1336 float yValue = 0.1f*(sunPhase); 1336 float yValue = 0.1f * (sunPhase);
1337 Console.WriteLine("Computed SunPhase: {0}, yValue: {1}", sunPhase, yValue); 1337 Console.WriteLine("Computed SunPhase: {0}, yValue: {1}", sunPhase, yValue);
1338 if (yValue > 1.2f) 1338 if (yValue > 1.2f)
1339 { 1339 {
@@ -1354,7 +1354,7 @@ namespace OpenSim.Region.ClientStack
1354 Console.WriteLine("sending sun update " + yValue); 1354 Console.WriteLine("sending sun update " + yValue);
1355 } 1355 }
1356 viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f); 1356 viewertime.TimeInfo.SunAngVelocity = new LLVector3(0, 0.0f, 10.0f);
1357 viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch(); 1357 viewertime.TimeInfo.UsecSinceStart = (ulong)Util.UnixTimeSinceEpoch();
1358 OutPacket(viewertime, ThrottleOutPacketType.Task); 1358 OutPacket(viewertime, ThrottleOutPacketType.Task);
1359 } 1359 }
1360 1360
@@ -1362,7 +1362,7 @@ namespace OpenSim.Region.ClientStack
1362 string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, 1362 string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL,
1363 LLUUID partnerID) 1363 LLUUID partnerID)
1364 { 1364 {
1365 AvatarPropertiesReplyPacket avatarReply = (AvatarPropertiesReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPropertiesReply); 1365 AvatarPropertiesReplyPacket avatarReply = (AvatarPropertiesReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarPropertiesReply);
1366 avatarReply.AgentData.AgentID = AgentId; 1366 avatarReply.AgentData.AgentID = AgentId;
1367 avatarReply.AgentData.AvatarID = avatarID; 1367 avatarReply.AgentData.AvatarID = avatarID;
1368 avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); 1368 avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText);
@@ -1387,9 +1387,9 @@ namespace OpenSim.Region.ClientStack
1387 /// <param name="wearables"></param> 1387 /// <param name="wearables"></param>
1388 public void SendWearables(AvatarWearable[] wearables, int serial) 1388 public void SendWearables(AvatarWearable[] wearables, int serial)
1389 { 1389 {
1390 AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket) PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate); 1390 AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate);
1391 aw.AgentData.AgentID = AgentId; 1391 aw.AgentData.AgentID = AgentId;
1392 aw.AgentData.SerialNum = (uint) serial; 1392 aw.AgentData.SerialNum = (uint)serial;
1393 aw.AgentData.SessionID = m_sessionId; 1393 aw.AgentData.SessionID = m_sessionId;
1394 1394
1395 // TODO: don't create new blocks if recycling an old packet 1395 // TODO: don't create new blocks if recycling an old packet
@@ -1398,7 +1398,7 @@ namespace OpenSim.Region.ClientStack
1398 for (int i = 0; i < wearables.Length; i++) 1398 for (int i = 0; i < wearables.Length; i++)
1399 { 1399 {
1400 awb = new AgentWearablesUpdatePacket.WearableDataBlock(); 1400 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
1401 awb.WearableType = (byte) i; 1401 awb.WearableType = (byte)i;
1402 awb.AssetID = wearables[i].AssetID; 1402 awb.AssetID = wearables[i].AssetID;
1403 awb.ItemID = wearables[i].ItemID; 1403 awb.ItemID = wearables[i].ItemID;
1404 aw.WearableData[i] = awb; 1404 aw.WearableData[i] = awb;
@@ -1415,7 +1415,7 @@ namespace OpenSim.Region.ClientStack
1415 /// <param name="textureEntry"></param> 1415 /// <param name="textureEntry"></param>
1416 public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) 1416 public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
1417 { 1417 {
1418 AvatarAppearancePacket avp = (AvatarAppearancePacket) PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); 1418 AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance);
1419 // TODO: don't create new blocks if recycling an old packet 1419 // TODO: don't create new blocks if recycling an old packet
1420 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; 1420 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
1421 avp.ObjectData.TextureEntry = textureEntry; 1421 avp.ObjectData.TextureEntry = textureEntry;
@@ -1435,7 +1435,7 @@ namespace OpenSim.Region.ClientStack
1435 1435
1436 public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId) 1436 public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId)
1437 { 1437 {
1438 AvatarAnimationPacket ani = (AvatarAnimationPacket) PacketPool.Instance.GetPacket(PacketType.AvatarAnimation); 1438 AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation);
1439 // TODO: don't create new blocks if recycling an old packet 1439 // TODO: don't create new blocks if recycling an old packet
1440 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; 1440 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
1441 ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); 1441 ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock();
@@ -1470,7 +1470,7 @@ namespace OpenSim.Region.ClientStack
1470 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, 1470 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
1471 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) 1471 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
1472 { 1472 {
1473 ObjectUpdatePacket objupdate = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); 1473 ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
1474 // TODO: don't create new blocks if recycling an old packet 1474 // TODO: don't create new blocks if recycling an old packet
1475 objupdate.RegionData.RegionHandle = regionHandle; 1475 objupdate.RegionData.RegionHandle = regionHandle;
1476 objupdate.RegionData.TimeDilation = 64096; 1476 objupdate.RegionData.TimeDilation = 64096;
@@ -1483,7 +1483,7 @@ namespace OpenSim.Region.ClientStack
1483 objupdate.ObjectData[0].ParentID = parentID; 1483 objupdate.ObjectData[0].ParentID = parentID;
1484 objupdate.ObjectData[0].NameValue = 1484 objupdate.ObjectData[0].NameValue =
1485 Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); 1485 Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName);
1486 LLVector3 pos2 = new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); 1486 LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z);
1487 byte[] pb = pos2.GetBytes(); 1487 byte[] pb = pos2.GetBytes();
1488 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); 1488 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
1489 1489
@@ -1503,7 +1503,7 @@ namespace OpenSim.Region.ClientStack
1503 { 1503 {
1504 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = 1504 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
1505 CreateAvatarImprovedBlock(localID, position, velocity, rotation); 1505 CreateAvatarImprovedBlock(localID, position, velocity, rotation);
1506 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 1506 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
1507 // TODO: don't create new blocks if recycling an old packet 1507 // TODO: don't create new blocks if recycling an old packet
1508 terse.RegionData.RegionHandle = regionHandle; 1508 terse.RegionData.RegionHandle = regionHandle;
1509 terse.RegionData.TimeDilation = timeDilation; 1509 terse.RegionData.TimeDilation = timeDilation;
@@ -1515,7 +1515,7 @@ namespace OpenSim.Region.ClientStack
1515 1515
1516 public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) 1516 public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations)
1517 { 1517 {
1518 CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket) PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); 1518 CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate);
1519 // TODO: don't create new blocks if recycling an old packet 1519 // TODO: don't create new blocks if recycling an old packet
1520 int total = CoarseLocations.Count; 1520 int total = CoarseLocations.Count;
1521 CoarseLocationUpdatePacket.IndexBlock ib = 1521 CoarseLocationUpdatePacket.IndexBlock ib =
@@ -1525,9 +1525,9 @@ namespace OpenSim.Region.ClientStack
1525 { 1525 {
1526 CoarseLocationUpdatePacket.LocationBlock lb = 1526 CoarseLocationUpdatePacket.LocationBlock lb =
1527 new CoarseLocationUpdatePacket.LocationBlock(); 1527 new CoarseLocationUpdatePacket.LocationBlock();
1528 lb.X = (byte) CoarseLocations[i].X; 1528 lb.X = (byte)CoarseLocations[i].X;
1529 lb.Y = (byte) CoarseLocations[i].Y; 1529 lb.Y = (byte)CoarseLocations[i].Y;
1530 lb.Z = (byte) (CoarseLocations[i].Z/4); 1530 lb.Z = (byte)(CoarseLocations[i].Z / 4);
1531 loc.Location[i] = lb; 1531 loc.Location[i] = lb;
1532 } 1532 }
1533 ib.You = -1; 1533 ib.You = -1;
@@ -1548,7 +1548,7 @@ namespace OpenSim.Region.ClientStack
1548 /// <param name="attachPoint"></param> 1548 /// <param name="attachPoint"></param>
1549 public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) 1549 public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint)
1550 { 1550 {
1551 ObjectAttachPacket attach = (ObjectAttachPacket) PacketPool.Instance.GetPacket(PacketType.ObjectAttach); 1551 ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach);
1552 // TODO: don't create new blocks if recycling an old packet 1552 // TODO: don't create new blocks if recycling an old packet
1553 attach.AgentData.AgentID = AgentId; 1553 attach.AgentData.AgentID = AgentId;
1554 attach.AgentData.SessionID = m_sessionId; 1554 attach.AgentData.SessionID = m_sessionId;
@@ -1568,7 +1568,7 @@ namespace OpenSim.Region.ClientStack
1568 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, 1568 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem,
1569 LLQuaternion rotation, byte clickAction) 1569 LLQuaternion rotation, byte clickAction)
1570 { 1570 {
1571 ObjectUpdatePacket outPacket = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); 1571 ObjectUpdatePacket outPacket = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
1572 // TODO: don't create new blocks if recycling an old packet 1572 // TODO: don't create new blocks if recycling an old packet
1573 outPacket.RegionData.RegionHandle = regionHandle; 1573 outPacket.RegionData.RegionHandle = regionHandle;
1574 outPacket.RegionData.TimeDilation = timeDilation; 1574 outPacket.RegionData.TimeDilation = timeDilation;
@@ -1612,7 +1612,7 @@ namespace OpenSim.Region.ClientStack
1612 { 1612 {
1613 LLVector3 velocity = new LLVector3(0f, 0f, 0f); 1613 LLVector3 velocity = new LLVector3(0f, 0f, 0f);
1614 LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f); 1614 LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f);
1615 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 1615 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
1616 // TODO: don't create new blocks if recycling an old packet 1616 // TODO: don't create new blocks if recycling an old packet
1617 terse.RegionData.RegionHandle = regionHandle; 1617 terse.RegionData.RegionHandle = regionHandle;
1618 terse.RegionData.TimeDilation = timeDilation; 1618 terse.RegionData.TimeDilation = timeDilation;
@@ -1625,7 +1625,7 @@ namespace OpenSim.Region.ClientStack
1625 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, 1625 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
1626 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity) 1626 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity)
1627 { 1627 {
1628 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 1628 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
1629 // TODO: don't create new blocks if recycling an old packet 1629 // TODO: don't create new blocks if recycling an old packet
1630 terse.RegionData.RegionHandle = regionHandle; 1630 terse.RegionData.RegionHandle = regionHandle;
1631 terse.RegionData.TimeDilation = timeDilation; 1631 terse.RegionData.TimeDilation = timeDilation;
@@ -1651,10 +1651,10 @@ namespace OpenSim.Region.ClientStack
1651 1651
1652 uint ID = localID; 1652 uint ID = localID;
1653 1653
1654 bytes[i++] = (byte) (ID%256); 1654 bytes[i++] = (byte)(ID % 256);
1655 bytes[i++] = (byte) ((ID >> 8)%256); 1655 bytes[i++] = (byte)((ID >> 8) % 256);
1656 bytes[i++] = (byte) ((ID >> 16)%256); 1656 bytes[i++] = (byte)((ID >> 16) % 256);
1657 bytes[i++] = (byte) ((ID >> 24)%256); 1657 bytes[i++] = (byte)((ID >> 24) % 256);
1658 bytes[i++] = 0; 1658 bytes[i++] = 0;
1659 bytes[i++] = 1; 1659 bytes[i++] = 1;
1660 i += 14; 1660 i += 14;
@@ -1671,55 +1671,55 @@ namespace OpenSim.Region.ClientStack
1671 1671
1672 internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z); 1672 internDirec = new Vector3(velocity.X, velocity.Y, velocity.Z);
1673 1673
1674 internDirec = internDirec/128.0f; 1674 internDirec = internDirec / 128.0f;
1675 internDirec.x += 1; 1675 internDirec.x += 1;
1676 internDirec.y += 1; 1676 internDirec.y += 1;
1677 internDirec.z += 1; 1677 internDirec.z += 1;
1678 1678
1679 InternVelocityX = (ushort) (32768*internDirec.x); 1679 InternVelocityX = (ushort)(32768 * internDirec.x);
1680 InternVelocityY = (ushort) (32768*internDirec.y); 1680 InternVelocityY = (ushort)(32768 * internDirec.y);
1681 InternVelocityZ = (ushort) (32768*internDirec.z); 1681 InternVelocityZ = (ushort)(32768 * internDirec.z);
1682 1682
1683 ushort ac = 32767; 1683 ushort ac = 32767;
1684 bytes[i++] = (byte) (InternVelocityX%256); 1684 bytes[i++] = (byte)(InternVelocityX % 256);
1685 bytes[i++] = (byte) ((InternVelocityX >> 8)%256); 1685 bytes[i++] = (byte)((InternVelocityX >> 8) % 256);
1686 bytes[i++] = (byte) (InternVelocityY%256); 1686 bytes[i++] = (byte)(InternVelocityY % 256);
1687 bytes[i++] = (byte) ((InternVelocityY >> 8)%256); 1687 bytes[i++] = (byte)((InternVelocityY >> 8) % 256);
1688 bytes[i++] = (byte) (InternVelocityZ%256); 1688 bytes[i++] = (byte)(InternVelocityZ % 256);
1689 bytes[i++] = (byte) ((InternVelocityZ >> 8)%256); 1689 bytes[i++] = (byte)((InternVelocityZ >> 8) % 256);
1690 1690
1691 //accel 1691 //accel
1692 bytes[i++] = (byte) (ac%256); 1692 bytes[i++] = (byte)(ac % 256);
1693 bytes[i++] = (byte) ((ac >> 8)%256); 1693 bytes[i++] = (byte)((ac >> 8) % 256);
1694 bytes[i++] = (byte) (ac%256); 1694 bytes[i++] = (byte)(ac % 256);
1695 bytes[i++] = (byte) ((ac >> 8)%256); 1695 bytes[i++] = (byte)((ac >> 8) % 256);
1696 bytes[i++] = (byte) (ac%256); 1696 bytes[i++] = (byte)(ac % 256);
1697 bytes[i++] = (byte) ((ac >> 8)%256); 1697 bytes[i++] = (byte)((ac >> 8) % 256);
1698 1698
1699 //rotation 1699 //rotation
1700 ushort rw, rx, ry, rz; 1700 ushort rw, rx, ry, rz;
1701 rw = (ushort) (32768*(rotation.W + 1)); 1701 rw = (ushort)(32768 * (rotation.W + 1));
1702 rx = (ushort) (32768*(rotation.X + 1)); 1702 rx = (ushort)(32768 * (rotation.X + 1));
1703 ry = (ushort) (32768*(rotation.Y + 1)); 1703 ry = (ushort)(32768 * (rotation.Y + 1));
1704 rz = (ushort) (32768*(rotation.Z + 1)); 1704 rz = (ushort)(32768 * (rotation.Z + 1));
1705 1705
1706 //rot 1706 //rot
1707 bytes[i++] = (byte) (rx%256); 1707 bytes[i++] = (byte)(rx % 256);
1708 bytes[i++] = (byte) ((rx >> 8)%256); 1708 bytes[i++] = (byte)((rx >> 8) % 256);
1709 bytes[i++] = (byte) (ry%256); 1709 bytes[i++] = (byte)(ry % 256);
1710 bytes[i++] = (byte) ((ry >> 8)%256); 1710 bytes[i++] = (byte)((ry >> 8) % 256);
1711 bytes[i++] = (byte) (rz%256); 1711 bytes[i++] = (byte)(rz % 256);
1712 bytes[i++] = (byte) ((rz >> 8)%256); 1712 bytes[i++] = (byte)((rz >> 8) % 256);
1713 bytes[i++] = (byte) (rw%256); 1713 bytes[i++] = (byte)(rw % 256);
1714 bytes[i++] = (byte) ((rw >> 8)%256); 1714 bytes[i++] = (byte)((rw >> 8) % 256);
1715 1715
1716 //rotation vel 1716 //rotation vel
1717 bytes[i++] = (byte) (ac%256); 1717 bytes[i++] = (byte)(ac % 256);
1718 bytes[i++] = (byte) ((ac >> 8)%256); 1718 bytes[i++] = (byte)((ac >> 8) % 256);
1719 bytes[i++] = (byte) (ac%256); 1719 bytes[i++] = (byte)(ac % 256);
1720 bytes[i++] = (byte) ((ac >> 8)%256); 1720 bytes[i++] = (byte)((ac >> 8) % 256);
1721 bytes[i++] = (byte) (ac%256); 1721 bytes[i++] = (byte)(ac % 256);
1722 bytes[i++] = (byte) ((ac >> 8)%256); 1722 bytes[i++] = (byte)((ac >> 8) % 256);
1723 1723
1724 dat.Data = bytes; 1724 dat.Data = bytes;
1725 1725
@@ -1745,10 +1745,10 @@ namespace OpenSim.Region.ClientStack
1745 int i = 0; 1745 int i = 0;
1746 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); 1746 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
1747 dat.TextureEntry = new byte[0]; 1747 dat.TextureEntry = new byte[0];
1748 bytes[i++] = (byte) (ID%256); 1748 bytes[i++] = (byte)(ID % 256);
1749 bytes[i++] = (byte) ((ID >> 8)%256); 1749 bytes[i++] = (byte)((ID >> 8) % 256);
1750 bytes[i++] = (byte) ((ID >> 16)%256); 1750 bytes[i++] = (byte)((ID >> 16) % 256);
1751 bytes[i++] = (byte) ((ID >> 24)%256); 1751 bytes[i++] = (byte)((ID >> 24) % 256);
1752 bytes[i++] = 0; 1752 bytes[i++] = 0;
1753 bytes[i++] = 0; 1753 bytes[i++] = 0;
1754 1754
@@ -1760,65 +1760,65 @@ namespace OpenSim.Region.ClientStack
1760 ushort velx, vely, velz; 1760 ushort velx, vely, velz;
1761 Vector3 vel = new Vector3(velocity.X, velocity.Y, velocity.Z); 1761 Vector3 vel = new Vector3(velocity.X, velocity.Y, velocity.Z);
1762 1762
1763 vel = vel/128.0f; 1763 vel = vel / 128.0f;
1764 vel.x += 1; 1764 vel.x += 1;
1765 vel.y += 1; 1765 vel.y += 1;
1766 vel.z += 1; 1766 vel.z += 1;
1767 //vel 1767 //vel
1768 velx = (ushort) (32768*(vel.x)); 1768 velx = (ushort)(32768 * (vel.x));
1769 vely = (ushort) (32768*(vel.y)); 1769 vely = (ushort)(32768 * (vel.y));
1770 velz = (ushort) (32768*(vel.z)); 1770 velz = (ushort)(32768 * (vel.z));
1771 1771
1772 bytes[i++] = (byte) (velx%256); 1772 bytes[i++] = (byte)(velx % 256);
1773 bytes[i++] = (byte) ((velx >> 8)%256); 1773 bytes[i++] = (byte)((velx >> 8) % 256);
1774 bytes[i++] = (byte) (vely%256); 1774 bytes[i++] = (byte)(vely % 256);
1775 bytes[i++] = (byte) ((vely >> 8)%256); 1775 bytes[i++] = (byte)((vely >> 8) % 256);
1776 bytes[i++] = (byte) (velz%256); 1776 bytes[i++] = (byte)(velz % 256);
1777 bytes[i++] = (byte) ((velz >> 8)%256); 1777 bytes[i++] = (byte)((velz >> 8) % 256);
1778 1778
1779 //accel 1779 //accel
1780 bytes[i++] = (byte) (ac%256); 1780 bytes[i++] = (byte)(ac % 256);
1781 bytes[i++] = (byte) ((ac >> 8)%256); 1781 bytes[i++] = (byte)((ac >> 8) % 256);
1782 bytes[i++] = (byte) (ac%256); 1782 bytes[i++] = (byte)(ac % 256);
1783 bytes[i++] = (byte) ((ac >> 8)%256); 1783 bytes[i++] = (byte)((ac >> 8) % 256);
1784 bytes[i++] = (byte) (ac%256); 1784 bytes[i++] = (byte)(ac % 256);
1785 bytes[i++] = (byte) ((ac >> 8)%256); 1785 bytes[i++] = (byte)((ac >> 8) % 256);
1786 1786
1787 ushort rw, rx, ry, rz; 1787 ushort rw, rx, ry, rz;
1788 rw = (ushort) (32768*(rotation.W + 1)); 1788 rw = (ushort)(32768 * (rotation.W + 1));
1789 rx = (ushort) (32768*(rotation.X + 1)); 1789 rx = (ushort)(32768 * (rotation.X + 1));
1790 ry = (ushort) (32768*(rotation.Y + 1)); 1790 ry = (ushort)(32768 * (rotation.Y + 1));
1791 rz = (ushort) (32768*(rotation.Z + 1)); 1791 rz = (ushort)(32768 * (rotation.Z + 1));
1792 1792
1793 //rot 1793 //rot
1794 bytes[i++] = (byte) (rx%256); 1794 bytes[i++] = (byte)(rx % 256);
1795 bytes[i++] = (byte) ((rx >> 8)%256); 1795 bytes[i++] = (byte)((rx >> 8) % 256);
1796 bytes[i++] = (byte) (ry%256); 1796 bytes[i++] = (byte)(ry % 256);
1797 bytes[i++] = (byte) ((ry >> 8)%256); 1797 bytes[i++] = (byte)((ry >> 8) % 256);
1798 bytes[i++] = (byte) (rz%256); 1798 bytes[i++] = (byte)(rz % 256);
1799 bytes[i++] = (byte) ((rz >> 8)%256); 1799 bytes[i++] = (byte)((rz >> 8) % 256);
1800 bytes[i++] = (byte) (rw%256); 1800 bytes[i++] = (byte)(rw % 256);
1801 bytes[i++] = (byte) ((rw >> 8)%256); 1801 bytes[i++] = (byte)((rw >> 8) % 256);
1802 1802
1803 //rotation vel 1803 //rotation vel
1804 ushort rvelx, rvely, rvelz; 1804 ushort rvelx, rvely, rvelz;
1805 Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z); 1805 Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z);
1806 1806
1807 rvel = rvel/128.0f; 1807 rvel = rvel / 128.0f;
1808 rvel.x += 1; 1808 rvel.x += 1;
1809 rvel.y += 1; 1809 rvel.y += 1;
1810 rvel.z += 1; 1810 rvel.z += 1;
1811 //vel 1811 //vel
1812 rvelx = (ushort) (32768*(rvel.x)); 1812 rvelx = (ushort)(32768 * (rvel.x));
1813 rvely = (ushort) (32768*(rvel.y)); 1813 rvely = (ushort)(32768 * (rvel.y));
1814 rvelz = (ushort) (32768*(rvel.z)); 1814 rvelz = (ushort)(32768 * (rvel.z));
1815 1815
1816 bytes[i++] = (byte) (rvelx%256); 1816 bytes[i++] = (byte)(rvelx % 256);
1817 bytes[i++] = (byte) ((rvelx >> 8)%256); 1817 bytes[i++] = (byte)((rvelx >> 8) % 256);
1818 bytes[i++] = (byte) (rvely%256); 1818 bytes[i++] = (byte)(rvely % 256);
1819 bytes[i++] = (byte) ((rvely >> 8)%256); 1819 bytes[i++] = (byte)((rvely >> 8) % 256);
1820 bytes[i++] = (byte) (rvelz%256); 1820 bytes[i++] = (byte)(rvelz % 256);
1821 bytes[i++] = (byte) ((rvelz >> 8)%256); 1821 bytes[i++] = (byte)((rvelz >> 8) % 256);
1822 1822
1823 dat.Data = bytes; 1823 dat.Data = bytes;
1824 return dat; 1824 return dat;
@@ -1963,7 +1963,7 @@ namespace OpenSim.Region.ClientStack
1963 1963
1964 public void SendNameReply(LLUUID profileId, string firstname, string lastname) 1964 public void SendNameReply(LLUUID profileId, string firstname, string lastname)
1965 { 1965 {
1966 UUIDNameReplyPacket packet = (UUIDNameReplyPacket) PacketPool.Instance.GetPacket(PacketType.UUIDNameReply); 1966 UUIDNameReplyPacket packet = (UUIDNameReplyPacket)PacketPool.Instance.GetPacket(PacketType.UUIDNameReply);
1967 // TODO: don't create new blocks if recycling an old packet 1967 // TODO: don't create new blocks if recycling an old packet
1968 packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; 1968 packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1];
1969 packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); 1969 packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
@@ -1986,7 +1986,7 @@ namespace OpenSim.Region.ClientStack
1986 1986
1987 private bool HandleViewerEffect(IClientAPI sender, Packet Pack) 1987 private bool HandleViewerEffect(IClientAPI sender, Packet Pack)
1988 { 1988 {
1989 ViewerEffectPacket viewer = (ViewerEffectPacket) Pack; 1989 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
1990 1990
1991 if (OnViewerEffect != null) 1991 if (OnViewerEffect != null)
1992 { 1992 {
@@ -2011,8 +2011,8 @@ namespace OpenSim.Region.ClientStack
2011 protected bool AgentTextureCached(IClientAPI simclient, Packet packet) 2011 protected bool AgentTextureCached(IClientAPI simclient, Packet packet)
2012 { 2012 {
2013 //System.Console.WriteLine("texture cached: " + packet.ToString()); 2013 //System.Console.WriteLine("texture cached: " + packet.ToString());
2014 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet; 2014 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet;
2015 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket) PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); 2015 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
2016 // TODO: don't create new blocks if recycling an old packet 2016 // TODO: don't create new blocks if recycling an old packet
2017 cachedresp.AgentData.AgentID = AgentId; 2017 cachedresp.AgentData.AgentID = AgentId;
2018 cachedresp.AgentData.SessionID = m_sessionId; 2018 cachedresp.AgentData.SessionID = m_sessionId;
@@ -2033,9 +2033,9 @@ namespace OpenSim.Region.ClientStack
2033 2033
2034 protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet) 2034 protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet)
2035 { 2035 {
2036 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket) packet; 2036 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
2037 // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); 2037 // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString());
2038 Scene tScene = (Scene) m_scene; 2038 Scene tScene = (Scene)m_scene;
2039 2039
2040 for (int i = 0; i < multipleupdate.ObjectData.Length; i++) 2040 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
2041 { 2041 {
@@ -2057,100 +2057,98 @@ namespace OpenSim.Region.ClientStack
2057 { 2057 {
2058 LLUUID partId = part.UUID; 2058 LLUUID partId = part.UUID;
2059 2059
2060 if (tScene.PermissionsMngr.CanEditObjectPosition(simClient.AgentId, partId)) 2060
2061 switch (block.Type)
2061 { 2062 {
2062 switch (block.Type) 2063 case 1:
2063 { 2064 if (OnUpdatePrimSinglePosition != null)
2064 case 1: 2065 {
2065 if (OnUpdatePrimSinglePosition != null) 2066 LLVector3 pos = new LLVector3(block.Data, 0);
2066 { 2067 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
2067 LLVector3 pos = new LLVector3(block.Data, 0); 2068 OnUpdatePrimSinglePosition(localId, pos, this);
2068 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 2069 }
2069 OnUpdatePrimSinglePosition(localId, pos, this); 2070 break;
2070 } 2071 case 2:
2071 break; 2072 if (OnUpdatePrimSingleRotation != null)
2072 case 2: 2073 {
2073 if (OnUpdatePrimSingleRotation != null) 2074 LLQuaternion rot = new LLQuaternion(block.Data, 0, true);
2074 { 2075 //System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
2075 LLQuaternion rot = new LLQuaternion(block.Data, 0, true); 2076 OnUpdatePrimSingleRotation(localId, rot, this);
2076 //System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 2077 }
2077 OnUpdatePrimSingleRotation(localId, rot, this); 2078 break;
2078 } 2079 case 3:
2079 break; 2080 if (OnUpdatePrimSingleRotation != null)
2080 case 3: 2081 {
2081 if (OnUpdatePrimSingleRotation != null) 2082 LLQuaternion rot = new LLQuaternion(block.Data, 12, true);
2082 { 2083 //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
2083 LLQuaternion rot = new LLQuaternion(block.Data, 12, true); 2084 OnUpdatePrimSingleRotation(localId, rot, this);
2084 //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 2085 }
2085 OnUpdatePrimSingleRotation(localId, rot, this); 2086 break;
2086 } 2087 case 5:
2087 break; 2088 if (OnUpdatePrimScale != null)
2088 case 5: 2089 {
2089 if (OnUpdatePrimScale != null) 2090 LLVector3 scale = new LLVector3(block.Data, 12);
2090 { 2091 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
2091 LLVector3 scale = new LLVector3(block.Data, 12); 2092 OnUpdatePrimScale(localId, scale, this);
2092 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 2093 }
2093 OnUpdatePrimScale(localId, scale, this); 2094 break;
2094 } 2095 case 9:
2095 break; 2096 if (OnUpdatePrimGroupPosition != null)
2096 case 9: 2097 {
2097 if (OnUpdatePrimGroupPosition != null) 2098 LLVector3 pos = new LLVector3(block.Data, 0);
2098 { 2099 OnUpdatePrimGroupPosition(localId, pos, this);
2099 LLVector3 pos = new LLVector3(block.Data, 0); 2100 }
2100 OnUpdatePrimGroupPosition(localId, pos, this); 2101 break;
2101 } 2102 case 10:
2102 break; 2103 if (OnUpdatePrimGroupRotation != null)
2103 case 10: 2104 {
2104 if (OnUpdatePrimGroupRotation != null) 2105 LLQuaternion rot = new LLQuaternion(block.Data, 0, true);
2105 { 2106 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
2106 LLQuaternion rot = new LLQuaternion(block.Data, 0, true); 2107 OnUpdatePrimGroupRotation(localId, rot, this);
2107 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 2108 }
2108 OnUpdatePrimGroupRotation(localId, rot, this); 2109 break;
2109 } 2110 case 11:
2110 break; 2111 if (OnUpdatePrimGroupMouseRotation != null)
2111 case 11: 2112 {
2112 if (OnUpdatePrimGroupMouseRotation != null) 2113 LLVector3 pos = new LLVector3(block.Data, 0);
2113 { 2114 LLQuaternion rot = new LLQuaternion(block.Data, 12, true);
2114 LLVector3 pos = new LLVector3(block.Data, 0); 2115 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
2115 LLQuaternion rot = new LLQuaternion(block.Data, 12, true); 2116 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
2116 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 2117 OnUpdatePrimGroupMouseRotation(localId, pos, rot,
2117 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 2118 this);
2118 OnUpdatePrimGroupMouseRotation(localId, pos, rot, 2119 }
2119 this); 2120 break;
2120 } 2121 case 13:
2121 break; 2122 if (OnUpdatePrimScale != null)
2122 case 13: 2123 {
2123 if (OnUpdatePrimScale != null) 2124 LLVector3 scale = new LLVector3(block.Data, 12);
2124 { 2125 //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
2125 LLVector3 scale = new LLVector3(block.Data, 12); 2126 OnUpdatePrimScale(localId, scale, this);
2126 //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 2127
2127 OnUpdatePrimScale(localId, scale, this); 2128 // Change the position based on scale (for bug number 246)
2128 2129 LLVector3 pos = new LLVector3(block.Data, 0);
2129 // Change the position based on scale (for bug number 246) 2130 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
2130 LLVector3 pos = new LLVector3(block.Data, 0); 2131 OnUpdatePrimSinglePosition(localId, pos, this);
2131 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 2132 }
2132 OnUpdatePrimSinglePosition(localId, pos, this); 2133 break;
2133 } 2134 case 29:
2134 break; 2135 if (OnUpdatePrimScale != null)
2135 case 29: 2136 {
2136 if (OnUpdatePrimScale != null) 2137 LLVector3 scale = new LLVector3(block.Data, 12);
2137 { 2138 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z );
2138 LLVector3 scale = new LLVector3(block.Data, 12); 2139 OnUpdatePrimScale(localId, scale, this);
2139 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); 2140 LLVector3 pos = new LLVector3(block.Data, 0);
2140 OnUpdatePrimScale(localId, scale, this); 2141 OnUpdatePrimSinglePosition(localId, pos, this);
2141 LLVector3 pos = new LLVector3(block.Data, 0); 2142 }
2142 OnUpdatePrimSinglePosition(localId, pos, this); 2143 break;
2143 } 2144 case 21:
2144 break; 2145 if (OnUpdatePrimScale != null)
2145 case 21: 2146 {
2146 if (OnUpdatePrimScale != null) 2147 LLVector3 scale = new LLVector3(block.Data, 12);
2147 { 2148 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
2148 LLVector3 scale = new LLVector3(block.Data, 12); 2149 OnUpdatePrimScale(localId, scale, this);
2149 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 2150 }
2150 OnUpdatePrimScale(localId, scale, this); 2151 break;
2151 }
2152 break;
2153 }
2154 } 2152 }
2155 } 2153 }
2156 } 2154 }
@@ -2162,7 +2160,7 @@ namespace OpenSim.Region.ClientStack
2162 { 2160 {
2163 //should be getting the map layer from the grid server 2161 //should be getting the map layer from the grid server
2164 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) 2162 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
2165 MapLayerReplyPacket mapReply = (MapLayerReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapLayerReply); 2163 MapLayerReplyPacket mapReply = (MapLayerReplyPacket)PacketPool.Instance.GetPacket(PacketType.MapLayerReply);
2166 // TODO: don't create new blocks if recycling an old packet 2164 // TODO: don't create new blocks if recycling an old packet
2167 mapReply.AgentData.AgentID = AgentId; 2165 mapReply.AgentData.AgentID = AgentId;
2168 mapReply.AgentData.Flags = 0; 2166 mapReply.AgentData.Flags = 0;
@@ -2307,18 +2305,18 @@ namespace OpenSim.Region.ClientStack
2307 // Actually make the byte array and send it 2305 // Actually make the byte array and send it
2308 try 2306 try
2309 { 2307 {
2310 byte[] sendbuffer = Pack.ToBytes(); 2308 byte[] sendbuffer = Pack.ToBytes();
2311 PacketPool.Instance.ReturnPacket(Pack); 2309 PacketPool.Instance.ReturnPacket(Pack);
2312 2310
2313 if (Pack.Header.Zerocoded) 2311 if (Pack.Header.Zerocoded)
2314 { 2312 {
2315 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 2313 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
2316 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); 2314 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
2317 } 2315 }
2318 else 2316 else
2319 { 2317 {
2320 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); 2318 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
2321 } 2319 }
2322 } 2320 }
2323 catch (Exception e) 2321 catch (Exception e)
2324 { 2322 {
@@ -2350,7 +2348,7 @@ namespace OpenSim.Region.ClientStack
2350 // Handle PacketAck packets 2348 // Handle PacketAck packets
2351 if (NewPack.Type == PacketType.PacketAck) 2349 if (NewPack.Type == PacketType.PacketAck)
2352 { 2350 {
2353 PacketAckPacket ackPacket = (PacketAckPacket) NewPack; 2351 PacketAckPacket ackPacket = (PacketAckPacket)NewPack;
2354 2352
2355 lock (m_needAck) 2353 lock (m_needAck)
2356 { 2354 {
@@ -2363,8 +2361,8 @@ namespace OpenSim.Region.ClientStack
2363 else if ((NewPack.Type == PacketType.StartPingCheck)) 2361 else if ((NewPack.Type == PacketType.StartPingCheck))
2364 { 2362 {
2365 //reply to pingcheck 2363 //reply to pingcheck
2366 StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack; 2364 StartPingCheckPacket startPing = (StartPingCheckPacket)NewPack;
2367 CompletePingCheckPacket endPing = (CompletePingCheckPacket) PacketPool.Instance.GetPacket(PacketType.CompletePingCheck); 2365 CompletePingCheckPacket endPing = (CompletePingCheckPacket)PacketPool.Instance.GetPacket(PacketType.CompletePingCheck);
2368 endPing.PingID.PingID = startPing.PingID.PingID; 2366 endPing.PingID.PingID = startPing.PingID.PingID;
2369 OutPacket(endPing, ThrottleOutPacketType.Task); 2367 OutPacket(endPing, ThrottleOutPacketType.Task);
2370 } 2368 }
@@ -2393,7 +2391,7 @@ namespace OpenSim.Region.ClientStack
2393 { 2391 {
2394 if (Pack.Header.Reliable) 2392 if (Pack.Header.Reliable)
2395 { 2393 {
2396 PacketAckPacket ack_it = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck); 2394 PacketAckPacket ack_it = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck);
2397 // TODO: don't create new blocks if recycling an old packet 2395 // TODO: don't create new blocks if recycling an old packet
2398 ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; 2396 ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
2399 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); 2397 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
@@ -2449,7 +2447,7 @@ namespace OpenSim.Region.ClientStack
2449 //MainLog.Instance.Verbose("NETWORK", "Sending PacketAck"); 2447 //MainLog.Instance.Verbose("NETWORK", "Sending PacketAck");
2450 2448
2451 int i = 0; 2449 int i = 0;
2452 PacketAckPacket acks = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck); 2450 PacketAckPacket acks = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck);
2453 // TODO: don't create new blocks if recycling an old packet 2451 // TODO: don't create new blocks if recycling an old packet
2454 acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count]; 2452 acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count];
2455 2453
@@ -2507,17 +2505,17 @@ namespace OpenSim.Region.ClientStack
2507 2505
2508 switch (Pack.Type) 2506 switch (Pack.Type)
2509 { 2507 {
2510 #region Scene/Avatar 2508 #region Scene/Avatar
2511 2509
2512 case PacketType.AvatarPropertiesRequest: 2510 case PacketType.AvatarPropertiesRequest:
2513 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket) Pack; 2511 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
2514 if (OnRequestAvatarProperties != null) 2512 if (OnRequestAvatarProperties != null)
2515 { 2513 {
2516 OnRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); 2514 OnRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID);
2517 } 2515 }
2518 break; 2516 break;
2519 case PacketType.ChatFromViewer: 2517 case PacketType.ChatFromViewer:
2520 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack; 2518 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
2521 2519
2522 string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname; 2520 string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
2523 byte[] message = inchatpack.ChatData.Message; 2521 byte[] message = inchatpack.ChatData.Message;
@@ -2533,7 +2531,7 @@ namespace OpenSim.Region.ClientStack
2533 args.Channel = channel; 2531 args.Channel = channel;
2534 args.From = fromName; 2532 args.From = fromName;
2535 args.Message = Helpers.FieldToUTF8String(message); 2533 args.Message = Helpers.FieldToUTF8String(message);
2536 args.Type = (ChatTypeEnum) type; 2534 args.Type = (ChatTypeEnum)type;
2537 args.Position = fromPos; 2535 args.Position = fromPos;
2538 2536
2539 args.Scene = Scene; 2537 args.Scene = Scene;
@@ -2543,12 +2541,12 @@ namespace OpenSim.Region.ClientStack
2543 } 2541 }
2544 break; 2542 break;
2545 case PacketType.ImprovedInstantMessage: 2543 case PacketType.ImprovedInstantMessage:
2546 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack; 2544 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
2547 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); 2545 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
2548 string IMmessage = Helpers.FieldToUTF8String(msgpack.MessageBlock.Message); 2546 string IMmessage = Helpers.FieldToUTF8String(msgpack.MessageBlock.Message);
2549 if (OnInstantMessage != null) 2547 if (OnInstantMessage != null)
2550 { 2548 {
2551 OnInstantMessage(this,msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, 2549 OnInstantMessage(this, msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,
2552 msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID, 2550 msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID,
2553 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage, 2551 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage,
2554 msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup, 2552 msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup,
@@ -2563,7 +2561,7 @@ namespace OpenSim.Region.ClientStack
2563 2561
2564 // My guess is this is the folder to stick the calling card into 2562 // My guess is this is the folder to stick the calling card into
2565 List<LLUUID> callingCardFolders = new List<LLUUID>(); 2563 List<LLUUID> callingCardFolders = new List<LLUUID>();
2566 2564
2567 LLUUID agentID = afriendpack.AgentData.AgentID; 2565 LLUUID agentID = afriendpack.AgentData.AgentID;
2568 LLUUID transactionID = afriendpack.TransactionBlock.TransactionID; 2566 LLUUID transactionID = afriendpack.TransactionBlock.TransactionID;
2569 2567
@@ -2591,7 +2589,7 @@ namespace OpenSim.Region.ClientStack
2591 2589
2592 break; 2590 break;
2593 case PacketType.RezObject: 2591 case PacketType.RezObject:
2594 RezObjectPacket rezPacket = (RezObjectPacket) Pack; 2592 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
2595 if (OnRezObject != null) 2593 if (OnRezObject != null)
2596 { 2594 {
2597 //rezPacket.RezData.BypassRaycast; 2595 //rezPacket.RezData.BypassRaycast;
@@ -2604,11 +2602,11 @@ namespace OpenSim.Region.ClientStack
2604 //rezPacket.RezData.FromTaskID; 2602 //rezPacket.RezData.FromTaskID;
2605 //MainLog.Instance.Verbose("REZData", rezPacket.ToString()); 2603 //MainLog.Instance.Verbose("REZData", rezPacket.ToString());
2606 OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, 2604 OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
2607 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID, 2605 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
2608 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection, 2606 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
2609 rezPacket.RezData.EveryoneMask, rezPacket.RezData.GroupMask, 2607 rezPacket.RezData.EveryoneMask, rezPacket.RezData.GroupMask,
2610 rezPacket.RezData.NextOwnerMask, rezPacket.RezData.ItemFlags, 2608 rezPacket.RezData.NextOwnerMask, rezPacket.RezData.ItemFlags,
2611 rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem, 2609 rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem,
2612 rezPacket.RezData.FromTaskID); 2610 rezPacket.RezData.FromTaskID);
2613 } 2611 }
2614 break; 2612 break;
@@ -2619,7 +2617,7 @@ namespace OpenSim.Region.ClientStack
2619 } 2617 }
2620 break; 2618 break;
2621 case PacketType.ModifyLand: 2619 case PacketType.ModifyLand:
2622 ModifyLandPacket modify = (ModifyLandPacket) Pack; 2620 ModifyLandPacket modify = (ModifyLandPacket)Pack;
2623 if (modify.ParcelData.Length > 0) 2621 if (modify.ParcelData.Length > 0)
2624 { 2622 {
2625 if (OnModifyTerrain != null) 2623 if (OnModifyTerrain != null)
@@ -2652,7 +2650,7 @@ namespace OpenSim.Region.ClientStack
2652 } 2650 }
2653 break; 2651 break;
2654 case PacketType.AgentSetAppearance: 2652 case PacketType.AgentSetAppearance:
2655 AgentSetAppearancePacket appear = (AgentSetAppearancePacket) Pack; 2653 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
2656 if (OnSetAppearance != null) 2654 if (OnSetAppearance != null)
2657 { 2655 {
2658 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); 2656 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
@@ -2661,7 +2659,7 @@ namespace OpenSim.Region.ClientStack
2661 case PacketType.AgentIsNowWearing: 2659 case PacketType.AgentIsNowWearing:
2662 if (OnAvatarNowWearing != null) 2660 if (OnAvatarNowWearing != null)
2663 { 2661 {
2664 AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket) Pack; 2662 AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket)Pack;
2665 AvatarWearingArgs wearingArgs = new AvatarWearingArgs(); 2663 AvatarWearingArgs wearingArgs = new AvatarWearingArgs();
2666 for (int i = 0; i < nowWearing.WearableData.Length; i++) 2664 for (int i = 0; i < nowWearing.WearableData.Length; i++)
2667 { 2665 {
@@ -2674,7 +2672,7 @@ namespace OpenSim.Region.ClientStack
2674 } 2672 }
2675 break; 2673 break;
2676 case PacketType.SetAlwaysRun: 2674 case PacketType.SetAlwaysRun:
2677 SetAlwaysRunPacket run = (SetAlwaysRunPacket) Pack; 2675 SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack;
2678 2676
2679 if (OnSetAlwaysRun != null) 2677 if (OnSetAlwaysRun != null)
2680 OnSetAlwaysRun(this, run.AgentData.AlwaysRun); 2678 OnSetAlwaysRun(this, run.AgentData.AlwaysRun);
@@ -2689,14 +2687,14 @@ namespace OpenSim.Region.ClientStack
2689 case PacketType.AgentUpdate: 2687 case PacketType.AgentUpdate:
2690 if (OnAgentUpdate != null) 2688 if (OnAgentUpdate != null)
2691 { 2689 {
2692 AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack; 2690 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
2693 2691
2694 OnAgentUpdate(this, agenUpdate); 2692 OnAgentUpdate(this, agenUpdate);
2695 //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa); 2693 //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa);
2696 } 2694 }
2697 break; 2695 break;
2698 case PacketType.AgentAnimation: 2696 case PacketType.AgentAnimation:
2699 AgentAnimationPacket AgentAni = (AgentAnimationPacket) Pack; 2697 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
2700 for (int i = 0; i < AgentAni.AnimationList.Length; i++) 2698 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
2701 { 2699 {
2702 if (AgentAni.AnimationList[i].StartAnim) 2700 if (AgentAni.AnimationList[i].StartAnim)
@@ -2718,7 +2716,7 @@ namespace OpenSim.Region.ClientStack
2718 case PacketType.AgentRequestSit: 2716 case PacketType.AgentRequestSit:
2719 if (OnAgentRequestSit != null) 2717 if (OnAgentRequestSit != null)
2720 { 2718 {
2721 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket) Pack; 2719 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack;
2722 OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, 2720 OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
2723 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); 2721 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
2724 } 2722 }
@@ -2726,12 +2724,12 @@ namespace OpenSim.Region.ClientStack
2726 case PacketType.AgentSit: 2724 case PacketType.AgentSit:
2727 if (OnAgentSit != null) 2725 if (OnAgentSit != null)
2728 { 2726 {
2729 AgentSitPacket agentSit = (AgentSitPacket) Pack; 2727 AgentSitPacket agentSit = (AgentSitPacket)Pack;
2730 OnAgentSit(this, agentSit.AgentData.AgentID); 2728 OnAgentSit(this, agentSit.AgentData.AgentID);
2731 } 2729 }
2732 break; 2730 break;
2733 case PacketType.AvatarPickerRequest: 2731 case PacketType.AvatarPickerRequest:
2734 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket) Pack; 2732 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack;
2735 AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData; 2733 AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData;
2736 AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data; 2734 AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data;
2737 //System.Console.WriteLine("Agent Sends:" + Helpers.FieldToUTF8String(querydata.Name)); 2735 //System.Console.WriteLine("Agent Sends:" + Helpers.FieldToUTF8String(querydata.Name));
@@ -2742,12 +2740,12 @@ namespace OpenSim.Region.ClientStack
2742 } 2740 }
2743 break; 2741 break;
2744 2742
2745 #endregion 2743 #endregion
2746 2744
2747 #region Objects/m_sceneObjects 2745 #region Objects/m_sceneObjects
2748 2746
2749 case PacketType.ObjectLink: 2747 case PacketType.ObjectLink:
2750 ObjectLinkPacket link = (ObjectLinkPacket) Pack; 2748 ObjectLinkPacket link = (ObjectLinkPacket)Pack;
2751 uint parentprimid = 0; 2749 uint parentprimid = 0;
2752 List<uint> childrenprims = new List<uint>(); 2750 List<uint> childrenprims = new List<uint>();
2753 if (link.ObjectData.Length > 1) 2751 if (link.ObjectData.Length > 1)
@@ -2765,7 +2763,7 @@ namespace OpenSim.Region.ClientStack
2765 } 2763 }
2766 break; 2764 break;
2767 case PacketType.ObjectDelink: 2765 case PacketType.ObjectDelink:
2768 ObjectDelinkPacket delink = (ObjectDelinkPacket) Pack; 2766 ObjectDelinkPacket delink = (ObjectDelinkPacket)Pack;
2769 2767
2770 // It appears the prim at index 0 is not always the root prim (for 2768 // It appears the prim at index 0 is not always the root prim (for
2771 // instance, when one prim of a link set has been edited independently 2769 // instance, when one prim of a link set has been edited independently
@@ -2786,19 +2784,19 @@ namespace OpenSim.Region.ClientStack
2786 case PacketType.ObjectAdd: 2784 case PacketType.ObjectAdd:
2787 if (OnAddPrim != null) 2785 if (OnAddPrim != null)
2788 { 2786 {
2789 ObjectAddPacket addPacket = (ObjectAddPacket) Pack; 2787 ObjectAddPacket addPacket = (ObjectAddPacket)Pack;
2790 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); 2788 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
2791 // MainLog.Instance.Verbose("REZData", addPacket.ToString()); 2789 // MainLog.Instance.Verbose("REZData", addPacket.ToString());
2792 //BypassRaycast: 1 2790 //BypassRaycast: 1
2793 //RayStart: <69.79469, 158.2652, 98.40343> 2791 //RayStart: <69.79469, 158.2652, 98.40343>
2794 //RayEnd: <61.97724, 141.995, 92.58341> 2792 //RayEnd: <61.97724, 141.995, 92.58341>
2795 //RayTargetID: 00000000-0000-0000-0000-000000000000 2793 //RayTargetID: 00000000-0000-0000-0000-000000000000
2796 2794
2797 OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape,addPacket.ObjectData.BypassRaycast,addPacket.ObjectData.RayStart,addPacket.ObjectData.RayTargetID,addPacket.ObjectData.RayEndIsIntersection); 2795 OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection);
2798 } 2796 }
2799 break; 2797 break;
2800 case PacketType.ObjectShape: 2798 case PacketType.ObjectShape:
2801 ObjectShapePacket shapePacket = (ObjectShapePacket) Pack; 2799 ObjectShapePacket shapePacket = (ObjectShapePacket)Pack;
2802 for (int i = 0; i < shapePacket.ObjectData.Length; i++) 2800 for (int i = 0; i < shapePacket.ObjectData.Length; i++)
2803 { 2801 {
2804 if (OnUpdatePrimShape != null) 2802 if (OnUpdatePrimShape != null)
@@ -2809,7 +2807,7 @@ namespace OpenSim.Region.ClientStack
2809 } 2807 }
2810 break; 2808 break;
2811 case PacketType.ObjectExtraParams: 2809 case PacketType.ObjectExtraParams:
2812 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket) Pack; 2810 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack;
2813 if (OnUpdateExtraParams != null) 2811 if (OnUpdateExtraParams != null)
2814 { 2812 {
2815 OnUpdateExtraParams(m_agentId, extraPar.ObjectData[0].ObjectLocalID, 2813 OnUpdateExtraParams(m_agentId, extraPar.ObjectData[0].ObjectLocalID,
@@ -2818,7 +2816,7 @@ namespace OpenSim.Region.ClientStack
2818 } 2816 }
2819 break; 2817 break;
2820 case PacketType.ObjectDuplicate: 2818 case PacketType.ObjectDuplicate:
2821 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket) Pack; 2819 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack;
2822 ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData; 2820 ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData;
2823 for (int i = 0; i < dupe.ObjectData.Length; i++) 2821 for (int i = 0; i < dupe.ObjectData.Length; i++)
2824 { 2822 {
@@ -2833,7 +2831,7 @@ namespace OpenSim.Region.ClientStack
2833 break; 2831 break;
2834 2832
2835 case PacketType.ObjectSelect: 2833 case PacketType.ObjectSelect:
2836 ObjectSelectPacket incomingselect = (ObjectSelectPacket) Pack; 2834 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
2837 for (int i = 0; i < incomingselect.ObjectData.Length; i++) 2835 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
2838 { 2836 {
2839 if (OnObjectSelect != null) 2837 if (OnObjectSelect != null)
@@ -2843,7 +2841,7 @@ namespace OpenSim.Region.ClientStack
2843 } 2841 }
2844 break; 2842 break;
2845 case PacketType.ObjectDeselect: 2843 case PacketType.ObjectDeselect:
2846 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket) Pack; 2844 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack;
2847 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) 2845 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
2848 { 2846 {
2849 if (OnObjectDeselect != null) 2847 if (OnObjectDeselect != null)
@@ -2853,14 +2851,14 @@ namespace OpenSim.Region.ClientStack
2853 } 2851 }
2854 break; 2852 break;
2855 case PacketType.ObjectFlagUpdate: 2853 case PacketType.ObjectFlagUpdate:
2856 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket) Pack; 2854 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
2857 if (OnUpdatePrimFlags != null) 2855 if (OnUpdatePrimFlags != null)
2858 { 2856 {
2859 OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); 2857 OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this);
2860 } 2858 }
2861 break; 2859 break;
2862 case PacketType.ObjectImage: 2860 case PacketType.ObjectImage:
2863 ObjectImagePacket imagePack = (ObjectImagePacket) Pack; 2861 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
2864 for (int i = 0; i < imagePack.ObjectData.Length; i++) 2862 for (int i = 0; i < imagePack.ObjectData.Length; i++)
2865 { 2863 {
2866 if (OnUpdatePrimTexture != null) 2864 if (OnUpdatePrimTexture != null)
@@ -2871,14 +2869,14 @@ namespace OpenSim.Region.ClientStack
2871 } 2869 }
2872 break; 2870 break;
2873 case PacketType.ObjectGrab: 2871 case PacketType.ObjectGrab:
2874 ObjectGrabPacket grab = (ObjectGrabPacket) Pack; 2872 ObjectGrabPacket grab = (ObjectGrabPacket)Pack;
2875 if (OnGrabObject != null) 2873 if (OnGrabObject != null)
2876 { 2874 {
2877 OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this); 2875 OnGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this);
2878 } 2876 }
2879 break; 2877 break;
2880 case PacketType.ObjectGrabUpdate: 2878 case PacketType.ObjectGrabUpdate:
2881 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket) Pack; 2879 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack;
2882 if (OnGrabUpdate != null) 2880 if (OnGrabUpdate != null)
2883 { 2881 {
2884 OnGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, 2882 OnGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
@@ -2886,14 +2884,14 @@ namespace OpenSim.Region.ClientStack
2886 } 2884 }
2887 break; 2885 break;
2888 case PacketType.ObjectDeGrab: 2886 case PacketType.ObjectDeGrab:
2889 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket) Pack; 2887 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack;
2890 if (OnDeGrabObject != null) 2888 if (OnDeGrabObject != null)
2891 { 2889 {
2892 OnDeGrabObject(deGrab.ObjectData.LocalID, this); 2890 OnDeGrabObject(deGrab.ObjectData.LocalID, this);
2893 } 2891 }
2894 break; 2892 break;
2895 case PacketType.ObjectDescription: 2893 case PacketType.ObjectDescription:
2896 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket) Pack; 2894 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack;
2897 for (int i = 0; i < objDes.ObjectData.Length; i++) 2895 for (int i = 0; i < objDes.ObjectData.Length; i++)
2898 { 2896 {
2899 if (OnObjectDescription != null) 2897 if (OnObjectDescription != null)
@@ -2904,7 +2902,7 @@ namespace OpenSim.Region.ClientStack
2904 } 2902 }
2905 break; 2903 break;
2906 case PacketType.ObjectName: 2904 case PacketType.ObjectName:
2907 ObjectNamePacket objName = (ObjectNamePacket) Pack; 2905 ObjectNamePacket objName = (ObjectNamePacket)Pack;
2908 for (int i = 0; i < objName.ObjectData.Length; i++) 2906 for (int i = 0; i < objName.ObjectData.Length; i++)
2909 { 2907 {
2910 if (OnObjectName != null) 2908 if (OnObjectName != null)
@@ -2916,7 +2914,7 @@ namespace OpenSim.Region.ClientStack
2916 break; 2914 break;
2917 case PacketType.ObjectPermissions: 2915 case PacketType.ObjectPermissions:
2918 MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString()); 2916 MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString());
2919 ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket) Pack; 2917 ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack;
2920 2918
2921 List<ObjectPermissionsPacket.ObjectDataBlock> permChanges = 2919 List<ObjectPermissionsPacket.ObjectDataBlock> permChanges =
2922 new List<ObjectPermissionsPacket.ObjectDataBlock>(); 2920 new List<ObjectPermissionsPacket.ObjectDataBlock>();
@@ -2949,7 +2947,7 @@ namespace OpenSim.Region.ClientStack
2949 2947
2950 case PacketType.RequestObjectPropertiesFamily: 2948 case PacketType.RequestObjectPropertiesFamily:
2951 //This powers the little tooltip that appears when you move your mouse over an object 2949 //This powers the little tooltip that appears when you move your mouse over an object
2952 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket) Pack; 2950 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack;
2953 2951
2954 2952
2955 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData; 2953 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData;
@@ -2962,12 +2960,12 @@ namespace OpenSim.Region.ClientStack
2962 2960
2963 break; 2961 break;
2964 2962
2965 #endregion 2963 #endregion
2966 2964
2967 #region Inventory/Asset/Other related packets 2965 #region Inventory/Asset/Other related packets
2968 2966
2969 case PacketType.RequestImage: 2967 case PacketType.RequestImage:
2970 RequestImagePacket imageRequest = (RequestImagePacket) Pack; 2968 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
2971 //Console.WriteLine("image request: " + Pack.ToString()); 2969 //Console.WriteLine("image request: " + Pack.ToString());
2972 for (int i = 0; i < imageRequest.RequestImage.Length; i++) 2970 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
2973 { 2971 {
@@ -2985,11 +2983,11 @@ namespace OpenSim.Region.ClientStack
2985 break; 2983 break;
2986 case PacketType.TransferRequest: 2984 case PacketType.TransferRequest:
2987 //Console.WriteLine("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); 2985 //Console.WriteLine("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request");
2988 TransferRequestPacket transfer = (TransferRequestPacket) Pack; 2986 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
2989 m_assetCache.AddAssetRequest(this, transfer); 2987 m_assetCache.AddAssetRequest(this, transfer);
2990 break; 2988 break;
2991 case PacketType.AssetUploadRequest: 2989 case PacketType.AssetUploadRequest:
2992 AssetUploadRequestPacket request = (AssetUploadRequestPacket) Pack; 2990 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
2993 // Console.WriteLine("upload request " + Pack.ToString()); 2991 // Console.WriteLine("upload request " + Pack.ToString());
2994 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString()); 2992 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString());
2995 if (OnAssetUploadRequest != null) 2993 if (OnAssetUploadRequest != null)
@@ -3002,21 +3000,21 @@ namespace OpenSim.Region.ClientStack
3002 } 3000 }
3003 break; 3001 break;
3004 case PacketType.RequestXfer: 3002 case PacketType.RequestXfer:
3005 RequestXferPacket xferReq = (RequestXferPacket) Pack; 3003 RequestXferPacket xferReq = (RequestXferPacket)Pack;
3006 if (OnRequestXfer != null) 3004 if (OnRequestXfer != null)
3007 { 3005 {
3008 OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); 3006 OnRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename));
3009 } 3007 }
3010 break; 3008 break;
3011 case PacketType.SendXferPacket: 3009 case PacketType.SendXferPacket:
3012 SendXferPacketPacket xferRec = (SendXferPacketPacket) Pack; 3010 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack;
3013 if (OnXferReceive != null) 3011 if (OnXferReceive != null)
3014 { 3012 {
3015 OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); 3013 OnXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data);
3016 } 3014 }
3017 break; 3015 break;
3018 case PacketType.ConfirmXferPacket: 3016 case PacketType.ConfirmXferPacket:
3019 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket) Pack; 3017 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack;
3020 if (OnConfirmXfer != null) 3018 if (OnConfirmXfer != null)
3021 { 3019 {
3022 OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); 3020 OnConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet);
@@ -3025,9 +3023,9 @@ namespace OpenSim.Region.ClientStack
3025 case PacketType.CreateInventoryFolder: 3023 case PacketType.CreateInventoryFolder:
3026 if (OnCreateNewInventoryFolder != null) 3024 if (OnCreateNewInventoryFolder != null)
3027 { 3025 {
3028 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket) Pack; 3026 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
3029 OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID, 3027 OnCreateNewInventoryFolder(this, invFolder.FolderData.FolderID,
3030 (ushort) invFolder.FolderData.Type, 3028 (ushort)invFolder.FolderData.Type,
3031 Util.FieldToString(invFolder.FolderData.Name), 3029 Util.FieldToString(invFolder.FolderData.Name),
3032 invFolder.FolderData.ParentID); 3030 invFolder.FolderData.ParentID);
3033 } 3031 }
@@ -3035,11 +3033,11 @@ namespace OpenSim.Region.ClientStack
3035 case PacketType.UpdateInventoryFolder: 3033 case PacketType.UpdateInventoryFolder:
3036 if (OnUpdateInventoryFolder != null) 3034 if (OnUpdateInventoryFolder != null)
3037 { 3035 {
3038 UpdateInventoryFolderPacket invFolder = (UpdateInventoryFolderPacket) Pack; 3036 UpdateInventoryFolderPacket invFolder = (UpdateInventoryFolderPacket)Pack;
3039 for (int i = 0; i < invFolder.FolderData.Length; i++) 3037 for (int i = 0; i < invFolder.FolderData.Length; i++)
3040 { 3038 {
3041 OnUpdateInventoryFolder(this, invFolder.FolderData[i].FolderID, 3039 OnUpdateInventoryFolder(this, invFolder.FolderData[i].FolderID,
3042 (ushort) invFolder.FolderData[i].Type, 3040 (ushort)invFolder.FolderData[i].Type,
3043 Util.FieldToString(invFolder.FolderData[i].Name), 3041 Util.FieldToString(invFolder.FolderData[i].Name),
3044 invFolder.FolderData[i].ParentID); 3042 invFolder.FolderData[i].ParentID);
3045 } 3043 }
@@ -3048,7 +3046,7 @@ namespace OpenSim.Region.ClientStack
3048 case PacketType.MoveInventoryFolder: 3046 case PacketType.MoveInventoryFolder:
3049 if (OnMoveInventoryFolder != null) 3047 if (OnMoveInventoryFolder != null)
3050 { 3048 {
3051 MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket) Pack; 3049 MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket)Pack;
3052 for (int i = 0; i < invFolder.InventoryData.Length; i++) 3050 for (int i = 0; i < invFolder.InventoryData.Length; i++)
3053 { 3051 {
3054 OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID, 3052 OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID,
@@ -3057,7 +3055,7 @@ namespace OpenSim.Region.ClientStack
3057 } 3055 }
3058 break; 3056 break;
3059 case PacketType.CreateInventoryItem: 3057 case PacketType.CreateInventoryItem:
3060 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack; 3058 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
3061 if (OnCreateNewInventoryItem != null) 3059 if (OnCreateNewInventoryItem != null)
3062 { 3060 {
3063 OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, 3061 OnCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID,
@@ -3074,7 +3072,7 @@ namespace OpenSim.Region.ClientStack
3074 case PacketType.FetchInventory: 3072 case PacketType.FetchInventory:
3075 if (OnFetchInventory != null) 3073 if (OnFetchInventory != null)
3076 { 3074 {
3077 FetchInventoryPacket FetchInventory = (FetchInventoryPacket) Pack; 3075 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
3078 for (int i = 0; i < FetchInventory.InventoryData.Length; i++) 3076 for (int i = 0; i < FetchInventory.InventoryData.Length; i++)
3079 { 3077 {
3080 OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID, 3078 OnFetchInventory(this, FetchInventory.InventoryData[i].ItemID,
@@ -3085,7 +3083,7 @@ namespace OpenSim.Region.ClientStack
3085 case PacketType.FetchInventoryDescendents: 3083 case PacketType.FetchInventoryDescendents:
3086 if (OnFetchInventoryDescendents != null) 3084 if (OnFetchInventoryDescendents != null)
3087 { 3085 {
3088 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket) Pack; 3086 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
3089 OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, 3087 OnFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID,
3090 Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, 3088 Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems,
3091 Fetch.InventoryData.SortOrder); 3089 Fetch.InventoryData.SortOrder);
@@ -3094,12 +3092,12 @@ namespace OpenSim.Region.ClientStack
3094 case PacketType.PurgeInventoryDescendents: 3092 case PacketType.PurgeInventoryDescendents:
3095 if (OnPurgeInventoryDescendents != null) 3093 if (OnPurgeInventoryDescendents != null)
3096 { 3094 {
3097 PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket) Pack; 3095 PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket)Pack;
3098 OnPurgeInventoryDescendents(this, Purge.InventoryData.FolderID); 3096 OnPurgeInventoryDescendents(this, Purge.InventoryData.FolderID);
3099 } 3097 }
3100 break; 3098 break;
3101 case PacketType.UpdateInventoryItem: 3099 case PacketType.UpdateInventoryItem:
3102 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket) Pack; 3100 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
3103 if (OnUpdateInventoryItem != null) 3101 if (OnUpdateInventoryItem != null)
3104 { 3102 {
3105 for (int i = 0; i < update.InventoryData.Length; i++) 3103 for (int i = 0; i < update.InventoryData.Length; i++)
@@ -3143,7 +3141,7 @@ namespace OpenSim.Region.ClientStack
3143 }*/ 3141 }*/
3144 break; 3142 break;
3145 case PacketType.CopyInventoryItem: 3143 case PacketType.CopyInventoryItem:
3146 CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket) Pack; 3144 CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket)Pack;
3147 if (OnCopyInventoryItem != null) 3145 if (OnCopyInventoryItem != null)
3148 { 3146 {
3149 foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData) 3147 foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData)
@@ -3155,7 +3153,7 @@ namespace OpenSim.Region.ClientStack
3155 } 3153 }
3156 break; 3154 break;
3157 case PacketType.MoveInventoryItem: 3155 case PacketType.MoveInventoryItem:
3158 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket) Pack; 3156 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack;
3159 if (OnMoveInventoryItem != null) 3157 if (OnMoveInventoryItem != null)
3160 { 3158 {
3161 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) 3159 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
@@ -3166,14 +3164,14 @@ namespace OpenSim.Region.ClientStack
3166 } 3164 }
3167 break; 3165 break;
3168 case PacketType.RequestTaskInventory: 3166 case PacketType.RequestTaskInventory:
3169 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket) Pack; 3167 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
3170 if (OnRequestTaskInventory != null) 3168 if (OnRequestTaskInventory != null)
3171 { 3169 {
3172 OnRequestTaskInventory(this, requesttask.InventoryData.LocalID); 3170 OnRequestTaskInventory(this, requesttask.InventoryData.LocalID);
3173 } 3171 }
3174 break; 3172 break;
3175 case PacketType.UpdateTaskInventory: 3173 case PacketType.UpdateTaskInventory:
3176 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket) Pack; 3174 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
3177 if (OnUpdateTaskInventory != null) 3175 if (OnUpdateTaskInventory != null)
3178 { 3176 {
3179 if (updatetask.UpdateData.Key == 0) 3177 if (updatetask.UpdateData.Key == 0)
@@ -3184,7 +3182,7 @@ namespace OpenSim.Region.ClientStack
3184 } 3182 }
3185 break; 3183 break;
3186 case PacketType.RemoveTaskInventory: 3184 case PacketType.RemoveTaskInventory:
3187 RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket) Pack; 3185 RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack;
3188 if (OnRemoveTaskItem != null) 3186 if (OnRemoveTaskItem != null)
3189 { 3187 {
3190 OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID); 3188 OnRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID);
@@ -3195,7 +3193,7 @@ namespace OpenSim.Region.ClientStack
3195 break; 3193 break;
3196 case PacketType.RezScript: 3194 case PacketType.RezScript:
3197 //Console.WriteLine(Pack.ToString()); 3195 //Console.WriteLine(Pack.ToString());
3198 RezScriptPacket rezScript = (RezScriptPacket) Pack; 3196 RezScriptPacket rezScript = (RezScriptPacket)Pack;
3199 if (OnRezScript != null) 3197 if (OnRezScript != null)
3200 { 3198 {
3201 OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID); 3199 OnRezScript(this, rezScript.InventoryBlock.ItemID, rezScript.UpdateBlock.ObjectLocalID);
@@ -3205,7 +3203,7 @@ namespace OpenSim.Region.ClientStack
3205 RequestMapLayer(); 3203 RequestMapLayer();
3206 break; 3204 break;
3207 case PacketType.MapBlockRequest: 3205 case PacketType.MapBlockRequest:
3208 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket) Pack; 3206 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
3209 if (OnRequestMapBlocks != null) 3207 if (OnRequestMapBlocks != null)
3210 { 3208 {
3211 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, 3209 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY,
@@ -3213,7 +3211,7 @@ namespace OpenSim.Region.ClientStack
3213 } 3211 }
3214 break; 3212 break;
3215 case PacketType.MapNameRequest: 3213 case PacketType.MapNameRequest:
3216 MapNameRequestPacket map = (MapNameRequestPacket) Pack; 3214 MapNameRequestPacket map = (MapNameRequestPacket)Pack;
3217 string mapName = UTF8Encoding.UTF8.GetString(map.NameData.Name, 0, 3215 string mapName = UTF8Encoding.UTF8.GetString(map.NameData.Name, 0,
3218 map.NameData.Name.Length - 1); 3216 map.NameData.Name.Length - 1);
3219 if (OnMapNameRequest != null) 3217 if (OnMapNameRequest != null)
@@ -3222,13 +3220,13 @@ namespace OpenSim.Region.ClientStack
3222 } 3220 }
3223 break; 3221 break;
3224 case PacketType.TeleportLandmarkRequest: 3222 case PacketType.TeleportLandmarkRequest:
3225 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack; 3223 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
3226 3224
3227 TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart); 3225 TeleportStartPacket tpStart = (TeleportStartPacket)PacketPool.Instance.GetPacket(PacketType.TeleportStart);
3228 tpStart.Info.TeleportFlags = 8; // tp via lm 3226 tpStart.Info.TeleportFlags = 8; // tp via lm
3229 OutPacket(tpStart, ThrottleOutPacketType.Task); 3227 OutPacket(tpStart, ThrottleOutPacketType.Task);
3230 3228
3231 TeleportProgressPacket tpProgress = (TeleportProgressPacket) PacketPool.Instance.GetPacket(PacketType.TeleportProgress); 3229 TeleportProgressPacket tpProgress = (TeleportProgressPacket)PacketPool.Instance.GetPacket(PacketType.TeleportProgress);
3232 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); 3230 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark");
3233 tpProgress.Info.TeleportFlags = 8; 3231 tpProgress.Info.TeleportFlags = 8;
3234 tpProgress.AgentData.AgentID = tpReq.Info.AgentID; 3232 tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
@@ -3243,7 +3241,7 @@ namespace OpenSim.Region.ClientStack
3243 3241
3244 if (lm.RegionID == m_scene.RegionInfo.RegionID) 3242 if (lm.RegionID == m_scene.RegionInfo.RegionID)
3245 { 3243 {
3246 TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal); 3244 TeleportLocalPacket tpLocal = (TeleportLocalPacket)PacketPool.Instance.GetPacket(PacketType.TeleportLocal);
3247 3245
3248 tpLocal.Info.AgentID = tpReq.Info.AgentID; 3246 tpLocal.Info.AgentID = tpReq.Info.AgentID;
3249 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark 3247 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
@@ -3253,7 +3251,7 @@ namespace OpenSim.Region.ClientStack
3253 } 3251 }
3254 else 3252 else
3255 { 3253 {
3256 TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 3254 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
3257 tpCancel.Info.AgentID = tpReq.Info.AgentID; 3255 tpCancel.Info.AgentID = tpReq.Info.AgentID;
3258 tpCancel.Info.SessionID = tpReq.Info.SessionID; 3256 tpCancel.Info.SessionID = tpReq.Info.SessionID;
3259 OutPacket(tpCancel, ThrottleOutPacketType.Task); 3257 OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3263,14 +3261,14 @@ namespace OpenSim.Region.ClientStack
3263 { 3261 {
3264 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); 3262 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
3265 3263
3266 TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 3264 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
3267 tpCancel.Info.AgentID = tpReq.Info.AgentID; 3265 tpCancel.Info.AgentID = tpReq.Info.AgentID;
3268 tpCancel.Info.SessionID = tpReq.Info.SessionID; 3266 tpCancel.Info.SessionID = tpReq.Info.SessionID;
3269 OutPacket(tpCancel, ThrottleOutPacketType.Task); 3267 OutPacket(tpCancel, ThrottleOutPacketType.Task);
3270 } 3268 }
3271 break; 3269 break;
3272 case PacketType.TeleportLocationRequest: 3270 case PacketType.TeleportLocationRequest:
3273 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket) Pack; 3271 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
3274 // Console.WriteLine(tpLocReq.ToString()); 3272 // Console.WriteLine(tpLocReq.ToString());
3275 3273
3276 if (OnTeleportLocationRequest != null) 3274 if (OnTeleportLocationRequest != null)
@@ -3281,30 +3279,30 @@ namespace OpenSim.Region.ClientStack
3281 else 3279 else
3282 { 3280 {
3283 //no event handler so cancel request 3281 //no event handler so cancel request
3284 TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 3282 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
3285 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; 3283 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
3286 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; 3284 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
3287 OutPacket(tpCancel, ThrottleOutPacketType.Task); 3285 OutPacket(tpCancel, ThrottleOutPacketType.Task);
3288 } 3286 }
3289 break; 3287 break;
3290 3288
3291 #endregion 3289 #endregion
3292 3290
3293 case PacketType.MoneyBalanceRequest: 3291 case PacketType.MoneyBalanceRequest:
3294 SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance); 3292 SendMoneyBalance(LLUUID.Zero, true, new byte[0], MoneyBalance);
3295 break; 3293 break;
3296 case PacketType.UUIDNameRequest: 3294 case PacketType.UUIDNameRequest:
3297 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket) Pack; 3295 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack;
3298 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) 3296 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock)
3299 { 3297 {
3300 OnNameFromUUIDRequest(UUIDBlock.ID, this); 3298 OnNameFromUUIDRequest(UUIDBlock.ID, this);
3301 } 3299 }
3302 break; 3300 break;
3303 3301
3304 #region Parcel related packets 3302 #region Parcel related packets
3305 3303
3306 case PacketType.ParcelAccessListRequest: 3304 case PacketType.ParcelAccessListRequest:
3307 ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket) Pack; 3305 ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack;
3308 if (OnParcelAccessListRequest != null) 3306 if (OnParcelAccessListRequest != null)
3309 { 3307 {
3310 OnParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID, 3308 OnParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID,
@@ -3314,13 +3312,13 @@ namespace OpenSim.Region.ClientStack
3314 break; 3312 break;
3315 3313
3316 case PacketType.ParcelAccessListUpdate: 3314 case PacketType.ParcelAccessListUpdate:
3317 ParcelAccessListUpdatePacket updatePacket = (ParcelAccessListUpdatePacket) Pack; 3315 ParcelAccessListUpdatePacket updatePacket = (ParcelAccessListUpdatePacket)Pack;
3318 List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>(); 3316 List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>();
3319 foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) 3317 foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List)
3320 { 3318 {
3321 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 3319 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
3322 entry.AgentID = block.ID; 3320 entry.AgentID = block.ID;
3323 entry.Flags = (ParcelManager.AccessList) block.Flags; 3321 entry.Flags = (ParcelManager.AccessList)block.Flags;
3324 entry.Time = new DateTime(); 3322 entry.Time = new DateTime();
3325 entries.Add(entry); 3323 entries.Add(entry);
3326 } 3324 }
@@ -3334,46 +3332,46 @@ namespace OpenSim.Region.ClientStack
3334 break; 3332 break;
3335 case PacketType.ParcelPropertiesRequest: 3333 case PacketType.ParcelPropertiesRequest:
3336 3334
3337 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket) Pack; 3335 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack;
3338 if (OnParcelPropertiesRequest != null) 3336 if (OnParcelPropertiesRequest != null)
3339 { 3337 {
3340 OnParcelPropertiesRequest((int) Math.Round(propertiesRequest.ParcelData.West), 3338 OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West),
3341 (int) Math.Round(propertiesRequest.ParcelData.South), 3339 (int)Math.Round(propertiesRequest.ParcelData.South),
3342 (int) Math.Round(propertiesRequest.ParcelData.East), 3340 (int)Math.Round(propertiesRequest.ParcelData.East),
3343 (int) Math.Round(propertiesRequest.ParcelData.North), 3341 (int)Math.Round(propertiesRequest.ParcelData.North),
3344 propertiesRequest.ParcelData.SequenceID, 3342 propertiesRequest.ParcelData.SequenceID,
3345 propertiesRequest.ParcelData.SnapSelection, this); 3343 propertiesRequest.ParcelData.SnapSelection, this);
3346 } 3344 }
3347 break; 3345 break;
3348 case PacketType.ParcelDivide: 3346 case PacketType.ParcelDivide:
3349 ParcelDividePacket landDivide = (ParcelDividePacket) Pack; 3347 ParcelDividePacket landDivide = (ParcelDividePacket)Pack;
3350 if (OnParcelDivideRequest != null) 3348 if (OnParcelDivideRequest != null)
3351 { 3349 {
3352 OnParcelDivideRequest((int) Math.Round(landDivide.ParcelData.West), 3350 OnParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West),
3353 (int) Math.Round(landDivide.ParcelData.South), 3351 (int)Math.Round(landDivide.ParcelData.South),
3354 (int) Math.Round(landDivide.ParcelData.East), 3352 (int)Math.Round(landDivide.ParcelData.East),
3355 (int) Math.Round(landDivide.ParcelData.North), this); 3353 (int)Math.Round(landDivide.ParcelData.North), this);
3356 } 3354 }
3357 break; 3355 break;
3358 case PacketType.ParcelJoin: 3356 case PacketType.ParcelJoin:
3359 ParcelJoinPacket landJoin = (ParcelJoinPacket) Pack; 3357 ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack;
3360 if (OnParcelJoinRequest != null) 3358 if (OnParcelJoinRequest != null)
3361 { 3359 {
3362 OnParcelJoinRequest((int) Math.Round(landJoin.ParcelData.West), 3360 OnParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West),
3363 (int) Math.Round(landJoin.ParcelData.South), 3361 (int)Math.Round(landJoin.ParcelData.South),
3364 (int) Math.Round(landJoin.ParcelData.East), 3362 (int)Math.Round(landJoin.ParcelData.East),
3365 (int) Math.Round(landJoin.ParcelData.North), this); 3363 (int)Math.Round(landJoin.ParcelData.North), this);
3366 } 3364 }
3367 break; 3365 break;
3368 case PacketType.ParcelPropertiesUpdate: 3366 case PacketType.ParcelPropertiesUpdate:
3369 ParcelPropertiesUpdatePacket parcelPropertiesPacket = (ParcelPropertiesUpdatePacket) Pack; 3367 ParcelPropertiesUpdatePacket parcelPropertiesPacket = (ParcelPropertiesUpdatePacket)Pack;
3370 if (OnParcelPropertiesUpdateRequest != null) 3368 if (OnParcelPropertiesUpdateRequest != null)
3371 { 3369 {
3372 OnParcelPropertiesUpdateRequest(parcelPropertiesPacket, this); 3370 OnParcelPropertiesUpdateRequest(parcelPropertiesPacket, this);
3373 } 3371 }
3374 break; 3372 break;
3375 case PacketType.ParcelSelectObjects: 3373 case PacketType.ParcelSelectObjects:
3376 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket) Pack; 3374 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack;
3377 if (OnParcelSelectObjects != null) 3375 if (OnParcelSelectObjects != null)
3378 { 3376 {
3379 OnParcelSelectObjects(selectPacket.ParcelData.LocalID, 3377 OnParcelSelectObjects(selectPacket.ParcelData.LocalID,
@@ -3382,26 +3380,26 @@ namespace OpenSim.Region.ClientStack
3382 break; 3380 break;
3383 case PacketType.ParcelObjectOwnersRequest: 3381 case PacketType.ParcelObjectOwnersRequest:
3384 //System.Console.WriteLine(Pack.ToString()); 3382 //System.Console.WriteLine(Pack.ToString());
3385 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket) Pack; 3383 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack;
3386 if (OnParcelObjectOwnerRequest != null) 3384 if (OnParcelObjectOwnerRequest != null)
3387 { 3385 {
3388 OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); 3386 OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
3389 } 3387 }
3390 break; 3388 break;
3391 3389
3392 #endregion 3390 #endregion
3393 3391
3394 #region Estate Packets 3392 #region Estate Packets
3395 3393
3396 case PacketType.EstateOwnerMessage: 3394 case PacketType.EstateOwnerMessage:
3397 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket) Pack; 3395 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
3398 if (OnEstateOwnerMessage != null) 3396 if (OnEstateOwnerMessage != null)
3399 { 3397 {
3400 OnEstateOwnerMessage(messagePacket, this); 3398 OnEstateOwnerMessage(messagePacket, this);
3401 } 3399 }
3402 break; 3400 break;
3403 case PacketType.RequestRegionInfo: 3401 case PacketType.RequestRegionInfo:
3404 RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket) Pack).AgentData; 3402 RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData;
3405 if (OnRegionInfoRequest != null) 3403 if (OnRegionInfoRequest != null)
3406 { 3404 {
3407 OnRegionInfoRequest(this, mPacket.SessionID); 3405 OnRegionInfoRequest(this, mPacket.SessionID);
@@ -3410,23 +3408,23 @@ namespace OpenSim.Region.ClientStack
3410 case PacketType.EstateCovenantRequest: 3408 case PacketType.EstateCovenantRequest:
3411 // TODO: handle this packet 3409 // TODO: handle this packet
3412 EstateCovenantRequestPacket.AgentDataBlock epack = 3410 EstateCovenantRequestPacket.AgentDataBlock epack =
3413 ((EstateCovenantRequestPacket) Pack).AgentData; 3411 ((EstateCovenantRequestPacket)Pack).AgentData;
3414 if (OnEstateCovenantRequest != null) 3412 if (OnEstateCovenantRequest != null)
3415 { 3413 {
3416 OnEstateCovenantRequest(this, epack.SessionID); 3414 OnEstateCovenantRequest(this, epack.SessionID);
3417 } 3415 }
3418 break; 3416 break;
3419 case PacketType.AgentThrottle: 3417 case PacketType.AgentThrottle:
3420 AgentThrottlePacket atpack = (AgentThrottlePacket) Pack; 3418 AgentThrottlePacket atpack = (AgentThrottlePacket)Pack;
3421 m_packetQueue.SetThrottleFromClient(atpack.Throttle.Throttles); 3419 m_packetQueue.SetThrottleFromClient(atpack.Throttle.Throttles);
3422 break; 3420 break;
3423 3421
3424 #endregion 3422 #endregion
3425 3423
3426 #region unimplemented handlers 3424 #region unimplemented handlers
3427 3425
3428 case PacketType.RequestGodlikePowers: 3426 case PacketType.RequestGodlikePowers:
3429 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket) Pack; 3427 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack;
3430 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock; 3428 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock;
3431 LLUUID token = rblock.Token; 3429 LLUUID token = rblock.Token;
3432 RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData; 3430 RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData;
@@ -3437,12 +3435,12 @@ namespace OpenSim.Region.ClientStack
3437 case PacketType.GodKickUser: 3435 case PacketType.GodKickUser:
3438 MainLog.Instance.Warn("CLIENT", "unhandled GodKickUser packet"); 3436 MainLog.Instance.Warn("CLIENT", "unhandled GodKickUser packet");
3439 3437
3440 GodKickUserPacket gkupack = (GodKickUserPacket) Pack; 3438 GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
3441 3439
3442 if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID) 3440 if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID)
3443 { 3441 {
3444 OnGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, 3442 OnGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
3445 gkupack.UserInfo.AgentID, (uint) 0, gkupack.UserInfo.Reason); 3443 gkupack.UserInfo.AgentID, (uint)0, gkupack.UserInfo.Reason);
3446 } 3444 }
3447 else 3445 else
3448 { 3446 {
@@ -3549,7 +3547,7 @@ namespace OpenSim.Region.ClientStack
3549 MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString()); 3547 MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString());
3550 break; 3548 break;
3551 3549
3552 #endregion 3550 #endregion
3553 } 3551 }
3554 } 3552 }
3555 3553
@@ -3590,14 +3588,14 @@ namespace OpenSim.Region.ClientStack
3590 public void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message) 3588 public void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message)
3591 { 3589 {
3592 if (!ChildAgentStatus()) 3590 if (!ChildAgentStatus())
3593 SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)1, (uint)Util.UnixTimeSinceEpoch()); 3591 SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)1, (uint)Util.UnixTimeSinceEpoch());
3594 3592
3595 //SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch()); 3593 //SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch());
3596 } 3594 }
3597 3595
3598 public void SendLogoutPacket() 3596 public void SendLogoutPacket()
3599 { 3597 {
3600 LogoutReplyPacket logReply = (LogoutReplyPacket) PacketPool.Instance.GetPacket(PacketType.LogoutReply); 3598 LogoutReplyPacket logReply = (LogoutReplyPacket)PacketPool.Instance.GetPacket(PacketType.LogoutReply);
3601 // TODO: don't create new blocks if recycling an old packet 3599 // TODO: don't create new blocks if recycling an old packet
3602 logReply.AgentData.AgentID = AgentId; 3600 logReply.AgentData.AgentID = AgentId;
3603 logReply.AgentData.SessionID = SessionId; 3601 logReply.AgentData.SessionID = SessionId;