diff options
author | Adam Frisby | 2007-07-11 08:02:47 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-11 08:02:47 +0000 |
commit | 5c7ffdde0b9642a42e8f5987e06eb01220ff7776 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /OpenSim/OpenSim.RegionServer/Client/ClientView.ProcessPackets.cs | |
parent | Who would have known that the only way of specifying utf-8 without preamble, ... (diff) | |
download | opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.zip opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.gz opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.bz2 opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.xz |
* Wiping trunk in prep for Sugilite
Diffstat (limited to '')
-rw-r--r-- | OpenSim/OpenSim.RegionServer/Client/ClientView.ProcessPackets.cs | 523 |
1 files changed, 0 insertions, 523 deletions
diff --git a/OpenSim/OpenSim.RegionServer/Client/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/Client/ClientView.ProcessPackets.cs deleted file mode 100644 index 306bf63..0000000 --- a/OpenSim/OpenSim.RegionServer/Client/ClientView.ProcessPackets.cs +++ /dev/null | |||
@@ -1,523 +0,0 @@ | |||
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 System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using Nwc.XmlRpc; | ||
34 | using System.Net; | ||
35 | using System.Net.Sockets; | ||
36 | using System.IO; | ||
37 | using System.Threading; | ||
38 | using System.Timers; | ||
39 | using OpenSim.Framework.Interfaces; | ||
40 | using OpenSim.Framework.Types; | ||
41 | using OpenSim.Framework.Inventory; | ||
42 | using OpenSim.Framework.Utilities; | ||
43 | using OpenSim.RegionServer.Simulator; | ||
44 | using OpenSim.RegionServer.Assets; | ||
45 | using OpenSim.Framework.Console; | ||
46 | |||
47 | namespace OpenSim.RegionServer.Client | ||
48 | { | ||
49 | public partial class ClientView | ||
50 | { | ||
51 | public delegate void GenericCall(ClientView remoteClient); | ||
52 | public delegate void GenericCall2(); | ||
53 | public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary. | ||
54 | public delegate void GenericCall4(Packet packet, ClientView remoteClient); | ||
55 | public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); | ||
56 | public delegate void ObjectSelect(uint localID, ClientView remoteClient); | ||
57 | public delegate void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient); | ||
58 | public delegate void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient); | ||
59 | public delegate void UpdatePrimVector(uint localID, LLVector3 pos, ClientView remoteClient); | ||
60 | public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient); | ||
61 | public delegate void StatusChange(bool status); | ||
62 | |||
63 | |||
64 | public event ChatFromViewer OnChatFromViewer; | ||
65 | public event RezObject OnRezObject; | ||
66 | public event GenericCall4 OnDeRezObject; | ||
67 | public event ModifyTerrain OnModifyTerrain; | ||
68 | public event GenericCall OnRegionHandShakeReply; | ||
69 | public event GenericCall OnRequestWearables; | ||
70 | public event SetAppearance OnSetAppearance; | ||
71 | public event GenericCall2 OnCompleteMovementToRegion; | ||
72 | public event GenericCall3 OnAgentUpdate; | ||
73 | public event StartAnim OnStartAnim; | ||
74 | public event GenericCall OnRequestAvatarsData; | ||
75 | public event LinkObjects OnLinkObjects; | ||
76 | public event GenericCall4 OnAddPrim; | ||
77 | public event UpdateShape OnUpdatePrimShape; | ||
78 | public event ObjectSelect OnObjectSelect; | ||
79 | public event UpdatePrimFlags OnUpdatePrimFlags; | ||
80 | public event UpdatePrimTexture OnUpdatePrimTexture; | ||
81 | public event UpdatePrimVector OnUpdatePrimPosition; | ||
82 | public event UpdatePrimRotation OnUpdatePrimRotation; | ||
83 | public event UpdatePrimVector OnUpdatePrimScale; | ||
84 | public event StatusChange OnChildAgentStatus; | ||
85 | |||
86 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | ||
87 | public event ParcelDivideRequest OnParcelDivideRequest; | ||
88 | public event ParcelJoinRequest OnParcelJoinRequest; | ||
89 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | ||
90 | |||
91 | protected override void ProcessInPacket(Packet Pack) | ||
92 | { | ||
93 | ack_pack(Pack); | ||
94 | if (debug) | ||
95 | { | ||
96 | if (Pack.Type != PacketType.AgentUpdate) | ||
97 | { | ||
98 | Console.WriteLine("IN: " + Pack.Type.ToString()); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | |||
103 | if (this.ProcessPacketMethod(Pack)) | ||
104 | { | ||
105 | //there is a handler registered that handled this packet type | ||
106 | return; | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
111 | |||
112 | switch (Pack.Type) | ||
113 | { | ||
114 | case PacketType.ViewerEffect: | ||
115 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; | ||
116 | foreach (ClientView client in m_clientThreads.Values) | ||
117 | { | ||
118 | if (client.AgentID != this.AgentID) | ||
119 | { | ||
120 | viewer.AgentData.AgentID = client.AgentID; | ||
121 | viewer.AgentData.SessionID = client.SessionID; | ||
122 | client.OutPacket(viewer); | ||
123 | } | ||
124 | } | ||
125 | break; | ||
126 | |||
127 | #region New Event System - World/Avatar | ||
128 | case PacketType.ChatFromViewer: | ||
129 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | ||
130 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") | ||
131 | { | ||
132 | //empty message so don't bother with it | ||
133 | break; | ||
134 | } | ||
135 | string fromName = ClientAvatar.firstname + " " + ClientAvatar.lastname; | ||
136 | byte[] message = inchatpack.ChatData.Message; | ||
137 | byte type = inchatpack.ChatData.Type; | ||
138 | LLVector3 fromPos = ClientAvatar.Pos; | ||
139 | LLUUID fromAgentID = AgentID; | ||
140 | this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); | ||
141 | break; | ||
142 | case PacketType.RezObject: | ||
143 | RezObjectPacket rezPacket = (RezObjectPacket)Pack; | ||
144 | AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID); | ||
145 | if (inven != null) | ||
146 | { | ||
147 | if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) | ||
148 | { | ||
149 | AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID); | ||
150 | if (asset != null) | ||
151 | { | ||
152 | this.OnRezObject(asset, rezPacket.RezData.RayEnd); | ||
153 | this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID); | ||
154 | } | ||
155 | } | ||
156 | } | ||
157 | break; | ||
158 | case PacketType.DeRezObject: | ||
159 | OnDeRezObject(Pack, this); | ||
160 | break; | ||
161 | case PacketType.ModifyLand: | ||
162 | ModifyLandPacket modify = (ModifyLandPacket)Pack; | ||
163 | if (modify.ParcelData.Length > 0) | ||
164 | { | ||
165 | OnModifyTerrain(modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West); | ||
166 | } | ||
167 | break; | ||
168 | case PacketType.RegionHandshakeReply: | ||
169 | OnRegionHandShakeReply(this); | ||
170 | break; | ||
171 | case PacketType.AgentWearablesRequest: | ||
172 | OnRequestWearables(this); | ||
173 | OnRequestAvatarsData(this); | ||
174 | break; | ||
175 | case PacketType.AgentSetAppearance: | ||
176 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; | ||
177 | OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); | ||
178 | break; | ||
179 | case PacketType.CompleteAgentMovement: | ||
180 | if (this.m_child) this.UpgradeClient(); | ||
181 | OnCompleteMovementToRegion(); | ||
182 | this.EnableNeighbours(); | ||
183 | break; | ||
184 | case PacketType.AgentUpdate: | ||
185 | OnAgentUpdate(Pack); | ||
186 | break; | ||
187 | case PacketType.AgentAnimation: | ||
188 | if (!m_child) | ||
189 | { | ||
190 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; | ||
191 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | ||
192 | { | ||
193 | if (AgentAni.AnimationList[i].StartAnim) | ||
194 | { | ||
195 | OnStartAnim(AgentAni.AnimationList[i].AnimID, 1); | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | break; | ||
200 | |||
201 | #endregion | ||
202 | |||
203 | #region New Event System - Objects/Prims | ||
204 | case PacketType.ObjectLink: | ||
205 | ObjectLinkPacket link = (ObjectLinkPacket)Pack; | ||
206 | uint parentprimid = 0; | ||
207 | List<uint> childrenprims = new List<uint>(); | ||
208 | if (link.ObjectData.Length > 1) | ||
209 | { | ||
210 | parentprimid = link.ObjectData[0].ObjectLocalID; | ||
211 | |||
212 | for (int i = 1; i < link.ObjectData.Length; i++) | ||
213 | { | ||
214 | childrenprims.Add(link.ObjectData[i].ObjectLocalID); | ||
215 | } | ||
216 | } | ||
217 | OnLinkObjects(parentprimid, childrenprims); | ||
218 | break; | ||
219 | case PacketType.ObjectAdd: | ||
220 | m_world.AddNewPrim((ObjectAddPacket)Pack, this); | ||
221 | OnAddPrim(Pack, this); | ||
222 | break; | ||
223 | case PacketType.ObjectShape: | ||
224 | ObjectShapePacket shape = (ObjectShapePacket)Pack; | ||
225 | for (int i = 0; i < shape.ObjectData.Length; i++) | ||
226 | { | ||
227 | OnUpdatePrimShape(shape.ObjectData[i].ObjectLocalID, shape.ObjectData[i]); | ||
228 | } | ||
229 | break; | ||
230 | case PacketType.ObjectSelect: | ||
231 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | ||
232 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | ||
233 | { | ||
234 | OnObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this); | ||
235 | } | ||
236 | break; | ||
237 | case PacketType.ObjectFlagUpdate: | ||
238 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; | ||
239 | OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); | ||
240 | break; | ||
241 | case PacketType.ObjectImage: | ||
242 | ObjectImagePacket imagePack = (ObjectImagePacket)Pack; | ||
243 | for (int i = 0; i < imagePack.ObjectData.Length; i++) | ||
244 | { | ||
245 | OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this); | ||
246 | |||
247 | } | ||
248 | break; | ||
249 | #endregion | ||
250 | |||
251 | #region Inventory/Asset/Other related packets | ||
252 | case PacketType.RequestImage: | ||
253 | RequestImagePacket imageRequest = (RequestImagePacket)Pack; | ||
254 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) | ||
255 | { | ||
256 | m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); | ||
257 | } | ||
258 | break; | ||
259 | case PacketType.TransferRequest: | ||
260 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | ||
261 | m_assetCache.AddAssetRequest(this, transfer); | ||
262 | break; | ||
263 | case PacketType.AssetUploadRequest: | ||
264 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; | ||
265 | this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); | ||
266 | break; | ||
267 | case PacketType.RequestXfer: | ||
268 | break; | ||
269 | case PacketType.SendXferPacket: | ||
270 | this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); | ||
271 | break; | ||
272 | case PacketType.CreateInventoryFolder: | ||
273 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | ||
274 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | ||
275 | break; | ||
276 | case PacketType.CreateInventoryItem: | ||
277 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; | ||
278 | if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) | ||
279 | { | ||
280 | this.UploadAssets.CreateInventoryItem(createItem); | ||
281 | } | ||
282 | else | ||
283 | { | ||
284 | this.CreateInventoryItem(createItem); | ||
285 | } | ||
286 | break; | ||
287 | case PacketType.FetchInventory: | ||
288 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; | ||
289 | m_inventoryCache.FetchInventory(this, FetchInventory); | ||
290 | break; | ||
291 | case PacketType.FetchInventoryDescendents: | ||
292 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | ||
293 | m_inventoryCache.FetchInventoryDescendents(this, Fetch); | ||
294 | break; | ||
295 | case PacketType.UpdateInventoryItem: | ||
296 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; | ||
297 | for (int i = 0; i < update.InventoryData.Length; i++) | ||
298 | { | ||
299 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) | ||
300 | { | ||
301 | AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); | ||
302 | if (asset != null) | ||
303 | { | ||
304 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); | ||
305 | } | ||
306 | else | ||
307 | { | ||
308 | asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); | ||
309 | if (asset != null) | ||
310 | { | ||
311 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); | ||
312 | } | ||
313 | else | ||
314 | { | ||
315 | |||
316 | } | ||
317 | } | ||
318 | } | ||
319 | else | ||
320 | { | ||
321 | m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; | ||
322 | } | ||
323 | } | ||
324 | break; | ||
325 | case PacketType.RequestTaskInventory: | ||
326 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; | ||
327 | ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); | ||
328 | bool foundent = false; | ||
329 | foreach (Entity ent in m_world.Entities.Values) | ||
330 | { | ||
331 | if (ent.localid == requesttask.InventoryData.LocalID) | ||
332 | { | ||
333 | replytask.InventoryData.TaskID = ent.uuid; | ||
334 | replytask.InventoryData.Serial = 0; | ||
335 | replytask.InventoryData.Filename = new byte[0]; | ||
336 | foundent = true; | ||
337 | } | ||
338 | } | ||
339 | if (foundent) | ||
340 | { | ||
341 | this.OutPacket(replytask); | ||
342 | } | ||
343 | break; | ||
344 | case PacketType.UpdateTaskInventory: | ||
345 | UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; | ||
346 | AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID); | ||
347 | if (myinventory != null) | ||
348 | { | ||
349 | if (updatetask.UpdateData.Key == 0) | ||
350 | { | ||
351 | if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null) | ||
352 | { | ||
353 | if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7) | ||
354 | { | ||
355 | LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID; | ||
356 | AssetBase assBase = this.m_assetCache.GetAsset(noteaid); | ||
357 | if (assBase != null) | ||
358 | { | ||
359 | foreach (Entity ent in m_world.Entities.Values) | ||
360 | { | ||
361 | if (ent.localid == updatetask.UpdateData.LocalID) | ||
362 | { | ||
363 | if (ent is OpenSim.RegionServer.Simulator.Primitive) | ||
364 | { | ||
365 | this.m_world.AddScript(ent, Util.FieldToString(assBase.Data)); | ||
366 | } | ||
367 | } | ||
368 | } | ||
369 | } | ||
370 | } | ||
371 | } | ||
372 | } | ||
373 | } | ||
374 | break; | ||
375 | case PacketType.MapLayerRequest: | ||
376 | // This be busted. | ||
377 | MapLayerRequestPacket MapRequest = (MapLayerRequestPacket)Pack; | ||
378 | this.RequestMapLayer(); | ||
379 | this.RequestMapBlocks((int)this.m_regionData.RegionLocX - 5, (int)this.m_regionData.RegionLocY - 5, (int)this.m_regionData.RegionLocX + 5, (int)this.m_regionData.RegionLocY + 5); | ||
380 | break; | ||
381 | |||
382 | case PacketType.MapBlockRequest: | ||
383 | MapBlockRequestPacket MapBRequest = (MapBlockRequestPacket)Pack; | ||
384 | this.RequestMapBlocks(MapBRequest.PositionData.MinX, MapBRequest.PositionData.MinY, MapBRequest.PositionData.MaxX, MapBRequest.PositionData.MaxY); | ||
385 | break; | ||
386 | |||
387 | case PacketType.MapNameRequest: | ||
388 | // TODO. | ||
389 | break; | ||
390 | |||
391 | case PacketType.TeleportLandmarkRequest: | ||
392 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; | ||
393 | |||
394 | TeleportStartPacket tpStart = new TeleportStartPacket(); | ||
395 | tpStart.Info.TeleportFlags = 8; // tp via lm | ||
396 | this.OutPacket(tpStart); | ||
397 | |||
398 | TeleportProgressPacket tpProgress = new TeleportProgressPacket(); | ||
399 | tpProgress.Info.Message = (new System.Text.ASCIIEncoding()).GetBytes("sending_landmark"); | ||
400 | tpProgress.Info.TeleportFlags = 8; | ||
401 | tpProgress.AgentData.AgentID = tpReq.Info.AgentID; | ||
402 | this.OutPacket(tpProgress); | ||
403 | |||
404 | // Fetch landmark | ||
405 | LLUUID lmid = tpReq.Info.LandmarkID; | ||
406 | AssetBase lma = this.m_assetCache.GetAsset(lmid); | ||
407 | if (lma != null) | ||
408 | { | ||
409 | AssetLandmark lm = new AssetLandmark(lma); | ||
410 | |||
411 | if (lm.RegionID == m_regionData.SimUUID) | ||
412 | { | ||
413 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | ||
414 | |||
415 | tpLocal.Info.AgentID = tpReq.Info.AgentID; | ||
416 | tpLocal.Info.TeleportFlags = 8; // Teleport via landmark | ||
417 | tpLocal.Info.LocationID = 2; | ||
418 | tpLocal.Info.Position = lm.Position; | ||
419 | OutPacket(tpLocal); | ||
420 | } | ||
421 | else | ||
422 | { | ||
423 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | ||
424 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | ||
425 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | ||
426 | OutPacket(tpCancel); | ||
427 | } | ||
428 | } | ||
429 | else | ||
430 | { | ||
431 | Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); | ||
432 | |||
433 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | ||
434 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | ||
435 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | ||
436 | OutPacket(tpCancel); | ||
437 | } | ||
438 | break; | ||
439 | case PacketType.TeleportLocationRequest: | ||
440 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; | ||
441 | Console.WriteLine(tpLocReq.ToString()); | ||
442 | |||
443 | tpStart = new TeleportStartPacket(); | ||
444 | tpStart.Info.TeleportFlags = 16; // Teleport via location | ||
445 | Console.WriteLine(tpStart.ToString()); | ||
446 | OutPacket(tpStart); | ||
447 | |||
448 | if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle) | ||
449 | { | ||
450 | /* m_gridServer.getRegion(tpLocReq.Info.RegionHandle); */ | ||
451 | Console.WriteLine("Inter-sim teleport not yet implemented"); | ||
452 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | ||
453 | tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; | ||
454 | tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; | ||
455 | |||
456 | OutPacket(tpCancel); | ||
457 | } | ||
458 | else | ||
459 | { | ||
460 | Console.WriteLine("Local teleport"); | ||
461 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | ||
462 | tpLocal.Info.AgentID = tpLocReq.AgentData.AgentID; | ||
463 | tpLocal.Info.TeleportFlags = tpStart.Info.TeleportFlags; | ||
464 | tpLocal.Info.LocationID = 2; | ||
465 | tpLocal.Info.LookAt = tpLocReq.Info.LookAt; | ||
466 | tpLocal.Info.Position = tpLocReq.Info.Position; | ||
467 | OutPacket(tpLocal); | ||
468 | |||
469 | } | ||
470 | break; | ||
471 | #endregion | ||
472 | |||
473 | #region Parcel Packets | ||
474 | case PacketType.ParcelPropertiesRequest: | ||
475 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; | ||
476 | OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North),propertiesRequest.ParcelData.SequenceID,propertiesRequest.ParcelData.SnapSelection, this); | ||
477 | break; | ||
478 | case PacketType.ParcelDivide: | ||
479 | ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack; | ||
480 | OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this); | ||
481 | break; | ||
482 | case PacketType.ParcelJoin: | ||
483 | ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack; | ||
484 | OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this); | ||
485 | break; | ||
486 | case PacketType.ParcelPropertiesUpdate: | ||
487 | ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; | ||
488 | OnParcelPropertiesUpdateRequest(updatePacket, this); | ||
489 | break; | ||
490 | #endregion | ||
491 | |||
492 | #region Estate Packets | ||
493 | case PacketType.EstateOwnerMessage: | ||
494 | this.m_world.estateManager.handleEstateOwnerMessage((EstateOwnerMessagePacket)Pack, this); | ||
495 | break; | ||
496 | #endregion | ||
497 | #region unimplemented handlers | ||
498 | case PacketType.AgentIsNowWearing: | ||
499 | // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; | ||
500 | break; | ||
501 | case PacketType.ObjectScale: | ||
502 | break; | ||
503 | case PacketType.MoneyBalanceRequest: | ||
504 | //This need to be actually done and not thrown back with fake infos | ||
505 | break; | ||
506 | |||
507 | case PacketType.EstateCovenantRequest: | ||
508 | //This should be actually done and not thrown back with fake info | ||
509 | EstateCovenantRequestPacket estateCovenantRequest = (EstateCovenantRequestPacket)Pack; | ||
510 | EstateCovenantReplyPacket estateCovenantReply = new EstateCovenantReplyPacket(); | ||
511 | estateCovenantReply.Data.EstateName = libsecondlife.Helpers.StringToField("Leet Estate"); | ||
512 | estateCovenantReply.Data.EstateOwnerID = LLUUID.Zero; | ||
513 | estateCovenantReply.Data.CovenantID = LLUUID.Zero; | ||
514 | estateCovenantReply.Data.CovenantTimestamp = (uint)0; | ||
515 | this.OutPacket((Packet)estateCovenantReply); | ||
516 | MainConsole.Instance.Notice("Sent Temporary Estate packet (they are in leet estate)"); | ||
517 | break; | ||
518 | #endregion | ||
519 | } | ||
520 | } | ||
521 | } | ||
522 | } | ||
523 | } | ||