aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/SimClient.cs
diff options
context:
space:
mode:
authorMW2007-05-15 15:15:01 +0000
committerMW2007-05-15 15:15:01 +0000
commit6b15c6e55642363cc0ce1b5908154bd57178dfcb (patch)
tree66021cea16b3f2fc16f56c5df99af41fafea7b7f /OpenSim.RegionServer/SimClient.cs
parentTurned SimClient into a partial class (and added SimClient(Grid), so that gri... (diff)
downloadopensim-SC-6b15c6e55642363cc0ce1b5908154bd57178dfcb.zip
opensim-SC-6b15c6e55642363cc0ce1b5908154bd57178dfcb.tar.gz
opensim-SC-6b15c6e55642363cc0ce1b5908154bd57178dfcb.tar.bz2
opensim-SC-6b15c6e55642363cc0ce1b5908154bd57178dfcb.tar.xz
Added SimClientPacketHandlers.cs (moved the SimClient Packet handlers into it)
Diffstat (limited to 'OpenSim.RegionServer/SimClient.cs')
-rw-r--r--OpenSim.RegionServer/SimClient.cs138
1 files changed, 1 insertions, 137 deletions
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index 03e151a..92156f0 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -954,119 +954,7 @@ namespace OpenSim
954 ClientLoop(); 954 ClientLoop();
955 } 955 }
956 } 956 }
957 #region Packet handlers 957
958
959 protected virtual bool Logout(SimClient simClient, Packet packet)
960 {
961 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"OpenSimClient.cs:ProcessInPacket() - Got a logout request");
962 //send reply to let the client logout
963 LogoutReplyPacket logReply = new LogoutReplyPacket();
964 logReply.AgentData.AgentID = this.AgentID;
965 logReply.AgentData.SessionID = this.SessionID;
966 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
967 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
968 logReply.InventoryData[0].ItemID = LLUUID.Zero;
969 OutPacket(logReply);
970 //tell all clients to kill our object
971 KillObjectPacket kill = new KillObjectPacket();
972 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
973 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
974 kill.ObjectData[0].ID = this.ClientAvatar.localid;
975 foreach (SimClient client in m_clientThreads.Values)
976 {
977 client.OutPacket(kill);
978 }
979 if (this.m_userServer != null)
980 {
981 this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer);
982 }
983 else
984 {
985 this.m_inventoryCache.ClientLeaving(this.AgentID, null);
986 }
987
988 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
989 /*lock (m_world.Entities)
990 {
991 m_world.Entities.Remove(this.AgentID);
992 }*/
993 m_world.RemoveViewerAgent(this);
994 //need to do other cleaning up here too
995 m_clientThreads.Remove(this.CircuitCode);
996 m_application.RemoveClientCircuit(this.CircuitCode);
997 this.ClientThread.Abort();
998 return true;
999 }
1000
1001 protected bool AgentTextureCached(SimClient simclient, Packet packet)
1002 {
1003 // Console.WriteLine(packet.ToString());
1004 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet;
1005 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
1006 cachedresp.AgentData.AgentID = this.AgentID;
1007 cachedresp.AgentData.SessionID = this.SessionID;
1008 cachedresp.AgentData.SerialNum = this.cachedtextureserial;
1009 this.cachedtextureserial++;
1010 cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length];
1011 for (int i = 0; i < chechedtex.WearableData.Length; i++)
1012 {
1013 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
1014 cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex;
1015 cachedresp.WearableData[i].TextureID = LLUUID.Zero;
1016 cachedresp.WearableData[i].HostName = new byte[0];
1017 }
1018 this.OutPacket(cachedresp);
1019 return true;
1020 }
1021
1022 protected bool MultipleObjUpdate(SimClient simClient, Packet packet)
1023 {
1024 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
1025 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
1026 {
1027 if (multipleupdate.ObjectData[i].Type == 9) //change position
1028 {
1029 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
1030 foreach (Entity ent in m_world.Entities.Values)
1031 {
1032 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
1033 {
1034 ((OpenSim.world.Primitive)ent).UpdatePosition(pos);
1035
1036 }
1037 }
1038 //should update stored position of the prim
1039 }
1040 else if (multipleupdate.ObjectData[i].Type == 10)//rotation
1041 {
1042 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
1043 foreach (Entity ent in m_world.Entities.Values)
1044 {
1045 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
1046 {
1047 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
1048 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
1049 }
1050 }
1051 }
1052 else if (multipleupdate.ObjectData[i].Type == 13)//scale
1053 {
1054
1055 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
1056 foreach (Entity ent in m_world.Entities.Values)
1057 {
1058 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
1059 {
1060 ((OpenSim.world.Primitive)ent).Scale = scale;
1061 }
1062 }
1063 }
1064 }
1065 return true;
1066 }
1067
1068 #endregion
1069
1070 private AgentInventory CreateInventory(LLUUID baseFolder) 958 private AgentInventory CreateInventory(LLUUID baseFolder)
1071 { 959 {
1072 AgentInventory inventory = null; 960 AgentInventory inventory = null;
@@ -1127,29 +1015,5 @@ namespace OpenSim
1127 m_assetCache.AddAsset(asset); 1015 m_assetCache.AddAsset(asset);
1128 m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset); 1016 m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset);
1129 } 1017 }
1130
1131 public void RequestMapLayer() //should be getting the map layer from the grid server
1132 {
1133 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
1134 MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
1135 mapReply.AgentData.AgentID = this.AgentID;
1136 mapReply.AgentData.Flags = 0;
1137 mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
1138 mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
1139 mapReply.LayerData[0].Bottom = 800;
1140 mapReply.LayerData[0].Left = 800;
1141 mapReply.LayerData[0].Top = 1200;
1142 mapReply.LayerData[0].Right = 1200;
1143 mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
1144 this.OutPacket(mapReply);
1145 }
1146
1147 public void RequestMapBlock( int minX, int minY, int maxX, int maxY)
1148 {
1149 //check if our own map was requested
1150 this.m_world.RequestMapBlock(this, minX, minY, maxX, maxY);
1151
1152 //now should get other regions maps from gridserver
1153 }
1154 } 1018 }
1155} 1019}