diff options
author | Adam Frisby | 2007-07-11 08:10:25 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-11 08:10:25 +0000 |
commit | e2ff441e31328e60c8bb1d4bb32fa4ac64f91978 (patch) | |
tree | 8405b6cef57b66a58f31a24c859846085d0b81f7 /OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs | |
parent | * Wiping trunk in prep for Sugilite (diff) | |
parent | * Applying dalien's patches from bug#177 and #179 (diff) | |
download | opensim-SC_OLD-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.zip opensim-SC_OLD-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.gz opensim-SC_OLD-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.bz2 opensim-SC_OLD-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.xz |
* Bringing Sugilite in to trunk
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs | 236 |
1 files changed, 236 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs new file mode 100644 index 0000000..e67807e --- /dev/null +++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs | |||
@@ -0,0 +1,236 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using libsecondlife; | ||
29 | using libsecondlife.Packets; | ||
30 | using OpenSim.Framework.Console; | ||
31 | |||
32 | namespace OpenSim.Region.ClientStack | ||
33 | { | ||
34 | public partial class ClientView | ||
35 | { | ||
36 | protected virtual void RegisterLocalPacketHandlers() | ||
37 | { | ||
38 | this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout); | ||
39 | this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached); | ||
40 | this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate); | ||
41 | } | ||
42 | |||
43 | protected virtual bool Logout(ClientView simClient, Packet packet) | ||
44 | { | ||
45 | MainLog.Instance.Verbose( "OpenSimClient.cs:ProcessInPacket() - Got a logout request"); | ||
46 | //send reply to let the client logout | ||
47 | LogoutReplyPacket logReply = new LogoutReplyPacket(); | ||
48 | logReply.AgentData.AgentID = this.AgentID; | ||
49 | logReply.AgentData.SessionID = this.SessionID; | ||
50 | logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1]; | ||
51 | logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); | ||
52 | logReply.InventoryData[0].ItemID = LLUUID.Zero; | ||
53 | OutPacket(logReply); | ||
54 | // | ||
55 | this.KillClient(); | ||
56 | return true; | ||
57 | } | ||
58 | |||
59 | protected bool AgentTextureCached(ClientView simclient, Packet packet) | ||
60 | { | ||
61 | // Console.WriteLine(packet.ToString()); | ||
62 | AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)packet; | ||
63 | AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); | ||
64 | cachedresp.AgentData.AgentID = this.AgentID; | ||
65 | cachedresp.AgentData.SessionID = this.SessionID; | ||
66 | cachedresp.AgentData.SerialNum = this.cachedtextureserial; | ||
67 | this.cachedtextureserial++; | ||
68 | cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; | ||
69 | for (int i = 0; i < chechedtex.WearableData.Length; i++) | ||
70 | { | ||
71 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
72 | cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex; | ||
73 | cachedresp.WearableData[i].TextureID = LLUUID.Zero; | ||
74 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
75 | } | ||
76 | this.OutPacket(cachedresp); | ||
77 | return true; | ||
78 | } | ||
79 | |||
80 | protected bool MultipleObjUpdate(ClientView simClient, Packet packet) | ||
81 | { | ||
82 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; | ||
83 | //System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); | ||
84 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) | ||
85 | { | ||
86 | #region position | ||
87 | if (multipleupdate.ObjectData[i].Type == 9) //change position | ||
88 | { | ||
89 | if (OnUpdatePrimGroupPosition != null) | ||
90 | { | ||
91 | LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | ||
92 | OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | ||
93 | } | ||
94 | |||
95 | } | ||
96 | else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position | ||
97 | { | ||
98 | if (OnUpdatePrimSinglePosition != null) | ||
99 | { | ||
100 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | ||
101 | // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
102 | OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); | ||
103 | } | ||
104 | } | ||
105 | #endregion position | ||
106 | #region rotation | ||
107 | else if (multipleupdate.ObjectData[i].Type == 2)// single item of group rotation from tab | ||
108 | { | ||
109 | if (OnUpdatePrimSingleRotation != null) | ||
110 | { | ||
111 | LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); | ||
112 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
113 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | ||
114 | } | ||
115 | } | ||
116 | else if (multipleupdate.ObjectData[i].Type == 3)// single item of group rotation from mouse | ||
117 | { | ||
118 | if (OnUpdatePrimSingleRotation != null) | ||
119 | { | ||
120 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); | ||
121 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
122 | OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | ||
123 | } | ||
124 | } | ||
125 | else if (multipleupdate.ObjectData[i].Type == 10)//group rotation from object tab | ||
126 | { | ||
127 | if (OnUpdatePrimGroupRotation != null) | ||
128 | { | ||
129 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); | ||
130 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
131 | OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); | ||
132 | } | ||
133 | } | ||
134 | else if (multipleupdate.ObjectData[i].Type == 11)//group rotation from mouse | ||
135 | { | ||
136 | if (OnUpdatePrimGroupMouseRotation != null) | ||
137 | { | ||
138 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | ||
139 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); | ||
140 | //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
141 | // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); | ||
142 | OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); | ||
143 | } | ||
144 | } | ||
145 | #endregion | ||
146 | #region scale | ||
147 | else if (multipleupdate.ObjectData[i].Type == 13)//group scale from object tab | ||
148 | { | ||
149 | if (OnUpdatePrimScale != null) | ||
150 | { | ||
151 | LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | ||
152 | //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
153 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | ||
154 | } | ||
155 | } | ||
156 | else if (multipleupdate.ObjectData[i].Type == 29)//group scale from mouse | ||
157 | { | ||
158 | if (OnUpdatePrimScale != null) | ||
159 | { | ||
160 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | ||
161 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); | ||
162 | // OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | ||
163 | } | ||
164 | } | ||
165 | else if (multipleupdate.ObjectData[i].Type == 5)//single prim scale from object tab | ||
166 | { | ||
167 | if (OnUpdatePrimScale != null) | ||
168 | { | ||
169 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | ||
170 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
171 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | ||
172 | } | ||
173 | } | ||
174 | else if (multipleupdate.ObjectData[i].Type == 21)//single prim scale from mouse | ||
175 | { | ||
176 | if (OnUpdatePrimScale != null) | ||
177 | { | ||
178 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | ||
179 | // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
180 | OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); | ||
181 | } | ||
182 | } | ||
183 | #endregion | ||
184 | } | ||
185 | return true; | ||
186 | } | ||
187 | |||
188 | public void RequestMapLayer() | ||
189 | { | ||
190 | //should be getting the map layer from the grid server | ||
191 | //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) | ||
192 | MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); | ||
193 | mapReply.AgentData.AgentID = this.AgentID; | ||
194 | mapReply.AgentData.Flags = 0; | ||
195 | mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; | ||
196 | mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); | ||
197 | mapReply.LayerData[0].Bottom = 0; | ||
198 | mapReply.LayerData[0].Left = 0; | ||
199 | mapReply.LayerData[0].Top = 30000; | ||
200 | mapReply.LayerData[0].Right = 30000; | ||
201 | mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); | ||
202 | this.OutPacket(mapReply); | ||
203 | } | ||
204 | |||
205 | public void RequestMapBlocks(int minX, int minY, int maxX, int maxY) | ||
206 | { | ||
207 | /* | ||
208 | IList simMapProfiles = m_gridServer.RequestMapBlocks(minX, minY, maxX, maxY); | ||
209 | MapBlockReplyPacket mbReply = new MapBlockReplyPacket(); | ||
210 | mbReply.AgentData.AgentID = this.AgentID; | ||
211 | int len; | ||
212 | if (simMapProfiles == null) | ||
213 | len = 0; | ||
214 | else | ||
215 | len = simMapProfiles.Count; | ||
216 | |||
217 | mbReply.Data = new MapBlockReplyPacket.DataBlock[len]; | ||
218 | int iii; | ||
219 | for (iii = 0; iii < len; iii++) | ||
220 | { | ||
221 | Hashtable mp = (Hashtable)simMapProfiles[iii]; | ||
222 | mbReply.Data[iii] = new MapBlockReplyPacket.DataBlock(); | ||
223 | mbReply.Data[iii].Name = System.Text.Encoding.UTF8.GetBytes((string)mp["name"]); | ||
224 | mbReply.Data[iii].Access = System.Convert.ToByte(mp["access"]); | ||
225 | mbReply.Data[iii].Agents = System.Convert.ToByte(mp["agents"]); | ||
226 | mbReply.Data[iii].MapImageID = new LLUUID((string)mp["map-image-id"]); | ||
227 | mbReply.Data[iii].RegionFlags = System.Convert.ToUInt32(mp["region-flags"]); | ||
228 | mbReply.Data[iii].WaterHeight = System.Convert.ToByte(mp["water-height"]); | ||
229 | mbReply.Data[iii].X = System.Convert.ToUInt16(mp["x"]); | ||
230 | mbReply.Data[iii].Y = System.Convert.ToUInt16(mp["y"]); | ||
231 | } | ||
232 | this.OutPacket(mbReply); | ||
233 | */ | ||
234 | } | ||
235 | } | ||
236 | } | ||