diff options
author | Sean Dague | 2007-07-16 15:40:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-16 15:40:11 +0000 |
commit | 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch) | |
tree | e3f80ad51736cf17e856547b1bcf956010927434 /OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |
parent | *Trunk compiles now (diff) | |
download | opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2 opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz |
changed to native line ending encoding
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 1294 |
1 files changed, 647 insertions, 647 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index a8512a7..1f9110c 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -1,647 +1,647 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework.Inventory; | 33 | using OpenSim.Framework.Inventory; |
34 | using OpenSim.Framework.Types; | 34 | using OpenSim.Framework.Types; |
35 | using OpenSim.Framework.Utilities; | 35 | using OpenSim.Framework.Utilities; |
36 | 36 | ||
37 | namespace OpenSim.Region.ClientStack | 37 | namespace OpenSim.Region.ClientStack |
38 | { | 38 | { |
39 | public partial class ClientView | 39 | public partial class ClientView |
40 | { | 40 | { |
41 | protected override void ProcessInPacket(Packet Pack) | 41 | protected override void ProcessInPacket(Packet Pack) |
42 | { | 42 | { |
43 | ack_pack(Pack); | 43 | ack_pack(Pack); |
44 | if (debug) | 44 | if (debug) |
45 | { | 45 | { |
46 | if (Pack.Type != PacketType.AgentUpdate) | 46 | if (Pack.Type != PacketType.AgentUpdate) |
47 | { | 47 | { |
48 | Console.WriteLine(CircuitCode + ":IN: " + Pack.Type.ToString()); | 48 | Console.WriteLine(CircuitCode + ":IN: " + Pack.Type.ToString()); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | if (this.ProcessPacketMethod(Pack)) | 52 | if (this.ProcessPacketMethod(Pack)) |
53 | { | 53 | { |
54 | //there is a handler registered that handled this packet type | 54 | //there is a handler registered that handled this packet type |
55 | return; | 55 | return; |
56 | } | 56 | } |
57 | else | 57 | else |
58 | { | 58 | { |
59 | Encoding _enc = Encoding.ASCII; | 59 | Encoding _enc = Encoding.ASCII; |
60 | 60 | ||
61 | switch (Pack.Type) | 61 | switch (Pack.Type) |
62 | { | 62 | { |
63 | case PacketType.ViewerEffect: | 63 | case PacketType.ViewerEffect: |
64 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; | 64 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; |
65 | foreach (ClientView client in m_clientThreads.Values) | 65 | foreach (ClientView client in m_clientThreads.Values) |
66 | { | 66 | { |
67 | if (client.AgentID != this.AgentID) | 67 | if (client.AgentID != this.AgentID) |
68 | { | 68 | { |
69 | viewer.AgentData.AgentID = client.AgentID; | 69 | viewer.AgentData.AgentID = client.AgentID; |
70 | viewer.AgentData.SessionID = client.SessionID; | 70 | viewer.AgentData.SessionID = client.SessionID; |
71 | client.OutPacket(viewer); | 71 | client.OutPacket(viewer); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | break; | 74 | break; |
75 | 75 | ||
76 | #region World/Avatar | 76 | #region World/Avatar |
77 | case PacketType.ChatFromViewer: | 77 | case PacketType.ChatFromViewer: |
78 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | 78 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; |
79 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") | 79 | if (Util.FieldToString(inchatpack.ChatData.Message) == "") |
80 | { | 80 | { |
81 | //empty message so don't bother with it | 81 | //empty message so don't bother with it |
82 | break; | 82 | break; |
83 | } | 83 | } |
84 | string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname; | 84 | string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname; |
85 | byte[] message = inchatpack.ChatData.Message; | 85 | byte[] message = inchatpack.ChatData.Message; |
86 | byte type = inchatpack.ChatData.Type; | 86 | byte type = inchatpack.ChatData.Type; |
87 | LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos; | 87 | LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos; |
88 | LLUUID fromAgentID = AgentID; | 88 | LLUUID fromAgentID = AgentID; |
89 | if (OnChatFromViewer != null) | 89 | if (OnChatFromViewer != null) |
90 | { | 90 | { |
91 | this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); | 91 | this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); |
92 | } | 92 | } |
93 | break; | 93 | break; |
94 | case PacketType.ImprovedInstantMessage: | 94 | case PacketType.ImprovedInstantMessage: |
95 | ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; | 95 | ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; |
96 | 96 | ||
97 | string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); | 97 | string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); |
98 | string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); | 98 | string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); |
99 | 99 | ||
100 | if (OnInstantMessage != null) | 100 | if (OnInstantMessage != null) |
101 | { | 101 | { |
102 | this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.MessageBlock.ToAgentID, | 102 | this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.MessageBlock.ToAgentID, |
103 | msgpack.MessageBlock.Timestamp, IMfromName, IMmessage); | 103 | msgpack.MessageBlock.Timestamp, IMfromName, IMmessage); |
104 | } | 104 | } |
105 | break; | 105 | break; |
106 | case PacketType.RezObject: | 106 | case PacketType.RezObject: |
107 | RezObjectPacket rezPacket = (RezObjectPacket)Pack; | 107 | RezObjectPacket rezPacket = (RezObjectPacket)Pack; |
108 | AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID); | 108 | AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID); |
109 | if (inven != null) | 109 | if (inven != null) |
110 | { | 110 | { |
111 | if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) | 111 | if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) |
112 | { | 112 | { |
113 | AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID); | 113 | AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID); |
114 | if (asset != null) | 114 | if (asset != null) |
115 | { | 115 | { |
116 | if (OnRezObject != null) | 116 | if (OnRezObject != null) |
117 | { | 117 | { |
118 | this.OnRezObject(asset, rezPacket.RezData.RayEnd); | 118 | this.OnRezObject(asset, rezPacket.RezData.RayEnd); |
119 | this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID); | 119 | this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | } | 122 | } |
123 | } | 123 | } |
124 | break; | 124 | break; |
125 | case PacketType.DeRezObject: | 125 | case PacketType.DeRezObject: |
126 | if (OnDeRezObject != null) | 126 | if (OnDeRezObject != null) |
127 | { | 127 | { |
128 | OnDeRezObject(Pack, this); | 128 | OnDeRezObject(Pack, this); |
129 | } | 129 | } |
130 | break; | 130 | break; |
131 | case PacketType.ModifyLand: | 131 | case PacketType.ModifyLand: |
132 | ModifyLandPacket modify = (ModifyLandPacket)Pack; | 132 | ModifyLandPacket modify = (ModifyLandPacket)Pack; |
133 | if (modify.ParcelData.Length > 0) | 133 | if (modify.ParcelData.Length > 0) |
134 | { | 134 | { |
135 | if (OnModifyTerrain != null) | 135 | if (OnModifyTerrain != null) |
136 | { | 136 | { |
137 | OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, | 137 | OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize, |
138 | modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West); | 138 | modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | break; | 141 | break; |
142 | case PacketType.RegionHandshakeReply: | 142 | case PacketType.RegionHandshakeReply: |
143 | if (OnRegionHandShakeReply != null) | 143 | if (OnRegionHandShakeReply != null) |
144 | { | 144 | { |
145 | OnRegionHandShakeReply(this); | 145 | OnRegionHandShakeReply(this); |
146 | } | 146 | } |
147 | break; | 147 | break; |
148 | case PacketType.AgentWearablesRequest: | 148 | case PacketType.AgentWearablesRequest: |
149 | if (OnRequestWearables != null) | 149 | if (OnRequestWearables != null) |
150 | { | 150 | { |
151 | OnRequestWearables(this); | 151 | OnRequestWearables(this); |
152 | } | 152 | } |
153 | if (OnRequestAvatarsData != null) | 153 | if (OnRequestAvatarsData != null) |
154 | { | 154 | { |
155 | OnRequestAvatarsData(this); | 155 | OnRequestAvatarsData(this); |
156 | } | 156 | } |
157 | break; | 157 | break; |
158 | case PacketType.AgentSetAppearance: | 158 | case PacketType.AgentSetAppearance: |
159 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; | 159 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; |
160 | if (OnSetAppearance != null) | 160 | if (OnSetAppearance != null) |
161 | { | 161 | { |
162 | OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); | 162 | OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam); |
163 | } | 163 | } |
164 | break; | 164 | break; |
165 | case PacketType.CompleteAgentMovement: | 165 | case PacketType.CompleteAgentMovement: |
166 | if (OnCompleteMovementToRegion != null) | 166 | if (OnCompleteMovementToRegion != null) |
167 | { | 167 | { |
168 | OnCompleteMovementToRegion(); | 168 | OnCompleteMovementToRegion(); |
169 | } | 169 | } |
170 | break; | 170 | break; |
171 | case PacketType.AgentUpdate: | 171 | case PacketType.AgentUpdate: |
172 | if (OnAgentUpdate != null) | 172 | if (OnAgentUpdate != null) |
173 | { | 173 | { |
174 | AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; | 174 | AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; |
175 | OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); | 175 | OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); |
176 | } | 176 | } |
177 | break; | 177 | break; |
178 | case PacketType.AgentAnimation: | 178 | case PacketType.AgentAnimation: |
179 | if (!m_child) | 179 | if (!m_child) |
180 | { | 180 | { |
181 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; | 181 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; |
182 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | 182 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) |
183 | { | 183 | { |
184 | if (AgentAni.AnimationList[i].StartAnim) | 184 | if (AgentAni.AnimationList[i].StartAnim) |
185 | { | 185 | { |
186 | if (OnStartAnim != null) | 186 | if (OnStartAnim != null) |
187 | { | 187 | { |
188 | OnStartAnim(AgentAni.AnimationList[i].AnimID, 1); | 188 | OnStartAnim(AgentAni.AnimationList[i].AnimID, 1); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | } | 191 | } |
192 | } | 192 | } |
193 | break; | 193 | break; |
194 | 194 | ||
195 | #endregion | 195 | #endregion |
196 | 196 | ||
197 | #region Objects/Prims | 197 | #region Objects/Prims |
198 | case PacketType.ObjectLink: | 198 | case PacketType.ObjectLink: |
199 | // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); | 199 | // OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); |
200 | ObjectLinkPacket link = (ObjectLinkPacket)Pack; | 200 | ObjectLinkPacket link = (ObjectLinkPacket)Pack; |
201 | uint parentprimid = 0; | 201 | uint parentprimid = 0; |
202 | List<uint> childrenprims = new List<uint>(); | 202 | List<uint> childrenprims = new List<uint>(); |
203 | if (link.ObjectData.Length > 1) | 203 | if (link.ObjectData.Length > 1) |
204 | { | 204 | { |
205 | parentprimid = link.ObjectData[0].ObjectLocalID; | 205 | parentprimid = link.ObjectData[0].ObjectLocalID; |
206 | 206 | ||
207 | for (int i = 1; i < link.ObjectData.Length; i++) | 207 | for (int i = 1; i < link.ObjectData.Length; i++) |
208 | { | 208 | { |
209 | childrenprims.Add(link.ObjectData[i].ObjectLocalID); | 209 | childrenprims.Add(link.ObjectData[i].ObjectLocalID); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | if (OnLinkObjects != null) | 212 | if (OnLinkObjects != null) |
213 | { | 213 | { |
214 | OnLinkObjects(parentprimid, childrenprims); | 214 | OnLinkObjects(parentprimid, childrenprims); |
215 | } | 215 | } |
216 | break; | 216 | break; |
217 | case PacketType.ObjectAdd: | 217 | case PacketType.ObjectAdd: |
218 | if (OnAddPrim != null) | 218 | if (OnAddPrim != null) |
219 | { | 219 | { |
220 | ObjectAddPacket addPacket = (ObjectAddPacket) Pack ; | 220 | ObjectAddPacket addPacket = (ObjectAddPacket) Pack ; |
221 | 221 | ||
222 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); | 222 | PrimitiveBaseShape shape = new PrimitiveBaseShape(); |
223 | 223 | ||
224 | shape.PCode = addPacket.ObjectData.PCode; | 224 | shape.PCode = addPacket.ObjectData.PCode; |
225 | shape.PathBegin = addPacket.ObjectData.PathBegin; | 225 | shape.PathBegin = addPacket.ObjectData.PathBegin; |
226 | shape.PathEnd = addPacket.ObjectData.PathEnd; | 226 | shape.PathEnd = addPacket.ObjectData.PathEnd; |
227 | shape.PathScaleX = addPacket.ObjectData.PathScaleX; | 227 | shape.PathScaleX = addPacket.ObjectData.PathScaleX; |
228 | shape.PathScaleY = addPacket.ObjectData.PathScaleY; | 228 | shape.PathScaleY = addPacket.ObjectData.PathScaleY; |
229 | shape.PathShearX = addPacket.ObjectData.PathShearX; | 229 | shape.PathShearX = addPacket.ObjectData.PathShearX; |
230 | shape.PathShearY = addPacket.ObjectData.PathShearY; | 230 | shape.PathShearY = addPacket.ObjectData.PathShearY; |
231 | shape.PathSkew = addPacket.ObjectData.PathSkew; | 231 | shape.PathSkew = addPacket.ObjectData.PathSkew; |
232 | shape.ProfileBegin = addPacket.ObjectData.ProfileBegin; | 232 | shape.ProfileBegin = addPacket.ObjectData.ProfileBegin; |
233 | shape.ProfileEnd = addPacket.ObjectData.ProfileEnd; | 233 | shape.ProfileEnd = addPacket.ObjectData.ProfileEnd; |
234 | shape.Scale = addPacket.ObjectData.Scale; | 234 | shape.Scale = addPacket.ObjectData.Scale; |
235 | shape.PathCurve = addPacket.ObjectData.PathCurve; | 235 | shape.PathCurve = addPacket.ObjectData.PathCurve; |
236 | shape.ProfileCurve = addPacket.ObjectData.ProfileCurve; | 236 | shape.ProfileCurve = addPacket.ObjectData.ProfileCurve; |
237 | shape.ProfileHollow = addPacket.ObjectData.ProfileHollow; | 237 | shape.ProfileHollow = addPacket.ObjectData.ProfileHollow; |
238 | shape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; | 238 | shape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; |
239 | shape.PathRevolutions = addPacket.ObjectData.PathRevolutions; | 239 | shape.PathRevolutions = addPacket.ObjectData.PathRevolutions; |
240 | shape.PathTaperX = addPacket.ObjectData.PathTaperX; | 240 | shape.PathTaperX = addPacket.ObjectData.PathTaperX; |
241 | shape.PathTaperY = addPacket.ObjectData.PathTaperY; | 241 | shape.PathTaperY = addPacket.ObjectData.PathTaperY; |
242 | shape.PathTwist = addPacket.ObjectData.PathTwist; | 242 | shape.PathTwist = addPacket.ObjectData.PathTwist; |
243 | shape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | 243 | shape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; |
244 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")); | 244 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")); |
245 | shape.TextureEntry = ntex.ToBytes(); | 245 | shape.TextureEntry = ntex.ToBytes(); |
246 | 246 | ||
247 | OnAddPrim(this.AgentId, addPacket.ObjectData.RayEnd, shape); | 247 | OnAddPrim(this.AgentId, addPacket.ObjectData.RayEnd, shape); |
248 | } | 248 | } |
249 | break; | 249 | break; |
250 | case PacketType.ObjectShape: | 250 | case PacketType.ObjectShape: |
251 | ObjectShapePacket shapePacket = (ObjectShapePacket)Pack; | 251 | ObjectShapePacket shapePacket = (ObjectShapePacket)Pack; |
252 | for (int i = 0; i < shapePacket.ObjectData.Length; i++) | 252 | for (int i = 0; i < shapePacket.ObjectData.Length; i++) |
253 | { | 253 | { |
254 | if (OnUpdatePrimShape != null) | 254 | if (OnUpdatePrimShape != null) |
255 | { | 255 | { |
256 | OnUpdatePrimShape(shapePacket.ObjectData[i].ObjectLocalID, shapePacket.ObjectData[i]); | 256 | OnUpdatePrimShape(shapePacket.ObjectData[i].ObjectLocalID, shapePacket.ObjectData[i]); |
257 | } | 257 | } |
258 | } | 258 | } |
259 | break; | 259 | break; |
260 | case PacketType.ObjectDuplicate: | 260 | case PacketType.ObjectDuplicate: |
261 | ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; | 261 | ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; |
262 | for (int i = 0; i < dupe.ObjectData.Length; i++) | 262 | for (int i = 0; i < dupe.ObjectData.Length; i++) |
263 | { | 263 | { |
264 | if (OnObjectDuplicate != null) | 264 | if (OnObjectDuplicate != null) |
265 | { | 265 | { |
266 | OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags); | 266 | OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, dupe.SharedData.DuplicateFlags); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | break; | 270 | break; |
271 | 271 | ||
272 | case PacketType.ObjectSelect: | 272 | case PacketType.ObjectSelect: |
273 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | 273 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; |
274 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | 274 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) |
275 | { | 275 | { |
276 | if (OnObjectSelect != null) | 276 | if (OnObjectSelect != null) |
277 | { | 277 | { |
278 | OnObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this); | 278 | OnObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this); |
279 | } | 279 | } |
280 | } | 280 | } |
281 | break; | 281 | break; |
282 | case PacketType.ObjectDeselect: | 282 | case PacketType.ObjectDeselect: |
283 | ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; | 283 | ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; |
284 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) | 284 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) |
285 | { | 285 | { |
286 | if (OnObjectDeselect != null) | 286 | if (OnObjectDeselect != null) |
287 | { | 287 | { |
288 | OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this); | 288 | OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | break; | 291 | break; |
292 | case PacketType.ObjectFlagUpdate: | 292 | case PacketType.ObjectFlagUpdate: |
293 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; | 293 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; |
294 | if (OnUpdatePrimFlags != null) | 294 | if (OnUpdatePrimFlags != null) |
295 | { | 295 | { |
296 | OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); | 296 | OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); |
297 | } | 297 | } |
298 | break; | 298 | break; |
299 | case PacketType.ObjectImage: | 299 | case PacketType.ObjectImage: |
300 | ObjectImagePacket imagePack = (ObjectImagePacket)Pack; | 300 | ObjectImagePacket imagePack = (ObjectImagePacket)Pack; |
301 | for (int i = 0; i < imagePack.ObjectData.Length; i++) | 301 | for (int i = 0; i < imagePack.ObjectData.Length; i++) |
302 | { | 302 | { |
303 | if (OnUpdatePrimTexture != null) | 303 | if (OnUpdatePrimTexture != null) |
304 | { | 304 | { |
305 | OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this); | 305 | OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this); |
306 | } | 306 | } |
307 | } | 307 | } |
308 | break; | 308 | break; |
309 | case PacketType.ObjectGrab: | 309 | case PacketType.ObjectGrab: |
310 | ObjectGrabPacket grap = (ObjectGrabPacket)Pack; | 310 | ObjectGrabPacket grap = (ObjectGrabPacket)Pack; |
311 | if (OnGrapObject != null) | 311 | if (OnGrapObject != null) |
312 | { | 312 | { |
313 | OnGrapObject(grap.ObjectData.LocalID, grap.ObjectData.GrabOffset, this); | 313 | OnGrapObject(grap.ObjectData.LocalID, grap.ObjectData.GrabOffset, this); |
314 | } | 314 | } |
315 | break; | 315 | break; |
316 | case PacketType.ObjectGrabUpdate: | 316 | case PacketType.ObjectGrabUpdate: |
317 | ObjectGrabUpdatePacket grapUpdate = (ObjectGrabUpdatePacket)Pack; | 317 | ObjectGrabUpdatePacket grapUpdate = (ObjectGrabUpdatePacket)Pack; |
318 | if (OnGrapUpdate != null) | 318 | if (OnGrapUpdate != null) |
319 | { | 319 | { |
320 | OnGrapUpdate(grapUpdate.ObjectData.ObjectID, grapUpdate.ObjectData.GrabOffsetInitial, grapUpdate.ObjectData.GrabPosition, this); | 320 | OnGrapUpdate(grapUpdate.ObjectData.ObjectID, grapUpdate.ObjectData.GrabOffsetInitial, grapUpdate.ObjectData.GrabPosition, this); |
321 | } | 321 | } |
322 | break; | 322 | break; |
323 | case PacketType.ObjectDeGrab: | 323 | case PacketType.ObjectDeGrab: |
324 | ObjectDeGrabPacket deGrap = (ObjectDeGrabPacket)Pack; | 324 | ObjectDeGrabPacket deGrap = (ObjectDeGrabPacket)Pack; |
325 | if (OnDeGrapObject != null) | 325 | if (OnDeGrapObject != null) |
326 | { | 326 | { |
327 | OnDeGrapObject(deGrap.ObjectData.LocalID, this); | 327 | OnDeGrapObject(deGrap.ObjectData.LocalID, this); |
328 | } | 328 | } |
329 | break; | 329 | break; |
330 | case PacketType.ObjectDescription: | 330 | case PacketType.ObjectDescription: |
331 | ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; | 331 | ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; |
332 | for (int i = 0; i < objDes.ObjectData.Length; i++) | 332 | for (int i = 0; i < objDes.ObjectData.Length; i++) |
333 | { | 333 | { |
334 | if (OnObjectDescription != null) | 334 | if (OnObjectDescription != null) |
335 | { | 335 | { |
336 | OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description)); | 336 | OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description)); |
337 | } | 337 | } |
338 | } | 338 | } |
339 | break; | 339 | break; |
340 | case PacketType.ObjectName: | 340 | case PacketType.ObjectName: |
341 | ObjectNamePacket objName = (ObjectNamePacket)Pack; | 341 | ObjectNamePacket objName = (ObjectNamePacket)Pack; |
342 | for (int i = 0; i < objName.ObjectData.Length; i++) | 342 | for (int i = 0; i < objName.ObjectData.Length; i++) |
343 | { | 343 | { |
344 | if (OnObjectName != null) | 344 | if (OnObjectName != null) |
345 | { | 345 | { |
346 | OnObjectName(objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name)); | 346 | OnObjectName(objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name)); |
347 | } | 347 | } |
348 | } | 348 | } |
349 | break; | 349 | break; |
350 | case PacketType.ObjectPermissions: | 350 | case PacketType.ObjectPermissions: |
351 | //Console.WriteLine("permissions set " + Pack.ToString()); | 351 | //Console.WriteLine("permissions set " + Pack.ToString()); |
352 | break; | 352 | break; |
353 | #endregion | 353 | #endregion |
354 | 354 | ||
355 | #region Inventory/Asset/Other related packets | 355 | #region Inventory/Asset/Other related packets |
356 | case PacketType.RequestImage: | 356 | case PacketType.RequestImage: |
357 | RequestImagePacket imageRequest = (RequestImagePacket)Pack; | 357 | RequestImagePacket imageRequest = (RequestImagePacket)Pack; |
358 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) | 358 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) |
359 | { | 359 | { |
360 | m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); | 360 | m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); |
361 | } | 361 | } |
362 | break; | 362 | break; |
363 | case PacketType.TransferRequest: | 363 | case PacketType.TransferRequest: |
364 | //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); | 364 | //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); |
365 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | 365 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; |
366 | m_assetCache.AddAssetRequest(this, transfer); | 366 | m_assetCache.AddAssetRequest(this, transfer); |
367 | break; | 367 | break; |
368 | case PacketType.AssetUploadRequest: | 368 | case PacketType.AssetUploadRequest: |
369 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; | 369 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; |
370 | this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); | 370 | this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); |
371 | break; | 371 | break; |
372 | case PacketType.RequestXfer: | 372 | case PacketType.RequestXfer: |
373 | //Console.WriteLine(Pack.ToString()); | 373 | //Console.WriteLine(Pack.ToString()); |
374 | break; | 374 | break; |
375 | case PacketType.SendXferPacket: | 375 | case PacketType.SendXferPacket: |
376 | this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); | 376 | this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); |
377 | break; | 377 | break; |
378 | case PacketType.CreateInventoryFolder: | 378 | case PacketType.CreateInventoryFolder: |
379 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | 379 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; |
380 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | 380 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Util.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); |
381 | //Console.WriteLine(Pack.ToString()); | 381 | //Console.WriteLine(Pack.ToString()); |
382 | break; | 382 | break; |
383 | case PacketType.CreateInventoryItem: | 383 | case PacketType.CreateInventoryItem: |
384 | //Console.WriteLine(Pack.ToString()); | 384 | //Console.WriteLine(Pack.ToString()); |
385 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; | 385 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; |
386 | if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) | 386 | if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) |
387 | { | 387 | { |
388 | this.UploadAssets.CreateInventoryItem(createItem); | 388 | this.UploadAssets.CreateInventoryItem(createItem); |
389 | } | 389 | } |
390 | else | 390 | else |
391 | { | 391 | { |
392 | // Console.Write(Pack.ToString()); | 392 | // Console.Write(Pack.ToString()); |
393 | this.CreateInventoryItem(createItem); | 393 | this.CreateInventoryItem(createItem); |
394 | } | 394 | } |
395 | break; | 395 | break; |
396 | case PacketType.FetchInventory: | 396 | case PacketType.FetchInventory: |
397 | //Console.WriteLine("fetch item packet"); | 397 | //Console.WriteLine("fetch item packet"); |
398 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; | 398 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; |
399 | m_inventoryCache.FetchInventory(this, FetchInventory); | 399 | m_inventoryCache.FetchInventory(this, FetchInventory); |
400 | break; | 400 | break; |
401 | case PacketType.FetchInventoryDescendents: | 401 | case PacketType.FetchInventoryDescendents: |
402 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | 402 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; |
403 | m_inventoryCache.FetchInventoryDescendents(this, Fetch); | 403 | m_inventoryCache.FetchInventoryDescendents(this, Fetch); |
404 | break; | 404 | break; |
405 | case PacketType.UpdateInventoryItem: | 405 | case PacketType.UpdateInventoryItem: |
406 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; | 406 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; |
407 | //Console.WriteLine(Pack.ToString()); | 407 | //Console.WriteLine(Pack.ToString()); |
408 | for (int i = 0; i < update.InventoryData.Length; i++) | 408 | for (int i = 0; i < update.InventoryData.Length; i++) |
409 | { | 409 | { |
410 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) | 410 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) |
411 | { | 411 | { |
412 | AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); | 412 | AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); |
413 | if (asset != null) | 413 | if (asset != null) |
414 | { | 414 | { |
415 | // Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache"); | 415 | // Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache"); |
416 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); | 416 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); |
417 | } | 417 | } |
418 | else | 418 | else |
419 | { | 419 | { |
420 | asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); | 420 | asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); |
421 | if (asset != null) | 421 | if (asset != null) |
422 | { | 422 | { |
423 | //Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache"); | 423 | //Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache"); |
424 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); | 424 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); |
425 | } | 425 | } |
426 | else | 426 | else |
427 | { | 427 | { |
428 | //Console.WriteLine("trying to update inventory item, but asset is null"); | 428 | //Console.WriteLine("trying to update inventory item, but asset is null"); |
429 | } | 429 | } |
430 | } | 430 | } |
431 | } | 431 | } |
432 | else | 432 | else |
433 | { | 433 | { |
434 | m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; | 434 | m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; |
435 | } | 435 | } |
436 | } | 436 | } |
437 | break; | 437 | break; |
438 | case PacketType.RequestTaskInventory: | 438 | case PacketType.RequestTaskInventory: |
439 | // Console.WriteLine(Pack.ToString()); | 439 | // Console.WriteLine(Pack.ToString()); |
440 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; | 440 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; |
441 | ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); | 441 | ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); |
442 | //bool foundent = false; | 442 | //bool foundent = false; |
443 | /* foreach (Entity ent in m_world.Entities.Values) | 443 | /* foreach (Entity ent in m_world.Entities.Values) |
444 | { | 444 | { |
445 | if (ent.localid == requesttask.InventoryData.LocalID) | 445 | if (ent.localid == requesttask.InventoryData.LocalID) |
446 | { | 446 | { |
447 | replytask.InventoryData.TaskID = ent.uuid; | 447 | replytask.InventoryData.TaskID = ent.uuid; |
448 | replytask.InventoryData.Serial = 0; | 448 | replytask.InventoryData.Serial = 0; |
449 | replytask.InventoryData.Filename = new byte[0]; | 449 | replytask.InventoryData.Filename = new byte[0]; |
450 | foundent = true; | 450 | foundent = true; |
451 | } | 451 | } |
452 | } | 452 | } |
453 | if (foundent) | 453 | if (foundent) |
454 | { | 454 | { |
455 | this.OutPacket(replytask); | 455 | this.OutPacket(replytask); |
456 | }*/ | 456 | }*/ |
457 | break; | 457 | break; |
458 | case PacketType.UpdateTaskInventory: | 458 | case PacketType.UpdateTaskInventory: |
459 | // Console.WriteLine(Pack.ToString()); | 459 | // Console.WriteLine(Pack.ToString()); |
460 | UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; | 460 | UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; |
461 | AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID); | 461 | AgentInventory myinventory = this.m_inventoryCache.GetAgentsInventory(this.AgentID); |
462 | /*if (myinventory != null) | 462 | /*if (myinventory != null) |
463 | { | 463 | { |
464 | if (updatetask.UpdateData.Key == 0) | 464 | if (updatetask.UpdateData.Key == 0) |
465 | { | 465 | { |
466 | if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null) | 466 | if (myinventory.InventoryItems[updatetask.InventoryData.ItemID] != null) |
467 | { | 467 | { |
468 | if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7) | 468 | if (myinventory.InventoryItems[updatetask.InventoryData.ItemID].Type == 7) |
469 | { | 469 | { |
470 | LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID; | 470 | LLUUID noteaid = myinventory.InventoryItems[updatetask.InventoryData.ItemID].AssetID; |
471 | AssetBase assBase = this.m_assetCache.GetAsset(noteaid); | 471 | AssetBase assBase = this.m_assetCache.GetAsset(noteaid); |
472 | if (assBase != null) | 472 | if (assBase != null) |
473 | { | 473 | { |
474 | foreach (Entity ent in m_world.Entities.Values) | 474 | foreach (Entity ent in m_world.Entities.Values) |
475 | { | 475 | { |
476 | if (ent.localid == updatetask.UpdateData.LocalID) | 476 | if (ent.localid == updatetask.UpdateData.LocalID) |
477 | { | 477 | { |
478 | if (ent is OpenSim.world.Primitive) | 478 | if (ent is OpenSim.world.Primitive) |
479 | { | 479 | { |
480 | this.m_world.AddScript(ent, Util.FieldToString(assBase.Data)); | 480 | this.m_world.AddScript(ent, Util.FieldToString(assBase.Data)); |
481 | } | 481 | } |
482 | } | 482 | } |
483 | } | 483 | } |
484 | } | 484 | } |
485 | } | 485 | } |
486 | } | 486 | } |
487 | } | 487 | } |
488 | }*/ | 488 | }*/ |
489 | break; | 489 | break; |
490 | case PacketType.MapLayerRequest: | 490 | case PacketType.MapLayerRequest: |
491 | this.RequestMapLayer(); | 491 | this.RequestMapLayer(); |
492 | break; | 492 | break; |
493 | case PacketType.MapBlockRequest: | 493 | case PacketType.MapBlockRequest: |
494 | MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; | 494 | MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; |
495 | if (OnRequestMapBlocks != null) | 495 | if (OnRequestMapBlocks != null) |
496 | { | 496 | { |
497 | OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); | 497 | OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); |
498 | } | 498 | } |
499 | break; | 499 | break; |
500 | case PacketType.TeleportLandmarkRequest: | 500 | case PacketType.TeleportLandmarkRequest: |
501 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; | 501 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; |
502 | 502 | ||
503 | TeleportStartPacket tpStart = new TeleportStartPacket(); | 503 | TeleportStartPacket tpStart = new TeleportStartPacket(); |
504 | tpStart.Info.TeleportFlags = 8; // tp via lm | 504 | tpStart.Info.TeleportFlags = 8; // tp via lm |
505 | this.OutPacket(tpStart); | 505 | this.OutPacket(tpStart); |
506 | 506 | ||
507 | TeleportProgressPacket tpProgress = new TeleportProgressPacket(); | 507 | TeleportProgressPacket tpProgress = new TeleportProgressPacket(); |
508 | tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); | 508 | tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); |
509 | tpProgress.Info.TeleportFlags = 8; | 509 | tpProgress.Info.TeleportFlags = 8; |
510 | tpProgress.AgentData.AgentID = tpReq.Info.AgentID; | 510 | tpProgress.AgentData.AgentID = tpReq.Info.AgentID; |
511 | this.OutPacket(tpProgress); | 511 | this.OutPacket(tpProgress); |
512 | 512 | ||
513 | // Fetch landmark | 513 | // Fetch landmark |
514 | LLUUID lmid = tpReq.Info.LandmarkID; | 514 | LLUUID lmid = tpReq.Info.LandmarkID; |
515 | AssetBase lma = this.m_assetCache.GetAsset(lmid); | 515 | AssetBase lma = this.m_assetCache.GetAsset(lmid); |
516 | if (lma != null) | 516 | if (lma != null) |
517 | { | 517 | { |
518 | AssetLandmark lm = new AssetLandmark(lma); | 518 | AssetLandmark lm = new AssetLandmark(lma); |
519 | 519 | ||
520 | if (lm.RegionID == m_world.RegionInfo.SimUUID) | 520 | if (lm.RegionID == m_world.RegionInfo.SimUUID) |
521 | { | 521 | { |
522 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | 522 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); |
523 | 523 | ||
524 | tpLocal.Info.AgentID = tpReq.Info.AgentID; | 524 | tpLocal.Info.AgentID = tpReq.Info.AgentID; |
525 | tpLocal.Info.TeleportFlags = 8; // Teleport via landmark | 525 | tpLocal.Info.TeleportFlags = 8; // Teleport via landmark |
526 | tpLocal.Info.LocationID = 2; | 526 | tpLocal.Info.LocationID = 2; |
527 | tpLocal.Info.Position = lm.Position; | 527 | tpLocal.Info.Position = lm.Position; |
528 | OutPacket(tpLocal); | 528 | OutPacket(tpLocal); |
529 | } | 529 | } |
530 | else | 530 | else |
531 | { | 531 | { |
532 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | 532 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); |
533 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | 533 | tpCancel.Info.AgentID = tpReq.Info.AgentID; |
534 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | 534 | tpCancel.Info.SessionID = tpReq.Info.SessionID; |
535 | OutPacket(tpCancel); | 535 | OutPacket(tpCancel); |
536 | } | 536 | } |
537 | } | 537 | } |
538 | else | 538 | else |
539 | { | 539 | { |
540 | Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); | 540 | Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); |
541 | 541 | ||
542 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | 542 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); |
543 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | 543 | tpCancel.Info.AgentID = tpReq.Info.AgentID; |
544 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | 544 | tpCancel.Info.SessionID = tpReq.Info.SessionID; |
545 | OutPacket(tpCancel); | 545 | OutPacket(tpCancel); |
546 | } | 546 | } |
547 | break; | 547 | break; |
548 | case PacketType.TeleportLocationRequest: | 548 | case PacketType.TeleportLocationRequest: |
549 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; | 549 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; |
550 | // Console.WriteLine(tpLocReq.ToString()); | 550 | // Console.WriteLine(tpLocReq.ToString()); |
551 | 551 | ||
552 | if (OnTeleportLocationRequest != null) | 552 | if (OnTeleportLocationRequest != null) |
553 | { | 553 | { |
554 | OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); | 554 | OnTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); |
555 | } | 555 | } |
556 | else | 556 | else |
557 | { | 557 | { |
558 | //no event handler so cancel request | 558 | //no event handler so cancel request |
559 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | 559 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); |
560 | tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; | 560 | tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; |
561 | tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; | 561 | tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; |
562 | OutPacket(tpCancel); | 562 | OutPacket(tpCancel); |
563 | } | 563 | } |
564 | break; | 564 | break; |
565 | #endregion | 565 | #endregion |
566 | 566 | ||
567 | case PacketType.MoneyBalanceRequest: | 567 | case PacketType.MoneyBalanceRequest: |
568 | this.SendMoneyBalance(LLUUID.Zero, true, new byte[0], 1000); | 568 | this.SendMoneyBalance(LLUUID.Zero, true, new byte[0], 1000); |
569 | break; | 569 | break; |
570 | case PacketType.UUIDNameRequest: | 570 | case PacketType.UUIDNameRequest: |
571 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; | 571 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; |
572 | foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) | 572 | foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) |
573 | { | 573 | { |
574 | OnNameFromUUIDRequest(UUIDBlock.ID, this); | 574 | OnNameFromUUIDRequest(UUIDBlock.ID, this); |
575 | } | 575 | } |
576 | break; | 576 | break; |
577 | #region Parcel related packets | 577 | #region Parcel related packets |
578 | case PacketType.ParcelPropertiesRequest: | 578 | case PacketType.ParcelPropertiesRequest: |
579 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; | 579 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; |
580 | if (OnParcelPropertiesRequest != null) | 580 | if (OnParcelPropertiesRequest != null) |
581 | { | 581 | { |
582 | 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); | 582 | 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); |
583 | } | 583 | } |
584 | break; | 584 | break; |
585 | case PacketType.ParcelDivide: | 585 | case PacketType.ParcelDivide: |
586 | ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack; | 586 | ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack; |
587 | if (OnParcelDivideRequest != null) | 587 | if (OnParcelDivideRequest != null) |
588 | { | 588 | { |
589 | 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); | 589 | 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); |
590 | } | 590 | } |
591 | break; | 591 | break; |
592 | case PacketType.ParcelJoin: | 592 | case PacketType.ParcelJoin: |
593 | ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack; | 593 | ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack; |
594 | if (OnParcelJoinRequest != null) | 594 | if (OnParcelJoinRequest != null) |
595 | { | 595 | { |
596 | 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); | 596 | 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); |
597 | } | 597 | } |
598 | break; | 598 | break; |
599 | case PacketType.ParcelPropertiesUpdate: | 599 | case PacketType.ParcelPropertiesUpdate: |
600 | ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; | 600 | ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; |
601 | if (OnParcelPropertiesUpdateRequest != null) | 601 | if (OnParcelPropertiesUpdateRequest != null) |
602 | { | 602 | { |
603 | OnParcelPropertiesUpdateRequest(updatePacket, this); | 603 | OnParcelPropertiesUpdateRequest(updatePacket, this); |
604 | 604 | ||
605 | } | 605 | } |
606 | break; | 606 | break; |
607 | case PacketType.ParcelSelectObjects: | 607 | case PacketType.ParcelSelectObjects: |
608 | ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; | 608 | ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; |
609 | if (OnParcelSelectObjects != null) | 609 | if (OnParcelSelectObjects != null) |
610 | { | 610 | { |
611 | OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); | 611 | OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); |
612 | } | 612 | } |
613 | break; | 613 | break; |
614 | 614 | ||
615 | case PacketType.ParcelObjectOwnersRequest: | 615 | case PacketType.ParcelObjectOwnersRequest: |
616 | ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack; | 616 | ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack; |
617 | if (OnParcelObjectOwnerRequest != null) | 617 | if (OnParcelObjectOwnerRequest != null) |
618 | { | 618 | { |
619 | OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); | 619 | OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); |
620 | } | 620 | } |
621 | break; | 621 | break; |
622 | #endregion | 622 | #endregion |
623 | 623 | ||
624 | #region Estate Packets | 624 | #region Estate Packets |
625 | case PacketType.EstateOwnerMessage: | 625 | case PacketType.EstateOwnerMessage: |
626 | EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; | 626 | EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; |
627 | if (OnEstateOwnerMessage != null) | 627 | if (OnEstateOwnerMessage != null) |
628 | { | 628 | { |
629 | OnEstateOwnerMessage(messagePacket, this); | 629 | OnEstateOwnerMessage(messagePacket, this); |
630 | } | 630 | } |
631 | break; | 631 | break; |
632 | #endregion | 632 | #endregion |
633 | 633 | ||
634 | #region unimplemented handlers | 634 | #region unimplemented handlers |
635 | case PacketType.AgentIsNowWearing: | 635 | case PacketType.AgentIsNowWearing: |
636 | // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; | 636 | // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; |
637 | //Console.WriteLine(Pack.ToString()); | 637 | //Console.WriteLine(Pack.ToString()); |
638 | break; | 638 | break; |
639 | case PacketType.ObjectScale: | 639 | case PacketType.ObjectScale: |
640 | //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); | 640 | //OpenSim.Framework.Console.MainLog.Instance.Verbose( Pack.ToString()); |
641 | break; | 641 | break; |
642 | #endregion | 642 | #endregion |
643 | } | 643 | } |
644 | } | 644 | } |
645 | } | 645 | } |
646 | } | 646 | } |
647 | } | 647 | } |