aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs257
1 files changed, 0 insertions, 257 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
deleted file mode 100644
index 5753018..0000000
--- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
+++ /dev/null
@@ -1,257 +0,0 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.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*/
28using libsecondlife;
29using libsecondlife.Packets;
30using OpenSim.Framework;
31using OpenSim.Framework.Console;
32
33namespace OpenSim.Region.ClientStack
34{
35 public partial class ClientView
36 {
37 protected virtual void RegisterLocalPacketHandlers()
38 {
39 AddLocalPacketHandler(PacketType.LogoutRequest, Logout);
40 AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect);
41 AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached);
42 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate);
43 }
44
45 private bool HandleViewerEffect(IClientAPI sender, Packet Pack)
46 {
47 ViewerEffectPacket viewer = (ViewerEffectPacket) Pack;
48
49 if (OnViewerEffect != null)
50 {
51 OnViewerEffect(sender, viewer.Effect);
52 }
53
54 return true;
55 }
56
57 protected virtual bool Logout(IClientAPI client, Packet packet)
58 {
59 MainLog.Instance.Verbose("CLIENT", "Got a logout request");
60
61 if (OnLogout != null)
62 {
63 OnLogout(client);
64 }
65
66 return true;
67 }
68
69 protected bool AgentTextureCached(IClientAPI simclient, Packet packet)
70 {
71 //System.Console.WriteLine("texture cached: " + packet.ToString());
72 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet;
73 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
74 cachedresp.AgentData.AgentID = AgentId;
75 cachedresp.AgentData.SessionID = m_sessionId;
76 cachedresp.AgentData.SerialNum = cachedtextureserial;
77 cachedtextureserial++;
78 cachedresp.WearableData =
79 new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length];
80 for (int i = 0; i < chechedtex.WearableData.Length; i++)
81 {
82 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
83 cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex;
84 cachedresp.WearableData[i].TextureID = LLUUID.Zero;
85 cachedresp.WearableData[i].HostName = new byte[0];
86 }
87 OutPacket(cachedresp, ThrottleOutPacketType.Texture);
88 return true;
89 }
90
91 protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet)
92 {
93 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket) packet;
94 // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString());
95 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
96 {
97 #region position
98
99 if (multipleupdate.ObjectData[i].Type == 9) //change position
100 {
101 if (OnUpdatePrimGroupPosition != null)
102 {
103 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
104 OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
105 }
106 }
107 else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position
108 {
109 if (OnUpdatePrimSinglePosition != null)
110 {
111 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
112 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
113 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
114 }
115 }
116 #endregion position
117 #region rotation
118
119 else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab
120 {
121 if (OnUpdatePrimSingleRotation != null)
122 {
123 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
124 //System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
125 OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
126 }
127 }
128 else if (multipleupdate.ObjectData[i].Type == 3) // single item of group rotation from mouse
129 {
130 if (OnUpdatePrimSingleRotation != null)
131 {
132 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
133 //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
134 OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
135 }
136 }
137 else if (multipleupdate.ObjectData[i].Type == 10) //group rotation from object tab
138 {
139 if (OnUpdatePrimGroupRotation != null)
140 {
141 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
142 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
143 OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
144 }
145 }
146 else if (multipleupdate.ObjectData[i].Type == 11) //group rotation from mouse
147 {
148 if (OnUpdatePrimGroupMouseRotation != null)
149 {
150 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
151 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
152 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
153 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
154 OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this);
155 }
156 }
157 #endregion
158 #region scale
159
160 else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab
161 {
162 if (OnUpdatePrimScale != null)
163 {
164 LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
165 //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
166 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
167
168 // Change the position based on scale (for bug number 246)
169 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
170 // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
171 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
172 }
173 }
174 else if (multipleupdate.ObjectData[i].Type == 29) //group scale from mouse
175 {
176 if (OnUpdatePrimScale != null)
177 {
178 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 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
182 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
183 }
184 }
185 else if (multipleupdate.ObjectData[i].Type == 5) //single prim scale from object tab
186 {
187 if (OnUpdatePrimScale != null)
188 {
189 LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
190 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
191 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
192 }
193 }
194 else if (multipleupdate.ObjectData[i].Type == 21) //single prim scale from mouse
195 {
196 if (OnUpdatePrimScale != null)
197 {
198 LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
199 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
200 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
201 }
202 }
203
204 #endregion
205 }
206 return true;
207 }
208
209 public void RequestMapLayer()
210 {
211 //should be getting the map layer from the grid server
212 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
213 MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
214 mapReply.AgentData.AgentID = AgentId;
215 mapReply.AgentData.Flags = 0;
216 mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
217 mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
218 mapReply.LayerData[0].Bottom = 0;
219 mapReply.LayerData[0].Left = 0;
220 mapReply.LayerData[0].Top = 30000;
221 mapReply.LayerData[0].Right = 30000;
222 mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
223 OutPacket(mapReply, ThrottleOutPacketType.Land);
224 }
225
226 public void RequestMapBlocks(int minX, int minY, int maxX, int maxY)
227 {
228 /*
229 IList simMapProfiles = m_gridServer.RequestMapBlocks(minX, minY, maxX, maxY);
230 MapBlockReplyPacket mbReply = new MapBlockReplyPacket();
231 mbReply.AgentData.AgentId = this.AgentId;
232 int len;
233 if (simMapProfiles == null)
234 len = 0;
235 else
236 len = simMapProfiles.Count;
237
238 mbReply.Data = new MapBlockReplyPacket.DataBlock[len];
239 int iii;
240 for (iii = 0; iii < len; iii++)
241 {
242 Hashtable mp = (Hashtable)simMapProfiles[iii];
243 mbReply.Data[iii] = new MapBlockReplyPacket.DataBlock();
244 mbReply.Data[iii].Name = System.Text.Encoding.UTF8.GetBytes((string)mp["name"]);
245 mbReply.Data[iii].Access = System.Convert.ToByte(mp["access"]);
246 mbReply.Data[iii].Agents = System.Convert.ToByte(mp["agents"]);
247 mbReply.Data[iii].MapImageID = new LLUUID((string)mp["map-image-id"]);
248 mbReply.Data[iii].RegionFlags = System.Convert.ToUInt32(mp["region-flags"]);
249 mbReply.Data[iii].WaterHeight = System.Convert.ToByte(mp["water-height"]);
250 mbReply.Data[iii].X = System.Convert.ToUInt16(mp["x"]);
251 mbReply.Data[iii].Y = System.Convert.ToUInt16(mp["y"]);
252 }
253 this.OutPacket(mbReply, ThrottleOutPacketType.Land);
254 */
255 }
256 }
257} \ No newline at end of file