aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs5084
1 files changed, 2526 insertions, 2558 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 363b09c..d272667 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Net.Sockets;
32using System.Reflection; 31using System.Reflection;
33using System.Text; 32using System.Text;
34using System.Threading; 33using System.Threading;
@@ -40,7 +39,6 @@ using log4net;
40using OpenSim.Framework; 39using OpenSim.Framework;
41using OpenSim.Framework.Communications.Cache; 40using OpenSim.Framework.Communications.Cache;
42using OpenSim.Framework.Statistics; 41using OpenSim.Framework.Statistics;
43using OpenSim.Region.ClientStack.LindenUDP;
44using OpenSim.Region.Interfaces; 42using OpenSim.Region.Interfaces;
45using OpenSim.Region.Environment.Scenes; 43using OpenSim.Region.Environment.Scenes;
46using Timer = System.Timers.Timer; 44using Timer = System.Timers.Timer;
@@ -63,39 +61,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP
63 // } 61 // }
64 62
65 /* static variables */ 63 /* static variables */
66 public static SynchronizeClientHandler SynchronizeClient = null; 64 public static SynchronizeClientHandler SynchronizeClient;
67 /* private variables */ 65 /* private variables */
68 private readonly UUID m_sessionId; 66 private readonly UUID m_sessionId;
69 private UUID m_secureSessionId = UUID.Zero; 67 private readonly UUID m_secureSessionId = UUID.Zero;
70 //private AgentAssetUpload UploadAssets; 68 //private AgentAssetUpload UploadAssets;
71 69
72 private int m_debugPacketLevel = 0; 70 private int m_debugPacketLevel;
73 71
74 private readonly AssetCache m_assetCache; 72 private readonly AssetCache m_assetCache;
75 // private InventoryCache m_inventoryCache; 73 // private InventoryCache m_inventoryCache;
76 private int m_cachedTextureSerial = 0; 74 private int m_cachedTextureSerial;
77 private Timer m_clientPingTimer; 75 private Timer m_clientPingTimer;
78 76
79 private bool m_clientBlocked = false; 77 private bool m_clientBlocked;
80 78
81 private int m_probesWithNoIngressPackets = 0; 79 private int m_probesWithNoIngressPackets;
82 //private int m_lastPacketsReceived = 0; 80 //private int m_lastPacketsReceived = 0;
83 //private byte[] ZeroOutBuffer = new byte[4096]; 81 //private byte[] ZeroOutBuffer = new byte[4096];
84 82
85 private readonly UUID m_agentId; 83 private readonly UUID m_agentId;
86 private readonly uint m_circuitCode; 84 private readonly uint m_circuitCode;
87 private int m_moneyBalance; 85 private int m_moneyBalance;
88 private IPacketHandler m_PacketHandler; 86 private readonly IPacketHandler m_PacketHandler;
89 87
90 private int m_animationSequenceNumber = 1; 88 private int m_animationSequenceNumber = 1;
91 89
92 private byte[] m_channelVersion = Utils.StringToBytes("OpenSimulator Server"); // Dummy value needed by libSL 90 private readonly byte[] m_channelVersion = Utils.StringToBytes("OpenSimulator Server"); // Dummy value needed by libSL
93 91
94 private Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>(); 92 private readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>();
95 93
96 private bool m_SendLogoutPacketWhenClosing = true; 94 private bool m_SendLogoutPacketWhenClosing = true;
97 95
98 private int m_inPacketsChecked = 0; 96 private int m_inPacketsChecked;
99 97
100 /* protected variables */ 98 /* protected variables */
101 99
@@ -117,163 +115,163 @@ namespace OpenSim.Region.ClientStack.LindenUDP
117 protected EndPoint m_proxyEndPoint; 115 protected EndPoint m_proxyEndPoint;
118 protected UUID m_activeGroupID = UUID.Zero; 116 protected UUID m_activeGroupID = UUID.Zero;
119 protected string m_activeGroupName = String.Empty; 117 protected string m_activeGroupName = String.Empty;
120 protected ulong m_activeGroupPowers = 0; 118 protected ulong m_activeGroupPowers;
121 protected Dictionary<UUID,ulong> m_groupPowers = new Dictionary<UUID, ulong>(); 119 protected Dictionary<UUID,ulong> m_groupPowers = new Dictionary<UUID, ulong>();
122 120
123 /* Instantiated Designated Event Delegates */ 121 /* Instantiated Designated Event Delegates */
124 //- used so we don't create new objects for each incoming packet and then toss it out later */ 122 //- used so we don't create new objects for each incoming packet and then toss it out later */
125 123
126 private GenericMessage handlerGenericMessage = null; 124 private GenericMessage handlerGenericMessage;
127 private RequestAvatarProperties handlerRequestAvatarProperties = null; //OnRequestAvatarProperties; 125 private RequestAvatarProperties handlerRequestAvatarProperties; //OnRequestAvatarProperties;
128 private UpdateAvatarProperties handlerUpdateAvatarProperties = null; // OnUpdateAvatarProperties; 126 private UpdateAvatarProperties handlerUpdateAvatarProperties; // OnUpdateAvatarProperties;
129 private ChatMessage handlerChatFromClient = null; //OnChatFromClient; 127 private ChatMessage handlerChatFromClient; //OnChatFromClient;
130 private ChatMessage handlerChatFromClient2 = null; //OnChatFromClient; 128 private ChatMessage handlerChatFromClient2; //OnChatFromClient;
131 private ImprovedInstantMessage handlerInstantMessage = null; //OnInstantMessage; 129 private ImprovedInstantMessage handlerInstantMessage; //OnInstantMessage;
132 private FriendActionDelegate handlerApproveFriendRequest = null; //OnApproveFriendRequest; 130 private FriendActionDelegate handlerApproveFriendRequest; //OnApproveFriendRequest;
133 private FriendshipTermination handlerTerminateFriendship = null; //OnTerminateFriendship; 131 private FriendshipTermination handlerTerminateFriendship; //OnTerminateFriendship;
134 private RezObject handlerRezObject = null; //OnRezObject; 132 private RezObject handlerRezObject; //OnRezObject;
135 private DeRezObject handlerDeRezObject = null; //OnDeRezObject; 133 private DeRezObject handlerDeRezObject; //OnDeRezObject;
136 private ModifyTerrain handlerModifyTerrain = null; 134 private ModifyTerrain handlerModifyTerrain;
137 private BakeTerrain handlerBakeTerrain = null; 135 private BakeTerrain handlerBakeTerrain;
138 private EstateChangeInfo handlerEstateChangeInfo = null; 136 private EstateChangeInfo handlerEstateChangeInfo;
139 private Action<IClientAPI> handlerRegionHandShakeReply = null; //OnRegionHandShakeReply; 137 private Action<IClientAPI> handlerRegionHandShakeReply; //OnRegionHandShakeReply;
140 private GenericCall2 handlerRequestWearables = null; //OnRequestWearables; 138 private GenericCall2 handlerRequestWearables; //OnRequestWearables;
141 private Action<IClientAPI> handlerRequestAvatarsData = null; //OnRequestAvatarsData; 139 private Action<IClientAPI> handlerRequestAvatarsData; //OnRequestAvatarsData;
142 private SetAppearance handlerSetAppearance = null; //OnSetAppearance; 140 private SetAppearance handlerSetAppearance; //OnSetAppearance;
143 private AvatarNowWearing handlerAvatarNowWearing = null; //OnAvatarNowWearing; 141 private AvatarNowWearing handlerAvatarNowWearing; //OnAvatarNowWearing;
144 private RezSingleAttachmentFromInv handlerRezSingleAttachment = null; //OnRezSingleAttachmentFromInv; 142 private RezSingleAttachmentFromInv handlerRezSingleAttachment; //OnRezSingleAttachmentFromInv;
145 private UUIDNameRequest handlerDetachAttachmentIntoInv = null; // Detach attachment! 143 private UUIDNameRequest handlerDetachAttachmentIntoInv; // Detach attachment!
146 private ObjectAttach handlerObjectAttach = null; //OnObjectAttach; 144 private ObjectAttach handlerObjectAttach; //OnObjectAttach;
147 private SetAlwaysRun handlerSetAlwaysRun = null; //OnSetAlwaysRun; 145 private SetAlwaysRun handlerSetAlwaysRun; //OnSetAlwaysRun;
148 private GenericCall2 handlerCompleteMovementToRegion = null; //OnCompleteMovementToRegion; 146 private GenericCall2 handlerCompleteMovementToRegion; //OnCompleteMovementToRegion;
149 private UpdateAgent handlerAgentUpdate = null; //OnAgentUpdate; 147 private UpdateAgent handlerAgentUpdate; //OnAgentUpdate;
150 private StartAnim handlerStartAnim = null; 148 private StartAnim handlerStartAnim;
151 private StopAnim handlerStopAnim = null; 149 private StopAnim handlerStopAnim;
152 private AgentRequestSit handlerAgentRequestSit = null; //OnAgentRequestSit; 150 private AgentRequestSit handlerAgentRequestSit; //OnAgentRequestSit;
153 private AgentSit handlerAgentSit = null; //OnAgentSit; 151 private AgentSit handlerAgentSit; //OnAgentSit;
154 private AvatarPickerRequest handlerAvatarPickerRequest = null; //OnAvatarPickerRequest; 152 private AvatarPickerRequest handlerAvatarPickerRequest; //OnAvatarPickerRequest;
155 private FetchInventory handlerAgentDataUpdateRequest = null; //OnAgentDataUpdateRequest; 153 private FetchInventory handlerAgentDataUpdateRequest; //OnAgentDataUpdateRequest;
156 private FetchInventory handlerUserInfoRequest = null; //OnUserInfoRequest; 154 private FetchInventory handlerUserInfoRequest; //OnUserInfoRequest;
157 private TeleportLocationRequest handlerSetStartLocationRequest = null; //OnSetStartLocationRequest; 155 private TeleportLocationRequest handlerSetStartLocationRequest; //OnSetStartLocationRequest;
158 private TeleportLandmarkRequest handlerTeleportLandmarkRequest = null; //OnTeleportLandmarkRequest; 156 private TeleportLandmarkRequest handlerTeleportLandmarkRequest; //OnTeleportLandmarkRequest;
159 private LinkObjects handlerLinkObjects = null; //OnLinkObjects; 157 private LinkObjects handlerLinkObjects; //OnLinkObjects;
160 private DelinkObjects handlerDelinkObjects = null; //OnDelinkObjects; 158 private DelinkObjects handlerDelinkObjects; //OnDelinkObjects;
161 private AddNewPrim handlerAddPrim = null; //OnAddPrim; 159 private AddNewPrim handlerAddPrim; //OnAddPrim;
162 private UpdateShape handlerUpdatePrimShape = null; //null; 160 private UpdateShape handlerUpdatePrimShape; //null;
163 private ObjectExtraParams handlerUpdateExtraParams = null; //OnUpdateExtraParams; 161 private ObjectExtraParams handlerUpdateExtraParams; //OnUpdateExtraParams;
164 private ObjectDuplicate handlerObjectDuplicate = null; 162 private ObjectDuplicate handlerObjectDuplicate;
165 private ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null; 163 private ObjectDuplicateOnRay handlerObjectDuplicateOnRay;
166 private ObjectSelect handlerObjectSelect = null; 164 private ObjectSelect handlerObjectSelect;
167 private ObjectDeselect handlerObjectDeselect = null; 165 private ObjectDeselect handlerObjectDeselect;
168 private ObjectIncludeInSearch handlerObjectIncludeInSearch = null; 166 private ObjectIncludeInSearch handlerObjectIncludeInSearch;
169 private UpdatePrimFlags handlerUpdatePrimFlags = null; //OnUpdatePrimFlags; 167 private UpdatePrimFlags handlerUpdatePrimFlags; //OnUpdatePrimFlags;
170 private UpdatePrimTexture handlerUpdatePrimTexture = null; 168 private UpdatePrimTexture handlerUpdatePrimTexture;
171 private GrabObject handlerGrabObject = null; //OnGrabObject; 169 private GrabObject handlerGrabObject; //OnGrabObject;
172 private MoveObject handlerGrabUpdate = null; //OnGrabUpdate; 170 private MoveObject handlerGrabUpdate; //OnGrabUpdate;
173 private ObjectSelect handlerDeGrabObject = null; //OnDeGrabObject; 171 private ObjectSelect handlerDeGrabObject; //OnDeGrabObject;
174 private GenericCall7 handlerObjectDescription = null; 172 private GenericCall7 handlerObjectDescription;
175 private GenericCall7 handlerObjectName = null; 173 private GenericCall7 handlerObjectName;
176 private GenericCall7 handlerObjectClickAction = null; 174 private GenericCall7 handlerObjectClickAction;
177 private GenericCall7 handlerObjectMaterial = null; 175 private GenericCall7 handlerObjectMaterial;
178 private ObjectPermissions handlerObjectPermissions = null; 176 private ObjectPermissions handlerObjectPermissions;
179 private RequestObjectPropertiesFamily handlerRequestObjectPropertiesFamily = null; //OnRequestObjectPropertiesFamily; 177 private RequestObjectPropertiesFamily handlerRequestObjectPropertiesFamily; //OnRequestObjectPropertiesFamily;
180 private TextureRequest handlerTextureRequest = null; 178 private TextureRequest handlerTextureRequest;
181 private UDPAssetUploadRequest handlerAssetUploadRequest = null; //OnAssetUploadRequest; 179 private UDPAssetUploadRequest handlerAssetUploadRequest; //OnAssetUploadRequest;
182 private RequestXfer handlerRequestXfer = null; //OnRequestXfer; 180 private RequestXfer handlerRequestXfer; //OnRequestXfer;
183 private XferReceive handlerXferReceive = null; //OnXferReceive; 181 private XferReceive handlerXferReceive; //OnXferReceive;
184 private ConfirmXfer handlerConfirmXfer = null; //OnConfirmXfer; 182 private ConfirmXfer handlerConfirmXfer; //OnConfirmXfer;
185 private CreateInventoryFolder handlerCreateInventoryFolder = null; //OnCreateNewInventoryFolder; 183 private CreateInventoryFolder handlerCreateInventoryFolder; //OnCreateNewInventoryFolder;
186 private UpdateInventoryFolder handlerUpdateInventoryFolder = null; 184 private UpdateInventoryFolder handlerUpdateInventoryFolder;
187 private MoveInventoryFolder handlerMoveInventoryFolder = null; 185 private MoveInventoryFolder handlerMoveInventoryFolder;
188 private CreateNewInventoryItem handlerCreateNewInventoryItem = null; //OnCreateNewInventoryItem; 186 private CreateNewInventoryItem handlerCreateNewInventoryItem; //OnCreateNewInventoryItem;
189 private FetchInventory handlerFetchInventory = null; 187 private FetchInventory handlerFetchInventory;
190 private FetchInventoryDescendents handlerFetchInventoryDescendents = null; //OnFetchInventoryDescendents; 188 private FetchInventoryDescendents handlerFetchInventoryDescendents; //OnFetchInventoryDescendents;
191 private PurgeInventoryDescendents handlerPurgeInventoryDescendents = null; //OnPurgeInventoryDescendents; 189 private PurgeInventoryDescendents handlerPurgeInventoryDescendents; //OnPurgeInventoryDescendents;
192 private UpdateInventoryItem handlerUpdateInventoryItem = null; 190 private UpdateInventoryItem handlerUpdateInventoryItem;
193 private CopyInventoryItem handlerCopyInventoryItem = null; 191 private CopyInventoryItem handlerCopyInventoryItem;
194 private MoveInventoryItem handlerMoveInventoryItem = null; 192 private MoveInventoryItem handlerMoveInventoryItem;
195 private RemoveInventoryItem handlerRemoveInventoryItem = null; 193 private RemoveInventoryItem handlerRemoveInventoryItem;
196 private RemoveInventoryFolder handlerRemoveInventoryFolder = null; 194 private RemoveInventoryFolder handlerRemoveInventoryFolder;
197 private RequestTaskInventory handlerRequestTaskInventory = null; //OnRequestTaskInventory; 195 private RequestTaskInventory handlerRequestTaskInventory; //OnRequestTaskInventory;
198 private UpdateTaskInventory handlerUpdateTaskInventory = null; //OnUpdateTaskInventory; 196 private UpdateTaskInventory handlerUpdateTaskInventory; //OnUpdateTaskInventory;
199 private MoveTaskInventory handlerMoveTaskItem = null; 197 private MoveTaskInventory handlerMoveTaskItem;
200 private RemoveTaskInventory handlerRemoveTaskItem = null; //OnRemoveTaskItem; 198 private RemoveTaskInventory handlerRemoveTaskItem; //OnRemoveTaskItem;
201 private RezScript handlerRezScript = null; //OnRezScript; 199 private RezScript handlerRezScript; //OnRezScript;
202 private RequestMapBlocks handlerRequestMapBlocks = null; //OnRequestMapBlocks; 200 private RequestMapBlocks handlerRequestMapBlocks; //OnRequestMapBlocks;
203 private RequestMapName handlerMapNameRequest = null; //OnMapNameRequest; 201 private RequestMapName handlerMapNameRequest; //OnMapNameRequest;
204 private TeleportLocationRequest handlerTeleportLocationRequest = null; //OnTeleportLocationRequest; 202 private TeleportLocationRequest handlerTeleportLocationRequest; //OnTeleportLocationRequest;
205 private MoneyBalanceRequest handlerMoneyBalanceRequest = null; //OnMoneyBalanceRequest; 203 private MoneyBalanceRequest handlerMoneyBalanceRequest; //OnMoneyBalanceRequest;
206 private UUIDNameRequest handlerNameRequest = null; 204 private UUIDNameRequest handlerNameRequest;
207 private ParcelAccessListRequest handlerParcelAccessListRequest = null; //OnParcelAccessListRequest; 205 private ParcelAccessListRequest handlerParcelAccessListRequest; //OnParcelAccessListRequest;
208 private ParcelAccessListUpdateRequest handlerParcelAccessListUpdateRequest = null; //OnParcelAccessListUpdateRequest; 206 private ParcelAccessListUpdateRequest handlerParcelAccessListUpdateRequest; //OnParcelAccessListUpdateRequest;
209 private ParcelPropertiesRequest handlerParcelPropertiesRequest = null; //OnParcelPropertiesRequest; 207 private ParcelPropertiesRequest handlerParcelPropertiesRequest; //OnParcelPropertiesRequest;
210 private ParcelDivideRequest handlerParcelDivideRequest = null; //OnParcelDivideRequest; 208 private ParcelDivideRequest handlerParcelDivideRequest; //OnParcelDivideRequest;
211 private ParcelJoinRequest handlerParcelJoinRequest = null; //OnParcelJoinRequest; 209 private ParcelJoinRequest handlerParcelJoinRequest; //OnParcelJoinRequest;
212 private ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest = null; //OnParcelPropertiesUpdateRequest; 210 private ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest; //OnParcelPropertiesUpdateRequest;
213 private ParcelSelectObjects handlerParcelSelectObjects = null; //OnParcelSelectObjects; 211 private ParcelSelectObjects handlerParcelSelectObjects; //OnParcelSelectObjects;
214 private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = null; //OnParcelObjectOwnerRequest; 212 private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest; //OnParcelObjectOwnerRequest;
215 private ParcelAbandonRequest handlerParcelAbandonRequest = null; 213 private ParcelAbandonRequest handlerParcelAbandonRequest;
216 private ParcelGodForceOwner handlerParcelGodForceOwner = null; 214 private ParcelGodForceOwner handlerParcelGodForceOwner;
217 private ParcelReclaim handlerParcelReclaim = null; 215 private ParcelReclaim handlerParcelReclaim;
218 private ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest = null; 216 private ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest;
219 private RegionInfoRequest handlerRegionInfoRequest = null; //OnRegionInfoRequest; 217 private RegionInfoRequest handlerRegionInfoRequest; //OnRegionInfoRequest;
220 private EstateCovenantRequest handlerEstateCovenantRequest = null; //OnEstateCovenantRequest; 218 private EstateCovenantRequest handlerEstateCovenantRequest; //OnEstateCovenantRequest;
221 private RequestGodlikePowers handlerReqGodlikePowers = null; //OnRequestGodlikePowers; 219 private RequestGodlikePowers handlerReqGodlikePowers; //OnRequestGodlikePowers;
222 private GodKickUser handlerGodKickUser = null; //OnGodKickUser; 220 private GodKickUser handlerGodKickUser; //OnGodKickUser;
223 private ViewerEffectEventHandler handlerViewerEffect = null; //OnViewerEffect; 221 private ViewerEffectEventHandler handlerViewerEffect; //OnViewerEffect;
224 private Action<IClientAPI> handlerLogout = null; //OnLogout; 222 private Action<IClientAPI> handlerLogout; //OnLogout;
225 private MoneyTransferRequest handlerMoneyTransferRequest = null; //OnMoneyTransferRequest; 223 private MoneyTransferRequest handlerMoneyTransferRequest; //OnMoneyTransferRequest;
226 private ParcelBuy handlerParcelBuy = null; 224 private ParcelBuy handlerParcelBuy;
227 private EconomyDataRequest handlerEconomoyDataRequest = null; 225 private EconomyDataRequest handlerEconomoyDataRequest;
228 226
229 private UpdateVector handlerUpdatePrimSinglePosition = null; //OnUpdatePrimSinglePosition; 227 private UpdateVector handlerUpdatePrimSinglePosition; //OnUpdatePrimSinglePosition;
230 private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = null; //OnUpdatePrimSingleRotation; 228 private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation; //OnUpdatePrimSingleRotation;
231 private UpdateVector handlerUpdatePrimScale = null; //OnUpdatePrimScale; 229 private UpdateVector handlerUpdatePrimScale; //OnUpdatePrimScale;
232 private UpdateVector handlerUpdatePrimGroupScale = null; //OnUpdateGroupScale; 230 private UpdateVector handlerUpdatePrimGroupScale; //OnUpdateGroupScale;
233 private UpdateVector handlerUpdateVector = null; //OnUpdatePrimGroupPosition; 231 private UpdateVector handlerUpdateVector; //OnUpdatePrimGroupPosition;
234 private UpdatePrimRotation handlerUpdatePrimRotation = null; //OnUpdatePrimGroupRotation; 232 private UpdatePrimRotation handlerUpdatePrimRotation; //OnUpdatePrimGroupRotation;
235 // private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation = null; //OnUpdatePrimGroupMouseRotation; 233 // private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; //OnUpdatePrimGroupMouseRotation;
236 // private RequestAsset handlerRequestAsset = null; // OnRequestAsset; 234 // private RequestAsset handlerRequestAsset; // OnRequestAsset;
237 private UUIDNameRequest handlerTeleportHomeRequest = null; 235 private UUIDNameRequest handlerTeleportHomeRequest;
238 236
239 private RegionHandleRequest handlerRegionHandleRequest = null; // OnRegionHandleRequest 237 private RegionHandleRequest handlerRegionHandleRequest; // OnRegionHandleRequest
240 private ParcelInfoRequest handlerParcelInfoRequest = null; // OnParcelInfoRequest 238 private ParcelInfoRequest handlerParcelInfoRequest; // OnParcelInfoRequest
241 239
242 private ScriptAnswer handlerScriptAnswer = null; 240 private ScriptAnswer handlerScriptAnswer;
243 private RequestPayPrice handlerRequestPayPrice = null; 241 private RequestPayPrice handlerRequestPayPrice;
244 private ObjectSaleInfo handlerObjectSaleInfo = null; 242 private ObjectSaleInfo handlerObjectSaleInfo;
245 private ObjectBuy handlerObjectBuy = null; 243 private ObjectBuy handlerObjectBuy;
246 //private BuyObjectInventory handlerBuyObjectInventory = null; 244 //private BuyObjectInventory handlerBuyObjectInventory;
247 private ObjectDeselect handlerObjectDetach = null; 245 private ObjectDeselect handlerObjectDetach;
248 private ObjectDrop handlerObjectDrop = null; 246 private ObjectDrop handlerObjectDrop;
249 private AgentSit handlerOnUndo = null; 247 private AgentSit handlerOnUndo;
250 248
251 private ForceReleaseControls handlerForceReleaseControls = null; 249 private ForceReleaseControls handlerForceReleaseControls;
252 250
253 private GodLandStatRequest handlerLandStatRequest = null; 251 private GodLandStatRequest handlerLandStatRequest;
254 252
255 private UUIDNameRequest handlerUUIDGroupNameRequest = null; 253 private UUIDNameRequest handlerUUIDGroupNameRequest;
256 254
257 private RequestObjectPropertiesFamily handlerObjectGroupRequest = null; 255 private RequestObjectPropertiesFamily handlerObjectGroupRequest;
258 private ScriptReset handlerScriptReset = null; 256 private ScriptReset handlerScriptReset;
259 private GetScriptRunning handlerGetScriptRunning = null; 257 private GetScriptRunning handlerGetScriptRunning;
260 private SetScriptRunning handlerSetScriptRunning = null; 258 private SetScriptRunning handlerSetScriptRunning;
261 private UpdateVector handlerAutoPilotGo = null; 259 private UpdateVector handlerAutoPilotGo;
262 //Gesture 260 //Gesture
263 private ActivateGesture handlerActivateGesture = null; 261 private ActivateGesture handlerActivateGesture;
264 private DeactivateGesture handlerDeactivateGesture = null; 262 private DeactivateGesture handlerDeactivateGesture;
265 private ObjectOwner handlerObjectOwner = null; 263 private ObjectOwner handlerObjectOwner;
266 264
267 private DirPlacesQuery handlerDirPlacesQuery = null; 265 private DirPlacesQuery handlerDirPlacesQuery;
268 private DirFindQuery handlerDirFindQuery = null; 266 private DirFindQuery handlerDirFindQuery;
269 private DirLandQuery handlerDirLandQuery = null; 267 private DirLandQuery handlerDirLandQuery;
270 private DirPopularQuery handlerDirPopularQuery = null; 268 private DirPopularQuery handlerDirPopularQuery;
271 private DirClassifiedQuery handlerDirClassifiedQuery = null; 269 private DirClassifiedQuery handlerDirClassifiedQuery;
272 private ParcelSetOtherCleanTime handlerParcelSetOtherCleanTime = null; 270 private ParcelSetOtherCleanTime handlerParcelSetOtherCleanTime;
273 271
274 private MapItemRequest handlerMapItemRequest = null; 272 private MapItemRequest handlerMapItemRequest;
275 273
276 private IGroupsModule m_GroupsModule = null; 274 private IGroupsModule m_GroupsModule;
277 275
278 //private TerrainUnacked handlerUnackedTerrain = null; 276 //private TerrainUnacked handlerUnackedTerrain = null;
279 277
@@ -399,15 +397,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
399 /// <summary> 397 /// <summary>
400 /// Constructor 398 /// Constructor
401 /// </summary> 399 /// </summary>
402 /// <param name="remoteEP"></param>
403 /// <param name="scene"></param>
404 /// <param name="assetCache"></param>
405 /// <param name="packServer"></param>
406 /// <param name="authenSessions"></param>
407 /// <param name="agentId"></param>
408 /// <param name="sessionId"></param>
409 /// <param name="circuitCode"></param>
410 /// <param name="proxyEP"></param>
411 public LLClientView( 400 public LLClientView(
412 EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer, 401 EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer,
413 AuthenticateResponse sessionInfo, UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP, 402 AuthenticateResponse sessionInfo, UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP,
@@ -451,7 +440,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
451 440
452 RegisterLocalPacketHandlers(); 441 RegisterLocalPacketHandlers();
453 442
454 m_clientThread = new Thread(new ThreadStart(Start)); 443 m_clientThread = new Thread(Start);
455 m_clientThread.Name = "ClientThread"; 444 m_clientThread.Name = "ClientThread";
456 m_clientThread.IsBackground = true; 445 m_clientThread.IsBackground = true;
457 m_clientThread.Start(); 446 m_clientThread.Start();
@@ -645,7 +634,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
645 { 634 {
646 if (m_debugPacketLevel > 0) 635 if (m_debugPacketLevel > 0)
647 { 636 {
648 string info = String.Empty; 637 string info;
649 638
650 if (m_debugPacketLevel < 255 && packet.Type == PacketType.AgentUpdate) 639 if (m_debugPacketLevel < 255 && packet.Type == PacketType.AgentUpdate)
651 return; 640 return;
@@ -699,7 +688,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
699 688
700 # endregion 689 # endregion
701 690
702 protected int m_terrainCheckerCount = 0; 691 protected int m_terrainCheckerCount;
703 692
704 /// <summary> 693 /// <summary>
705 /// Event handler for check client timer 694 /// Event handler for check client timer
@@ -1002,10 +991,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1002 } 991 }
1003 #region Scene/Avatar to Client 992 #region Scene/Avatar to Client
1004 993
1005 /// <summary>
1006 ///
1007 /// </summary>
1008 /// <param name="regionInfo"></param>
1009 public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) 994 public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
1010 { 995 {
1011 RegionHandshakePacket handshake = (RegionHandshakePacket)PacketPool.Instance.GetPacket(PacketType.RegionHandshake); 996 RegionHandshakePacket handshake = (RegionHandshakePacket)PacketPool.Instance.GetPacket(PacketType.RegionHandshake);
@@ -2050,8 +2035,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2050 ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog); 2035 ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog);
2051 dialog.Data.ObjectID = objectID; 2036 dialog.Data.ObjectID = objectID;
2052 dialog.Data.ObjectName = Utils.StringToBytes(objectname); 2037 dialog.Data.ObjectName = Utils.StringToBytes(objectname);
2053 dialog.Data.FirstName = Utils.StringToBytes(this.FirstName); 2038 dialog.Data.FirstName = Utils.StringToBytes(FirstName);
2054 dialog.Data.LastName = Utils.StringToBytes(this.LastName); 2039 dialog.Data.LastName = Utils.StringToBytes(LastName);
2055 dialog.Data.Message = Utils.StringToBytes(msg); 2040 dialog.Data.Message = Utils.StringToBytes(msg);
2056 dialog.Data.ImageID = textureID; 2041 dialog.Data.ImageID = textureID;
2057 dialog.Data.ChatChannel = ch; 2042 dialog.Data.ChatChannel = ch;
@@ -2519,11 +2504,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2519 /// <summary> 2504 /// <summary>
2520 /// 2505 ///
2521 /// </summary> 2506 /// </summary>
2522 /// <param name="regionHandle"></param>
2523 /// <param name="timeDilation"></param>
2524 /// <param name="localID"></param>
2525 /// <param name="position"></param>
2526 /// <param name="rotation"></param>
2527 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, 2507 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
2528 Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId) 2508 Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId)
2529 { 2509 {
@@ -2709,7 +2689,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2709 2689
2710 #region Estate Data Sending Methods 2690 #region Estate Data Sending Methods
2711 2691
2712 private bool convertParamStringToBool(byte[] field) 2692 private static bool convertParamStringToBool(byte[] field)
2713 { 2693 {
2714 string s = Utils.BytesToString(field); 2694 string s = Utils.BytesToString(field);
2715 if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true") 2695 if (s == "1" || s.ToLower() == "y" || s.ToLower() == "yes" || s.ToLower() == "t" || s.ToLower() == "true")
@@ -2723,7 +2703,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2723 { 2703 {
2724 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 2704 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
2725 packet.AgentData.TransactionID = UUID.Random(); 2705 packet.AgentData.TransactionID = UUID.Random();
2726 packet.AgentData.AgentID = this.AgentId; 2706 packet.AgentData.AgentID = AgentId;
2727 packet.AgentData.SessionID = this.SessionId; 2707 packet.AgentData.SessionID = this.SessionId;
2728 packet.MethodData.Invoice = invoice; 2708 packet.MethodData.Invoice = invoice;
2729 packet.MethodData.Method = Utils.StringToBytes("setaccess"); 2709 packet.MethodData.Method = Utils.StringToBytes("setaccess");
@@ -2766,7 +2746,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2766 2746
2767 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 2747 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
2768 packet.AgentData.TransactionID = UUID.Random(); 2748 packet.AgentData.TransactionID = UUID.Random();
2769 packet.AgentData.AgentID = this.AgentId; 2749 packet.AgentData.AgentID = AgentId;
2770 packet.AgentData.SessionID = this.SessionId; 2750 packet.AgentData.SessionID = this.SessionId;
2771 packet.MethodData.Invoice = invoice; 2751 packet.MethodData.Invoice = invoice;
2772 packet.MethodData.Method = Utils.StringToBytes("setaccess"); 2752 packet.MethodData.Method = Utils.StringToBytes("setaccess");
@@ -2799,7 +2779,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2799 { 2779 {
2800 RegionInfoPacket rinfopack = new RegionInfoPacket(); 2780 RegionInfoPacket rinfopack = new RegionInfoPacket();
2801 RegionInfoPacket.RegionInfoBlock rinfoblk = new RegionInfoPacket.RegionInfoBlock(); 2781 RegionInfoPacket.RegionInfoBlock rinfoblk = new RegionInfoPacket.RegionInfoBlock();
2802 rinfopack.AgentData.AgentID = this.AgentId; 2782 rinfopack.AgentData.AgentID = AgentId;
2803 rinfopack.AgentData.SessionID = this.SessionId; 2783 rinfopack.AgentData.SessionID = this.SessionId;
2804 rinfoblk.BillableFactor = args.billableFactor; 2784 rinfoblk.BillableFactor = args.billableFactor;
2805 rinfoblk.EstateID = args.estateID; 2785 rinfoblk.EstateID = args.estateID;
@@ -2974,7 +2954,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2974 public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) 2954 public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)
2975 { 2955 {
2976 ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); 2956 ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
2977 replyPacket.Data.AgentID = this.AgentId; 2957 replyPacket.Data.AgentID = AgentId;
2978 replyPacket.Data.Flags = accessFlag; 2958 replyPacket.Data.Flags = accessFlag;
2979 replyPacket.Data.LocalID = localLandID; 2959 replyPacket.Data.LocalID = localLandID;
2980 replyPacket.Data.SequenceID = 0; 2960 replyPacket.Data.SequenceID = 0;
@@ -3580,8 +3560,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3580 { 3560 {
3581 if (nod.Attributes["name"] != null) 3561 if (nod.Attributes["name"] != null)
3582 { 3562 {
3583 string name = (string)nod.Attributes["name"].Value.ToLower(); 3563 string name = nod.Attributes["name"].Value.ToLower();
3584 string id = (string)nod.InnerText; 3564 string id = nod.InnerText;
3585 m_defaultAnimations.Add(name, (UUID)id); 3565 m_defaultAnimations.Add(name, (UUID)id);
3586 } 3566 }
3587 } 3567 }
@@ -3687,8 +3667,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3687 else 3667 else
3688 { 3668 {
3689 // UUID partId = part.UUID; 3669 // UUID partId = part.UUID;
3690 UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; 3670 UpdatePrimRotation handlerUpdatePrimRotation;
3691 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; 3671 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation;
3692 3672
3693 switch (block.Type) 3673 switch (block.Type)
3694 { 3674 {
@@ -3856,7 +3836,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3856 /* 3836 /*
3857 IList simMapProfiles = m_gridServer.RequestMapBlocks(minX, minY, maxX, maxY); 3837 IList simMapProfiles = m_gridServer.RequestMapBlocks(minX, minY, maxX, maxY);
3858 MapBlockReplyPacket mbReply = new MapBlockReplyPacket(); 3838 MapBlockReplyPacket mbReply = new MapBlockReplyPacket();
3859 mbReply.AgentData.AgentId = this.AgentId; 3839 mbReply.AgentData.AgentId = AgentId;
3860 int len; 3840 int len;
3861 if (simMapProfiles == null) 3841 if (simMapProfiles == null)
3862 len = 0; 3842 len = 0;
@@ -3933,10 +3913,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3933 SendMoneyBalance(UUID.Zero, true, Utils.StringToBytes("Poof Poof!"), m_moneyBalance); 3913 SendMoneyBalance(UUID.Zero, true, Utils.StringToBytes("Poof Poof!"), m_moneyBalance);
3934 return true; 3914 return true;
3935 } 3915 }
3936 else 3916 return false;
3937 {
3938 return false;
3939 }
3940 } 3917 }
3941 3918
3942 /// <summary> 3919 /// <summary>
@@ -3950,16 +3927,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3950 switch (gmMethod) 3927 switch (gmMethod)
3951 { 3928 {
3952 case "autopilot": 3929 case "autopilot":
3953 float locx = 0f; 3930 float locx;
3954 float locy = 0f; 3931 float locy;
3955 float locz = 0f; 3932 float locz;
3956 uint regionX = 0; 3933 uint regionX;
3957 uint regionY = 0; 3934 uint regionY;
3958 try 3935 try
3959 { 3936 {
3960 Helpers.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY); 3937 Helpers.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY);
3961 locx = Convert.ToSingle(Utils.BytesToString(gmParams[0].Parameter)) - (float)regionX; 3938 locx = Convert.ToSingle(Utils.BytesToString(gmParams[0].Parameter)) - regionX;
3962 locy = Convert.ToSingle(Utils.BytesToString(gmParams[1].Parameter)) - (float)regionY; 3939 locy = Convert.ToSingle(Utils.BytesToString(gmParams[1].Parameter)) - regionY;
3963 locz = Convert.ToSingle(Utils.BytesToString(gmParams[2].Parameter)); 3940 locz = Convert.ToSingle(Utils.BytesToString(gmParams[2].Parameter));
3964 } 3941 }
3965 catch (InvalidCastException) 3942 catch (InvalidCastException)
@@ -3978,10 +3955,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3978 3955
3979 break; 3956 break;
3980 default: 3957 default:
3981 m_log.Debug("[CLIENT]: Unknown Generic Message, Method: " + gmMethod + ". Invoice: " + gmInvoice.ToString() + ". Dumping Params:"); 3958 m_log.Debug("[CLIENT]: Unknown Generic Message, Method: " + gmMethod + ". Invoice: " + gmInvoice + ". Dumping Params:");
3982 for (int hi = 0; hi < gmParams.Length; hi++) 3959 for (int hi = 0; hi < gmParams.Length; hi++)
3983 { 3960 {
3984 System.Console.WriteLine(gmParams[hi].ToString()); 3961 Console.WriteLine(gmParams[hi].ToString());
3985 } 3962 }
3986 //gmpack.MethodData. 3963 //gmpack.MethodData.
3987 break; 3964 break;
@@ -4002,1291 +3979,1286 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4002 //there is a handler registered that handled this packet type 3979 //there is a handler registered that handled this packet type
4003 return; 3980 return;
4004 } 3981 }
4005 else 3982 // Main packet processing conditional
3983 switch (Pack.Type)
4006 { 3984 {
4007 // Main packet processing conditional
4008 switch (Pack.Type)
4009 {
4010 #region Scene/Avatar 3985 #region Scene/Avatar
4011 3986
4012 case PacketType.GenericMessage: 3987 case PacketType.GenericMessage:
4013 GenericMessagePacket gmpack = (GenericMessagePacket)Pack; 3988 GenericMessagePacket gmpack = (GenericMessagePacket)Pack;
4014 3989
4015 DecipherGenericMessage(Utils.BytesToString(gmpack.MethodData.Method), gmpack.MethodData.Invoice, gmpack.ParamList); 3990 DecipherGenericMessage(Utils.BytesToString(gmpack.MethodData.Method), gmpack.MethodData.Invoice, gmpack.ParamList);
4016 3991
4017 break; 3992 break;
4018 case PacketType.AvatarPropertiesRequest: 3993 case PacketType.AvatarPropertiesRequest:
4019 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 3994 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
4020 3995
4021 handlerRequestAvatarProperties = OnRequestAvatarProperties; 3996 handlerRequestAvatarProperties = OnRequestAvatarProperties;
4022 if (handlerRequestAvatarProperties != null) 3997 if (handlerRequestAvatarProperties != null)
4023 { 3998 {
4024 handlerRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); 3999 handlerRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID);
4025 } 4000 }
4026 4001
4027 break; 4002 break;
4028 case PacketType.ChatFromViewer: 4003 case PacketType.ChatFromViewer:
4029 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; 4004 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
4030 4005
4031 string fromName = String.Empty; //ClientAvatar.firstname + " " + ClientAvatar.lastname; 4006 string fromName = String.Empty; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
4032 byte[] message = inchatpack.ChatData.Message; 4007 byte[] message = inchatpack.ChatData.Message;
4033 byte type = inchatpack.ChatData.Type; 4008 byte type = inchatpack.ChatData.Type;
4034 Vector3 fromPos = new Vector3(); // ClientAvatar.Pos; 4009 Vector3 fromPos = new Vector3(); // ClientAvatar.Pos;
4035 // UUID fromAgentID = AgentId; 4010 // UUID fromAgentID = AgentId;
4036 4011
4037 int channel = inchatpack.ChatData.Channel; 4012 int channel = inchatpack.ChatData.Channel;
4038 4013
4039 if (OnChatFromClient != null) 4014 if (OnChatFromClient != null)
4040 { 4015 {
4041 OSChatMessage args = new OSChatMessage(); 4016 OSChatMessage args = new OSChatMessage();
4042 args.Channel = channel; 4017 args.Channel = channel;
4043 args.From = fromName; 4018 args.From = fromName;
4044 args.Message = Utils.BytesToString(message); 4019 args.Message = Utils.BytesToString(message);
4045 args.Type = (ChatTypeEnum)type; 4020 args.Type = (ChatTypeEnum)type;
4046 args.Position = fromPos; 4021 args.Position = fromPos;
4047 4022
4048 args.Scene = Scene; 4023 args.Scene = Scene;
4049 args.Sender = this; 4024 args.Sender = this;
4050 4025
4051 handlerChatFromClient = OnChatFromClient; 4026 handlerChatFromClient = OnChatFromClient;
4052 if (handlerChatFromClient != null) 4027 if (handlerChatFromClient != null)
4053 handlerChatFromClient(this, args); 4028 handlerChatFromClient(this, args);
4054 } 4029 }
4055 break; 4030 break;
4056 case PacketType.AvatarPropertiesUpdate: 4031 case PacketType.AvatarPropertiesUpdate:
4057 AvatarPropertiesUpdatePacket Packet = (AvatarPropertiesUpdatePacket)Pack; 4032 AvatarPropertiesUpdatePacket Packet = (AvatarPropertiesUpdatePacket)Pack;
4058 4033
4059 handlerUpdateAvatarProperties = OnUpdateAvatarProperties; 4034 handlerUpdateAvatarProperties = OnUpdateAvatarProperties;
4060 if (handlerUpdateAvatarProperties != null) 4035 if (handlerUpdateAvatarProperties != null)
4061 { 4036 {
4062 AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = Packet.PropertiesData; 4037 AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = Packet.PropertiesData;
4063 UserProfileData UserProfile = new UserProfileData(); 4038 UserProfileData UserProfile = new UserProfileData();
4064 UserProfile.ID = AgentId; 4039 UserProfile.ID = AgentId;
4065 UserProfile.AboutText = Utils.BytesToString(Properties.AboutText); 4040 UserProfile.AboutText = Utils.BytesToString(Properties.AboutText);
4066 UserProfile.FirstLifeAboutText = Utils.BytesToString(Properties.FLAboutText); 4041 UserProfile.FirstLifeAboutText = Utils.BytesToString(Properties.FLAboutText);
4067 UserProfile.FirstLifeImage = Properties.FLImageID; 4042 UserProfile.FirstLifeImage = Properties.FLImageID;
4068 UserProfile.Image = Properties.ImageID; 4043 UserProfile.Image = Properties.ImageID;
4069 4044
4070 handlerUpdateAvatarProperties(this, UserProfile); 4045 handlerUpdateAvatarProperties(this, UserProfile);
4071 } 4046 }
4072 break; 4047 break;
4073 4048
4074 case PacketType.ScriptDialogReply: 4049 case PacketType.ScriptDialogReply:
4075 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; 4050 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
4076 int ch = rdialog.Data.ChatChannel; 4051 int ch = rdialog.Data.ChatChannel;
4077 byte[] msg = rdialog.Data.ButtonLabel; 4052 byte[] msg = rdialog.Data.ButtonLabel;
4078 if (OnChatFromClient != null) 4053 if (OnChatFromClient != null)
4079 { 4054 {
4080 OSChatMessage args = new OSChatMessage(); 4055 OSChatMessage args = new OSChatMessage();
4081 args.Channel = ch; 4056 args.Channel = ch;
4082 args.From = String.Empty; 4057 args.From = String.Empty;
4083 args.Message = Utils.BytesToString(msg); 4058 args.Message = Utils.BytesToString(msg);
4084 args.Type = ChatTypeEnum.Shout; 4059 args.Type = ChatTypeEnum.Shout;
4085 args.Position = new Vector3(); 4060 args.Position = new Vector3();
4086 args.Scene = Scene; 4061 args.Scene = Scene;
4087 args.Sender = this; 4062 args.Sender = this;
4088 handlerChatFromClient2 = OnChatFromClient; 4063 handlerChatFromClient2 = OnChatFromClient;
4089 if (handlerChatFromClient2 != null) 4064 if (handlerChatFromClient2 != null)
4090 handlerChatFromClient2(this, args); 4065 handlerChatFromClient2(this, args);
4091 } 4066 }
4092 4067
4093 break; 4068 break;
4094 case PacketType.ImprovedInstantMessage: 4069 case PacketType.ImprovedInstantMessage:
4095 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; 4070 ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
4096 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); 4071 string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
4097 string IMmessage = Utils.BytesToString(msgpack.MessageBlock.Message); 4072 string IMmessage = Utils.BytesToString(msgpack.MessageBlock.Message);
4098 handlerInstantMessage = OnInstantMessage; 4073 handlerInstantMessage = OnInstantMessage;
4099 4074
4100 if (handlerInstantMessage != null) 4075 if (handlerInstantMessage != null)
4101 { 4076 {
4102 handlerInstantMessage(this, msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, 4077 handlerInstantMessage(this, msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,
4103 msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID, 4078 msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID,
4104 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage, 4079 msgpack.MessageBlock.Timestamp, IMfromName, IMmessage,
4105 msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup, 4080 msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup,
4106 msgpack.MessageBlock.Offline, msgpack.MessageBlock.ParentEstateID, 4081 msgpack.MessageBlock.Offline, msgpack.MessageBlock.ParentEstateID,
4107 msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID, 4082 msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID,
4108 msgpack.MessageBlock.BinaryBucket); 4083 msgpack.MessageBlock.BinaryBucket);
4109 } 4084 }
4110 break; 4085 break;
4111 4086
4112 case PacketType.AcceptFriendship: 4087 case PacketType.AcceptFriendship:
4113 AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack; 4088 AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack;
4114 4089
4115 // My guess is this is the folder to stick the calling card into 4090 // My guess is this is the folder to stick the calling card into
4116 List<UUID> callingCardFolders = new List<UUID>(); 4091 List<UUID> callingCardFolders = new List<UUID>();
4117 4092
4118 UUID agentID = afriendpack.AgentData.AgentID; 4093 UUID agentID = afriendpack.AgentData.AgentID;
4119 UUID transactionID = afriendpack.TransactionBlock.TransactionID; 4094 UUID transactionID = afriendpack.TransactionBlock.TransactionID;
4120 4095
4121 for (int fi = 0; fi < afriendpack.FolderData.Length; fi++) 4096 for (int fi = 0; fi < afriendpack.FolderData.Length; fi++)
4122 { 4097 {
4123 callingCardFolders.Add(afriendpack.FolderData[fi].FolderID); 4098 callingCardFolders.Add(afriendpack.FolderData[fi].FolderID);
4124 } 4099 }
4125 4100
4126 handlerApproveFriendRequest = OnApproveFriendRequest; 4101 handlerApproveFriendRequest = OnApproveFriendRequest;
4127 if (handlerApproveFriendRequest != null) 4102 if (handlerApproveFriendRequest != null)
4128 { 4103 {
4129 handlerApproveFriendRequest(this, agentID, transactionID, callingCardFolders); 4104 handlerApproveFriendRequest(this, agentID, transactionID, callingCardFolders);
4130 } 4105 }
4131 break; 4106 break;
4132 4107
4133 case PacketType.DeclineFriendship: 4108 case PacketType.DeclineFriendship:
4134 DeclineFriendshipPacket dfriendpack = (DeclineFriendshipPacket)Pack; 4109 DeclineFriendshipPacket dfriendpack = (DeclineFriendshipPacket)Pack;
4135 4110
4136 if (OnDenyFriendRequest != null) 4111 if (OnDenyFriendRequest != null)
4137 { 4112 {
4138 OnDenyFriendRequest(this, 4113 OnDenyFriendRequest(this,
4139 dfriendpack.AgentData.AgentID, 4114 dfriendpack.AgentData.AgentID,
4140 dfriendpack.TransactionBlock.TransactionID, 4115 dfriendpack.TransactionBlock.TransactionID,
4141 null); 4116 null);
4142 } 4117 }
4143 break; 4118 break;
4144 4119
4145 case PacketType.TerminateFriendship: 4120 case PacketType.TerminateFriendship:
4146 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack; 4121 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack;
4147 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID; 4122 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID;
4148 UUID exFriendID = tfriendpack.ExBlock.OtherID; 4123 UUID exFriendID = tfriendpack.ExBlock.OtherID;
4149 4124
4150 handlerTerminateFriendship = OnTerminateFriendship; 4125 handlerTerminateFriendship = OnTerminateFriendship;
4151 if (handlerTerminateFriendship != null) 4126 if (handlerTerminateFriendship != null)
4152 { 4127 {
4153 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); 4128 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID);
4154 } 4129 }
4155 break; 4130 break;
4156 4131
4157 case PacketType.RezObject: 4132 case PacketType.RezObject:
4158 RezObjectPacket rezPacket = (RezObjectPacket)Pack; 4133 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
4159 4134
4160 handlerRezObject = OnRezObject; 4135 handlerRezObject = OnRezObject;
4161 if (handlerRezObject != null) 4136 if (handlerRezObject != null)
4162 { 4137 {
4163 handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, 4138 handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
4164 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID, 4139 rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
4165 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection, 4140 rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
4166 rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem, 4141 rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem,
4167 rezPacket.RezData.FromTaskID); 4142 rezPacket.RezData.FromTaskID);
4168 } 4143 }
4169 break; 4144 break;
4170 4145
4171 case PacketType.DeRezObject: 4146 case PacketType.DeRezObject:
4172 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) Pack; 4147 DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) Pack;
4173 handlerDeRezObject = OnDeRezObject; 4148 handlerDeRezObject = OnDeRezObject;
4174 if (handlerDeRezObject != null) 4149 if (handlerDeRezObject != null)
4150 {
4151 foreach (DeRezObjectPacket.ObjectDataBlock data in
4152 DeRezPacket.ObjectData)
4175 { 4153 {
4176 foreach (DeRezObjectPacket.ObjectDataBlock data in 4154 handlerDeRezObject(this, data.ObjectLocalID,
4177 DeRezPacket.ObjectData) 4155 DeRezPacket.AgentBlock.GroupID,
4178 { 4156 DeRezPacket.AgentBlock.Destination,
4179 handlerDeRezObject(this, data.ObjectLocalID, 4157 DeRezPacket.AgentBlock.DestinationID);
4180 DeRezPacket.AgentBlock.GroupID,
4181 DeRezPacket.AgentBlock.Destination,
4182 DeRezPacket.AgentBlock.DestinationID);
4183 }
4184 } 4158 }
4185 break; 4159 }
4160 break;
4186 4161
4187 case PacketType.ModifyLand: 4162 case PacketType.ModifyLand:
4188 ModifyLandPacket modify = (ModifyLandPacket)Pack; 4163 ModifyLandPacket modify = (ModifyLandPacket)Pack;
4189 //m_log.Info("[LAND]: LAND:" + modify.ToString()); 4164 //m_log.Info("[LAND]: LAND:" + modify.ToString());
4190 if (modify.ParcelData.Length > 0) 4165 if (modify.ParcelData.Length > 0)
4166 {
4167 if (OnModifyTerrain != null)
4191 { 4168 {
4192 if (OnModifyTerrain != null) 4169 for (int i = 0; i < modify.ParcelData.Length; i++)
4193 { 4170 {
4194 for (int i = 0; i < modify.ParcelData.Length; i++) 4171 handlerModifyTerrain = OnModifyTerrain;
4172 if (handlerModifyTerrain != null)
4195 { 4173 {
4196 handlerModifyTerrain = OnModifyTerrain; 4174 modify.ModifyBlock.Height = -1; // Hack, i don't know why the value is wrong
4197 if (handlerModifyTerrain != null) 4175 handlerModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds,
4198 { 4176 modify.ModifyBlock.BrushSize,
4199 modify.ModifyBlock.Height = -1; // Hack, i don't know why the value is wrong 4177 modify.ModifyBlock.Action, modify.ParcelData[i].North,
4200 handlerModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, 4178 modify.ParcelData[i].West, modify.ParcelData[i].South,
4201 modify.ModifyBlock.BrushSize, 4179 modify.ParcelData[i].East, AgentId);
4202 modify.ModifyBlock.Action, modify.ParcelData[i].North,
4203 modify.ParcelData[i].West, modify.ParcelData[i].South,
4204 modify.ParcelData[i].East, this.AgentId);
4205 }
4206 } 4180 }
4207 } 4181 }
4208 } 4182 }
4183 }
4209 4184
4210 break; 4185 break;
4211 4186
4212 case PacketType.RegionHandshakeReply: 4187 case PacketType.RegionHandshakeReply:
4213 4188
4214 handlerRegionHandShakeReply = OnRegionHandShakeReply; 4189 handlerRegionHandShakeReply = OnRegionHandShakeReply;
4215 if (handlerRegionHandShakeReply != null) 4190 if (handlerRegionHandShakeReply != null)
4216 { 4191 {
4217 handlerRegionHandShakeReply(this); 4192 handlerRegionHandShakeReply(this);
4218 } 4193 }
4219 4194
4220 break; 4195 break;
4221 4196
4222 case PacketType.AgentWearablesRequest: 4197 case PacketType.AgentWearablesRequest:
4223 handlerRequestWearables = OnRequestWearables; 4198 handlerRequestWearables = OnRequestWearables;
4224 4199
4225 if (handlerRequestWearables != null) 4200 if (handlerRequestWearables != null)
4226 { 4201 {
4227 m_log.DebugFormat("[APPEARANCE]: Wearables requested by {0}", Name); 4202 m_log.DebugFormat("[APPEARANCE]: Wearables requested by {0}", Name);
4228 4203
4229 handlerRequestWearables(); 4204 handlerRequestWearables();
4230 } 4205 }
4231 4206
4232 handlerRequestAvatarsData = OnRequestAvatarsData; 4207 handlerRequestAvatarsData = OnRequestAvatarsData;
4233 4208
4234 if (handlerRequestAvatarsData != null) 4209 if (handlerRequestAvatarsData != null)
4235 { 4210 {
4236 handlerRequestAvatarsData(this); 4211 handlerRequestAvatarsData(this);
4237 } 4212 }
4238 4213
4239 break; 4214 break;
4240 4215
4241 case PacketType.AgentSetAppearance: 4216 case PacketType.AgentSetAppearance:
4242 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; 4217 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
4243 4218
4244 handlerSetAppearance = OnSetAppearance; 4219 handlerSetAppearance = OnSetAppearance;
4245 if (handlerSetAppearance != null) 4220 if (handlerSetAppearance != null)
4246 { 4221 {
4247 // Temporarily protect ourselves from the mantis #951 failure. 4222 // Temporarily protect ourselves from the mantis #951 failure.
4248 // However, we could do this for several other handlers where a failure isn't terminal 4223 // However, we could do this for several other handlers where a failure isn't terminal
4249 // for the client session anyway, in order to protect ourselves against bad code in plugins 4224 // for the client session anyway, in order to protect ourselves against bad code in plugins
4250 try 4225 try
4251 {
4252 List<byte> visualparams = new List<byte>();
4253 foreach (AgentSetAppearancePacket.VisualParamBlock x in appear.VisualParam)
4254 {
4255 visualparams.Add(x.ParamValue);
4256 }
4257
4258 handlerSetAppearance(appear.ObjectData.TextureEntry, visualparams);
4259 }
4260 catch (Exception e)
4261 {
4262 m_log.ErrorFormat(
4263 "[CLIENT VIEW]: AgentSetApperance packet handler threw an exception, {0}",
4264 e);
4265 }
4266 }
4267
4268 break;
4269 case PacketType.AgentIsNowWearing:
4270 if (OnAvatarNowWearing != null)
4271 { 4226 {
4272 AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket)Pack; 4227 List<byte> visualparams = new List<byte>();
4273 AvatarWearingArgs wearingArgs = new AvatarWearingArgs(); 4228 foreach (AgentSetAppearancePacket.VisualParamBlock x in appear.VisualParam)
4274 for (int i = 0; i < nowWearing.WearableData.Length; i++)
4275 { 4229 {
4276 AvatarWearingArgs.Wearable wearable = 4230 visualparams.Add(x.ParamValue);
4277 new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID,
4278 nowWearing.WearableData[i].WearableType);
4279 wearingArgs.NowWearing.Add(wearable);
4280 } 4231 }
4281 4232
4282 handlerAvatarNowWearing = OnAvatarNowWearing; 4233 handlerSetAppearance(appear.ObjectData.TextureEntry, visualparams);
4283 if (handlerAvatarNowWearing != null)
4284 {
4285 handlerAvatarNowWearing(this, wearingArgs);
4286 }
4287 } 4234 }
4288 break; 4235 catch (Exception e)
4289 case PacketType.RezSingleAttachmentFromInv:
4290 handlerRezSingleAttachment = OnRezSingleAttachmentFromInv;
4291 if (handlerRezSingleAttachment != null)
4292 { 4236 {
4293 RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket)Pack; 4237 m_log.ErrorFormat(
4294 handlerRezSingleAttachment(this, rez.ObjectData.ItemID, 4238 "[CLIENT VIEW]: AgentSetApperance packet handler threw an exception, {0}",
4295 rez.ObjectData.AttachmentPt); 4239 e);
4296 } 4240 }
4241 }
4297 4242
4298 break; 4243 break;
4299 case PacketType.DetachAttachmentIntoInv: 4244 case PacketType.AgentIsNowWearing:
4300 handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv; 4245 if (OnAvatarNowWearing != null)
4301 if (handlerDetachAttachmentIntoInv != null) 4246 {
4247 AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket)Pack;
4248 AvatarWearingArgs wearingArgs = new AvatarWearingArgs();
4249 for (int i = 0; i < nowWearing.WearableData.Length; i++)
4302 { 4250 {
4303 DetachAttachmentIntoInvPacket detachtoInv = (DetachAttachmentIntoInvPacket)Pack; 4251 AvatarWearingArgs.Wearable wearable =
4304 4252 new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID,
4305 UUID itemID = detachtoInv.ObjectData.ItemID; 4253 nowWearing.WearableData[i].WearableType);
4306 // UUID ATTACH_agentID = detachtoInv.ObjectData.AgentID; 4254 wearingArgs.NowWearing.Add(wearable);
4307
4308 handlerDetachAttachmentIntoInv(itemID, this);
4309 } 4255 }
4310 break;
4311 case PacketType.ObjectAttach:
4312 if (OnObjectAttach != null)
4313 {
4314 ObjectAttachPacket att = (ObjectAttachPacket)Pack;
4315 4256
4316 handlerObjectAttach = OnObjectAttach; 4257 handlerAvatarNowWearing = OnAvatarNowWearing;
4317 4258 if (handlerAvatarNowWearing != null)
4318 if (handlerObjectAttach != null) 4259 {
4319 { 4260 handlerAvatarNowWearing(this, wearingArgs);
4320 if (att.ObjectData.Length > 0)
4321 {
4322 handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation);
4323 }
4324 }
4325 } 4261 }
4262 }
4263 break;
4264 case PacketType.RezSingleAttachmentFromInv:
4265 handlerRezSingleAttachment = OnRezSingleAttachmentFromInv;
4266 if (handlerRezSingleAttachment != null)
4267 {
4268 RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket)Pack;
4269 handlerRezSingleAttachment(this, rez.ObjectData.ItemID,
4270 rez.ObjectData.AttachmentPt);
4271 }
4326 4272
4327 break; 4273 break;
4328 case PacketType.ObjectDetach: 4274 case PacketType.DetachAttachmentIntoInv:
4275 handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv;
4276 if (handlerDetachAttachmentIntoInv != null)
4277 {
4278 DetachAttachmentIntoInvPacket detachtoInv = (DetachAttachmentIntoInvPacket)Pack;
4329 4279
4330 ObjectDetachPacket dett = (ObjectDetachPacket)Pack; 4280 UUID itemID = detachtoInv.ObjectData.ItemID;
4331 for (int j = 0; j < dett.ObjectData.Length; j++) 4281 // UUID ATTACH_agentID = detachtoInv.ObjectData.AgentID;
4332 {
4333 uint obj = dett.ObjectData[j].ObjectLocalID;
4334 handlerObjectDetach = OnObjectDetach;
4335 if (handlerObjectDetach != null)
4336 {
4337 handlerObjectDetach(obj, this);
4338 }
4339 4282
4340 } 4283 handlerDetachAttachmentIntoInv(itemID, this);
4284 }
4285 break;
4286 case PacketType.ObjectAttach:
4287 if (OnObjectAttach != null)
4288 {
4289 ObjectAttachPacket att = (ObjectAttachPacket)Pack;
4341 4290
4342 break; 4291 handlerObjectAttach = OnObjectAttach;
4343 case PacketType.ObjectDrop: 4292
4344 ObjectDropPacket dropp = (ObjectDropPacket)Pack; 4293 if (handlerObjectAttach != null)
4345 for (int j = 0; j < dropp.ObjectData.Length; j++)
4346 { 4294 {
4347 uint obj = dropp.ObjectData[j].ObjectLocalID; 4295 if (att.ObjectData.Length > 0)
4348 handlerObjectDrop = OnObjectDrop;
4349 if (handlerObjectDrop != null)
4350 { 4296 {
4351 handlerObjectDrop(obj, this); 4297 handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation);
4352 } 4298 }
4353 } 4299 }
4354 break; 4300 }
4355 case PacketType.SetAlwaysRun:
4356 SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack;
4357 4301
4358 handlerSetAlwaysRun = OnSetAlwaysRun; 4302 break;
4359 if (handlerSetAlwaysRun != null) 4303 case PacketType.ObjectDetach:
4360 handlerSetAlwaysRun(this, run.AgentData.AlwaysRun);
4361 4304
4362 break; 4305 ObjectDetachPacket dett = (ObjectDetachPacket)Pack;
4363 case PacketType.CompleteAgentMovement: 4306 for (int j = 0; j < dett.ObjectData.Length; j++)
4364 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; 4307 {
4365 if (handlerCompleteMovementToRegion != null) 4308 uint obj = dett.ObjectData[j].ObjectLocalID;
4309 handlerObjectDetach = OnObjectDetach;
4310 if (handlerObjectDetach != null)
4366 { 4311 {
4367 handlerCompleteMovementToRegion(); 4312 handlerObjectDetach(obj, this);
4368 } 4313 }
4369 handlerCompleteMovementToRegion = null;
4370 4314
4371 break; 4315 }
4372 case PacketType.AgentUpdate: 4316
4373 if (OnAgentUpdate != null) 4317 break;
4318 case PacketType.ObjectDrop:
4319 ObjectDropPacket dropp = (ObjectDropPacket)Pack;
4320 for (int j = 0; j < dropp.ObjectData.Length; j++)
4321 {
4322 uint obj = dropp.ObjectData[j].ObjectLocalID;
4323 handlerObjectDrop = OnObjectDrop;
4324 if (handlerObjectDrop != null)
4374 { 4325 {
4375 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; 4326 handlerObjectDrop(obj, this);
4376
4377 AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
4378 AgentUpdateArgs arg = new AgentUpdateArgs();
4379 arg.AgentID = x.AgentID;
4380 arg.BodyRotation = x.BodyRotation;
4381 arg.CameraAtAxis = x.CameraAtAxis;
4382 arg.CameraCenter = x.CameraCenter;
4383 arg.CameraLeftAxis = x.CameraLeftAxis;
4384 arg.CameraUpAxis = x.CameraUpAxis;
4385 arg.ControlFlags = x.ControlFlags;
4386 arg.Far = x.Far;
4387 arg.Flags = x.Flags;
4388 arg.HeadRotation = x.HeadRotation;
4389 arg.SessionID = x.SessionID;
4390 arg.State = x.State;
4391
4392 handlerAgentUpdate = OnAgentUpdate;
4393 if (handlerAgentUpdate != null)
4394 OnAgentUpdate(this, arg);
4395
4396 handlerAgentUpdate = null;
4397 //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa);
4398 } 4327 }
4399 break; 4328 }
4400 case PacketType.AgentAnimation: 4329 break;
4401 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; 4330 case PacketType.SetAlwaysRun:
4331 SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack;
4402 4332
4403 handlerStartAnim = null; 4333 handlerSetAlwaysRun = OnSetAlwaysRun;
4404 handlerStopAnim = null; 4334 if (handlerSetAlwaysRun != null)
4335 handlerSetAlwaysRun(this, run.AgentData.AlwaysRun);
4336
4337 break;
4338 case PacketType.CompleteAgentMovement:
4339 handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
4340 if (handlerCompleteMovementToRegion != null)
4341 {
4342 handlerCompleteMovementToRegion();
4343 }
4344 handlerCompleteMovementToRegion = null;
4405 4345
4406 for (int i = 0; i < AgentAni.AnimationList.Length; i++) 4346 break;
4347 case PacketType.AgentUpdate:
4348 if (OnAgentUpdate != null)
4349 {
4350 AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
4351
4352 AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
4353 AgentUpdateArgs arg = new AgentUpdateArgs();
4354 arg.AgentID = x.AgentID;
4355 arg.BodyRotation = x.BodyRotation;
4356 arg.CameraAtAxis = x.CameraAtAxis;
4357 arg.CameraCenter = x.CameraCenter;
4358 arg.CameraLeftAxis = x.CameraLeftAxis;
4359 arg.CameraUpAxis = x.CameraUpAxis;
4360 arg.ControlFlags = x.ControlFlags;
4361 arg.Far = x.Far;
4362 arg.Flags = x.Flags;
4363 arg.HeadRotation = x.HeadRotation;
4364 arg.SessionID = x.SessionID;
4365 arg.State = x.State;
4366
4367 handlerAgentUpdate = OnAgentUpdate;
4368 if (handlerAgentUpdate != null)
4369 OnAgentUpdate(this, arg);
4370
4371 handlerAgentUpdate = null;
4372 //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa);
4373 }
4374 break;
4375 case PacketType.AgentAnimation:
4376 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
4377
4378 handlerStartAnim = null;
4379 handlerStopAnim = null;
4380
4381 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
4382 {
4383 if (AgentAni.AnimationList[i].StartAnim)
4407 { 4384 {
4408 if (AgentAni.AnimationList[i].StartAnim) 4385 handlerStartAnim = OnStartAnim;
4409 { 4386 if (handlerStartAnim != null)
4410 handlerStartAnim = OnStartAnim;
4411 if (handlerStartAnim != null)
4412 {
4413 handlerStartAnim(this, AgentAni.AnimationList[i].AnimID);
4414 }
4415 }
4416 else
4417 { 4387 {
4418 handlerStopAnim = OnStopAnim; 4388 handlerStartAnim(this, AgentAni.AnimationList[i].AnimID);
4419 if (handlerStopAnim != null)
4420 {
4421 handlerStopAnim(this, AgentAni.AnimationList[i].AnimID);
4422 }
4423 } 4389 }
4424 } 4390 }
4425 break; 4391 else
4426 case PacketType.AgentRequestSit:
4427 if (OnAgentRequestSit != null)
4428 {
4429 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack;
4430
4431 handlerAgentRequestSit = OnAgentRequestSit;
4432 if (handlerAgentRequestSit != null)
4433 handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
4434 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
4435 }
4436 break;
4437 case PacketType.AgentSit:
4438 if (OnAgentSit != null)
4439 { 4392 {
4440 AgentSitPacket agentSit = (AgentSitPacket)Pack; 4393 handlerStopAnim = OnStopAnim;
4441 4394 if (handlerStopAnim != null)
4442 handlerAgentSit = OnAgentSit;
4443 if (handlerAgentSit != null)
4444 { 4395 {
4445 OnAgentSit(this, agentSit.AgentData.AgentID); 4396 handlerStopAnim(this, AgentAni.AnimationList[i].AnimID);
4446 } 4397 }
4447 } 4398 }
4448 break; 4399 }
4449 case PacketType.AvatarPickerRequest: 4400 break;
4450 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; 4401 case PacketType.AgentRequestSit:
4451 AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData; 4402 if (OnAgentRequestSit != null)
4452 AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data; 4403 {
4453 //Console.WriteLine("Agent Sends:" + Utils.BytesToString(querydata.Name)); 4404 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack;
4454
4455 handlerAvatarPickerRequest = OnAvatarPickerRequest;
4456 if (handlerAvatarPickerRequest != null)
4457 {
4458 handlerAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID,
4459 Utils.BytesToString(querydata.Name));
4460 }
4461 break;
4462 case PacketType.AgentDataUpdateRequest:
4463 AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack;
4464 4405
4465 handlerAgentDataUpdateRequest = OnAgentDataUpdateRequest; 4406 handlerAgentRequestSit = OnAgentRequestSit;
4407 if (handlerAgentRequestSit != null)
4408 handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
4409 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
4410 }
4411 break;
4412 case PacketType.AgentSit:
4413 if (OnAgentSit != null)
4414 {
4415 AgentSitPacket agentSit = (AgentSitPacket)Pack;
4466 4416
4467 if (handlerAgentDataUpdateRequest != null) 4417 handlerAgentSit = OnAgentSit;
4418 if (handlerAgentSit != null)
4468 { 4419 {
4469 handlerAgentDataUpdateRequest(this, avRequestDataUpdatePacket.AgentData.AgentID, avRequestDataUpdatePacket.AgentData.SessionID); 4420 OnAgentSit(this, agentSit.AgentData.AgentID);
4470 } 4421 }
4422 }
4423 break;
4424 case PacketType.AvatarPickerRequest:
4425 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack;
4426 AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData;
4427 AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data;
4428 //Console.WriteLine("Agent Sends:" + Utils.BytesToString(querydata.Name));
4429
4430 handlerAvatarPickerRequest = OnAvatarPickerRequest;
4431 if (handlerAvatarPickerRequest != null)
4432 {
4433 handlerAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID,
4434 Utils.BytesToString(querydata.Name));
4435 }
4436 break;
4437 case PacketType.AgentDataUpdateRequest:
4438 AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack;
4471 4439
4472 break; 4440 handlerAgentDataUpdateRequest = OnAgentDataUpdateRequest;
4473 case PacketType.UserInfoRequest:
4474 UserInfoRequestPacket avUserInfoRequestPacket = (UserInfoRequestPacket)Pack;
4475 4441
4476 handlerUserInfoRequest = OnUserInfoRequest; 4442 if (handlerAgentDataUpdateRequest != null)
4477 if (handlerUserInfoRequest != null) 4443 {
4478 { 4444 handlerAgentDataUpdateRequest(this, avRequestDataUpdatePacket.AgentData.AgentID, avRequestDataUpdatePacket.AgentData.SessionID);
4479 handlerUserInfoRequest(this, avUserInfoRequestPacket.AgentData.AgentID, avUserInfoRequestPacket.AgentData.SessionID); 4445 }
4480 } 4446
4481 break; 4447 break;
4448 case PacketType.UserInfoRequest:
4449 UserInfoRequestPacket avUserInfoRequestPacket = (UserInfoRequestPacket)Pack;
4450
4451 handlerUserInfoRequest = OnUserInfoRequest;
4452 if (handlerUserInfoRequest != null)
4453 {
4454 handlerUserInfoRequest(this, avUserInfoRequestPacket.AgentData.AgentID, avUserInfoRequestPacket.AgentData.SessionID);
4455 }
4456 break;
4482 4457
4483 case PacketType.SetStartLocationRequest: 4458 case PacketType.SetStartLocationRequest:
4484 SetStartLocationRequestPacket avSetStartLocationRequestPacket = (SetStartLocationRequestPacket)Pack; 4459 SetStartLocationRequestPacket avSetStartLocationRequestPacket = (SetStartLocationRequestPacket)Pack;
4485 4460
4486 if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId) 4461 if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId)
4462 {
4463 handlerSetStartLocationRequest = OnSetStartLocationRequest;
4464 if (handlerSetStartLocationRequest != null)
4487 { 4465 {
4488 handlerSetStartLocationRequest = OnSetStartLocationRequest; 4466 handlerSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos,
4489 if (handlerSetStartLocationRequest != null) 4467 avSetStartLocationRequestPacket.StartLocationData.LocationLookAt,
4490 { 4468 avSetStartLocationRequestPacket.StartLocationData.LocationID);
4491 handlerSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos,
4492 avSetStartLocationRequestPacket.StartLocationData.LocationLookAt,
4493 avSetStartLocationRequestPacket.StartLocationData.LocationID);
4494 }
4495 } 4469 }
4496 break; 4470 }
4471 break;
4497 4472
4498 case PacketType.AgentThrottle: 4473 case PacketType.AgentThrottle:
4499 AgentThrottlePacket atpack = (AgentThrottlePacket)Pack; 4474 AgentThrottlePacket atpack = (AgentThrottlePacket)Pack;
4500 m_PacketHandler.PacketQueue.SetThrottleFromClient(atpack.Throttle.Throttles); 4475 m_PacketHandler.PacketQueue.SetThrottleFromClient(atpack.Throttle.Throttles);
4501 break; 4476 break;
4502 4477
4503 case PacketType.AgentPause: 4478 case PacketType.AgentPause:
4504 m_probesWithNoIngressPackets = 0; 4479 m_probesWithNoIngressPackets = 0;
4505 m_clientBlocked = true; 4480 m_clientBlocked = true;
4506 break; 4481 break;
4507 4482
4508 case PacketType.AgentResume: 4483 case PacketType.AgentResume:
4509 m_probesWithNoIngressPackets = 0; 4484 m_probesWithNoIngressPackets = 0;
4510 m_clientBlocked = false; 4485 m_clientBlocked = false;
4511 SendStartPingCheck(0); 4486 SendStartPingCheck(0);
4512 4487
4513 break; 4488 break;
4514 4489
4515 case PacketType.ForceScriptControlRelease: 4490 case PacketType.ForceScriptControlRelease:
4516 handlerForceReleaseControls = OnForceReleaseControls; 4491 handlerForceReleaseControls = OnForceReleaseControls;
4517 if (handlerForceReleaseControls != null) 4492 if (handlerForceReleaseControls != null)
4518 { 4493 {
4519 handlerForceReleaseControls(this, AgentId); 4494 handlerForceReleaseControls(this, AgentId);
4520 } 4495 }
4521 break; 4496 break;
4522 4497
4523 #endregion 4498 #endregion
4524 4499
4525 #region Objects/m_sceneObjects 4500 #region Objects/m_sceneObjects
4526 4501
4527 case PacketType.ObjectLink: 4502 case PacketType.ObjectLink:
4528 ObjectLinkPacket link = (ObjectLinkPacket)Pack; 4503 ObjectLinkPacket link = (ObjectLinkPacket)Pack;
4529 uint parentprimid = 0; 4504 uint parentprimid = 0;
4530 List<uint> childrenprims = new List<uint>(); 4505 List<uint> childrenprims = new List<uint>();
4531 if (link.ObjectData.Length > 1) 4506 if (link.ObjectData.Length > 1)
4532 { 4507 {
4533 parentprimid = link.ObjectData[0].ObjectLocalID; 4508 parentprimid = link.ObjectData[0].ObjectLocalID;
4534 4509
4535 for (int i = 1; i < link.ObjectData.Length; i++) 4510 for (int i = 1; i < link.ObjectData.Length; i++)
4536 {
4537 childrenprims.Add(link.ObjectData[i].ObjectLocalID);
4538 }
4539 }
4540 handlerLinkObjects = OnLinkObjects;
4541 if (handlerLinkObjects != null)
4542 { 4511 {
4543 handlerLinkObjects(this, parentprimid, childrenprims); 4512 childrenprims.Add(link.ObjectData[i].ObjectLocalID);
4544 }
4545 break;
4546 case PacketType.ObjectDelink:
4547 ObjectDelinkPacket delink = (ObjectDelinkPacket)Pack;
4548
4549 // It appears the prim at index 0 is not always the root prim (for
4550 // instance, when one prim of a link set has been edited independently
4551 // of the others). Therefore, we'll pass all the ids onto the delink
4552 // method for it to decide which is the root.
4553 List<uint> prims = new List<uint>();
4554 for (int i = 0; i < delink.ObjectData.Length; i++)
4555 {
4556 prims.Add(delink.ObjectData[i].ObjectLocalID);
4557 }
4558 handlerDelinkObjects = OnDelinkObjects;
4559 if (handlerDelinkObjects != null)
4560 {
4561 handlerDelinkObjects(prims);
4562 } 4513 }
4514 }
4515 handlerLinkObjects = OnLinkObjects;
4516 if (handlerLinkObjects != null)
4517 {
4518 handlerLinkObjects(this, parentprimid, childrenprims);
4519 }
4520 break;
4521 case PacketType.ObjectDelink:
4522 ObjectDelinkPacket delink = (ObjectDelinkPacket)Pack;
4523
4524 // It appears the prim at index 0 is not always the root prim (for
4525 // instance, when one prim of a link set has been edited independently
4526 // of the others). Therefore, we'll pass all the ids onto the delink
4527 // method for it to decide which is the root.
4528 List<uint> prims = new List<uint>();
4529 for (int i = 0; i < delink.ObjectData.Length; i++)
4530 {
4531 prims.Add(delink.ObjectData[i].ObjectLocalID);
4532 }
4533 handlerDelinkObjects = OnDelinkObjects;
4534 if (handlerDelinkObjects != null)
4535 {
4536 handlerDelinkObjects(prims);
4537 }
4563 4538
4564 break; 4539 break;
4565 case PacketType.ObjectAdd: 4540 case PacketType.ObjectAdd:
4566 if (OnAddPrim != null) 4541 if (OnAddPrim != null)
4567 { 4542 {
4568 ObjectAddPacket addPacket = (ObjectAddPacket)Pack; 4543 ObjectAddPacket addPacket = (ObjectAddPacket)Pack;
4569 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); 4544 PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
4570 // m_log.Info("[REZData]: " + addPacket.ToString()); 4545 // m_log.Info("[REZData]: " + addPacket.ToString());
4571 //BypassRaycast: 1 4546 //BypassRaycast: 1
4572 //RayStart: <69.79469, 158.2652, 98.40343> 4547 //RayStart: <69.79469, 158.2652, 98.40343>
4573 //RayEnd: <61.97724, 141.995, 92.58341> 4548 //RayEnd: <61.97724, 141.995, 92.58341>
4574 //RayTargetID: 00000000-0000-0000-0000-000000000000 4549 //RayTargetID: 00000000-0000-0000-0000-000000000000
4575 4550
4576 //Check to see if adding the prim is allowed; useful for any module wanting to restrict the 4551 //Check to see if adding the prim is allowed; useful for any module wanting to restrict the
4577 //object from rezing initially 4552 //object from rezing initially
4578 4553
4579 handlerAddPrim = OnAddPrim; 4554 handlerAddPrim = OnAddPrim;
4580 if (handlerAddPrim != null) 4555 if (handlerAddPrim != null)
4581 handlerAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection); 4556 handlerAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection);
4582 } 4557 }
4583 break; 4558 break;
4584 case PacketType.ObjectShape: 4559 case PacketType.ObjectShape:
4585 ObjectShapePacket shapePacket = (ObjectShapePacket)Pack; 4560 ObjectShapePacket shapePacket = (ObjectShapePacket)Pack;
4586 handlerUpdatePrimShape = null; 4561 handlerUpdatePrimShape = null;
4587 for (int i = 0; i < shapePacket.ObjectData.Length; i++) 4562 for (int i = 0; i < shapePacket.ObjectData.Length; i++)
4588 { 4563 {
4589 handlerUpdatePrimShape = OnUpdatePrimShape; 4564 handlerUpdatePrimShape = OnUpdatePrimShape;
4590 if (handlerUpdatePrimShape != null) 4565 if (handlerUpdatePrimShape != null)
4591 { 4566 {
4592 UpdateShapeArgs shapeData = new UpdateShapeArgs(); 4567 UpdateShapeArgs shapeData = new UpdateShapeArgs();
4593 shapeData.ObjectLocalID = shapePacket.ObjectData[i].ObjectLocalID; 4568 shapeData.ObjectLocalID = shapePacket.ObjectData[i].ObjectLocalID;
4594 shapeData.PathBegin = shapePacket.ObjectData[i].PathBegin; 4569 shapeData.PathBegin = shapePacket.ObjectData[i].PathBegin;
4595 shapeData.PathCurve = shapePacket.ObjectData[i].PathCurve; 4570 shapeData.PathCurve = shapePacket.ObjectData[i].PathCurve;
4596 shapeData.PathEnd = shapePacket.ObjectData[i].PathEnd; 4571 shapeData.PathEnd = shapePacket.ObjectData[i].PathEnd;
4597 shapeData.PathRadiusOffset = shapePacket.ObjectData[i].PathRadiusOffset; 4572 shapeData.PathRadiusOffset = shapePacket.ObjectData[i].PathRadiusOffset;
4598 shapeData.PathRevolutions = shapePacket.ObjectData[i].PathRevolutions; 4573 shapeData.PathRevolutions = shapePacket.ObjectData[i].PathRevolutions;
4599 shapeData.PathScaleX = shapePacket.ObjectData[i].PathScaleX; 4574 shapeData.PathScaleX = shapePacket.ObjectData[i].PathScaleX;
4600 shapeData.PathScaleY = shapePacket.ObjectData[i].PathScaleY; 4575 shapeData.PathScaleY = shapePacket.ObjectData[i].PathScaleY;
4601 shapeData.PathShearX = shapePacket.ObjectData[i].PathShearX; 4576 shapeData.PathShearX = shapePacket.ObjectData[i].PathShearX;
4602 shapeData.PathShearY = shapePacket.ObjectData[i].PathShearY; 4577 shapeData.PathShearY = shapePacket.ObjectData[i].PathShearY;
4603 shapeData.PathSkew = shapePacket.ObjectData[i].PathSkew; 4578 shapeData.PathSkew = shapePacket.ObjectData[i].PathSkew;
4604 shapeData.PathTaperX = shapePacket.ObjectData[i].PathTaperX; 4579 shapeData.PathTaperX = shapePacket.ObjectData[i].PathTaperX;
4605 shapeData.PathTaperY = shapePacket.ObjectData[i].PathTaperY; 4580 shapeData.PathTaperY = shapePacket.ObjectData[i].PathTaperY;
4606 shapeData.PathTwist = shapePacket.ObjectData[i].PathTwist; 4581 shapeData.PathTwist = shapePacket.ObjectData[i].PathTwist;
4607 shapeData.PathTwistBegin = shapePacket.ObjectData[i].PathTwistBegin; 4582 shapeData.PathTwistBegin = shapePacket.ObjectData[i].PathTwistBegin;
4608 shapeData.ProfileBegin = shapePacket.ObjectData[i].ProfileBegin; 4583 shapeData.ProfileBegin = shapePacket.ObjectData[i].ProfileBegin;
4609 shapeData.ProfileCurve = shapePacket.ObjectData[i].ProfileCurve; 4584 shapeData.ProfileCurve = shapePacket.ObjectData[i].ProfileCurve;
4610 shapeData.ProfileEnd = shapePacket.ObjectData[i].ProfileEnd; 4585 shapeData.ProfileEnd = shapePacket.ObjectData[i].ProfileEnd;
4611 shapeData.ProfileHollow = shapePacket.ObjectData[i].ProfileHollow; 4586 shapeData.ProfileHollow = shapePacket.ObjectData[i].ProfileHollow;
4612 4587
4613 handlerUpdatePrimShape(m_agentId, shapePacket.ObjectData[i].ObjectLocalID, 4588 handlerUpdatePrimShape(m_agentId, shapePacket.ObjectData[i].ObjectLocalID,
4614 shapeData); 4589 shapeData);
4615 }
4616 } 4590 }
4617 break; 4591 }
4618 case PacketType.ObjectExtraParams: 4592 break;
4619 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack; 4593 case PacketType.ObjectExtraParams:
4594 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack;
4620 4595
4621 handlerUpdateExtraParams = OnUpdateExtraParams; 4596 handlerUpdateExtraParams = OnUpdateExtraParams;
4622 if (handlerUpdateExtraParams != null) 4597 if (handlerUpdateExtraParams != null)
4623 { 4598 {
4624 handlerUpdateExtraParams(m_agentId, extraPar.ObjectData[0].ObjectLocalID, 4599 handlerUpdateExtraParams(m_agentId, extraPar.ObjectData[0].ObjectLocalID,
4625 extraPar.ObjectData[0].ParamType, 4600 extraPar.ObjectData[0].ParamType,
4626 extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); 4601 extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData);
4627 } 4602 }
4628 break; 4603 break;
4629 case PacketType.ObjectDuplicate: 4604 case PacketType.ObjectDuplicate:
4630 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; 4605 ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack;
4631 ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData; 4606 ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData;
4632 4607
4633 handlerObjectDuplicate = null; 4608 handlerObjectDuplicate = null;
4634 4609
4635 for (int i = 0; i < dupe.ObjectData.Length; i++) 4610 for (int i = 0; i < dupe.ObjectData.Length; i++)
4611 {
4612 handlerObjectDuplicate = OnObjectDuplicate;
4613 if (handlerObjectDuplicate != null)
4636 { 4614 {
4637 handlerObjectDuplicate = OnObjectDuplicate; 4615 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
4638 if (handlerObjectDuplicate != null) 4616 dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID,
4639 { 4617 AgentandGroupData.GroupID);
4640 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
4641 dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID,
4642 AgentandGroupData.GroupID);
4643 }
4644 } 4618 }
4619 }
4645 4620
4646 break; 4621 break;
4647 4622
4648 case PacketType.ObjectSelect: 4623 case PacketType.ObjectSelect:
4649 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; 4624 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
4650 4625
4651 handlerObjectSelect = null; 4626 handlerObjectSelect = null;
4652 4627
4653 for (int i = 0; i < incomingselect.ObjectData.Length; i++) 4628 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
4629 {
4630 handlerObjectSelect = OnObjectSelect;
4631 if (handlerObjectSelect != null)
4654 { 4632 {
4655 handlerObjectSelect = OnObjectSelect; 4633 handlerObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this);
4656 if (handlerObjectSelect != null)
4657 {
4658 handlerObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this);
4659 }
4660 } 4634 }
4661 break; 4635 }
4662 case PacketType.ObjectDeselect: 4636 break;
4663 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; 4637 case PacketType.ObjectDeselect:
4638 ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack;
4664 4639
4665 handlerObjectDeselect = null; 4640 handlerObjectDeselect = null;
4666 4641
4667 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) 4642 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
4643 {
4644 handlerObjectDeselect = OnObjectDeselect;
4645 if (handlerObjectDeselect != null)
4668 { 4646 {
4669 handlerObjectDeselect = OnObjectDeselect; 4647 OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this);
4670 if (handlerObjectDeselect != null)
4671 {
4672 OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this);
4673 }
4674 } 4648 }
4675 break; 4649 }
4676 case PacketType.ObjectPosition: 4650 break;
4677 // DEPRECATED: but till libsecondlife removes it, people will use it 4651 case PacketType.ObjectPosition:
4678 ObjectPositionPacket position = (ObjectPositionPacket)Pack; 4652 // DEPRECATED: but till libsecondlife removes it, people will use it
4653 ObjectPositionPacket position = (ObjectPositionPacket)Pack;
4679 4654
4680 for (int i = 0; i < position.ObjectData.Length; i++) 4655 for (int i = 0; i < position.ObjectData.Length; i++)
4681 { 4656 {
4682 handlerUpdateVector = OnUpdatePrimGroupPosition; 4657 handlerUpdateVector = OnUpdatePrimGroupPosition;
4683 if (handlerUpdateVector != null) 4658 if (handlerUpdateVector != null)
4684 handlerUpdateVector(position.ObjectData[i].ObjectLocalID, position.ObjectData[i].Position, this); 4659 handlerUpdateVector(position.ObjectData[i].ObjectLocalID, position.ObjectData[i].Position, this);
4685 } 4660 }
4686 4661
4687 break; 4662 break;
4688 case PacketType.ObjectScale: 4663 case PacketType.ObjectScale:
4689 // DEPRECATED: but till libsecondlife removes it, people will use it 4664 // DEPRECATED: but till libsecondlife removes it, people will use it
4690 ObjectScalePacket scale = (ObjectScalePacket)Pack; 4665 ObjectScalePacket scale = (ObjectScalePacket)Pack;
4691 4666
4692 for (int i = 0; i < scale.ObjectData.Length; i++) 4667 for (int i = 0; i < scale.ObjectData.Length; i++)
4693 { 4668 {
4694 handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 4669 handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale;
4695 if (handlerUpdatePrimGroupScale != null) 4670 if (handlerUpdatePrimGroupScale != null)
4696 handlerUpdatePrimGroupScale(scale.ObjectData[i].ObjectLocalID, scale.ObjectData[i].Scale, this); 4671 handlerUpdatePrimGroupScale(scale.ObjectData[i].ObjectLocalID, scale.ObjectData[i].Scale, this);
4697 } 4672 }
4698 4673
4699 break; 4674 break;
4700 case PacketType.ObjectRotation: 4675 case PacketType.ObjectRotation:
4701 // DEPRECATED: but till libsecondlife removes it, people will use it 4676 // DEPRECATED: but till libsecondlife removes it, people will use it
4702 ObjectRotationPacket rotation = (ObjectRotationPacket)Pack; 4677 ObjectRotationPacket rotation = (ObjectRotationPacket)Pack;
4703 4678
4704 for (int i = 0; i < rotation.ObjectData.Length; i++) 4679 for (int i = 0; i < rotation.ObjectData.Length; i++)
4705 { 4680 {
4706 handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; 4681 handlerUpdatePrimRotation = OnUpdatePrimGroupRotation;
4707 if (handlerUpdatePrimRotation != null) 4682 if (handlerUpdatePrimRotation != null)
4708 handlerUpdatePrimRotation(rotation.ObjectData[i].ObjectLocalID, rotation.ObjectData[i].Rotation, this); 4683 handlerUpdatePrimRotation(rotation.ObjectData[i].ObjectLocalID, rotation.ObjectData[i].Rotation, this);
4709 } 4684 }
4710 4685
4711 break; 4686 break;
4712 case PacketType.ObjectFlagUpdate: 4687 case PacketType.ObjectFlagUpdate:
4713 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; 4688 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
4714 4689
4715 handlerUpdatePrimFlags = OnUpdatePrimFlags; 4690 handlerUpdatePrimFlags = OnUpdatePrimFlags;
4716 4691
4717 if (handlerUpdatePrimFlags != null) 4692 if (handlerUpdatePrimFlags != null)
4718 { 4693 {
4719 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this); 4694 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this);
4720 } 4695 }
4721 break; 4696 break;
4722 case PacketType.ObjectImage: 4697 case PacketType.ObjectImage:
4723 ObjectImagePacket imagePack = (ObjectImagePacket)Pack; 4698 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
4724 4699
4725 handlerUpdatePrimTexture = null; 4700 handlerUpdatePrimTexture = null;
4726 for (int i = 0; i < imagePack.ObjectData.Length; i++) 4701 for (int i = 0; i < imagePack.ObjectData.Length; i++)
4702 {
4703 handlerUpdatePrimTexture = OnUpdatePrimTexture;
4704 if (handlerUpdatePrimTexture != null)
4727 { 4705 {
4728 handlerUpdatePrimTexture = OnUpdatePrimTexture; 4706 handlerUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID,
4729 if (handlerUpdatePrimTexture != null) 4707 imagePack.ObjectData[i].TextureEntry, this);
4730 {
4731 handlerUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID,
4732 imagePack.ObjectData[i].TextureEntry, this);
4733 }
4734 } 4708 }
4735 break; 4709 }
4736 case PacketType.ObjectGrab: 4710 break;
4737 ObjectGrabPacket grab = (ObjectGrabPacket)Pack; 4711 case PacketType.ObjectGrab:
4712 ObjectGrabPacket grab = (ObjectGrabPacket)Pack;
4738 4713
4739 handlerGrabObject = OnGrabObject; 4714 handlerGrabObject = OnGrabObject;
4740 4715
4741 if (handlerGrabObject != null) 4716 if (handlerGrabObject != null)
4717 {
4718 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
4719 if ((grab.SurfaceInfo != null) && (grab.SurfaceInfo.Length > 0))
4742 { 4720 {
4743 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>(); 4721 foreach (ObjectGrabPacket.SurfaceInfoBlock surfaceInfo in grab.SurfaceInfo)
4744 if ((grab.SurfaceInfo != null) && (grab.SurfaceInfo.Length > 0))
4745 { 4722 {
4746 foreach (ObjectGrabPacket.SurfaceInfoBlock surfaceInfo in grab.SurfaceInfo) 4723 SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs();
4747 { 4724 arg.Binormal = surfaceInfo.Binormal;
4748 SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs(); 4725 arg.FaceIndex = surfaceInfo.FaceIndex;
4749 arg.Binormal = surfaceInfo.Binormal; 4726 arg.Normal = surfaceInfo.Normal;
4750 arg.FaceIndex = surfaceInfo.FaceIndex; 4727 arg.Position = surfaceInfo.Position;
4751 arg.Normal = surfaceInfo.Normal; 4728 arg.STCoord = surfaceInfo.STCoord;
4752 arg.Position = surfaceInfo.Position; 4729 arg.UVCoord = surfaceInfo.UVCoord;
4753 arg.STCoord = surfaceInfo.STCoord; 4730 touchArgs.Add(arg);
4754 arg.UVCoord = surfaceInfo.UVCoord;
4755 touchArgs.Add(arg);
4756 }
4757 } 4731 }
4758 handlerGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this, touchArgs);
4759 } 4732 }
4760 break; 4733 handlerGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this, touchArgs);
4761 case PacketType.ObjectGrabUpdate: 4734 }
4762 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack; 4735 break;
4736 case PacketType.ObjectGrabUpdate:
4737 ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack;
4763 4738
4764 handlerGrabUpdate = OnGrabUpdate; 4739 handlerGrabUpdate = OnGrabUpdate;
4765 4740
4766 if (handlerGrabUpdate != null) 4741 if (handlerGrabUpdate != null)
4742 {
4743 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>();
4744 if ((grabUpdate.SurfaceInfo != null) && (grabUpdate.SurfaceInfo.Length > 0))
4767 { 4745 {
4768 List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>(); 4746 foreach (ObjectGrabUpdatePacket.SurfaceInfoBlock surfaceInfo in grabUpdate.SurfaceInfo)
4769 if ((grabUpdate.SurfaceInfo != null) && (grabUpdate.SurfaceInfo.Length > 0))
4770 { 4747 {
4771 foreach (ObjectGrabUpdatePacket.SurfaceInfoBlock surfaceInfo in grabUpdate.SurfaceInfo) 4748 SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs();
4772 { 4749 arg.Binormal = surfaceInfo.Binormal;
4773 SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs(); 4750 arg.FaceIndex = surfaceInfo.FaceIndex;
4774 arg.Binormal = surfaceInfo.Binormal; 4751 arg.Normal = surfaceInfo.Normal;
4775 arg.FaceIndex = surfaceInfo.FaceIndex; 4752 arg.Position = surfaceInfo.Position;
4776 arg.Normal = surfaceInfo.Normal; 4753 arg.STCoord = surfaceInfo.STCoord;
4777 arg.Position = surfaceInfo.Position; 4754 arg.UVCoord = surfaceInfo.UVCoord;
4778 arg.STCoord = surfaceInfo.STCoord; 4755 touchArgs.Add(arg);
4779 arg.UVCoord = surfaceInfo.UVCoord;
4780 touchArgs.Add(arg);
4781 }
4782 } 4756 }
4783 handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
4784 grabUpdate.ObjectData.GrabPosition, this, touchArgs);
4785 } 4757 }
4786 break; 4758 handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
4787 case PacketType.ObjectDeGrab: 4759 grabUpdate.ObjectData.GrabPosition, this, touchArgs);
4788 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack; 4760 }
4761 break;
4762 case PacketType.ObjectDeGrab:
4763 ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack;
4789 4764
4790 handlerDeGrabObject = OnDeGrabObject; 4765 handlerDeGrabObject = OnDeGrabObject;
4791 if (handlerDeGrabObject != null) 4766 if (handlerDeGrabObject != null)
4792 { 4767 {
4793 handlerDeGrabObject(deGrab.ObjectData.LocalID, this); 4768 handlerDeGrabObject(deGrab.ObjectData.LocalID, this);
4794 } 4769 }
4795 break; 4770 break;
4796 case PacketType.ObjectDescription: 4771 case PacketType.ObjectDescription:
4797 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; 4772 ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack;
4798 4773
4799 handlerObjectDescription = null; 4774 handlerObjectDescription = null;
4800 4775
4801 for (int i = 0; i < objDes.ObjectData.Length; i++) 4776 for (int i = 0; i < objDes.ObjectData.Length; i++)
4777 {
4778 handlerObjectDescription = OnObjectDescription;
4779 if (handlerObjectDescription != null)
4802 { 4780 {
4803 handlerObjectDescription = OnObjectDescription; 4781 handlerObjectDescription(this, objDes.ObjectData[i].LocalID,
4804 if (handlerObjectDescription != null) 4782 Util.FieldToString(objDes.ObjectData[i].Description));
4805 {
4806 handlerObjectDescription(this, objDes.ObjectData[i].LocalID,
4807 Util.FieldToString(objDes.ObjectData[i].Description));
4808 }
4809 } 4783 }
4810 break; 4784 }
4811 case PacketType.ObjectName: 4785 break;
4812 ObjectNamePacket objName = (ObjectNamePacket)Pack; 4786 case PacketType.ObjectName:
4787 ObjectNamePacket objName = (ObjectNamePacket)Pack;
4813 4788
4814 handlerObjectName = null; 4789 handlerObjectName = null;
4815 for (int i = 0; i < objName.ObjectData.Length; i++) 4790 for (int i = 0; i < objName.ObjectData.Length; i++)
4816 { 4791 {
4817 handlerObjectName = OnObjectName; 4792 handlerObjectName = OnObjectName;
4818 if (handlerObjectName != null) 4793 if (handlerObjectName != null)
4819 {
4820 handlerObjectName(this, objName.ObjectData[i].LocalID,
4821 Util.FieldToString(objName.ObjectData[i].Name));
4822 }
4823 }
4824 break;
4825 case PacketType.ObjectPermissions:
4826 if (OnObjectPermissions != null)
4827 { 4794 {
4828 ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack; 4795 handlerObjectName(this, objName.ObjectData[i].LocalID,
4796 Util.FieldToString(objName.ObjectData[i].Name));
4797 }
4798 }
4799 break;
4800 case PacketType.ObjectPermissions:
4801 if (OnObjectPermissions != null)
4802 {
4803 ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack;
4829 4804
4830 UUID AgentID = newobjPerms.AgentData.AgentID; 4805 UUID AgentID = newobjPerms.AgentData.AgentID;
4831 UUID SessionID = newobjPerms.AgentData.SessionID; 4806 UUID SessionID = newobjPerms.AgentData.SessionID;
4832 4807
4833 handlerObjectPermissions = null; 4808 handlerObjectPermissions = null;
4834 4809
4835 for (int i = 0; i < newobjPerms.ObjectData.Length; i++) 4810 for (int i = 0; i < newobjPerms.ObjectData.Length; i++)
4836 { 4811 {
4837 ObjectPermissionsPacket.ObjectDataBlock permChanges = newobjPerms.ObjectData[i]; 4812 ObjectPermissionsPacket.ObjectDataBlock permChanges = newobjPerms.ObjectData[i];
4838 4813
4839 byte field = permChanges.Field; 4814 byte field = permChanges.Field;
4840 uint localID = permChanges.ObjectLocalID; 4815 uint localID = permChanges.ObjectLocalID;
4841 uint mask = permChanges.Mask; 4816 uint mask = permChanges.Mask;
4842 byte set = permChanges.Set; 4817 byte set = permChanges.Set;
4843 4818
4844 handlerObjectPermissions = OnObjectPermissions; 4819 handlerObjectPermissions = OnObjectPermissions;
4845 4820
4846 if (handlerObjectPermissions != null) 4821 if (handlerObjectPermissions != null)
4847 handlerObjectPermissions(this, AgentID, SessionID, field, localID, mask, set); 4822 handlerObjectPermissions(this, AgentID, SessionID, field, localID, mask, set);
4848 }
4849 } 4823 }
4824 }
4850 4825
4851 // Here's our data, 4826 // Here's our data,
4852 // PermField contains the field the info goes into 4827 // PermField contains the field the info goes into
4853 // PermField determines which mask we're changing 4828 // PermField determines which mask we're changing
4854 // 4829 //
4855 // chmask is the mask of the change 4830 // chmask is the mask of the change
4856 // setTF is whether we're adding it or taking it away 4831 // setTF is whether we're adding it or taking it away
4857 // 4832 //
4858 // objLocalID is the localID of the object. 4833 // objLocalID is the localID of the object.
4859 4834
4860 // Unfortunately, we have to pass the event the packet because objData is an array 4835 // Unfortunately, we have to pass the event the packet because objData is an array
4861 // That means multiple object perms may be updated in a single packet. 4836 // That means multiple object perms may be updated in a single packet.
4862 4837
4863 break; 4838 break;
4864 4839
4865 case PacketType.Undo: 4840 case PacketType.Undo:
4866 UndoPacket undoitem = (UndoPacket)Pack; 4841 UndoPacket undoitem = (UndoPacket)Pack;
4867 if (undoitem.ObjectData.Length > 0) 4842 if (undoitem.ObjectData.Length > 0)
4843 {
4844 for (int i = 0; i < undoitem.ObjectData.Length; i++)
4868 { 4845 {
4869 for (int i = 0; i < undoitem.ObjectData.Length; i++) 4846 UUID objiD = undoitem.ObjectData[i].ObjectID;
4847 handlerOnUndo = OnUndo;
4848 if (handlerOnUndo != null)
4870 { 4849 {
4871 UUID objiD = undoitem.ObjectData[i].ObjectID; 4850 handlerOnUndo(this, objiD);
4872 handlerOnUndo = OnUndo;
4873 if (handlerOnUndo != null)
4874 {
4875 handlerOnUndo(this, objiD);
4876 }
4877
4878 } 4851 }
4852
4879 } 4853 }
4880 break; 4854 }
4881 case PacketType.ObjectDuplicateOnRay: 4855 break;
4882 ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack; 4856 case PacketType.ObjectDuplicateOnRay:
4857 ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack;
4883 4858
4884 handlerObjectDuplicateOnRay = null; 4859 handlerObjectDuplicateOnRay = null;
4885 4860
4886 4861
4887 for (int i = 0; i < dupeOnRay.ObjectData.Length; i++) 4862 for (int i = 0; i < dupeOnRay.ObjectData.Length; i++)
4863 {
4864 handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay;
4865 if (handlerObjectDuplicateOnRay != null)
4888 { 4866 {
4889 handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay; 4867 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags,
4890 if (handlerObjectDuplicateOnRay != null) 4868 dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
4891 { 4869 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
4892 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, 4870 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
4893 dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
4894 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
4895 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
4896 }
4897 } 4871 }
4872 }
4898 4873
4899 break; 4874 break;
4900 case PacketType.RequestObjectPropertiesFamily: 4875 case PacketType.RequestObjectPropertiesFamily:
4901 //This powers the little tooltip that appears when you move your mouse over an object 4876 //This powers the little tooltip that appears when you move your mouse over an object
4902 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack; 4877 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack;
4903 4878
4904 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData; 4879 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData;
4905 4880
4906 handlerRequestObjectPropertiesFamily = OnRequestObjectPropertiesFamily; 4881 handlerRequestObjectPropertiesFamily = OnRequestObjectPropertiesFamily;
4907 4882
4908 if (handlerRequestObjectPropertiesFamily != null) 4883 if (handlerRequestObjectPropertiesFamily != null)
4909 { 4884 {
4910 handlerRequestObjectPropertiesFamily(this, m_agentId, packObjBlock.RequestFlags, 4885 handlerRequestObjectPropertiesFamily(this, m_agentId, packObjBlock.RequestFlags,
4911 packObjBlock.ObjectID); 4886 packObjBlock.ObjectID);
4912 } 4887 }
4913 4888
4914 break; 4889 break;
4915 case PacketType.ObjectIncludeInSearch: 4890 case PacketType.ObjectIncludeInSearch:
4916 //This lets us set objects to appear in search (stuff like DataSnapshot, etc) 4891 //This lets us set objects to appear in search (stuff like DataSnapshot, etc)
4917 ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack; 4892 ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack;
4918 handlerObjectIncludeInSearch = null; 4893 handlerObjectIncludeInSearch = null;
4919 4894
4920 foreach (ObjectIncludeInSearchPacket.ObjectDataBlock objData in packInSearch.ObjectData) 4895 foreach (ObjectIncludeInSearchPacket.ObjectDataBlock objData in packInSearch.ObjectData)
4921 { 4896 {
4922 bool inSearch = objData.IncludeInSearch; 4897 bool inSearch = objData.IncludeInSearch;
4923 uint localID = objData.ObjectLocalID; 4898 uint localID = objData.ObjectLocalID;
4924 4899
4925 handlerObjectIncludeInSearch = OnObjectIncludeInSearch; 4900 handlerObjectIncludeInSearch = OnObjectIncludeInSearch;
4926 4901
4927 if (handlerObjectIncludeInSearch != null) 4902 if (handlerObjectIncludeInSearch != null)
4928 { 4903 {
4929 handlerObjectIncludeInSearch(this, inSearch, localID); 4904 handlerObjectIncludeInSearch(this, inSearch, localID);
4930 }
4931 } 4905 }
4932 break; 4906 }
4907 break;
4933 4908
4934 case PacketType.ScriptAnswerYes: 4909 case PacketType.ScriptAnswerYes:
4935 ScriptAnswerYesPacket scriptAnswer = (ScriptAnswerYesPacket)Pack; 4910 ScriptAnswerYesPacket scriptAnswer = (ScriptAnswerYesPacket)Pack;
4936 4911
4937 handlerScriptAnswer = OnScriptAnswer; 4912 handlerScriptAnswer = OnScriptAnswer;
4938 if (handlerScriptAnswer != null) 4913 if (handlerScriptAnswer != null)
4914 {
4915 handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions);
4916 }
4917 break;
4918
4919 case PacketType.ObjectClickAction:
4920 ObjectClickActionPacket ocpacket = (ObjectClickActionPacket)Pack;
4921
4922 handlerObjectClickAction = OnObjectClickAction;
4923 if (handlerObjectClickAction != null)
4924 {
4925 foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData)
4939 { 4926 {
4940 handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions); 4927 byte action = odata.ClickAction;
4928 uint localID = odata.ObjectLocalID;
4929 handlerObjectClickAction(this, localID, action.ToString());
4941 } 4930 }
4942 break; 4931 }
4932 break;
4943 4933
4944 case PacketType.ObjectClickAction: 4934 case PacketType.ObjectMaterial:
4945 ObjectClickActionPacket ocpacket = (ObjectClickActionPacket)Pack; 4935 ObjectMaterialPacket ompacket = (ObjectMaterialPacket)Pack;
4946 4936
4947 handlerObjectClickAction = OnObjectClickAction; 4937 handlerObjectMaterial = OnObjectMaterial;
4948 if (handlerObjectClickAction != null) 4938 if (handlerObjectMaterial != null)
4949 { 4939 {
4950 foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData) 4940 foreach (ObjectMaterialPacket.ObjectDataBlock odata in ompacket.ObjectData)
4951 { 4941 {
4952 byte action = odata.ClickAction; 4942 byte material = odata.Material;
4953 uint localID = odata.ObjectLocalID; 4943 uint localID = odata.ObjectLocalID;
4954 handlerObjectClickAction(this, localID, action.ToString()); 4944 handlerObjectMaterial(this, localID, material.ToString());
4955 } 4945 }
4956 } 4946 }
4957 break; 4947 break;
4958
4959 case PacketType.ObjectMaterial:
4960 ObjectMaterialPacket ompacket = (ObjectMaterialPacket)Pack;
4961
4962 handlerObjectMaterial = OnObjectMaterial;
4963 if (handlerObjectMaterial != null)
4964 {
4965 foreach (ObjectMaterialPacket.ObjectDataBlock odata in ompacket.ObjectData)
4966 {
4967 byte material = odata.Material;
4968 uint localID = odata.ObjectLocalID;
4969 handlerObjectMaterial(this, localID, material.ToString());
4970 }
4971 }
4972 break;
4973 4948
4974 #endregion 4949 #endregion
4975 4950
4976 #region Inventory/Asset/Other related packets 4951 #region Inventory/Asset/Other related packets
4977 4952
4978 case PacketType.RequestImage: 4953 case PacketType.RequestImage:
4979 RequestImagePacket imageRequest = (RequestImagePacket)Pack; 4954 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
4980 //Console.WriteLine("image request: " + Pack.ToString()); 4955 //Console.WriteLine("image request: " + Pack.ToString());
4981 4956
4982 handlerTextureRequest = null; 4957 handlerTextureRequest = null;
4983 4958
4984 for (int i = 0; i < imageRequest.RequestImage.Length; i++) 4959 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
4960 {
4961 if (OnRequestTexture != null)
4985 { 4962 {
4986 if (OnRequestTexture != null) 4963 TextureRequestArgs args = new TextureRequestArgs();
4987 { 4964 args.RequestedAssetID = imageRequest.RequestImage[i].Image;
4988 TextureRequestArgs args = new TextureRequestArgs(); 4965 args.DiscardLevel = imageRequest.RequestImage[i].DiscardLevel;
4989 args.RequestedAssetID = imageRequest.RequestImage[i].Image; 4966 args.PacketNumber = imageRequest.RequestImage[i].Packet;
4990 args.DiscardLevel = imageRequest.RequestImage[i].DiscardLevel; 4967 args.Priority = imageRequest.RequestImage[i].DownloadPriority;
4991 args.PacketNumber = imageRequest.RequestImage[i].Packet;
4992 args.Priority = imageRequest.RequestImage[i].DownloadPriority;
4993 4968
4994 handlerTextureRequest = OnRequestTexture; 4969 handlerTextureRequest = OnRequestTexture;
4995 4970
4996 if (handlerTextureRequest != null) 4971 if (handlerTextureRequest != null)
4997 OnRequestTexture(this, args); 4972 OnRequestTexture(this, args);
4998 }
4999 } 4973 }
5000 break; 4974 }
5001 case PacketType.TransferRequest: 4975 break;
5002 //Console.WriteLine("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); 4976 case PacketType.TransferRequest:
5003 TransferRequestPacket transfer = (TransferRequestPacket)Pack; 4977 //Console.WriteLine("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request");
5004 // Validate inventory transfers 4978 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
5005 // Has to be done here, because AssetCache can't do it 4979 // Validate inventory transfers
5006 // 4980 // Has to be done here, because AssetCache can't do it
5007 if (transfer.TransferInfo.SourceType == 3) 4981 //
4982 if (transfer.TransferInfo.SourceType == 3)
4983 {
4984 UUID taskID = new UUID(transfer.TransferInfo.Params, 48);
4985 UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
4986 UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
4987 if (!(((Scene)m_scene).ExternalChecks.ExternalChecksBypassPermissions()))
5008 { 4988 {
5009 UUID taskID = UUID.Zero; 4989 if (taskID != UUID.Zero) // Prim
5010 UUID itemID = UUID.Zero;
5011 UUID requestID = UUID.Zero;
5012 taskID = new UUID(transfer.TransferInfo.Params, 48);
5013 itemID = new UUID(transfer.TransferInfo.Params, 64);
5014 requestID = new UUID(transfer.TransferInfo.Params, 80);
5015 if (!(((Scene)m_scene).ExternalChecks.ExternalChecksBypassPermissions()))
5016 { 4990 {
5017 if (taskID != UUID.Zero) // Prim 4991 SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
5018 { 4992 if (part == null)
5019 SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); 4993 break;
5020 if (part == null)
5021 break;
5022 4994
5023 if (part.OwnerID != AgentId) 4995 if (part.OwnerID != AgentId)
5024 break; 4996 break;
5025 4997
5026 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 4998 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
5027 break; 4999 break;
5028 5000
5029 TaskInventoryItem ti = part.GetInventoryItem(itemID); 5001 TaskInventoryItem ti = part.GetInventoryItem(itemID);
5030 if (ti == null) 5002 if (ti == null)
5031 break; 5003 break;
5032 5004
5033 if (ti.OwnerID != AgentId) 5005 if (ti.OwnerID != AgentId)
5034 break; 5006 break;
5035 5007
5036 if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify| (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify| (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) 5008 if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify| (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify| (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
5037 break; 5009 break;
5038 5010
5039 if (ti.AssetID != requestID) 5011 if (ti.AssetID != requestID)
5040 break; 5012 break;
5041 } 5013 }
5042 else // Agent 5014 else // Agent
5015 {
5016 CachedUserInfo userInfo = ((Scene)m_scene).CommsManager.UserProfileCacheService.GetUserDetails(AgentId);
5017 if (userInfo == null)
5043 { 5018 {
5044 CachedUserInfo userInfo = ((Scene)m_scene).CommsManager.UserProfileCacheService.GetUserDetails(AgentId); 5019 m_log.ErrorFormat(
5045 if (userInfo == null) 5020 "[CLIENT]: Could not resolve user {0} for caps inventory update",
5046 { 5021 AgentId);
5047 m_log.ErrorFormat(
5048 "[CLIENT]: Could not resolve user {0} for caps inventory update",
5049 AgentId);
5050 5022
5051 break; 5023 break;
5052 } 5024 }
5053 5025
5054 if (userInfo.RootFolder == null) 5026 if (userInfo.RootFolder == null)
5055 break; 5027 break;
5056 5028
5057 InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID); 5029 InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
5030 if (assetRequestItem == null)
5031 {
5032 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
5058 if (assetRequestItem == null) 5033 if (assetRequestItem == null)
5059 { 5034 return;
5060 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); 5035 }
5061 if (assetRequestItem == null)
5062 return;
5063 }
5064 5036
5065 // At this point, we need to apply perms 5037 // At this point, we need to apply perms
5066 // only to notecards and scripts. All 5038 // only to notecards and scripts. All
5067 // other asset types are always available 5039 // other asset types are always available
5068 // 5040 //
5069 if (assetRequestItem.AssetType == 10) 5041 if (assetRequestItem.AssetType == 10)
5042 {
5043 if (!((Scene)m_scene).ExternalChecks.ExternalChecksCanViewScript(itemID, UUID.Zero, AgentId))
5070 { 5044 {
5071 if (!((Scene)m_scene).ExternalChecks.ExternalChecksCanViewScript(itemID, UUID.Zero, AgentId)) 5045 SendAgentAlertMessage("Insufficient permissions to view script", false);
5072 { 5046 break;
5073 SendAgentAlertMessage("Insufficient permissions to view script", false);
5074 break;
5075 }
5076 } 5047 }
5077 else if (assetRequestItem.AssetType == 7) 5048 }
5049 else if (assetRequestItem.AssetType == 7)
5050 {
5051 if (!((Scene)m_scene).ExternalChecks.ExternalChecksCanViewNotecard(itemID, UUID.Zero, AgentId))
5078 { 5052 {
5079 if (!((Scene)m_scene).ExternalChecks.ExternalChecksCanViewNotecard(itemID, UUID.Zero, AgentId)) 5053 SendAgentAlertMessage("Insufficient permissions to view notecard", false);
5080 {
5081 SendAgentAlertMessage("Insufficient permissions to view notecard", false);
5082 break;
5083 }
5084 }
5085
5086 if (assetRequestItem.AssetID != requestID)
5087 break; 5054 break;
5055 }
5088 } 5056 }
5057
5058 if (assetRequestItem.AssetID != requestID)
5059 break;
5089 } 5060 }
5090 } 5061 }
5062 }
5091 5063
5092 m_assetCache.AddAssetRequest(this, transfer); 5064 m_assetCache.AddAssetRequest(this, transfer);
5093 /* RequestAsset = OnRequestAsset; 5065 /* RequestAsset = OnRequestAsset;
5094 if (RequestAsset != null) 5066 if (RequestAsset != null)
5095 { 5067 {
5096 RequestAsset(this, transfer); 5068 RequestAsset(this, transfer);
5097 }*/ 5069 }*/
5098 break; 5070 break;
5099 case PacketType.AssetUploadRequest: 5071 case PacketType.AssetUploadRequest:
5100 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; 5072 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
5101 // Console.WriteLine("upload request " + Pack.ToString()); 5073 // Console.WriteLine("upload request " + Pack.ToString());
5102 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString()); 5074 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString());
5103 UUID temp = UUID.Combine(request.AssetBlock.TransactionID, SecureSessionId); 5075 UUID temp = UUID.Combine(request.AssetBlock.TransactionID, SecureSessionId);
5104 5076
5105 handlerAssetUploadRequest = OnAssetUploadRequest; 5077 handlerAssetUploadRequest = OnAssetUploadRequest;
5106 5078
5107 if (handlerAssetUploadRequest != null) 5079 if (handlerAssetUploadRequest != null)
5108 { 5080 {
5109 handlerAssetUploadRequest(this, temp, 5081 handlerAssetUploadRequest(this, temp,
5110 request.AssetBlock.TransactionID, request.AssetBlock.Type, 5082 request.AssetBlock.TransactionID, request.AssetBlock.Type,
5111 request.AssetBlock.AssetData, request.AssetBlock.StoreLocal, 5083 request.AssetBlock.AssetData, request.AssetBlock.StoreLocal,
5112 request.AssetBlock.Tempfile); 5084 request.AssetBlock.Tempfile);
5113 } 5085 }
5114 break; 5086 break;
5115 case PacketType.RequestXfer: 5087 case PacketType.RequestXfer:
5116 RequestXferPacket xferReq = (RequestXferPacket)Pack; 5088 RequestXferPacket xferReq = (RequestXferPacket)Pack;
5117 5089
5118 handlerRequestXfer = OnRequestXfer; 5090 handlerRequestXfer = OnRequestXfer;
5119 5091
5120 if (handlerRequestXfer != null) 5092 if (handlerRequestXfer != null)
5121 { 5093 {
5122 handlerRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); 5094 handlerRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename));
5123 } 5095 }
5124 break; 5096 break;
5125 case PacketType.SendXferPacket: 5097 case PacketType.SendXferPacket:
5126 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; 5098 SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack;
5127 5099
5128 handlerXferReceive = OnXferReceive; 5100 handlerXferReceive = OnXferReceive;
5129 if (handlerXferReceive != null) 5101 if (handlerXferReceive != null)
5130 { 5102 {
5131 handlerXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); 5103 handlerXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data);
5132 } 5104 }
5133 break; 5105 break;
5134 case PacketType.ConfirmXferPacket: 5106 case PacketType.ConfirmXferPacket:
5135 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack; 5107 ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack;
5136 5108
5137 handlerConfirmXfer = OnConfirmXfer; 5109 handlerConfirmXfer = OnConfirmXfer;
5138 if (handlerConfirmXfer != null) 5110 if (handlerConfirmXfer != null)
5139 { 5111 {
5140 handlerConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); 5112 handlerConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet);
5141 } 5113 }
5142 break; 5114 break;
5143 case PacketType.CreateInventoryFolder: 5115 case PacketType.CreateInventoryFolder:
5144 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; 5116 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
5145 5117
5146 handlerCreateInventoryFolder = OnCreateNewInventoryFolder; 5118 handlerCreateInventoryFolder = OnCreateNewInventoryFolder;
5147 if (handlerCreateInventoryFolder != null) 5119 if (handlerCreateInventoryFolder != null)
5148 { 5120 {
5149 handlerCreateInventoryFolder(this, invFolder.FolderData.FolderID, 5121 handlerCreateInventoryFolder(this, invFolder.FolderData.FolderID,
5150 (ushort)invFolder.FolderData.Type, 5122 (ushort)invFolder.FolderData.Type,
5151 Util.FieldToString(invFolder.FolderData.Name), 5123 Util.FieldToString(invFolder.FolderData.Name),
5152 invFolder.FolderData.ParentID); 5124 invFolder.FolderData.ParentID);
5153 } 5125 }
5154 break; 5126 break;
5155 case PacketType.UpdateInventoryFolder: 5127 case PacketType.UpdateInventoryFolder:
5156 if (OnUpdateInventoryFolder != null) 5128 if (OnUpdateInventoryFolder != null)
5157 { 5129 {
5158 UpdateInventoryFolderPacket invFolderx = (UpdateInventoryFolderPacket)Pack; 5130 UpdateInventoryFolderPacket invFolderx = (UpdateInventoryFolderPacket)Pack;
5159 5131
5160 handlerUpdateInventoryFolder = null; 5132 handlerUpdateInventoryFolder = null;
5161 5133
5162 for (int i = 0; i < invFolderx.FolderData.Length; i++) 5134 for (int i = 0; i < invFolderx.FolderData.Length; i++)
5135 {
5136 handlerUpdateInventoryFolder = OnUpdateInventoryFolder;
5137 if (handlerUpdateInventoryFolder != null)
5163 { 5138 {
5164 handlerUpdateInventoryFolder = OnUpdateInventoryFolder; 5139 OnUpdateInventoryFolder(this, invFolderx.FolderData[i].FolderID,
5165 if (handlerUpdateInventoryFolder != null) 5140 (ushort)invFolderx.FolderData[i].Type,
5166 { 5141 Util.FieldToString(invFolderx.FolderData[i].Name),
5167 OnUpdateInventoryFolder(this, invFolderx.FolderData[i].FolderID, 5142 invFolderx.FolderData[i].ParentID);
5168 (ushort)invFolderx.FolderData[i].Type,
5169 Util.FieldToString(invFolderx.FolderData[i].Name),
5170 invFolderx.FolderData[i].ParentID);
5171 }
5172 } 5143 }
5173 } 5144 }
5174 break; 5145 }
5175 case PacketType.MoveInventoryFolder: 5146 break;
5176 if (OnMoveInventoryFolder != null) 5147 case PacketType.MoveInventoryFolder:
5177 { 5148 if (OnMoveInventoryFolder != null)
5178 MoveInventoryFolderPacket invFoldery = (MoveInventoryFolderPacket)Pack; 5149 {
5150 MoveInventoryFolderPacket invFoldery = (MoveInventoryFolderPacket)Pack;
5179 5151
5180 handlerMoveInventoryFolder = null; 5152 handlerMoveInventoryFolder = null;
5181 5153
5182 for (int i = 0; i < invFoldery.InventoryData.Length; i++) 5154 for (int i = 0; i < invFoldery.InventoryData.Length; i++)
5155 {
5156 handlerMoveInventoryFolder = OnMoveInventoryFolder;
5157 if (handlerMoveInventoryFolder != null)
5183 { 5158 {
5184 handlerMoveInventoryFolder = OnMoveInventoryFolder; 5159 OnMoveInventoryFolder(this, invFoldery.InventoryData[i].FolderID,
5185 if (handlerMoveInventoryFolder != null) 5160 invFoldery.InventoryData[i].ParentID);
5186 {
5187 OnMoveInventoryFolder(this, invFoldery.InventoryData[i].FolderID,
5188 invFoldery.InventoryData[i].ParentID);
5189 }
5190 } 5161 }
5191 } 5162 }
5192 break; 5163 }
5193 case PacketType.CreateInventoryItem: 5164 break;
5194 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; 5165 case PacketType.CreateInventoryItem:
5166 CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack;
5195 5167
5196 handlerCreateNewInventoryItem = OnCreateNewInventoryItem; 5168 handlerCreateNewInventoryItem = OnCreateNewInventoryItem;
5197 if (handlerCreateNewInventoryItem != null) 5169 if (handlerCreateNewInventoryItem != null)
5198 { 5170 {
5199 handlerCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, 5171 handlerCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID,
5200 createItem.InventoryBlock.FolderID, 5172 createItem.InventoryBlock.FolderID,
5201 createItem.InventoryBlock.CallbackID, 5173 createItem.InventoryBlock.CallbackID,
5202 Util.FieldToString(createItem.InventoryBlock.Description), 5174 Util.FieldToString(createItem.InventoryBlock.Description),
5203 Util.FieldToString(createItem.InventoryBlock.Name), 5175 Util.FieldToString(createItem.InventoryBlock.Name),
5204 createItem.InventoryBlock.InvType, 5176 createItem.InventoryBlock.InvType,
5205 createItem.InventoryBlock.Type, 5177 createItem.InventoryBlock.Type,
5206 createItem.InventoryBlock.WearableType, 5178 createItem.InventoryBlock.WearableType,
5207 createItem.InventoryBlock.NextOwnerMask, 5179 createItem.InventoryBlock.NextOwnerMask,
5208 Util.UnixTimeSinceEpoch()); 5180 Util.UnixTimeSinceEpoch());
5209 } 5181 }
5210 break; 5182 break;
5211 case PacketType.FetchInventory: 5183 case PacketType.FetchInventory:
5212 if (OnFetchInventory != null) 5184 if (OnFetchInventory != null)
5213 { 5185 {
5214 FetchInventoryPacket FetchInventoryx = (FetchInventoryPacket)Pack; 5186 FetchInventoryPacket FetchInventoryx = (FetchInventoryPacket)Pack;
5215 5187
5216 handlerFetchInventory = null; 5188 handlerFetchInventory = null;
5217 5189
5218 for (int i = 0; i < FetchInventoryx.InventoryData.Length; i++) 5190 for (int i = 0; i < FetchInventoryx.InventoryData.Length; i++)
5219 { 5191 {
5220 handlerFetchInventory = OnFetchInventory; 5192 handlerFetchInventory = OnFetchInventory;
5221 5193
5222 if (handlerFetchInventory != null) 5194 if (handlerFetchInventory != null)
5223 { 5195 {
5224 OnFetchInventory(this, FetchInventoryx.InventoryData[i].ItemID, 5196 OnFetchInventory(this, FetchInventoryx.InventoryData[i].ItemID,
5225 FetchInventoryx.InventoryData[i].OwnerID); 5197 FetchInventoryx.InventoryData[i].OwnerID);
5226 }
5227 } 5198 }
5228 } 5199 }
5229 break; 5200 }
5230 case PacketType.FetchInventoryDescendents: 5201 break;
5231 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; 5202 case PacketType.FetchInventoryDescendents:
5203 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
5232 5204
5233 handlerFetchInventoryDescendents = OnFetchInventoryDescendents; 5205 handlerFetchInventoryDescendents = OnFetchInventoryDescendents;
5234 if (handlerFetchInventoryDescendents != null) 5206 if (handlerFetchInventoryDescendents != null)
5235 { 5207 {
5236 handlerFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, 5208 handlerFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID,
5237 Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, 5209 Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems,
5238 Fetch.InventoryData.SortOrder); 5210 Fetch.InventoryData.SortOrder);
5239 } 5211 }
5240 break; 5212 break;
5241 case PacketType.PurgeInventoryDescendents: 5213 case PacketType.PurgeInventoryDescendents:
5242 PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket)Pack; 5214 PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket)Pack;
5243 5215
5244 handlerPurgeInventoryDescendents = OnPurgeInventoryDescendents; 5216 handlerPurgeInventoryDescendents = OnPurgeInventoryDescendents;
5245 if (handlerPurgeInventoryDescendents != null) 5217 if (handlerPurgeInventoryDescendents != null)
5246 { 5218 {
5247 handlerPurgeInventoryDescendents(this, Purge.InventoryData.FolderID); 5219 handlerPurgeInventoryDescendents(this, Purge.InventoryData.FolderID);
5248 } 5220 }
5249 break; 5221 break;
5250 case PacketType.UpdateInventoryItem: 5222 case PacketType.UpdateInventoryItem:
5251 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; 5223 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
5252 if (OnUpdateInventoryItem != null) 5224 if (OnUpdateInventoryItem != null)
5225 {
5226 handlerUpdateInventoryItem = null;
5227 for (int i = 0; i < update.InventoryData.Length; i++)
5253 { 5228 {
5254 handlerUpdateInventoryItem = null; 5229 handlerUpdateInventoryItem = OnUpdateInventoryItem;
5255 for (int i = 0; i < update.InventoryData.Length; i++)
5256 {
5257 handlerUpdateInventoryItem = OnUpdateInventoryItem;
5258 5230
5259 if (handlerUpdateInventoryItem != null) 5231 if (handlerUpdateInventoryItem != null)
5260 { 5232 {
5261 InventoryItemBase itemUpd = new InventoryItemBase(); 5233 InventoryItemBase itemUpd = new InventoryItemBase();
5262 itemUpd.ID = update.InventoryData[i].ItemID; 5234 itemUpd.ID = update.InventoryData[i].ItemID;
5263 itemUpd.Name = Util.FieldToString(update.InventoryData[i].Name); 5235 itemUpd.Name = Util.FieldToString(update.InventoryData[i].Name);
5264 itemUpd.Description = Util.FieldToString(update.InventoryData[i].Description); 5236 itemUpd.Description = Util.FieldToString(update.InventoryData[i].Description);
5265 itemUpd.GroupID = update.InventoryData[i].GroupID; 5237 itemUpd.GroupID = update.InventoryData[i].GroupID;
5266 itemUpd.GroupOwned = update.InventoryData[i].GroupOwned; 5238 itemUpd.GroupOwned = update.InventoryData[i].GroupOwned;
5267 itemUpd.NextPermissions = update.InventoryData[i].NextOwnerMask; 5239 itemUpd.NextPermissions = update.InventoryData[i].NextOwnerMask;
5268 itemUpd.EveryOnePermissions = update.InventoryData[i].EveryoneMask; 5240 itemUpd.EveryOnePermissions = update.InventoryData[i].EveryoneMask;
5269 itemUpd.CreationDate = update.InventoryData[i].CreationDate; 5241 itemUpd.CreationDate = update.InventoryData[i].CreationDate;
5270 itemUpd.Folder = update.InventoryData[i].FolderID; 5242 itemUpd.Folder = update.InventoryData[i].FolderID;
5271 itemUpd.InvType = update.InventoryData[i].InvType; 5243 itemUpd.InvType = update.InventoryData[i].InvType;
5272 itemUpd.SalePrice = update.InventoryData[i].SalePrice; 5244 itemUpd.SalePrice = update.InventoryData[i].SalePrice;
5273 itemUpd.SaleType = update.InventoryData[i].SaleType; 5245 itemUpd.SaleType = update.InventoryData[i].SaleType;
5274 itemUpd.Flags = update.InventoryData[i].Flags; 5246 itemUpd.Flags = update.InventoryData[i].Flags;
5275 /* 5247 /*
5276 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, 5248 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID,
5277 update.InventoryData[i].ItemID, 5249 update.InventoryData[i].ItemID,
5278 Util.FieldToString(update.InventoryData[i].Name), 5250 Util.FieldToString(update.InventoryData[i].Name),
5279 Util.FieldToString(update.InventoryData[i].Description), 5251 Util.FieldToString(update.InventoryData[i].Description),
5280 update.InventoryData[i].NextOwnerMask); 5252 update.InventoryData[i].NextOwnerMask);
5281 */ 5253 */
5282 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, 5254 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID,
5283 update.InventoryData[i].ItemID, 5255 update.InventoryData[i].ItemID,
5284 itemUpd); 5256 itemUpd);
5285 }
5286 } 5257 }
5287 } 5258 }
5288 //Console.WriteLine(Pack.ToString()); 5259 }
5289 /*for (int i = 0; i < update.InventoryData.Length; i++) 5260 //Console.WriteLine(Pack.ToString());
5261 /*for (int i = 0; i < update.InventoryData.Length; i++)
5290 { 5262 {
5291 if (update.InventoryData[i].TransactionID != UUID.Zero) 5263 if (update.InventoryData[i].TransactionID != UUID.Zero)
5292 { 5264 {
@@ -5315,519 +5287,519 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5315 m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; 5287 m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ;
5316 } 5288 }
5317 }*/ 5289 }*/
5318 break; 5290 break;
5319 case PacketType.CopyInventoryItem: 5291 case PacketType.CopyInventoryItem:
5320 CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket)Pack; 5292 CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket)Pack;
5321 5293
5322 handlerCopyInventoryItem = null; 5294 handlerCopyInventoryItem = null;
5323 if (OnCopyInventoryItem != null) 5295 if (OnCopyInventoryItem != null)
5296 {
5297 foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData)
5324 { 5298 {
5325 foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData) 5299 handlerCopyInventoryItem = OnCopyInventoryItem;
5300 if (handlerCopyInventoryItem != null)
5326 { 5301 {
5327 handlerCopyInventoryItem = OnCopyInventoryItem; 5302 handlerCopyInventoryItem(this, datablock.CallbackID, datablock.OldAgentID,
5328 if (handlerCopyInventoryItem != null) 5303 datablock.OldItemID, datablock.NewFolderID,
5329 { 5304 Util.FieldToString(datablock.NewName));
5330 handlerCopyInventoryItem(this, datablock.CallbackID, datablock.OldAgentID,
5331 datablock.OldItemID, datablock.NewFolderID,
5332 Util.FieldToString(datablock.NewName));
5333 }
5334 } 5305 }
5335 } 5306 }
5336 break; 5307 }
5337 case PacketType.MoveInventoryItem: 5308 break;
5338 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack; 5309 case PacketType.MoveInventoryItem:
5339 if (OnMoveInventoryItem != null) 5310 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack;
5311 if (OnMoveInventoryItem != null)
5312 {
5313 handlerMoveInventoryItem = null;
5314 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
5340 { 5315 {
5341 handlerMoveInventoryItem = null; 5316 handlerMoveInventoryItem = OnMoveInventoryItem;
5342 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) 5317 if (handlerMoveInventoryItem != null)
5343 { 5318 {
5344 handlerMoveInventoryItem = OnMoveInventoryItem; 5319 handlerMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length,
5345 if (handlerMoveInventoryItem != null) 5320 Util.FieldToString(datablock.NewName));
5346 {
5347 handlerMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length,
5348 Util.FieldToString(datablock.NewName));
5349 }
5350 } 5321 }
5351 } 5322 }
5352 break; 5323 }
5353 case PacketType.RemoveInventoryItem: 5324 break;
5354 RemoveInventoryItemPacket removeItem = (RemoveInventoryItemPacket)Pack; 5325 case PacketType.RemoveInventoryItem:
5355 if (OnRemoveInventoryItem != null) 5326 RemoveInventoryItemPacket removeItem = (RemoveInventoryItemPacket)Pack;
5327 if (OnRemoveInventoryItem != null)
5328 {
5329 handlerRemoveInventoryItem = null;
5330 foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData)
5356 { 5331 {
5357 handlerRemoveInventoryItem = null; 5332 handlerRemoveInventoryItem = OnRemoveInventoryItem;
5358 foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData) 5333 if (handlerRemoveInventoryItem != null)
5359 { 5334 {
5360 handlerRemoveInventoryItem = OnRemoveInventoryItem; 5335 handlerRemoveInventoryItem(this, datablock.ItemID);
5361 if (handlerRemoveInventoryItem != null)
5362 {
5363 handlerRemoveInventoryItem(this, datablock.ItemID);
5364 }
5365 } 5336 }
5366 } 5337 }
5367 break; 5338 }
5368 case PacketType.RemoveInventoryFolder: 5339 break;
5369 RemoveInventoryFolderPacket removeFolder = (RemoveInventoryFolderPacket)Pack; 5340 case PacketType.RemoveInventoryFolder:
5370 if (OnRemoveInventoryFolder != null) 5341 RemoveInventoryFolderPacket removeFolder = (RemoveInventoryFolderPacket)Pack;
5342 if (OnRemoveInventoryFolder != null)
5343 {
5344 handlerRemoveInventoryFolder = null;
5345 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData)
5371 { 5346 {
5372 handlerRemoveInventoryFolder = null; 5347 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
5373 foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData)
5374 {
5375 handlerRemoveInventoryFolder = OnRemoveInventoryFolder;
5376 5348
5377 if (handlerRemoveInventoryFolder != null) 5349 if (handlerRemoveInventoryFolder != null)
5378 { 5350 {
5379 handlerRemoveInventoryFolder(this, datablock.FolderID); 5351 handlerRemoveInventoryFolder(this, datablock.FolderID);
5380 }
5381 } 5352 }
5382 } 5353 }
5383 break; 5354 }
5384 case PacketType.RequestTaskInventory: 5355 break;
5385 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; 5356 case PacketType.RequestTaskInventory:
5357 RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack;
5386 5358
5387 handlerRequestTaskInventory = OnRequestTaskInventory; 5359 handlerRequestTaskInventory = OnRequestTaskInventory;
5388 if (handlerRequestTaskInventory != null) 5360 if (handlerRequestTaskInventory != null)
5389 { 5361 {
5390 handlerRequestTaskInventory(this, requesttask.InventoryData.LocalID); 5362 handlerRequestTaskInventory(this, requesttask.InventoryData.LocalID);
5391 } 5363 }
5392 break; 5364 break;
5393 case PacketType.UpdateTaskInventory: 5365 case PacketType.UpdateTaskInventory:
5394 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; 5366 UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack;
5395 if (OnUpdateTaskInventory != null) 5367 if (OnUpdateTaskInventory != null)
5368 {
5369 if (updatetask.UpdateData.Key == 0)
5396 { 5370 {
5397 if (updatetask.UpdateData.Key == 0) 5371 handlerUpdateTaskInventory = OnUpdateTaskInventory;
5372 if (handlerUpdateTaskInventory != null)
5398 { 5373 {
5399 handlerUpdateTaskInventory = OnUpdateTaskInventory; 5374 TaskInventoryItem newTaskItem = new TaskInventoryItem();
5400 if (handlerUpdateTaskInventory != null) 5375 newTaskItem.ItemID = updatetask.InventoryData.ItemID;
5401 { 5376 newTaskItem.ParentID = updatetask.InventoryData.FolderID;
5402 TaskInventoryItem newTaskItem = new TaskInventoryItem(); 5377 newTaskItem.CreatorID = updatetask.InventoryData.CreatorID;
5403 newTaskItem.ItemID = updatetask.InventoryData.ItemID; 5378 newTaskItem.OwnerID = updatetask.InventoryData.OwnerID;
5404 newTaskItem.ParentID = updatetask.InventoryData.FolderID; 5379 newTaskItem.GroupID = updatetask.InventoryData.GroupID;
5405 newTaskItem.CreatorID = updatetask.InventoryData.CreatorID; 5380 newTaskItem.BasePermissions = updatetask.InventoryData.BaseMask;
5406 newTaskItem.OwnerID = updatetask.InventoryData.OwnerID; 5381 newTaskItem.CurrentPermissions = updatetask.InventoryData.OwnerMask;
5407 newTaskItem.GroupID = updatetask.InventoryData.GroupID; 5382 newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask;
5408 newTaskItem.BasePermissions = updatetask.InventoryData.BaseMask; 5383 newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask;
5409 newTaskItem.CurrentPermissions = updatetask.InventoryData.OwnerMask; 5384 newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask;
5410 newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask; 5385 //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned;
5411 newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask; 5386 newTaskItem.Type = updatetask.InventoryData.Type;
5412 newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask; 5387 newTaskItem.InvType = updatetask.InventoryData.InvType;
5413 //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned; 5388 newTaskItem.Flags = updatetask.InventoryData.Flags;
5414 newTaskItem.Type = updatetask.InventoryData.Type; 5389 //newTaskItem.SaleType=updatetask.InventoryData.SaleType;
5415 newTaskItem.InvType = updatetask.InventoryData.InvType; 5390 //newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;;
5416 newTaskItem.Flags = updatetask.InventoryData.Flags; 5391 newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name);
5417 //newTaskItem.SaleType=updatetask.InventoryData.SaleType; 5392 newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description);
5418 //newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;; 5393 newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate;
5419 newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name); 5394 handlerUpdateTaskInventory(this, updatetask.InventoryData.TransactionID,
5420 newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description); 5395 newTaskItem, updatetask.UpdateData.LocalID);
5421 newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate;
5422 handlerUpdateTaskInventory(this, updatetask.InventoryData.TransactionID,
5423 newTaskItem, updatetask.UpdateData.LocalID);
5424 }
5425 } 5396 }
5426 } 5397 }
5398 }
5427 5399
5428 break; 5400 break;
5429
5430 case PacketType.RemoveTaskInventory:
5431 5401
5432 RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack; 5402 case PacketType.RemoveTaskInventory:
5433 5403
5434 handlerRemoveTaskItem = OnRemoveTaskItem; 5404 RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack;
5435 5405
5436 if (handlerRemoveTaskItem != null) 5406 handlerRemoveTaskItem = OnRemoveTaskItem;
5437 {
5438 handlerRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID);
5439 }
5440 5407
5441 break; 5408 if (handlerRemoveTaskItem != null)
5442 5409 {
5443 case PacketType.MoveTaskInventory: 5410 handlerRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID);
5411 }
5444 5412
5445 MoveTaskInventoryPacket moveTaskInventoryPacket = (MoveTaskInventoryPacket)Pack; 5413 break;
5446 5414
5447 handlerMoveTaskItem = OnMoveTaskItem; 5415 case PacketType.MoveTaskInventory:
5448 5416
5449 if (handlerMoveTaskItem != null) 5417 MoveTaskInventoryPacket moveTaskInventoryPacket = (MoveTaskInventoryPacket)Pack;
5450 {
5451 handlerMoveTaskItem(
5452 this, moveTaskInventoryPacket.AgentData.FolderID,
5453 moveTaskInventoryPacket.InventoryData.LocalID,
5454 moveTaskInventoryPacket.InventoryData.ItemID);
5455 }
5456 5418
5457 break; 5419 handlerMoveTaskItem = OnMoveTaskItem;
5458 5420
5459 case PacketType.RezScript: 5421 if (handlerMoveTaskItem != null)
5460 //Console.WriteLine(Pack.ToString()); 5422 {
5461 RezScriptPacket rezScriptx = (RezScriptPacket)Pack; 5423 handlerMoveTaskItem(
5462 5424 this, moveTaskInventoryPacket.AgentData.FolderID,
5463 handlerRezScript = OnRezScript; 5425 moveTaskInventoryPacket.InventoryData.LocalID,
5464 InventoryItemBase item = new InventoryItemBase(); 5426 moveTaskInventoryPacket.InventoryData.ItemID);
5465 item.ID = rezScriptx.InventoryBlock.ItemID; 5427 }
5466 item.Folder = rezScriptx.InventoryBlock.FolderID;
5467 item.Creator = rezScriptx.InventoryBlock.CreatorID;
5468 item.Owner = rezScriptx.InventoryBlock.OwnerID;
5469 item.BasePermissions = rezScriptx.InventoryBlock.BaseMask;
5470 item.CurrentPermissions = rezScriptx.InventoryBlock.OwnerMask;
5471 item.EveryOnePermissions = rezScriptx.InventoryBlock.EveryoneMask;
5472 item.NextPermissions = rezScriptx.InventoryBlock.NextOwnerMask;
5473 item.GroupOwned = rezScriptx.InventoryBlock.GroupOwned;
5474 item.GroupID = rezScriptx.InventoryBlock.GroupID;
5475 item.AssetType = rezScriptx.InventoryBlock.Type;
5476 item.InvType = rezScriptx.InventoryBlock.InvType;
5477 item.Flags = rezScriptx.InventoryBlock.Flags;
5478 item.SaleType = rezScriptx.InventoryBlock.SaleType;
5479 item.SalePrice = rezScriptx.InventoryBlock.SalePrice;
5480 item.Name = Util.FieldToString(rezScriptx.InventoryBlock.Name);
5481 item.Description = Util.FieldToString(rezScriptx.InventoryBlock.Description);
5482 item.CreationDate = (int)rezScriptx.InventoryBlock.CreationDate;
5483
5484 if (handlerRezScript != null)
5485 {
5486 handlerRezScript(this, item, rezScriptx.InventoryBlock.TransactionID, rezScriptx.UpdateBlock.ObjectLocalID);
5487 }
5488 break;
5489 5428
5490 case PacketType.MapLayerRequest: 5429 break;
5491 RequestMapLayer();
5492 break;
5493 case PacketType.MapBlockRequest:
5494 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
5495 5430
5496 handlerRequestMapBlocks = OnRequestMapBlocks; 5431 case PacketType.RezScript:
5497 if (handlerRequestMapBlocks != null) 5432 //Console.WriteLine(Pack.ToString());
5498 { 5433 RezScriptPacket rezScriptx = (RezScriptPacket)Pack;
5499 handlerRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, 5434
5500 MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY, MapRequest.AgentData.Flags); 5435 handlerRezScript = OnRezScript;
5501 } 5436 InventoryItemBase item = new InventoryItemBase();
5502 break; 5437 item.ID = rezScriptx.InventoryBlock.ItemID;
5503 case PacketType.MapNameRequest: 5438 item.Folder = rezScriptx.InventoryBlock.FolderID;
5504 MapNameRequestPacket map = (MapNameRequestPacket)Pack; 5439 item.Creator = rezScriptx.InventoryBlock.CreatorID;
5505 string mapName = UTF8Encoding.UTF8.GetString(map.NameData.Name, 0, 5440 item.Owner = rezScriptx.InventoryBlock.OwnerID;
5506 map.NameData.Name.Length - 1); 5441 item.BasePermissions = rezScriptx.InventoryBlock.BaseMask;
5507 handlerMapNameRequest = OnMapNameRequest; 5442 item.CurrentPermissions = rezScriptx.InventoryBlock.OwnerMask;
5508 if (handlerMapNameRequest != null) 5443 item.EveryOnePermissions = rezScriptx.InventoryBlock.EveryoneMask;
5509 { 5444 item.NextPermissions = rezScriptx.InventoryBlock.NextOwnerMask;
5510 handlerMapNameRequest(this, mapName); 5445 item.GroupOwned = rezScriptx.InventoryBlock.GroupOwned;
5511 } 5446 item.GroupID = rezScriptx.InventoryBlock.GroupID;
5512 break; 5447 item.AssetType = rezScriptx.InventoryBlock.Type;
5513 case PacketType.TeleportLandmarkRequest: 5448 item.InvType = rezScriptx.InventoryBlock.InvType;
5514 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 5449 item.Flags = rezScriptx.InventoryBlock.Flags;
5515 UUID lmid = tpReq.Info.LandmarkID; 5450 item.SaleType = rezScriptx.InventoryBlock.SaleType;
5516 AssetLandmark lm; 5451 item.SalePrice = rezScriptx.InventoryBlock.SalePrice;
5517 if (lmid != UUID.Zero) 5452 item.Name = Util.FieldToString(rezScriptx.InventoryBlock.Name);
5518 { 5453 item.Description = Util.FieldToString(rezScriptx.InventoryBlock.Description);
5519 AssetBase lma = m_assetCache.GetAsset(lmid, false); 5454 item.CreationDate = rezScriptx.InventoryBlock.CreationDate;
5455
5456 if (handlerRezScript != null)
5457 {
5458 handlerRezScript(this, item, rezScriptx.InventoryBlock.TransactionID, rezScriptx.UpdateBlock.ObjectLocalID);
5459 }
5460 break;
5520 5461
5521 if (lma == null) 5462 case PacketType.MapLayerRequest:
5522 { 5463 RequestMapLayer();
5523 // Failed to find landmark 5464 break;
5524 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 5465 case PacketType.MapBlockRequest:
5525 tpCancel.Info.SessionID = tpReq.Info.SessionID; 5466 MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
5526 tpCancel.Info.AgentID = tpReq.Info.AgentID;
5527 OutPacket(tpCancel, ThrottleOutPacketType.Task);
5528 }
5529 5467
5530 try 5468 handlerRequestMapBlocks = OnRequestMapBlocks;
5531 { 5469 if (handlerRequestMapBlocks != null)
5532 lm = new AssetLandmark(lma); 5470 {
5533 } 5471 handlerRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY,
5534 catch (NullReferenceException) 5472 MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY, MapRequest.AgentData.Flags);
5535 { 5473 }
5536 // asset not found generates null ref inside the assetlandmark constructor. 5474 break;
5537 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 5475 case PacketType.MapNameRequest:
5538 tpCancel.Info.SessionID = tpReq.Info.SessionID; 5476 MapNameRequestPacket map = (MapNameRequestPacket)Pack;
5539 tpCancel.Info.AgentID = tpReq.Info.AgentID; 5477 string mapName = Encoding.UTF8.GetString(map.NameData.Name, 0,
5540 OutPacket(tpCancel, ThrottleOutPacketType.Task); 5478 map.NameData.Name.Length - 1);
5541 break; 5479 handlerMapNameRequest = OnMapNameRequest;
5542 } 5480 if (handlerMapNameRequest != null)
5543 } 5481 {
5544 else 5482 handlerMapNameRequest(this, mapName);
5545 { 5483 }
5546 // Teleport home request 5484 break;
5547 handlerTeleportHomeRequest = OnTeleportHomeRequest; 5485 case PacketType.TeleportLandmarkRequest:
5548 if (handlerTeleportHomeRequest != null) 5486 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
5549 { 5487 UUID lmid = tpReq.Info.LandmarkID;
5550 handlerTeleportHomeRequest(this.AgentId, this); 5488 AssetLandmark lm;
5551 } 5489 if (lmid != UUID.Zero)
5552 break; 5490 {
5553 } 5491 AssetBase lma = m_assetCache.GetAsset(lmid, false);
5554 5492
5555 handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest; 5493 if (lma == null)
5556 if (handlerTeleportLandmarkRequest != null)
5557 { 5494 {
5558 handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position); 5495 // Failed to find landmark
5559 }
5560 else
5561 {
5562 //no event handler so cancel request
5563
5564
5565 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 5496 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
5566 tpCancel.Info.AgentID = tpReq.Info.AgentID;
5567 tpCancel.Info.SessionID = tpReq.Info.SessionID; 5497 tpCancel.Info.SessionID = tpReq.Info.SessionID;
5498 tpCancel.Info.AgentID = tpReq.Info.AgentID;
5568 OutPacket(tpCancel, ThrottleOutPacketType.Task); 5499 OutPacket(tpCancel, ThrottleOutPacketType.Task);
5569
5570 } 5500 }
5571 break;
5572 case PacketType.TeleportLocationRequest:
5573 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
5574 // Console.WriteLine(tpLocReq.ToString());
5575 5501
5576 handlerTeleportLocationRequest = OnTeleportLocationRequest; 5502 try
5577 if (handlerTeleportLocationRequest != null)
5578 { 5503 {
5579 handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, 5504 lm = new AssetLandmark(lma);
5580 tpLocReq.Info.LookAt, 16);
5581 } 5505 }
5582 else 5506 catch (NullReferenceException)
5583 { 5507 {
5584 //no event handler so cancel request 5508 // asset not found generates null ref inside the assetlandmark constructor.
5585 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); 5509 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
5586 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; 5510 tpCancel.Info.SessionID = tpReq.Info.SessionID;
5587 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; 5511 tpCancel.Info.AgentID = tpReq.Info.AgentID;
5588 OutPacket(tpCancel, ThrottleOutPacketType.Task); 5512 OutPacket(tpCancel, ThrottleOutPacketType.Task);
5513 break;
5514 }
5515 }
5516 else
5517 {
5518 // Teleport home request
5519 handlerTeleportHomeRequest = OnTeleportHomeRequest;
5520 if (handlerTeleportHomeRequest != null)
5521 {
5522 handlerTeleportHomeRequest(AgentId, this);
5589 } 5523 }
5590 break; 5524 break;
5525 }
5526
5527 handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
5528 if (handlerTeleportLandmarkRequest != null)
5529 {
5530 handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position);
5531 }
5532 else
5533 {
5534 //no event handler so cancel request
5535
5536
5537 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
5538 tpCancel.Info.AgentID = tpReq.Info.AgentID;
5539 tpCancel.Info.SessionID = tpReq.Info.SessionID;
5540 OutPacket(tpCancel, ThrottleOutPacketType.Task);
5541
5542 }
5543 break;
5544 case PacketType.TeleportLocationRequest:
5545 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
5546 // Console.WriteLine(tpLocReq.ToString());
5547
5548 handlerTeleportLocationRequest = OnTeleportLocationRequest;
5549 if (handlerTeleportLocationRequest != null)
5550 {
5551 handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position,
5552 tpLocReq.Info.LookAt, 16);
5553 }
5554 else
5555 {
5556 //no event handler so cancel request
5557 TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
5558 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
5559 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
5560 OutPacket(tpCancel, ThrottleOutPacketType.Task);
5561 }
5562 break;
5591 5563
5592 #endregion 5564 #endregion
5593 5565
5594 case PacketType.UUIDNameRequest: 5566 case PacketType.UUIDNameRequest:
5595 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; 5567 UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack;
5596 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) 5568 foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock)
5569 {
5570 handlerNameRequest = OnNameFromUUIDRequest;
5571 if (handlerNameRequest != null)
5597 { 5572 {
5598 handlerNameRequest = OnNameFromUUIDRequest; 5573 handlerNameRequest(UUIDBlock.ID, this);
5599 if (handlerNameRequest != null)
5600 {
5601 handlerNameRequest(UUIDBlock.ID, this);
5602 }
5603 } 5574 }
5604 break; 5575 }
5576 break;
5605 5577
5606 #region Parcel related packets 5578 #region Parcel related packets
5607 5579
5608 case PacketType.RegionHandleRequest: 5580 case PacketType.RegionHandleRequest:
5609 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; 5581 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
5610 5582
5611 handlerRegionHandleRequest = OnRegionHandleRequest; 5583 handlerRegionHandleRequest = OnRegionHandleRequest;
5612 if (handlerRegionHandleRequest != null) 5584 if (handlerRegionHandleRequest != null)
5613 { 5585 {
5614 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); 5586 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID);
5615 } 5587 }
5616 break; 5588 break;
5617 5589
5618 case PacketType.ParcelInfoRequest: 5590 case PacketType.ParcelInfoRequest:
5619 ParcelInfoRequestPacket pirPack = (ParcelInfoRequestPacket)Pack; 5591 ParcelInfoRequestPacket pirPack = (ParcelInfoRequestPacket)Pack;
5620 5592
5621 handlerParcelInfoRequest = OnParcelInfoRequest; 5593 handlerParcelInfoRequest = OnParcelInfoRequest;
5622 if (handlerParcelInfoRequest != null) 5594 if (handlerParcelInfoRequest != null)
5623 { 5595 {
5624 handlerParcelInfoRequest(this, pirPack.Data.ParcelID); 5596 handlerParcelInfoRequest(this, pirPack.Data.ParcelID);
5625 } 5597 }
5626 break; 5598 break;
5627 5599
5628 case PacketType.ParcelAccessListRequest: 5600 case PacketType.ParcelAccessListRequest:
5629 ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack; 5601 ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack;
5630 5602
5631 handlerParcelAccessListRequest = OnParcelAccessListRequest; 5603 handlerParcelAccessListRequest = OnParcelAccessListRequest;
5632 5604
5633 if (handlerParcelAccessListRequest != null) 5605 if (handlerParcelAccessListRequest != null)
5634 { 5606 {
5635 handlerParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID, 5607 handlerParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID,
5636 requestPacket.Data.Flags, requestPacket.Data.SequenceID, 5608 requestPacket.Data.Flags, requestPacket.Data.SequenceID,
5637 requestPacket.Data.LocalID, this); 5609 requestPacket.Data.LocalID, this);
5638 } 5610 }
5639 break; 5611 break;
5640 5612
5641 case PacketType.ParcelAccessListUpdate: 5613 case PacketType.ParcelAccessListUpdate:
5642 ParcelAccessListUpdatePacket updatePacket = (ParcelAccessListUpdatePacket)Pack; 5614 ParcelAccessListUpdatePacket updatePacket = (ParcelAccessListUpdatePacket)Pack;
5643 List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>(); 5615 List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>();
5644 foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) 5616 foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List)
5645 { 5617 {
5646 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 5618 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
5647 entry.AgentID = block.ID; 5619 entry.AgentID = block.ID;
5648 entry.Flags = (AccessList)block.Flags; 5620 entry.Flags = (AccessList)block.Flags;
5649 entry.Time = new DateTime(); 5621 entry.Time = new DateTime();
5650 entries.Add(entry); 5622 entries.Add(entry);
5651 } 5623 }
5652 5624
5653 handlerParcelAccessListUpdateRequest = OnParcelAccessListUpdateRequest; 5625 handlerParcelAccessListUpdateRequest = OnParcelAccessListUpdateRequest;
5654 if (handlerParcelAccessListUpdateRequest != null) 5626 if (handlerParcelAccessListUpdateRequest != null)
5655 { 5627 {
5656 handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID, 5628 handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID,
5657 updatePacket.AgentData.SessionID, updatePacket.Data.Flags, 5629 updatePacket.AgentData.SessionID, updatePacket.Data.Flags,
5658 updatePacket.Data.LocalID, entries, this); 5630 updatePacket.Data.LocalID, entries, this);
5659 } 5631 }
5660 break; 5632 break;
5661 case PacketType.ParcelPropertiesRequest: 5633 case PacketType.ParcelPropertiesRequest:
5662 5634
5663 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; 5635 ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack;
5664 5636
5665 handlerParcelPropertiesRequest = OnParcelPropertiesRequest; 5637 handlerParcelPropertiesRequest = OnParcelPropertiesRequest;
5666 if (handlerParcelPropertiesRequest != null) 5638 if (handlerParcelPropertiesRequest != null)
5667 { 5639 {
5668 handlerParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), 5640 handlerParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West),
5669 (int)Math.Round(propertiesRequest.ParcelData.South), 5641 (int)Math.Round(propertiesRequest.ParcelData.South),
5670 (int)Math.Round(propertiesRequest.ParcelData.East), 5642 (int)Math.Round(propertiesRequest.ParcelData.East),
5671 (int)Math.Round(propertiesRequest.ParcelData.North), 5643 (int)Math.Round(propertiesRequest.ParcelData.North),
5672 propertiesRequest.ParcelData.SequenceID, 5644 propertiesRequest.ParcelData.SequenceID,
5673 propertiesRequest.ParcelData.SnapSelection, this); 5645 propertiesRequest.ParcelData.SnapSelection, this);
5674 } 5646 }
5675 break; 5647 break;
5676 case PacketType.ParcelDivide: 5648 case PacketType.ParcelDivide:
5677 ParcelDividePacket landDivide = (ParcelDividePacket)Pack; 5649 ParcelDividePacket landDivide = (ParcelDividePacket)Pack;
5678 5650
5679 handlerParcelDivideRequest = OnParcelDivideRequest; 5651 handlerParcelDivideRequest = OnParcelDivideRequest;
5680 if (handlerParcelDivideRequest != null) 5652 if (handlerParcelDivideRequest != null)
5681 { 5653 {
5682 handlerParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West), 5654 handlerParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West),
5683 (int)Math.Round(landDivide.ParcelData.South), 5655 (int)Math.Round(landDivide.ParcelData.South),
5684 (int)Math.Round(landDivide.ParcelData.East), 5656 (int)Math.Round(landDivide.ParcelData.East),
5685 (int)Math.Round(landDivide.ParcelData.North), this); 5657 (int)Math.Round(landDivide.ParcelData.North), this);
5686 } 5658 }
5687 break; 5659 break;
5688 case PacketType.ParcelJoin: 5660 case PacketType.ParcelJoin:
5689 ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack; 5661 ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack;
5690 5662
5691 handlerParcelJoinRequest = OnParcelJoinRequest; 5663 handlerParcelJoinRequest = OnParcelJoinRequest;
5692 5664
5693 if (handlerParcelJoinRequest != null) 5665 if (handlerParcelJoinRequest != null)
5694 { 5666 {
5695 handlerParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West), 5667 handlerParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West),
5696 (int)Math.Round(landJoin.ParcelData.South), 5668 (int)Math.Round(landJoin.ParcelData.South),
5697 (int)Math.Round(landJoin.ParcelData.East), 5669 (int)Math.Round(landJoin.ParcelData.East),
5698 (int)Math.Round(landJoin.ParcelData.North), this); 5670 (int)Math.Round(landJoin.ParcelData.North), this);
5699 } 5671 }
5700 break; 5672 break;
5701 case PacketType.ParcelPropertiesUpdate: 5673 case PacketType.ParcelPropertiesUpdate:
5702 ParcelPropertiesUpdatePacket parcelPropertiesPacket = (ParcelPropertiesUpdatePacket)Pack; 5674 ParcelPropertiesUpdatePacket parcelPropertiesPacket = (ParcelPropertiesUpdatePacket)Pack;
5703 5675
5704 handlerParcelPropertiesUpdateRequest = OnParcelPropertiesUpdateRequest; 5676 handlerParcelPropertiesUpdateRequest = OnParcelPropertiesUpdateRequest;
5705 5677
5706 if (handlerParcelPropertiesUpdateRequest != null) 5678 if (handlerParcelPropertiesUpdateRequest != null)
5707 { 5679 {
5708 LandUpdateArgs args = new LandUpdateArgs(); 5680 LandUpdateArgs args = new LandUpdateArgs();
5709 5681
5710 args.AuthBuyerID = parcelPropertiesPacket.ParcelData.AuthBuyerID; 5682 args.AuthBuyerID = parcelPropertiesPacket.ParcelData.AuthBuyerID;
5711 args.Category = (Parcel.ParcelCategory)parcelPropertiesPacket.ParcelData.Category; 5683 args.Category = (Parcel.ParcelCategory)parcelPropertiesPacket.ParcelData.Category;
5712 args.Desc = Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc); 5684 args.Desc = Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc);
5713 args.GroupID = parcelPropertiesPacket.ParcelData.GroupID; 5685 args.GroupID = parcelPropertiesPacket.ParcelData.GroupID;
5714 args.LandingType = parcelPropertiesPacket.ParcelData.LandingType; 5686 args.LandingType = parcelPropertiesPacket.ParcelData.LandingType;
5715 args.MediaAutoScale = parcelPropertiesPacket.ParcelData.MediaAutoScale; 5687 args.MediaAutoScale = parcelPropertiesPacket.ParcelData.MediaAutoScale;
5716 args.MediaID = parcelPropertiesPacket.ParcelData.MediaID; 5688 args.MediaID = parcelPropertiesPacket.ParcelData.MediaID;
5717 args.MediaURL = Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL); 5689 args.MediaURL = Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL);
5718 args.MusicURL = Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL); 5690 args.MusicURL = Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL);
5719 args.Name = Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name); 5691 args.Name = Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name);
5720 args.ParcelFlags = parcelPropertiesPacket.ParcelData.ParcelFlags; 5692 args.ParcelFlags = parcelPropertiesPacket.ParcelData.ParcelFlags;
5721 args.PassHours = parcelPropertiesPacket.ParcelData.PassHours; 5693 args.PassHours = parcelPropertiesPacket.ParcelData.PassHours;
5722 args.PassPrice = parcelPropertiesPacket.ParcelData.PassPrice; 5694 args.PassPrice = parcelPropertiesPacket.ParcelData.PassPrice;
5723 args.SalePrice = parcelPropertiesPacket.ParcelData.SalePrice; 5695 args.SalePrice = parcelPropertiesPacket.ParcelData.SalePrice;
5724 args.SnapshotID = parcelPropertiesPacket.ParcelData.SnapshotID; 5696 args.SnapshotID = parcelPropertiesPacket.ParcelData.SnapshotID;
5725 args.UserLocation = parcelPropertiesPacket.ParcelData.UserLocation; 5697 args.UserLocation = parcelPropertiesPacket.ParcelData.UserLocation;
5726 args.UserLookAt = parcelPropertiesPacket.ParcelData.UserLookAt; 5698 args.UserLookAt = parcelPropertiesPacket.ParcelData.UserLookAt;
5727 handlerParcelPropertiesUpdateRequest(args, parcelPropertiesPacket.ParcelData.LocalID, this); 5699 handlerParcelPropertiesUpdateRequest(args, parcelPropertiesPacket.ParcelData.LocalID, this);
5728 } 5700 }
5729 break; 5701 break;
5730 case PacketType.ParcelSelectObjects: 5702 case PacketType.ParcelSelectObjects:
5731 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; 5703 ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack;
5732 5704
5733 handlerParcelSelectObjects = OnParcelSelectObjects; 5705 handlerParcelSelectObjects = OnParcelSelectObjects;
5734 5706
5735 if (handlerParcelSelectObjects != null) 5707 if (handlerParcelSelectObjects != null)
5736 { 5708 {
5737 handlerParcelSelectObjects(selectPacket.ParcelData.LocalID, 5709 handlerParcelSelectObjects(selectPacket.ParcelData.LocalID,
5738 Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); 5710 Convert.ToInt32(selectPacket.ParcelData.ReturnType), this);
5739 } 5711 }
5740 break; 5712 break;
5741 case PacketType.ParcelObjectOwnersRequest: 5713 case PacketType.ParcelObjectOwnersRequest:
5742 //Console.WriteLine(Pack.ToString()); 5714 //Console.WriteLine(Pack.ToString());
5743 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack; 5715 ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack;
5744 5716
5745 handlerParcelObjectOwnerRequest = OnParcelObjectOwnerRequest; 5717 handlerParcelObjectOwnerRequest = OnParcelObjectOwnerRequest;
5746 5718
5747 if (handlerParcelObjectOwnerRequest != null) 5719 if (handlerParcelObjectOwnerRequest != null)
5748 { 5720 {
5749 handlerParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); 5721 handlerParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
5750 } 5722 }
5751 break; 5723 break;
5752 case PacketType.ParcelGodForceOwner: 5724 case PacketType.ParcelGodForceOwner:
5753 ParcelGodForceOwnerPacket godForceOwnerPacket = (ParcelGodForceOwnerPacket)Pack; 5725 ParcelGodForceOwnerPacket godForceOwnerPacket = (ParcelGodForceOwnerPacket)Pack;
5754 5726
5755 handlerParcelGodForceOwner = OnParcelGodForceOwner; 5727 handlerParcelGodForceOwner = OnParcelGodForceOwner;
5756 if (handlerParcelGodForceOwner != null) 5728 if (handlerParcelGodForceOwner != null)
5757 { 5729 {
5758 handlerParcelGodForceOwner(godForceOwnerPacket.Data.LocalID, godForceOwnerPacket.Data.OwnerID, this); 5730 handlerParcelGodForceOwner(godForceOwnerPacket.Data.LocalID, godForceOwnerPacket.Data.OwnerID, this);
5759 } 5731 }
5760 break; 5732 break;
5761 case PacketType.ParcelRelease: 5733 case PacketType.ParcelRelease:
5762 ParcelReleasePacket releasePacket = (ParcelReleasePacket)Pack; 5734 ParcelReleasePacket releasePacket = (ParcelReleasePacket)Pack;
5763 5735
5764 handlerParcelAbandonRequest = OnParcelAbandonRequest; 5736 handlerParcelAbandonRequest = OnParcelAbandonRequest;
5765 if (handlerParcelAbandonRequest != null) 5737 if (handlerParcelAbandonRequest != null)
5766 { 5738 {
5767 handlerParcelAbandonRequest(releasePacket.Data.LocalID, this); 5739 handlerParcelAbandonRequest(releasePacket.Data.LocalID, this);
5768 } 5740 }
5769 break; 5741 break;
5770 case PacketType.ParcelReclaim: 5742 case PacketType.ParcelReclaim:
5771 ParcelReclaimPacket reclaimPacket = (ParcelReclaimPacket)Pack; 5743 ParcelReclaimPacket reclaimPacket = (ParcelReclaimPacket)Pack;
5772 5744
5773 handlerParcelReclaim = OnParcelReclaim; 5745 handlerParcelReclaim = OnParcelReclaim;
5774 if (handlerParcelReclaim != null) 5746 if (handlerParcelReclaim != null)
5775 { 5747 {
5776 handlerParcelReclaim(reclaimPacket.Data.LocalID, this); 5748 handlerParcelReclaim(reclaimPacket.Data.LocalID, this);
5777 } 5749 }
5778 break; 5750 break;
5779 case PacketType.ParcelReturnObjects: 5751 case PacketType.ParcelReturnObjects:
5780 5752
5781 5753
5782 ParcelReturnObjectsPacket parcelReturnObjects = (ParcelReturnObjectsPacket)Pack; 5754 ParcelReturnObjectsPacket parcelReturnObjects = (ParcelReturnObjectsPacket)Pack;
5783 5755
5784 UUID[] puserselectedOwnerIDs = new UUID[parcelReturnObjects.OwnerIDs.Length]; 5756 UUID[] puserselectedOwnerIDs = new UUID[parcelReturnObjects.OwnerIDs.Length];
5785 for (int parceliterator = 0; parceliterator < parcelReturnObjects.OwnerIDs.Length; parceliterator++) 5757 for (int parceliterator = 0; parceliterator < parcelReturnObjects.OwnerIDs.Length; parceliterator++)
5786 puserselectedOwnerIDs[parceliterator] = parcelReturnObjects.OwnerIDs[parceliterator].OwnerID; 5758 puserselectedOwnerIDs[parceliterator] = parcelReturnObjects.OwnerIDs[parceliterator].OwnerID;
5787 5759
5788 UUID[] puserselectedTaskIDs = new UUID[parcelReturnObjects.TaskIDs.Length]; 5760 UUID[] puserselectedTaskIDs = new UUID[parcelReturnObjects.TaskIDs.Length];
5789 5761
5790 for (int parceliterator = 0; parceliterator < parcelReturnObjects.TaskIDs.Length; parceliterator++) 5762 for (int parceliterator = 0; parceliterator < parcelReturnObjects.TaskIDs.Length; parceliterator++)
5791 puserselectedTaskIDs[parceliterator] = parcelReturnObjects.TaskIDs[parceliterator].TaskID; 5763 puserselectedTaskIDs[parceliterator] = parcelReturnObjects.TaskIDs[parceliterator].TaskID;
5792 5764
5793 handlerParcelReturnObjectsRequest = OnParcelReturnObjectsRequest; 5765 handlerParcelReturnObjectsRequest = OnParcelReturnObjectsRequest;
5794 if (handlerParcelReturnObjectsRequest != null) 5766 if (handlerParcelReturnObjectsRequest != null)
5795 { 5767 {
5796 handlerParcelReturnObjectsRequest(parcelReturnObjects.ParcelData.LocalID, parcelReturnObjects.ParcelData.ReturnType, puserselectedOwnerIDs, puserselectedTaskIDs, this); 5768 handlerParcelReturnObjectsRequest(parcelReturnObjects.ParcelData.LocalID, parcelReturnObjects.ParcelData.ReturnType, puserselectedOwnerIDs, puserselectedTaskIDs, this);
5797 5769
5798 } 5770 }
5799 break; 5771 break;
5800 5772
5801 #endregion 5773 #endregion
5802 5774
5803 #region Estate Packets 5775 #region Estate Packets
5804 5776
5805 case PacketType.EstateOwnerMessage: 5777 case PacketType.EstateOwnerMessage:
5806 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; 5778 EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
5807 5779
5808 switch (Utils.BytesToString(messagePacket.MethodData.Method)) 5780 switch (Utils.BytesToString(messagePacket.MethodData.Method))
5809 { 5781 {
5810 case "getinfo": 5782 case "getinfo":
5811 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5783 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5812 { 5784 {
5813 OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice); 5785 OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice);
5814 } 5786 }
5815 break; 5787 break;
5816 case "setregioninfo": 5788 case "setregioninfo":
5817 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5789 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5818 { 5790 {
5819 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter), 5791 OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter),
5820 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), 5792 convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
5821 Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter))), 5793 Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter))),
5822 (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)), 5794 (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)),
5823 Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)), 5795 Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)),
5824 convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter)); 5796 convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter));
5825 5797
5826 } 5798 }
5827 5799
5828 break; 5800 break;
5829// case "texturebase": 5801// case "texturebase":
5830// if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5802// if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5831// { 5803// {
5832// foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5804// foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5833// { 5805// {
@@ -5841,1086 +5813,1084 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5841// } 5813// }
5842// } 5814// }
5843// break; 5815// break;
5844 case "texturedetail": 5816 case "texturedetail":
5845 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5817 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5818 {
5819 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5846 { 5820 {
5847 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5821 string s = Utils.BytesToString(block.Parameter);
5822 string[] splitField = s.Split(' ');
5823 if (splitField.Length == 2)
5848 { 5824 {
5849 string s = Utils.BytesToString(block.Parameter); 5825 Int16 corner = Convert.ToInt16(splitField[0]);
5850 string[] splitField = s.Split(' '); 5826 UUID textureUUID = new UUID(splitField[1]);
5851 if (splitField.Length == 2) 5827
5852 { 5828 OnSetEstateTerrainDetailTexture(this, corner, textureUUID);
5853 Int16 corner = Convert.ToInt16(splitField[0]);
5854 UUID textureUUID = new UUID(splitField[1]);
5855
5856 OnSetEstateTerrainDetailTexture(this, corner, textureUUID);
5857 }
5858 } 5829 }
5859 } 5830 }
5831 }
5860 5832
5861 break; 5833 break;
5862 case "textureheights": 5834 case "textureheights":
5863 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5835 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5836 {
5837 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5864 { 5838 {
5865 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) 5839 string s = Utils.BytesToString(block.Parameter);
5840 string[] splitField = s.Split(' ');
5841 if (splitField.Length == 3)
5866 { 5842 {
5867 string s = Utils.BytesToString(block.Parameter); 5843 Int16 corner = Convert.ToInt16(splitField[0]);
5868 string[] splitField = s.Split(' '); 5844 float lowValue = (float)Convert.ToDecimal(splitField[1]);
5869 if (splitField.Length == 3) 5845 float highValue = (float)Convert.ToDecimal(splitField[2]);
5870 { 5846
5871 Int16 corner = Convert.ToInt16(splitField[0]); 5847 OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue);
5872 float lowValue = (float)Convert.ToDecimal(splitField[1]);
5873 float highValue = (float)Convert.ToDecimal(splitField[2]);
5874
5875 OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue);
5876 }
5877 } 5848 }
5878 } 5849 }
5879 break; 5850 }
5880 case "texturecommit": 5851 break;
5881 OnCommitEstateTerrainTextureRequest(this); 5852 case "texturecommit":
5882 break; 5853 OnCommitEstateTerrainTextureRequest(this);
5883 case "setregionterrain": 5854 break;
5884 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5855 case "setregionterrain":
5856 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5857 {
5858 if (messagePacket.ParamList.Length != 9)
5885 { 5859 {
5886 if (messagePacket.ParamList.Length != 9) 5860 m_log.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
5887 {
5888 m_log.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
5889 }
5890 else
5891 {
5892 try
5893 {
5894 string tmp;
5895 tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter);
5896 if (!tmp.Contains(".")) tmp += ".00";
5897 float WaterHeight = (float)Convert.ToDecimal(tmp);
5898 tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter);
5899 if (!tmp.Contains(".")) tmp += ".00";
5900 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp);
5901 tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter);
5902 if (!tmp.Contains(".")) tmp += ".00";
5903 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp);
5904 bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter);
5905 bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter);
5906 float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter));
5907 bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter);
5908 bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter);
5909 float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter));
5910
5911 OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour);
5912
5913 }
5914 catch (Exception ex)
5915 {
5916 m_log.Error("EstateOwnerMessage: Exception while setting terrain settings: \n" + messagePacket.ToString() + "\n" + ex.ToString());
5917 }
5918 }
5919 } 5861 }
5920 5862 else
5921 break;
5922 case "restart":
5923 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
5924 { 5863 {
5925 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. 5864 try
5926 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5927 { 5865 {
5928 float timeSeconds = 0; 5866 string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter);
5929 Utils.TryParseSingle(Utils.BytesToString(block.Parameter), out timeSeconds); 5867 if (!tmp.Contains(".")) tmp += ".00";
5930 timeSeconds = (int)timeSeconds; 5868 float WaterHeight = (float)Convert.ToDecimal(tmp);
5931 OnEstateRestartSimRequest(this, (int)timeSeconds); 5869 tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter);
5870 if (!tmp.Contains(".")) tmp += ".00";
5871 float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp);
5872 tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter);
5873 if (!tmp.Contains(".")) tmp += ".00";
5874 float TerrainLowerLimit = (float)Convert.ToDecimal(tmp);
5875 bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter);
5876 bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter);
5877 float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter));
5878 bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter);
5879 bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter);
5880 float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter));
5881
5882 OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour);
5932 5883
5933 } 5884 }
5934 } 5885 catch (Exception ex)
5935 break;
5936 case "estatechangecovenantid":
5937 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
5938 {
5939 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5940 { 5886 {
5941 UUID newCovenantID = new UUID(Utils.BytesToString(block.Parameter)); 5887 m_log.Error("EstateOwnerMessage: Exception while setting terrain settings: \n" + messagePacket + "\n" + ex);
5942 OnEstateChangeCovenantRequest(this, newCovenantID);
5943 } 5888 }
5944 } 5889 }
5945 break; 5890 }
5946 case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
5947 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
5948 {
5949 int estateAccessType = Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
5950 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)));
5951 5891
5952 } 5892 break;
5953 break; 5893 case "restart":
5954 case "simulatormessage": 5894 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5955 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5895 {
5896 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart.
5897 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5956 { 5898 {
5957 UUID invoice = messagePacket.MethodData.Invoice; 5899 float timeSeconds;
5958 UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); 5900 Utils.TryParseSingle(Utils.BytesToString(block.Parameter), out timeSeconds);
5959 string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter); 5901 timeSeconds = (int)timeSeconds;
5960 string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter); 5902 OnEstateRestartSimRequest(this, (int)timeSeconds);
5961 UUID sessionID = messagePacket.AgentData.SessionID; 5903
5962 OnSimulatorBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
5963 } 5904 }
5964 break; 5905 }
5965 case "instantmessage": 5906 break;
5966 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5907 case "estatechangecovenantid":
5908 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5909 {
5910 foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
5967 { 5911 {
5968 if (messagePacket.ParamList.Length < 5) 5912 UUID newCovenantID = new UUID(Utils.BytesToString(block.Parameter));
5969 break; 5913 OnEstateChangeCovenantRequest(this, newCovenantID);
5970 UUID invoice = messagePacket.MethodData.Invoice;
5971 UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
5972 string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
5973 string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
5974 UUID sessionID = messagePacket.AgentData.SessionID;
5975 OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
5976 } 5914 }
5977 break; 5915 }
5978 case "setregiondebug": 5916 break;
5979 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5917 case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
5980 { 5918 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5981 UUID invoice = messagePacket.MethodData.Invoice; 5919 {
5982 UUID SenderID = messagePacket.AgentData.AgentID; 5920 int estateAccessType = Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
5983 bool scripted = convertParamStringToBool(messagePacket.ParamList[0].Parameter); 5921 OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)));
5984 bool collisionEvents = convertParamStringToBool(messagePacket.ParamList[1].Parameter);
5985 bool physics = convertParamStringToBool(messagePacket.ParamList[2].Parameter);
5986 5922
5987 OnEstateDebugRegionRequest(this, invoice, SenderID, scripted, collisionEvents, physics); 5923 }
5988 } 5924 break;
5989 break; 5925 case "simulatormessage":
5990 case "teleporthomeuser": 5926 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5991 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5927 {
5992 { 5928 UUID invoice = messagePacket.MethodData.Invoice;
5993 UUID invoice = messagePacket.MethodData.Invoice; 5929 UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
5994 UUID SenderID = messagePacket.AgentData.AgentID; 5930 string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
5995 UUID Prey = UUID.Zero; 5931 string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
5932 UUID sessionID = messagePacket.AgentData.SessionID;
5933 OnSimulatorBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
5934 }
5935 break;
5936 case "instantmessage":
5937 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5938 {
5939 if (messagePacket.ParamList.Length < 5)
5940 break;
5941 UUID invoice = messagePacket.MethodData.Invoice;
5942 UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
5943 string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
5944 string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
5945 UUID sessionID = messagePacket.AgentData.SessionID;
5946 OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
5947 }
5948 break;
5949 case "setregiondebug":
5950 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5951 {
5952 UUID invoice = messagePacket.MethodData.Invoice;
5953 UUID SenderID = messagePacket.AgentData.AgentID;
5954 bool scripted = convertParamStringToBool(messagePacket.ParamList[0].Parameter);
5955 bool collisionEvents = convertParamStringToBool(messagePacket.ParamList[1].Parameter);
5956 bool physics = convertParamStringToBool(messagePacket.ParamList[2].Parameter);
5996 5957
5997 UUID.TryParse(Utils.BytesToString(messagePacket.ParamList[1].Parameter), out Prey); 5958 OnEstateDebugRegionRequest(this, invoice, SenderID, scripted, collisionEvents, physics);
5959 }
5960 break;
5961 case "teleporthomeuser":
5962 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5963 {
5964 UUID invoice = messagePacket.MethodData.Invoice;
5965 UUID SenderID = messagePacket.AgentData.AgentID;
5966 UUID Prey;
5998 5967
5999 OnEstateTeleportOneUserHomeRequest(this, invoice, SenderID, Prey); 5968 UUID.TryParse(Utils.BytesToString(messagePacket.ParamList[1].Parameter), out Prey);
6000 } 5969
6001 break; 5970 OnEstateTeleportOneUserHomeRequest(this, invoice, SenderID, Prey);
6002 case "teleporthomeallusers": 5971 }
6003 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5972 break;
6004 { 5973 case "teleporthomeallusers":
6005 UUID invoice = messagePacket.MethodData.Invoice; 5974 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
6006 UUID SenderID = messagePacket.AgentData.AgentID; 5975 {
6007 OnEstateTeleportAllUsersHomeRequest(this, invoice, SenderID); 5976 UUID invoice = messagePacket.MethodData.Invoice;
6008 } 5977 UUID SenderID = messagePacket.AgentData.AgentID;
6009 break; 5978 OnEstateTeleportAllUsersHomeRequest(this, invoice, SenderID);
6010 case "colliders": 5979 }
6011 handlerLandStatRequest = OnLandStatRequest; 5980 break;
6012 if (handlerLandStatRequest != null) 5981 case "colliders":
6013 { 5982 handlerLandStatRequest = OnLandStatRequest;
6014 handlerLandStatRequest(0, 1, 0, "", this); 5983 if (handlerLandStatRequest != null)
6015 } 5984 {
6016 break; 5985 handlerLandStatRequest(0, 1, 0, "", this);
6017 case "scripts": 5986 }
6018 handlerLandStatRequest = OnLandStatRequest; 5987 break;
6019 if (handlerLandStatRequest != null) 5988 case "scripts":
6020 { 5989 handlerLandStatRequest = OnLandStatRequest;
6021 handlerLandStatRequest(0, 0, 0, "", this); 5990 if (handlerLandStatRequest != null)
6022 } 5991 {
6023 break; 5992 handlerLandStatRequest(0, 0, 0, "", this);
6024 case "terrain": 5993 }
6025 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 5994 break;
5995 case "terrain":
5996 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
5997 {
5998 handlerBakeTerrain = OnBakeTerrain;
5999 if (handlerBakeTerrain != null)
6026 { 6000 {
6027 handlerBakeTerrain = OnBakeTerrain; 6001 handlerBakeTerrain(this);
6028 if (handlerBakeTerrain != null)
6029 {
6030 handlerBakeTerrain(this);
6031 }
6032 } 6002 }
6033 break; 6003 }
6004 break;
6034 6005
6035 case "estatechangeinfo": 6006 case "estatechangeinfo":
6036 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false)) 6007 if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
6037 { 6008 {
6038 UUID invoice = messagePacket.MethodData.Invoice; 6009 UUID invoice = messagePacket.MethodData.Invoice;
6039 UUID SenderID = messagePacket.AgentData.AgentID; 6010 UUID SenderID = messagePacket.AgentData.AgentID;
6040 UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); 6011 UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
6041 UInt32 param2 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); 6012 UInt32 param2 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
6042 6013
6043 handlerEstateChangeInfo = OnEstateChangeInfo; 6014 handlerEstateChangeInfo = OnEstateChangeInfo;
6044 if (handlerEstateChangeInfo != null) 6015 if (handlerEstateChangeInfo != null)
6045 { 6016 {
6046 handlerEstateChangeInfo(this, invoice, SenderID, param1, param2); 6017 handlerEstateChangeInfo(this, invoice, SenderID, param1, param2);
6047 }
6048 } 6018 }
6049 break; 6019 }
6020 break;
6050 6021
6051 default: 6022 default:
6052 m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket.ToString()); 6023 m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket);
6053 break; 6024 break;
6054 } 6025 }
6055 break; 6026 break;
6056 case PacketType.LandStatRequest: 6027 case PacketType.LandStatRequest:
6057 LandStatRequestPacket lsrp = (LandStatRequestPacket)Pack; 6028 LandStatRequestPacket lsrp = (LandStatRequestPacket)Pack;
6058 6029
6059 handlerLandStatRequest = OnLandStatRequest; 6030 handlerLandStatRequest = OnLandStatRequest;
6060 if (handlerLandStatRequest != null) 6031 if (handlerLandStatRequest != null)
6061 { 6032 {
6062 handlerLandStatRequest(lsrp.RequestData.ParcelLocalID, lsrp.RequestData.ReportType, lsrp.RequestData.RequestFlags, Utils.BytesToString(lsrp.RequestData.Filter), this); 6033 handlerLandStatRequest(lsrp.RequestData.ParcelLocalID, lsrp.RequestData.ReportType, lsrp.RequestData.RequestFlags, Utils.BytesToString(lsrp.RequestData.Filter), this);
6063 } 6034 }
6064 //int parcelID, uint reportType, uint requestflags, string filter 6035 //int parcelID, uint reportType, uint requestflags, string filter
6065 6036
6066 //lsrp.RequestData.ParcelLocalID; 6037 //lsrp.RequestData.ParcelLocalID;
6067 //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts 6038 //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts
6068 //lsrp.RequestData.RequestFlags; 6039 //lsrp.RequestData.RequestFlags;
6069 //lsrp.RequestData.Filter; 6040 //lsrp.RequestData.Filter;
6070 6041
6071 break; 6042 break;
6072 6043
6073 case PacketType.RequestRegionInfo: 6044 case PacketType.RequestRegionInfo:
6074 // RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData; 6045 // RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData;
6075 6046
6076 handlerRegionInfoRequest = OnRegionInfoRequest; 6047 handlerRegionInfoRequest = OnRegionInfoRequest;
6077 if (handlerRegionInfoRequest != null) 6048 if (handlerRegionInfoRequest != null)
6078 { 6049 {
6079 handlerRegionInfoRequest(this); 6050 handlerRegionInfoRequest(this);
6080 } 6051 }
6081 break; 6052 break;
6082 case PacketType.EstateCovenantRequest: 6053 case PacketType.EstateCovenantRequest:
6083 6054
6084 // EstateCovenantRequestPacket.AgentDataBlock epack = 6055 // EstateCovenantRequestPacket.AgentDataBlock epack =
6085 // ((EstateCovenantRequestPacket)Pack).AgentData; 6056 // ((EstateCovenantRequestPacket)Pack).AgentData;
6086 6057
6087 handlerEstateCovenantRequest = OnEstateCovenantRequest; 6058 handlerEstateCovenantRequest = OnEstateCovenantRequest;
6088 if (handlerEstateCovenantRequest != null) 6059 if (handlerEstateCovenantRequest != null)
6089 { 6060 {
6090 handlerEstateCovenantRequest(this); 6061 handlerEstateCovenantRequest(this);
6091 } 6062 }
6092 break; 6063 break;
6093 6064
6094 #endregion 6065 #endregion
6095 6066
6096 #region GodPackets 6067 #region GodPackets
6097 6068
6098 case PacketType.RequestGodlikePowers: 6069 case PacketType.RequestGodlikePowers:
6099 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack; 6070 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack;
6100 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock; 6071 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock;
6101 UUID token = rblock.Token; 6072 UUID token = rblock.Token;
6102 6073
6103 RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData; 6074 RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData;
6104 6075
6105 handlerReqGodlikePowers = OnRequestGodlikePowers; 6076 handlerReqGodlikePowers = OnRequestGodlikePowers;
6106 6077
6107 if (handlerReqGodlikePowers != null) 6078 if (handlerReqGodlikePowers != null)
6108 { 6079 {
6109 handlerReqGodlikePowers(ablock.AgentID, ablock.SessionID, token, rblock.Godlike, this); 6080 handlerReqGodlikePowers(ablock.AgentID, ablock.SessionID, token, rblock.Godlike, this);
6110 } 6081 }
6111 6082
6112 break; 6083 break;
6113 case PacketType.GodKickUser: 6084 case PacketType.GodKickUser:
6114 GodKickUserPacket gkupack = (GodKickUserPacket)Pack; 6085 GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
6115 6086
6116 if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID) 6087 if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID)
6117 { 6088 {
6118 handlerGodKickUser = OnGodKickUser; 6089 handlerGodKickUser = OnGodKickUser;
6119 if (handlerGodKickUser != null) 6090 if (handlerGodKickUser != null)
6120 {
6121 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
6122 gkupack.UserInfo.AgentID, (uint)0, gkupack.UserInfo.Reason);
6123 }
6124 }
6125 else
6126 { 6091 {
6127 SendAgentAlertMessage("Kick request denied", false); 6092 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
6093 gkupack.UserInfo.AgentID, (uint)0, gkupack.UserInfo.Reason);
6128 } 6094 }
6129 //KickUserPacket kupack = new KickUserPacket(); 6095 }
6130 //KickUserPacket.UserInfoBlock kupackib = kupack.UserInfo; 6096 else
6097 {
6098 SendAgentAlertMessage("Kick request denied", false);
6099 }
6100 //KickUserPacket kupack = new KickUserPacket();
6101 //KickUserPacket.UserInfoBlock kupackib = kupack.UserInfo;
6131 6102
6132 //kupack.UserInfo.AgentID = gkupack.UserInfo.AgentID; 6103 //kupack.UserInfo.AgentID = gkupack.UserInfo.AgentID;
6133 //kupack.UserInfo.SessionID = gkupack.UserInfo.GodSessionID; 6104 //kupack.UserInfo.SessionID = gkupack.UserInfo.GodSessionID;
6134 6105
6135 //kupack.TargetBlock.TargetIP = (uint)0; 6106 //kupack.TargetBlock.TargetIP = (uint)0;
6136 //kupack.TargetBlock.TargetPort = (ushort)0; 6107 //kupack.TargetBlock.TargetPort = (ushort)0;
6137 //kupack.UserInfo.Reason = gkupack.UserInfo.Reason; 6108 //kupack.UserInfo.Reason = gkupack.UserInfo.Reason;
6138 6109
6139 //OutPacket(kupack, ThrottleOutPacketType.Task); 6110 //OutPacket(kupack, ThrottleOutPacketType.Task);
6140 break; 6111 break;
6141 6112
6142 #endregion 6113 #endregion
6143 6114
6144 #region Economy/Transaction Packets 6115 #region Economy/Transaction Packets
6145 6116
6146 case PacketType.MoneyBalanceRequest: 6117 case PacketType.MoneyBalanceRequest:
6147 MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack; 6118 MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack;
6148 6119
6149 handlerMoneyBalanceRequest = OnMoneyBalanceRequest; 6120 handlerMoneyBalanceRequest = OnMoneyBalanceRequest;
6150 6121
6151 if (handlerMoneyBalanceRequest != null) 6122 if (handlerMoneyBalanceRequest != null)
6152 { 6123 {
6153 handlerMoneyBalanceRequest(this, moneybalancerequestpacket.AgentData.AgentID, moneybalancerequestpacket.AgentData.SessionID, moneybalancerequestpacket.MoneyData.TransactionID); 6124 handlerMoneyBalanceRequest(this, moneybalancerequestpacket.AgentData.AgentID, moneybalancerequestpacket.AgentData.SessionID, moneybalancerequestpacket.MoneyData.TransactionID);
6154 } 6125 }
6155 6126
6156 break; 6127 break;
6157 case PacketType.EconomyDataRequest: 6128 case PacketType.EconomyDataRequest:
6158 6129
6159 handlerEconomoyDataRequest = OnEconomyDataRequest; 6130 handlerEconomoyDataRequest = OnEconomyDataRequest;
6160 if (handlerEconomoyDataRequest != null) 6131 if (handlerEconomoyDataRequest != null)
6161 { 6132 {
6162 handlerEconomoyDataRequest(AgentId); 6133 handlerEconomoyDataRequest(AgentId);
6163 } 6134 }
6164 // TODO: handle this packet 6135 // TODO: handle this packet
6165 //m_log.Warn("[CLIENT]: unhandled EconomyDataRequest packet"); 6136 //m_log.Warn("[CLIENT]: unhandled EconomyDataRequest packet");
6166 break; 6137 break;
6167 case PacketType.RequestPayPrice: 6138 case PacketType.RequestPayPrice:
6168 RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack; 6139 RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack;
6169 handlerRequestPayPrice = OnRequestPayPrice; 6140 handlerRequestPayPrice = OnRequestPayPrice;
6170 if (handlerRequestPayPrice != null) 6141 if (handlerRequestPayPrice != null)
6171 { 6142 {
6172 handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID); 6143 handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID);
6173 } 6144 }
6174 break; 6145 break;
6175 6146
6176 case PacketType.ObjectSaleInfo: 6147 case PacketType.ObjectSaleInfo:
6177 ObjectSaleInfoPacket objectSaleInfoPacket = (ObjectSaleInfoPacket)Pack; 6148 ObjectSaleInfoPacket objectSaleInfoPacket = (ObjectSaleInfoPacket)Pack;
6178 handlerObjectSaleInfo = OnObjectSaleInfo; 6149 handlerObjectSaleInfo = OnObjectSaleInfo;
6179 if (handlerObjectSaleInfo != null) 6150 if (handlerObjectSaleInfo != null)
6151 {
6152 foreach (ObjectSaleInfoPacket.ObjectDataBlock d
6153 in objectSaleInfoPacket.ObjectData)
6180 { 6154 {
6181 foreach (ObjectSaleInfoPacket.ObjectDataBlock d 6155 handlerObjectSaleInfo(this,
6182 in objectSaleInfoPacket.ObjectData) 6156 objectSaleInfoPacket.AgentData.AgentID,
6183 { 6157 objectSaleInfoPacket.AgentData.SessionID,
6184 handlerObjectSaleInfo(this, 6158 d.LocalID,
6185 objectSaleInfoPacket.AgentData.AgentID, 6159 d.SaleType,
6186 objectSaleInfoPacket.AgentData.SessionID, 6160 d.SalePrice);
6187 d.LocalID,
6188 d.SaleType,
6189 d.SalePrice);
6190 }
6191 } 6161 }
6192 break; 6162 }
6163 break;
6193 6164
6194 case PacketType.ObjectBuy: 6165 case PacketType.ObjectBuy:
6195 ObjectBuyPacket objectBuyPacket = (ObjectBuyPacket)Pack; 6166 ObjectBuyPacket objectBuyPacket = (ObjectBuyPacket)Pack;
6196 handlerObjectBuy = OnObjectBuy; 6167 handlerObjectBuy = OnObjectBuy;
6197 Console.WriteLine(objectBuyPacket.ToString()); 6168 Console.WriteLine(objectBuyPacket.ToString());
6198 if (handlerObjectBuy != null) 6169 if (handlerObjectBuy != null)
6199 { 6170 {
6200 foreach (ObjectBuyPacket.ObjectDataBlock d 6171 foreach (ObjectBuyPacket.ObjectDataBlock d
6201 in objectBuyPacket.ObjectData) 6172 in objectBuyPacket.ObjectData)
6202 { 6173 {
6203 handlerObjectBuy(this, 6174 handlerObjectBuy(this,
6204 objectBuyPacket.AgentData.AgentID, 6175 objectBuyPacket.AgentData.AgentID,
6205 objectBuyPacket.AgentData.SessionID, 6176 objectBuyPacket.AgentData.SessionID,
6206 objectBuyPacket.AgentData.GroupID, 6177 objectBuyPacket.AgentData.GroupID,
6207 objectBuyPacket.AgentData.CategoryID, 6178 objectBuyPacket.AgentData.CategoryID,
6208 d.ObjectLocalID, 6179 d.ObjectLocalID,
6209 d.SaleType, 6180 d.SaleType,
6210 d.SalePrice); 6181 d.SalePrice);
6211 }
6212 } 6182 }
6213 break; 6183 }
6184 break;
6214 6185
6215 #endregion 6186 #endregion
6216 6187
6217 #region Script Packets 6188 #region Script Packets
6218 6189
6219 case PacketType.GetScriptRunning: 6190 case PacketType.GetScriptRunning:
6220 GetScriptRunningPacket scriptRunning = (GetScriptRunningPacket)Pack; 6191 GetScriptRunningPacket scriptRunning = (GetScriptRunningPacket)Pack;
6221 handlerGetScriptRunning = OnGetScriptRunning; 6192 handlerGetScriptRunning = OnGetScriptRunning;
6222 if (handlerGetScriptRunning != null) 6193 if (handlerGetScriptRunning != null)
6223 { 6194 {
6224 handlerGetScriptRunning(this, scriptRunning.Script.ObjectID, scriptRunning.Script.ItemID); 6195 handlerGetScriptRunning(this, scriptRunning.Script.ObjectID, scriptRunning.Script.ItemID);
6225 } 6196 }
6226 break; 6197 break;
6227 6198
6228 case PacketType.SetScriptRunning: 6199 case PacketType.SetScriptRunning:
6229 SetScriptRunningPacket setScriptRunning = (SetScriptRunningPacket)Pack; 6200 SetScriptRunningPacket setScriptRunning = (SetScriptRunningPacket)Pack;
6230 handlerSetScriptRunning = OnSetScriptRunning; 6201 handlerSetScriptRunning = OnSetScriptRunning;
6231 if (handlerSetScriptRunning != null) 6202 if (handlerSetScriptRunning != null)
6232 { 6203 {
6233 handlerSetScriptRunning(this, setScriptRunning.Script.ObjectID, setScriptRunning.Script.ItemID, setScriptRunning.Script.Running); 6204 handlerSetScriptRunning(this, setScriptRunning.Script.ObjectID, setScriptRunning.Script.ItemID, setScriptRunning.Script.Running);
6234 } 6205 }
6235 break; 6206 break;
6236 6207
6237 case PacketType.ScriptReset: 6208 case PacketType.ScriptReset:
6238 ScriptResetPacket scriptResetPacket = (ScriptResetPacket)Pack; 6209 ScriptResetPacket scriptResetPacket = (ScriptResetPacket)Pack;
6239 handlerScriptReset = OnScriptReset; 6210 handlerScriptReset = OnScriptReset;
6240 if (handlerScriptReset != null) 6211 if (handlerScriptReset != null)
6241 { 6212 {
6242 handlerScriptReset(this, scriptResetPacket.Script.ObjectID, scriptResetPacket.Script.ItemID); 6213 handlerScriptReset(this, scriptResetPacket.Script.ObjectID, scriptResetPacket.Script.ItemID);
6243 } 6214 }
6244 break; 6215 break;
6245 6216
6246 #endregion 6217 #endregion
6247 6218
6248 #region Gesture Managment 6219 #region Gesture Managment
6249 6220
6250 case PacketType.ActivateGestures: 6221 case PacketType.ActivateGestures:
6251 ActivateGesturesPacket activateGesturePacket = (ActivateGesturesPacket)Pack; 6222 ActivateGesturesPacket activateGesturePacket = (ActivateGesturesPacket)Pack;
6252 handlerActivateGesture = OnActivateGesture; 6223 handlerActivateGesture = OnActivateGesture;
6253 if (handlerActivateGesture != null) 6224 if (handlerActivateGesture != null)
6254 { 6225 {
6255 handlerActivateGesture(this, 6226 handlerActivateGesture(this,
6256 activateGesturePacket.Data[0].AssetID, 6227 activateGesturePacket.Data[0].AssetID,
6257 activateGesturePacket.Data[0].ItemID); 6228 activateGesturePacket.Data[0].ItemID);
6258 } 6229 }
6259 else m_log.Error("Null pointer for activateGesture"); 6230 else m_log.Error("Null pointer for activateGesture");
6260 6231
6261 break; 6232 break;
6262 6233
6263 case PacketType.DeactivateGestures: 6234 case PacketType.DeactivateGestures:
6264 DeactivateGesturesPacket deactivateGesturePacket = (DeactivateGesturesPacket)Pack; 6235 DeactivateGesturesPacket deactivateGesturePacket = (DeactivateGesturesPacket)Pack;
6265 handlerDeactivateGesture = OnDeactivateGesture; 6236 handlerDeactivateGesture = OnDeactivateGesture;
6266 if (handlerDeactivateGesture != null) 6237 if (handlerDeactivateGesture != null)
6267 { 6238 {
6268 handlerDeactivateGesture(this, deactivateGesturePacket.Data[0].ItemID); 6239 handlerDeactivateGesture(this, deactivateGesturePacket.Data[0].ItemID);
6269 } 6240 }
6270 break; 6241 break;
6271 case PacketType.ObjectOwner: 6242 case PacketType.ObjectOwner:
6272 ObjectOwnerPacket objectOwnerPacket = (ObjectOwnerPacket)Pack; 6243 ObjectOwnerPacket objectOwnerPacket = (ObjectOwnerPacket)Pack;
6273 6244
6274 List<uint> localIDs = new List<uint>(); 6245 List<uint> localIDs = new List<uint>();
6275 6246
6276 foreach (ObjectOwnerPacket.ObjectDataBlock d in objectOwnerPacket.ObjectData) 6247 foreach (ObjectOwnerPacket.ObjectDataBlock d in objectOwnerPacket.ObjectData)
6277 localIDs.Add(d.ObjectLocalID); 6248 localIDs.Add(d.ObjectLocalID);
6278 6249
6279 handlerObjectOwner = OnObjectOwner; 6250 handlerObjectOwner = OnObjectOwner;
6280 if (handlerObjectOwner != null) 6251 if (handlerObjectOwner != null)
6281 { 6252 {
6282 handlerObjectOwner(this, objectOwnerPacket.HeaderData.OwnerID, objectOwnerPacket.HeaderData.GroupID, localIDs); 6253 handlerObjectOwner(this, objectOwnerPacket.HeaderData.OwnerID, objectOwnerPacket.HeaderData.GroupID, localIDs);
6283 } 6254 }
6284 break; 6255 break;
6285 6256
6286 #endregion 6257 #endregion
6287 6258
6288 6259
6289 #region unimplemented handlers 6260 #region unimplemented handlers
6290 6261
6291 case PacketType.StartPingCheck: 6262 case PacketType.StartPingCheck:
6292 // Send the client the ping response back 6263 // Send the client the ping response back
6293 // Pass the same PingID in the matching packet 6264 // Pass the same PingID in the matching packet
6294 // Handled In the packet processing 6265 // Handled In the packet processing
6295 //m_log.Debug("[CLIENT]: possibly unhandled StartPingCheck packet"); 6266 //m_log.Debug("[CLIENT]: possibly unhandled StartPingCheck packet");
6296 break; 6267 break;
6297 case PacketType.CompletePingCheck: 6268 case PacketType.CompletePingCheck:
6298 // TODO: Perhaps this should be processed on the Sim to determine whether or not to drop a dead client 6269 // TODO: Perhaps this should be processed on the Sim to determine whether or not to drop a dead client
6299 //m_log.Warn("[CLIENT]: unhandled CompletePingCheck packet"); 6270 //m_log.Warn("[CLIENT]: unhandled CompletePingCheck packet");
6300 break; 6271 break;
6301 6272
6302 case PacketType.ViewerStats: 6273 case PacketType.ViewerStats:
6303 // TODO: handle this packet 6274 // TODO: handle this packet
6304 //m_log.Warn("[CLIENT]: unhandled ViewerStats packet"); 6275 //m_log.Warn("[CLIENT]: unhandled ViewerStats packet");
6305 break; 6276 break;
6306 6277
6307 //case PacketType.GenericMessage: 6278 //case PacketType.GenericMessage:
6308 // TODO: handle this packet 6279 // TODO: handle this packet
6309 //m_log.Warn("[CLIENT]: unhandled GenericMessage packet"); 6280 //m_log.Warn("[CLIENT]: unhandled GenericMessage packet");
6310 //break; 6281 //break;
6311 case PacketType.MapItemRequest: 6282 case PacketType.MapItemRequest:
6312 // TODO: handle this packet 6283 // TODO: handle this packet
6313 MapItemRequestPacket mirpk = (MapItemRequestPacket)Pack; 6284 MapItemRequestPacket mirpk = (MapItemRequestPacket)Pack;
6314 //System.Console.WriteLine(mirpk.ToString()); 6285 //System.Console.WriteLine(mirpk.ToString());
6315 handlerMapItemRequest = OnMapItemRequest; 6286 handlerMapItemRequest = OnMapItemRequest;
6316 if (handlerMapItemRequest != null) 6287 if (handlerMapItemRequest != null)
6317 { 6288 {
6318 handlerMapItemRequest(this,mirpk.AgentData.Flags, mirpk.AgentData.EstateID, 6289 handlerMapItemRequest(this,mirpk.AgentData.Flags, mirpk.AgentData.EstateID,
6319 mirpk.AgentData.Godlike,mirpk.RequestData.ItemType, 6290 mirpk.AgentData.Godlike,mirpk.RequestData.ItemType,
6320 mirpk.RequestData.RegionHandle); 6291 mirpk.RequestData.RegionHandle);
6321 6292
6322 } 6293 }
6323 //m_log.Warn("[CLIENT]: unhandled MapItemRequest packet"); 6294 //m_log.Warn("[CLIENT]: unhandled MapItemRequest packet");
6324 break; 6295 break;
6325 case PacketType.TransferAbort: 6296 case PacketType.TransferAbort:
6326 // TODO: handle this packet 6297 // TODO: handle this packet
6327 //m_log.Warn("[CLIENT]: unhandled TransferAbort packet"); 6298 //m_log.Warn("[CLIENT]: unhandled TransferAbort packet");
6328 break; 6299 break;
6329 case PacketType.MuteListRequest: 6300 case PacketType.MuteListRequest:
6330 // TODO: handle this packet 6301 // TODO: handle this packet
6331 //m_log.Warn("[CLIENT]: unhandled MuteListRequest packet"); 6302 //m_log.Warn("[CLIENT]: unhandled MuteListRequest packet");
6332 break; 6303 break;
6333 case PacketType.ParcelDwellRequest: 6304 case PacketType.ParcelDwellRequest:
6334 // TODO: handle this packet 6305 // TODO: handle this packet
6335 //m_log.Warn("[CLIENT]: unhandled ParcelDwellRequest packet"); 6306 //m_log.Warn("[CLIENT]: unhandled ParcelDwellRequest packet");
6336 break; 6307 break;
6337 case PacketType.UseCircuitCode: 6308 case PacketType.UseCircuitCode:
6338 // TODO: Don't display this one, we handle it at a lower level 6309 // TODO: Don't display this one, we handle it at a lower level
6339 //m_log.Warn("[CLIENT]: unhandled UseCircuitCode packet"); 6310 //m_log.Warn("[CLIENT]: unhandled UseCircuitCode packet");
6340 break; 6311 break;
6341 6312
6342 case PacketType.AgentHeightWidth: 6313 case PacketType.AgentHeightWidth:
6343 // TODO: handle this packet 6314 // TODO: handle this packet
6344 //m_log.Warn("[CLIENT]: unhandled AgentHeightWidth packet"); 6315 //m_log.Warn("[CLIENT]: unhandled AgentHeightWidth packet");
6345 break; 6316 break;
6346 case PacketType.ObjectSpinStop: 6317 case PacketType.ObjectSpinStop:
6347 // TODO: handle this packet 6318 // TODO: handle this packet
6348 //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); 6319 //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet");
6349 break; 6320 break;
6350 case PacketType.SoundTrigger: 6321 case PacketType.SoundTrigger:
6351 // TODO: handle this packet 6322 // TODO: handle this packet
6352 //m_log.Warn("[CLIENT]: unhandled SoundTrigger packet"); 6323 //m_log.Warn("[CLIENT]: unhandled SoundTrigger packet");
6353 break; 6324 break;
6354 case PacketType.InventoryDescendents: 6325 case PacketType.InventoryDescendents:
6355 // TODO: handle this packet 6326 // TODO: handle this packet
6356 //m_log.Warn("[CLIENT]: unhandled InventoryDescent packet"); 6327 //m_log.Warn("[CLIENT]: unhandled InventoryDescent packet");
6357 break; 6328 break;
6358 case PacketType.DirPlacesQuery: 6329 case PacketType.DirPlacesQuery:
6359 DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack; 6330 DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack;
6360 //Console.WriteLine(dirPlacesQueryPacket.ToString()); 6331 //Console.WriteLine(dirPlacesQueryPacket.ToString());
6361 6332
6362 handlerDirPlacesQuery = OnDirPlacesQuery; 6333 handlerDirPlacesQuery = OnDirPlacesQuery;
6363 if (handlerDirPlacesQuery != null) 6334 if (handlerDirPlacesQuery != null)
6364 { 6335 {
6365 handlerDirPlacesQuery(this, 6336 handlerDirPlacesQuery(this,
6366 dirPlacesQueryPacket.QueryData.QueryID, 6337 dirPlacesQueryPacket.QueryData.QueryID,
6367 Utils.BytesToString( 6338 Utils.BytesToString(
6368 dirPlacesQueryPacket.QueryData.QueryText), 6339 dirPlacesQueryPacket.QueryData.QueryText),
6369 (int)dirPlacesQueryPacket.QueryData.QueryFlags, 6340 (int)dirPlacesQueryPacket.QueryData.QueryFlags,
6370 (int)dirPlacesQueryPacket.QueryData.Category, 6341 (int)dirPlacesQueryPacket.QueryData.Category,
6371 Utils.BytesToString( 6342 Utils.BytesToString(
6372 dirPlacesQueryPacket.QueryData.SimName), 6343 dirPlacesQueryPacket.QueryData.SimName),
6373 dirPlacesQueryPacket.QueryData.QueryStart); 6344 dirPlacesQueryPacket.QueryData.QueryStart);
6374 } 6345 }
6375 break; 6346 break;
6376 case PacketType.DirFindQuery: 6347 case PacketType.DirFindQuery:
6377 DirFindQueryPacket dirFindQueryPacket = (DirFindQueryPacket)Pack; 6348 DirFindQueryPacket dirFindQueryPacket = (DirFindQueryPacket)Pack;
6378 handlerDirFindQuery = OnDirFindQuery; 6349 handlerDirFindQuery = OnDirFindQuery;
6379 if (handlerDirFindQuery != null) 6350 if (handlerDirFindQuery != null)
6380 { 6351 {
6381 handlerDirFindQuery(this, 6352 handlerDirFindQuery(this,
6382 dirFindQueryPacket.QueryData.QueryID, 6353 dirFindQueryPacket.QueryData.QueryID,
6383 Utils.BytesToString( 6354 Utils.BytesToString(
6384 dirFindQueryPacket.QueryData.QueryText), 6355 dirFindQueryPacket.QueryData.QueryText),
6385 dirFindQueryPacket.QueryData.QueryFlags, 6356 dirFindQueryPacket.QueryData.QueryFlags,
6386 dirFindQueryPacket.QueryData.QueryStart); 6357 dirFindQueryPacket.QueryData.QueryStart);
6387 } 6358 }
6388 break; 6359 break;
6389 case PacketType.DirLandQuery: 6360 case PacketType.DirLandQuery:
6390 DirLandQueryPacket dirLandQueryPacket = (DirLandQueryPacket)Pack; 6361 DirLandQueryPacket dirLandQueryPacket = (DirLandQueryPacket)Pack;
6391 handlerDirLandQuery = OnDirLandQuery; 6362 handlerDirLandQuery = OnDirLandQuery;
6392 if (handlerDirLandQuery != null) 6363 if (handlerDirLandQuery != null)
6393 { 6364 {
6394 handlerDirLandQuery(this, 6365 handlerDirLandQuery(this,
6395 dirLandQueryPacket.QueryData.QueryID, 6366 dirLandQueryPacket.QueryData.QueryID,
6396 dirLandQueryPacket.QueryData.QueryFlags, 6367 dirLandQueryPacket.QueryData.QueryFlags,
6397 dirLandQueryPacket.QueryData.SearchType, 6368 dirLandQueryPacket.QueryData.SearchType,
6398 dirLandQueryPacket.QueryData.Price, 6369 dirLandQueryPacket.QueryData.Price,
6399 dirLandQueryPacket.QueryData.Area, 6370 dirLandQueryPacket.QueryData.Area,
6400 dirLandQueryPacket.QueryData.QueryStart); 6371 dirLandQueryPacket.QueryData.QueryStart);
6401 } 6372 }
6402 break; 6373 break;
6403 case PacketType.DirPopularQuery: 6374 case PacketType.DirPopularQuery:
6404 DirPopularQueryPacket dirPopularQueryPacket = (DirPopularQueryPacket)Pack; 6375 DirPopularQueryPacket dirPopularQueryPacket = (DirPopularQueryPacket)Pack;
6405 handlerDirPopularQuery = OnDirPopularQuery; 6376 handlerDirPopularQuery = OnDirPopularQuery;
6406 if (handlerDirPopularQuery != null) 6377 if (handlerDirPopularQuery != null)
6407 { 6378 {
6408 handlerDirPopularQuery(this, 6379 handlerDirPopularQuery(this,
6409 dirPopularQueryPacket.QueryData.QueryID, 6380 dirPopularQueryPacket.QueryData.QueryID,
6410 dirPopularQueryPacket.QueryData.QueryFlags); 6381 dirPopularQueryPacket.QueryData.QueryFlags);
6411 } 6382 }
6412 break; 6383 break;
6413 case PacketType.DirClassifiedQuery: 6384 case PacketType.DirClassifiedQuery:
6414 DirClassifiedQueryPacket dirClassifiedQueryPacket = (DirClassifiedQueryPacket)Pack; 6385 DirClassifiedQueryPacket dirClassifiedQueryPacket = (DirClassifiedQueryPacket)Pack;
6415 handlerDirClassifiedQuery = OnDirClassifiedQuery; 6386 handlerDirClassifiedQuery = OnDirClassifiedQuery;
6416 if (handlerDirClassifiedQuery != null) 6387 if (handlerDirClassifiedQuery != null)
6417 { 6388 {
6418 handlerDirClassifiedQuery(this, 6389 handlerDirClassifiedQuery(this,
6419 dirClassifiedQueryPacket.QueryData.QueryID, 6390 dirClassifiedQueryPacket.QueryData.QueryID,
6420 Utils.BytesToString( 6391 Utils.BytesToString(
6421 dirClassifiedQueryPacket.QueryData.QueryText), 6392 dirClassifiedQueryPacket.QueryData.QueryText),
6422 dirClassifiedQueryPacket.QueryData.QueryFlags, 6393 dirClassifiedQueryPacket.QueryData.QueryFlags,
6423 dirClassifiedQueryPacket.QueryData.Category, 6394 dirClassifiedQueryPacket.QueryData.Category,
6424 dirClassifiedQueryPacket.QueryData.QueryStart); 6395 dirClassifiedQueryPacket.QueryData.QueryStart);
6425 } 6396 }
6426 break; 6397 break;
6427 case PacketType.EventInfoRequest: 6398 case PacketType.EventInfoRequest:
6428 EventInfoRequestPacket eventInfoRequestPacket = (EventInfoRequestPacket)Pack; 6399 EventInfoRequestPacket eventInfoRequestPacket = (EventInfoRequestPacket)Pack;
6429 if (OnEventInfoRequest != null) 6400 if (OnEventInfoRequest != null)
6430 { 6401 {
6431 OnEventInfoRequest(this, eventInfoRequestPacket.EventData.EventID); 6402 OnEventInfoRequest(this, eventInfoRequestPacket.EventData.EventID);
6432 } 6403 }
6433 break; 6404 break;
6434 6405
6435 case PacketType.ParcelSetOtherCleanTime: 6406 case PacketType.ParcelSetOtherCleanTime:
6436 ParcelSetOtherCleanTimePacket parcelSetOtherCleanTimePacket = (ParcelSetOtherCleanTimePacket)Pack; 6407 ParcelSetOtherCleanTimePacket parcelSetOtherCleanTimePacket = (ParcelSetOtherCleanTimePacket)Pack;
6437 handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime; 6408 handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime;
6438 if (handlerParcelSetOtherCleanTime != null) 6409 if (handlerParcelSetOtherCleanTime != null)
6439 { 6410 {
6440 handlerParcelSetOtherCleanTime(this, 6411 handlerParcelSetOtherCleanTime(this,
6441 parcelSetOtherCleanTimePacket.ParcelData.LocalID, 6412 parcelSetOtherCleanTimePacket.ParcelData.LocalID,
6442 parcelSetOtherCleanTimePacket.ParcelData.OtherCleanTime); 6413 parcelSetOtherCleanTimePacket.ParcelData.OtherCleanTime);
6443 } 6414 }
6444 break; 6415 break;
6445 6416
6446 case PacketType.OfferCallingCard: 6417 case PacketType.OfferCallingCard:
6447 OfferCallingCardPacket offerCallingCardPacket = (OfferCallingCardPacket)Pack; 6418 OfferCallingCardPacket offerCallingCardPacket = (OfferCallingCardPacket)Pack;
6448 if (OnOfferCallingCard != null) 6419 if (OnOfferCallingCard != null)
6449 { 6420 {
6450 OnOfferCallingCard(this, 6421 OnOfferCallingCard(this,
6451 offerCallingCardPacket.AgentBlock.DestID, 6422 offerCallingCardPacket.AgentBlock.DestID,
6452 offerCallingCardPacket.AgentBlock.TransactionID); 6423 offerCallingCardPacket.AgentBlock.TransactionID);
6453 } 6424 }
6454 break; 6425 break;
6455 6426
6456 case PacketType.AcceptCallingCard: 6427 case PacketType.AcceptCallingCard:
6457 AcceptCallingCardPacket acceptCallingCardPacket = (AcceptCallingCardPacket)Pack; 6428 AcceptCallingCardPacket acceptCallingCardPacket = (AcceptCallingCardPacket)Pack;
6458 // according to http://wiki.secondlife.com/wiki/AcceptCallingCard FolderData should 6429 // according to http://wiki.secondlife.com/wiki/AcceptCallingCard FolderData should
6459 // contain exactly one entry 6430 // contain exactly one entry
6460 if (OnAcceptCallingCard != null && acceptCallingCardPacket.FolderData.Length > 0) 6431 if (OnAcceptCallingCard != null && acceptCallingCardPacket.FolderData.Length > 0)
6461 { 6432 {
6462 OnAcceptCallingCard(this, 6433 OnAcceptCallingCard(this,
6463 acceptCallingCardPacket.TransactionBlock.TransactionID, 6434 acceptCallingCardPacket.TransactionBlock.TransactionID,
6464 acceptCallingCardPacket.FolderData[0].FolderID); 6435 acceptCallingCardPacket.FolderData[0].FolderID);
6465 } 6436 }
6466 break; 6437 break;
6467 6438
6468 case PacketType.DeclineCallingCard: 6439 case PacketType.DeclineCallingCard:
6469 DeclineCallingCardPacket declineCallingCardPacket = (DeclineCallingCardPacket)Pack; 6440 DeclineCallingCardPacket declineCallingCardPacket = (DeclineCallingCardPacket)Pack;
6470 if (OnDeclineCallingCard != null) 6441 if (OnDeclineCallingCard != null)
6471 { 6442 {
6472 OnDeclineCallingCard(this, 6443 OnDeclineCallingCard(this,
6473 declineCallingCardPacket.TransactionBlock.TransactionID); 6444 declineCallingCardPacket.TransactionBlock.TransactionID);
6474 } 6445 }
6475 break; 6446 break;
6476 6447
6477 case PacketType.ActivateGroup: 6448 case PacketType.ActivateGroup:
6478 ActivateGroupPacket activateGroupPacket = (ActivateGroupPacket)Pack; 6449 ActivateGroupPacket activateGroupPacket = (ActivateGroupPacket)Pack;
6479 if (m_GroupsModule != null) 6450 if (m_GroupsModule != null)
6480 { 6451 {
6481 m_GroupsModule.ActivateGroup(this, activateGroupPacket.AgentData.GroupID); 6452 m_GroupsModule.ActivateGroup(this, activateGroupPacket.AgentData.GroupID);
6482 m_GroupsModule.SendAgentGroupDataUpdate(this); 6453 m_GroupsModule.SendAgentGroupDataUpdate(this);
6483 } 6454 }
6484 break; 6455 break;
6485 6456
6486 case PacketType.GroupTitlesRequest: 6457 case PacketType.GroupTitlesRequest:
6487 GroupTitlesRequestPacket groupTitlesRequest = 6458 GroupTitlesRequestPacket groupTitlesRequest =
6488 (GroupTitlesRequestPacket)Pack; 6459 (GroupTitlesRequestPacket)Pack;
6489 6460
6490 if (m_GroupsModule != null) 6461 if (m_GroupsModule != null)
6491 { 6462 {
6492 GroupTitlesReplyPacket groupTitlesReply = (GroupTitlesReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupTitlesReply); 6463 GroupTitlesReplyPacket groupTitlesReply = (GroupTitlesReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupTitlesReply);
6493 6464
6494 groupTitlesReply.AgentData = 6465 groupTitlesReply.AgentData =
6495 new GroupTitlesReplyPacket.AgentDataBlock(); 6466 new GroupTitlesReplyPacket.AgentDataBlock();
6496 6467
6497 groupTitlesReply.AgentData.AgentID = AgentId; 6468 groupTitlesReply.AgentData.AgentID = AgentId;
6498 groupTitlesReply.AgentData.GroupID = 6469 groupTitlesReply.AgentData.GroupID =
6499 groupTitlesRequest.AgentData.GroupID; 6470 groupTitlesRequest.AgentData.GroupID;
6500 6471
6501 groupTitlesReply.AgentData.RequestID = 6472 groupTitlesReply.AgentData.RequestID =
6502 groupTitlesRequest.AgentData.RequestID; 6473 groupTitlesRequest.AgentData.RequestID;
6503 6474
6504 List<GroupTitlesData> titles = 6475 List<GroupTitlesData> titles =
6505 m_GroupsModule.GroupTitlesRequest(this, 6476 m_GroupsModule.GroupTitlesRequest(this,
6506 groupTitlesRequest.AgentData.GroupID); 6477 groupTitlesRequest.AgentData.GroupID);
6507 6478
6508 groupTitlesReply.GroupData = 6479 groupTitlesReply.GroupData =
6509 new GroupTitlesReplyPacket. 6480 new GroupTitlesReplyPacket.
6510 GroupDataBlock[titles.Count]; 6481 GroupDataBlock[titles.Count];
6511 6482
6512 int i = 0; 6483 int i = 0;
6513 foreach (GroupTitlesData d in titles) 6484 foreach (GroupTitlesData d in titles)
6514 { 6485 {
6515 groupTitlesReply.GroupData[i] = 6486 groupTitlesReply.GroupData[i] =
6516 new GroupTitlesReplyPacket. 6487 new GroupTitlesReplyPacket.
6517 GroupDataBlock(); 6488 GroupDataBlock();
6518
6519 groupTitlesReply.GroupData[i].Title =
6520 Utils.StringToBytes(d.Name);
6521 groupTitlesReply.GroupData[i].RoleID =
6522 d.UUID;
6523 groupTitlesReply.GroupData[i].Selected =
6524 d.Selected;
6525 i++;
6526 }
6527 6489
6528 OutPacket(groupTitlesReply, ThrottleOutPacketType.Task); 6490 groupTitlesReply.GroupData[i].Title =
6491 Utils.StringToBytes(d.Name);
6492 groupTitlesReply.GroupData[i].RoleID =
6493 d.UUID;
6494 groupTitlesReply.GroupData[i].Selected =
6495 d.Selected;
6496 i++;
6529 } 6497 }
6530 break;
6531 6498
6532 case PacketType.GroupProfileRequest: 6499 OutPacket(groupTitlesReply, ThrottleOutPacketType.Task);
6533 GroupProfileRequestPacket groupProfileRequest = 6500 }
6534 (GroupProfileRequestPacket)Pack; 6501 break;
6535 6502
6536 if (m_GroupsModule != null) 6503 case PacketType.GroupProfileRequest:
6537 { 6504 GroupProfileRequestPacket groupProfileRequest =
6538 GroupProfileReplyPacket groupProfileReply = (GroupProfileReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupProfileReply); 6505 (GroupProfileRequestPacket)Pack;
6539
6540 groupProfileReply.AgentData = new GroupProfileReplyPacket.AgentDataBlock();
6541 groupProfileReply.GroupData = new GroupProfileReplyPacket.GroupDataBlock();
6542 groupProfileReply.AgentData.AgentID = AgentId;
6543
6544 GroupProfileData d = m_GroupsModule.GroupProfileRequest(this,
6545 groupProfileRequest.GroupData.GroupID);
6546
6547 groupProfileReply.GroupData.GroupID = d.GroupID;
6548 groupProfileReply.GroupData.Name = Utils.StringToBytes(d.Name);
6549 groupProfileReply.GroupData.Charter = Utils.StringToBytes(d.Charter);
6550 groupProfileReply.GroupData.ShowInList = d.ShowInList;
6551 groupProfileReply.GroupData.MemberTitle = Utils.StringToBytes(d.MemberTitle);
6552 groupProfileReply.GroupData.PowersMask = d.PowersMask;
6553 groupProfileReply.GroupData.InsigniaID = d.InsigniaID;
6554 groupProfileReply.GroupData.FounderID = d.FounderID;
6555 groupProfileReply.GroupData.MembershipFee = d.MembershipFee;
6556 groupProfileReply.GroupData.OpenEnrollment = d.OpenEnrollment;
6557 groupProfileReply.GroupData.Money = d.Money;
6558 groupProfileReply.GroupData.GroupMembershipCount = d.GroupMembershipCount;
6559 groupProfileReply.GroupData.GroupRolesCount = d.GroupRolesCount;
6560 groupProfileReply.GroupData.AllowPublish = d.AllowPublish;
6561 groupProfileReply.GroupData.MaturePublish = d.MaturePublish;
6562 groupProfileReply.GroupData.OwnerRole = d.OwnerRole;
6563
6564 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
6565 }
6566 break;
6567 6506
6568 case PacketType.GroupMembersRequest: 6507 if (m_GroupsModule != null)
6569 GroupMembersRequestPacket groupMembersRequestPacket = 6508 {
6570 (GroupMembersRequestPacket)Pack; 6509 GroupProfileReplyPacket groupProfileReply = (GroupProfileReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupProfileReply);
6510
6511 groupProfileReply.AgentData = new GroupProfileReplyPacket.AgentDataBlock();
6512 groupProfileReply.GroupData = new GroupProfileReplyPacket.GroupDataBlock();
6513 groupProfileReply.AgentData.AgentID = AgentId;
6514
6515 GroupProfileData d = m_GroupsModule.GroupProfileRequest(this,
6516 groupProfileRequest.GroupData.GroupID);
6517
6518 groupProfileReply.GroupData.GroupID = d.GroupID;
6519 groupProfileReply.GroupData.Name = Utils.StringToBytes(d.Name);
6520 groupProfileReply.GroupData.Charter = Utils.StringToBytes(d.Charter);
6521 groupProfileReply.GroupData.ShowInList = d.ShowInList;
6522 groupProfileReply.GroupData.MemberTitle = Utils.StringToBytes(d.MemberTitle);
6523 groupProfileReply.GroupData.PowersMask = d.PowersMask;
6524 groupProfileReply.GroupData.InsigniaID = d.InsigniaID;
6525 groupProfileReply.GroupData.FounderID = d.FounderID;
6526 groupProfileReply.GroupData.MembershipFee = d.MembershipFee;
6527 groupProfileReply.GroupData.OpenEnrollment = d.OpenEnrollment;
6528 groupProfileReply.GroupData.Money = d.Money;
6529 groupProfileReply.GroupData.GroupMembershipCount = d.GroupMembershipCount;
6530 groupProfileReply.GroupData.GroupRolesCount = d.GroupRolesCount;
6531 groupProfileReply.GroupData.AllowPublish = d.AllowPublish;
6532 groupProfileReply.GroupData.MaturePublish = d.MaturePublish;
6533 groupProfileReply.GroupData.OwnerRole = d.OwnerRole;
6534
6535 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
6536 }
6537 break;
6571 6538
6572 if (m_GroupsModule != null) 6539 case PacketType.GroupMembersRequest:
6573 { 6540 GroupMembersRequestPacket groupMembersRequestPacket =
6574 List<GroupMembersData> members = 6541 (GroupMembersRequestPacket)Pack;
6575 m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID);
6576 6542
6577 GroupMembersReplyPacket groupMembersReply = (GroupMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupMembersReply); 6543 if (m_GroupsModule != null)
6544 {
6545 List<GroupMembersData> members =
6546 m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID);
6578 6547
6579 groupMembersReply.AgentData = 6548 GroupMembersReplyPacket groupMembersReply = (GroupMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupMembersReply);
6580 new GroupMembersReplyPacket.AgentDataBlock();
6581 groupMembersReply.GroupData =
6582 new GroupMembersReplyPacket.GroupDataBlock();
6583 groupMembersReply.MemberData =
6584 new GroupMembersReplyPacket.MemberDataBlock[
6585 members.Count];
6586 6549
6587 groupMembersReply.AgentData.AgentID = AgentId; 6550 groupMembersReply.AgentData =
6588 groupMembersReply.GroupData.GroupID = 6551 new GroupMembersReplyPacket.AgentDataBlock();
6589 groupMembersRequestPacket.GroupData.GroupID; 6552 groupMembersReply.GroupData =
6590 groupMembersReply.GroupData.RequestID = 6553 new GroupMembersReplyPacket.GroupDataBlock();
6591 groupMembersRequestPacket.GroupData.RequestID; 6554 groupMembersReply.MemberData =
6592 groupMembersReply.GroupData.MemberCount = members.Count; 6555 new GroupMembersReplyPacket.MemberDataBlock[
6556 members.Count];
6593 6557
6594 int i = 0; 6558 groupMembersReply.AgentData.AgentID = AgentId;
6595 foreach (GroupMembersData m in members) 6559 groupMembersReply.GroupData.GroupID =
6596 { 6560 groupMembersRequestPacket.GroupData.GroupID;
6597 groupMembersReply.MemberData[i] = 6561 groupMembersReply.GroupData.RequestID =
6598 new GroupMembersReplyPacket.MemberDataBlock(); 6562 groupMembersRequestPacket.GroupData.RequestID;
6599 groupMembersReply.MemberData[i].AgentID = 6563 groupMembersReply.GroupData.MemberCount = members.Count;
6600 m.AgentID; 6564
6601 groupMembersReply.MemberData[i].Contribution = 6565 int i = 0;
6602 m.Contribution; 6566 foreach (GroupMembersData m in members)
6603 groupMembersReply.MemberData[i].OnlineStatus = 6567 {
6604 Utils.StringToBytes(m.OnlineStatus); 6568 groupMembersReply.MemberData[i] =
6605 groupMembersReply.MemberData[i].AgentPowers = 6569 new GroupMembersReplyPacket.MemberDataBlock();
6606 m.AgentPowers; 6570 groupMembersReply.MemberData[i].AgentID =
6607 groupMembersReply.MemberData[i].Title = 6571 m.AgentID;
6608 Utils.StringToBytes(m.Title); 6572 groupMembersReply.MemberData[i].Contribution =
6609 groupMembersReply.MemberData[i].IsOwner = 6573 m.Contribution;
6610 m.IsOwner; 6574 groupMembersReply.MemberData[i].OnlineStatus =
6611 i++; 6575 Utils.StringToBytes(m.OnlineStatus);
6612 } 6576 groupMembersReply.MemberData[i].AgentPowers =
6577 m.AgentPowers;
6578 groupMembersReply.MemberData[i].Title =
6579 Utils.StringToBytes(m.Title);
6580 groupMembersReply.MemberData[i].IsOwner =
6581 m.IsOwner;
6582 i++;
6583 }
6584
6585 OutPacket(groupMembersReply, ThrottleOutPacketType.Task);
6586 }
6587 break;
6613 6588
6614 OutPacket(groupMembersReply, ThrottleOutPacketType.Task); 6589 case PacketType.GroupRoleDataRequest:
6615 } 6590 GroupRoleDataRequestPacket groupRolesRequest =
6616 break; 6591 (GroupRoleDataRequestPacket)Pack;
6617 6592
6618 case PacketType.GroupRoleDataRequest: 6593 if (m_GroupsModule != null)
6619 GroupRoleDataRequestPacket groupRolesRequest = 6594 {
6620 (GroupRoleDataRequestPacket)Pack; 6595 GroupRoleDataReplyPacket groupRolesReply = (GroupRoleDataReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleDataReply);
6621 6596
6622 if (m_GroupsModule != null) 6597 groupRolesReply.AgentData =
6623 { 6598 new GroupRoleDataReplyPacket.AgentDataBlock();
6624 GroupRoleDataReplyPacket groupRolesReply = (GroupRoleDataReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleDataReply);
6625 6599
6626 groupRolesReply.AgentData = 6600 groupRolesReply.AgentData.AgentID = AgentId;
6627 new GroupRoleDataReplyPacket.AgentDataBlock();
6628 6601
6629 groupRolesReply.AgentData.AgentID = AgentId; 6602 groupRolesReply.GroupData =
6603 new GroupRoleDataReplyPacket.
6604 GroupDataBlock();
6630 6605
6631 groupRolesReply.GroupData = 6606 groupRolesReply.GroupData.GroupID =
6632 new GroupRoleDataReplyPacket. 6607 groupRolesRequest.GroupData.GroupID;
6633 GroupDataBlock();
6634 6608
6635 groupRolesReply.GroupData.GroupID = 6609 groupRolesReply.GroupData.RequestID =
6636 groupRolesRequest.GroupData.GroupID; 6610 groupRolesRequest.GroupData.RequestID;
6637 6611
6638 groupRolesReply.GroupData.RequestID = 6612 List<GroupRolesData> titles =
6639 groupRolesRequest.GroupData.RequestID; 6613 m_GroupsModule.GroupRoleDataRequest(this,
6614 groupRolesRequest.GroupData.GroupID);
6640 6615
6641 List<GroupRolesData> titles = 6616 groupRolesReply.GroupData.RoleCount =
6642 m_GroupsModule.GroupRoleDataRequest(this, 6617 titles.Count;
6643 groupRolesRequest.GroupData.GroupID);
6644 6618
6645 groupRolesReply.GroupData.RoleCount = 6619 groupRolesReply.RoleData =
6646 titles.Count; 6620 new GroupRoleDataReplyPacket.
6621 RoleDataBlock[titles.Count];
6647 6622
6648 groupRolesReply.RoleData = 6623 int i = 0;
6649 new GroupRoleDataReplyPacket. 6624 foreach (GroupRolesData d in titles)
6650 RoleDataBlock[titles.Count]; 6625 {
6626 groupRolesReply.RoleData[i] =
6627 new GroupRoleDataReplyPacket.
6628 RoleDataBlock();
6651 6629
6652 int i = 0; 6630 groupRolesReply.RoleData[i].RoleID =
6653 foreach (GroupRolesData d in titles) 6631 d.RoleID;
6654 { 6632 groupRolesReply.RoleData[i].Name =
6655 groupRolesReply.RoleData[i] = 6633 Utils.StringToBytes(d.Name);
6656 new GroupRoleDataReplyPacket. 6634 groupRolesReply.RoleData[i].Title =
6657 RoleDataBlock(); 6635 Utils.StringToBytes(d.Title);
6658 6636 groupRolesReply.RoleData[i].Description =
6659 groupRolesReply.RoleData[i].RoleID = 6637 Utils.StringToBytes(d.Description);
6660 d.RoleID; 6638 groupRolesReply.RoleData[i].Powers =
6661 groupRolesReply.RoleData[i].Name = 6639 d.Powers;
6662 Utils.StringToBytes(d.Name); 6640 groupRolesReply.RoleData[i].Members =
6663 groupRolesReply.RoleData[i].Title = 6641 (uint)d.Members;
6664 Utils.StringToBytes(d.Title);
6665 groupRolesReply.RoleData[i].Description =
6666 Utils.StringToBytes(d.Description);
6667 groupRolesReply.RoleData[i].Powers =
6668 d.Powers;
6669 groupRolesReply.RoleData[i].Members =
6670 (uint)d.Members;
6671
6672 i++;
6673 }
6674 6642
6675 OutPacket(groupRolesReply, ThrottleOutPacketType.Task); 6643 i++;
6676 } 6644 }
6677 break;
6678 6645
6679 case PacketType.GroupRoleMembersRequest: 6646 OutPacket(groupRolesReply, ThrottleOutPacketType.Task);
6680 GroupRoleMembersRequestPacket groupRoleMembersRequest = 6647 }
6681 (GroupRoleMembersRequestPacket)Pack; 6648 break;
6682 6649
6683 if (m_GroupsModule != null) 6650 case PacketType.GroupRoleMembersRequest:
6684 { 6651 GroupRoleMembersRequestPacket groupRoleMembersRequest =
6685 GroupRoleMembersReplyPacket groupRoleMembersReply = (GroupRoleMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleMembersReply); 6652 (GroupRoleMembersRequestPacket)Pack;
6686 groupRoleMembersReply.AgentData =
6687 new GroupRoleMembersReplyPacket.AgentDataBlock();
6688 groupRoleMembersReply.AgentData.AgentID =
6689 AgentId;
6690 groupRoleMembersReply.AgentData.GroupID =
6691 groupRoleMembersRequest.GroupData.GroupID;
6692 groupRoleMembersReply.AgentData.RequestID =
6693 groupRoleMembersRequest.GroupData.RequestID;
6694
6695 List<GroupRoleMembersData> mappings =
6696 m_GroupsModule.GroupRoleMembersRequest(this,
6697 groupRoleMembersRequest.GroupData.GroupID);
6698
6699 groupRoleMembersReply.AgentData.TotalPairs =
6700 (uint)mappings.Count;
6701
6702 groupRoleMembersReply.MemberData =
6703 new GroupRoleMembersReplyPacket.
6704 MemberDataBlock[mappings.Count];
6705
6706 int i = 0;
6707 foreach (GroupRoleMembersData d in mappings)
6708 {
6709 groupRoleMembersReply.MemberData[i] =
6710 new GroupRoleMembersReplyPacket.
6711 MemberDataBlock();
6712
6713 groupRoleMembersReply.MemberData[i].RoleID =
6714 d.RoleID;
6715 groupRoleMembersReply.MemberData[i].MemberID =
6716 d.MemberID;
6717 i++;
6718 }
6719 6653
6654 if (m_GroupsModule != null)
6655 {
6656 GroupRoleMembersReplyPacket groupRoleMembersReply = (GroupRoleMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleMembersReply);
6657 groupRoleMembersReply.AgentData =
6658 new GroupRoleMembersReplyPacket.AgentDataBlock();
6659 groupRoleMembersReply.AgentData.AgentID =
6660 AgentId;
6661 groupRoleMembersReply.AgentData.GroupID =
6662 groupRoleMembersRequest.GroupData.GroupID;
6663 groupRoleMembersReply.AgentData.RequestID =
6664 groupRoleMembersRequest.GroupData.RequestID;
6720 6665
6721 OutPacket(groupRoleMembersReply, ThrottleOutPacketType.Task); 6666 List<GroupRoleMembersData> mappings =
6722 } 6667 m_GroupsModule.GroupRoleMembersRequest(this,
6723 break; 6668 groupRoleMembersRequest.GroupData.GroupID);
6669
6670 groupRoleMembersReply.AgentData.TotalPairs =
6671 (uint)mappings.Count;
6724 6672
6725 case PacketType.CreateGroupRequest: 6673 groupRoleMembersReply.MemberData =
6726 CreateGroupRequestPacket createGroupRequest = 6674 new GroupRoleMembersReplyPacket.
6727 (CreateGroupRequestPacket)Pack; 6675 MemberDataBlock[mappings.Count];
6728 6676
6729 if (m_GroupsModule != null) 6677 int i = 0;
6678 foreach (GroupRoleMembersData d in mappings)
6730 { 6679 {
6731 CreateGroupReplyPacket createGroupReply = (CreateGroupReplyPacket)PacketPool.Instance.GetPacket(PacketType.CreateGroupReply); 6680 groupRoleMembersReply.MemberData[i] =
6681 new GroupRoleMembersReplyPacket.
6682 MemberDataBlock();
6732 6683
6733 createGroupReply.AgentData = 6684 groupRoleMembersReply.MemberData[i].RoleID =
6734 new CreateGroupReplyPacket.AgentDataBlock(); 6685 d.RoleID;
6735 createGroupReply.ReplyData = 6686 groupRoleMembersReply.MemberData[i].MemberID =
6736 new CreateGroupReplyPacket.ReplyDataBlock(); 6687 d.MemberID;
6688 i++;
6689 }
6737 6690
6738 createGroupReply.AgentData.AgentID = AgentId;
6739 createGroupReply.ReplyData.GroupID = UUID.Zero;
6740 6691
6741 IMoneyModule money = m_scene.RequestModuleInterface<IMoneyModule>(); 6692 OutPacket(groupRoleMembersReply, ThrottleOutPacketType.Task);
6742 if (money != null && !money.GroupCreationCovered(this)) 6693 }
6743 { 6694 break;
6744 createGroupReply.ReplyData.Success = false;
6745 createGroupReply.ReplyData.Message = Utils.StringToBytes("You do not have sufficient funds to create a group");
6746 OutPacket(createGroupReply, ThrottleOutPacketType.Task);
6747 break;
6748 }
6749 6695
6750 UUID groupID = m_GroupsModule.CreateGroup(this, 6696 case PacketType.CreateGroupRequest:
6751 Utils.BytesToString(createGroupRequest.GroupData.Name), 6697 CreateGroupRequestPacket createGroupRequest =
6752 Utils.BytesToString(createGroupRequest.GroupData.Charter), 6698 (CreateGroupRequestPacket)Pack;
6753 createGroupRequest.GroupData.ShowInList,
6754 createGroupRequest.GroupData.InsigniaID,
6755 createGroupRequest.GroupData.MembershipFee,
6756 createGroupRequest.GroupData.OpenEnrollment,
6757 createGroupRequest.GroupData.AllowPublish,
6758 createGroupRequest.GroupData.MaturePublish);
6759 if (groupID == UUID.Zero)
6760 {
6761 createGroupReply.ReplyData.Success = false;
6762 createGroupReply.ReplyData.Message = Utils.StringToBytes("We're sorry, but we could not create the requested group. Please try another name");
6763 OutPacket(createGroupReply, ThrottleOutPacketType.Task);
6764 break;
6765 }
6766 6699
6767 if (money != null) 6700 if (m_GroupsModule != null)
6768 money.ApplyGroupCreationCharge(AgentId); 6701 {
6702 CreateGroupReplyPacket createGroupReply = (CreateGroupReplyPacket)PacketPool.Instance.GetPacket(PacketType.CreateGroupReply);
6769 6703
6770 createGroupReply.ReplyData.Success = true; 6704 createGroupReply.AgentData =
6771 createGroupReply.ReplyData.GroupID = groupID; 6705 new CreateGroupReplyPacket.AgentDataBlock();
6772 createGroupReply.ReplyData.Message = Utils.StringToBytes("Group created"); 6706 createGroupReply.ReplyData =
6773 OutPacket(createGroupReply, ThrottleOutPacketType.Task); 6707 new CreateGroupReplyPacket.ReplyDataBlock();
6774 6708
6775 // Sync with event queue 6709 createGroupReply.AgentData.AgentID = AgentId;
6776 System.Threading.Thread.Sleep(1000); 6710 createGroupReply.ReplyData.GroupID = UUID.Zero;
6777 6711
6778 m_GroupsModule.SendAgentGroupDataUpdate(this); 6712 IMoneyModule money = m_scene.RequestModuleInterface<IMoneyModule>();
6713 if (money != null && !money.GroupCreationCovered(this))
6714 {
6715 createGroupReply.ReplyData.Success = false;
6716 createGroupReply.ReplyData.Message = Utils.StringToBytes("You do not have sufficient funds to create a group");
6717 OutPacket(createGroupReply, ThrottleOutPacketType.Task);
6718 break;
6779 } 6719 }
6780 break;
6781 6720
6782 case PacketType.UpdateGroupInfo: 6721 UUID groupID = m_GroupsModule.CreateGroup(this,
6783 UpdateGroupInfoPacket updateGroupInfo = 6722 Utils.BytesToString(createGroupRequest.GroupData.Name),
6784 (UpdateGroupInfoPacket)Pack; 6723 Utils.BytesToString(createGroupRequest.GroupData.Charter),
6785 6724 createGroupRequest.GroupData.ShowInList,
6786 if (m_GroupsModule != null) 6725 createGroupRequest.GroupData.InsigniaID,
6726 createGroupRequest.GroupData.MembershipFee,
6727 createGroupRequest.GroupData.OpenEnrollment,
6728 createGroupRequest.GroupData.AllowPublish,
6729 createGroupRequest.GroupData.MaturePublish);
6730 if (groupID == UUID.Zero)
6787 { 6731 {
6788 m_GroupsModule.UpdateGroupInfo(this, 6732 createGroupReply.ReplyData.Success = false;
6789 updateGroupInfo.GroupData.GroupID, 6733 createGroupReply.ReplyData.Message = Utils.StringToBytes("We're sorry, but we could not create the requested group. Please try another name");
6790 Utils.BytesToString(updateGroupInfo.GroupData.Charter), 6734 OutPacket(createGroupReply, ThrottleOutPacketType.Task);
6791 updateGroupInfo.GroupData.ShowInList, 6735 break;
6792 updateGroupInfo.GroupData.InsigniaID,
6793 updateGroupInfo.GroupData.MembershipFee,
6794 updateGroupInfo.GroupData.OpenEnrollment,
6795 updateGroupInfo.GroupData.AllowPublish,
6796 updateGroupInfo.GroupData.MaturePublish);
6797 } 6736 }
6798 6737
6799 break; 6738 if (money != null)
6739 money.ApplyGroupCreationCharge(AgentId);
6800 6740
6801 case PacketType.SetGroupAcceptNotices: 6741 createGroupReply.ReplyData.Success = true;
6802 SetGroupAcceptNoticesPacket setGroupAcceptNotices = 6742 createGroupReply.ReplyData.GroupID = groupID;
6803 (SetGroupAcceptNoticesPacket)Pack; 6743 createGroupReply.ReplyData.Message = Utils.StringToBytes("Group created");
6744 OutPacket(createGroupReply, ThrottleOutPacketType.Task);
6804 6745
6805 if (m_GroupsModule != null) 6746 // Sync with event queue
6806 { 6747 Thread.Sleep(1000);
6807 m_GroupsModule.SetGroupAcceptNotices(this,
6808 setGroupAcceptNotices.Data.GroupID,
6809 setGroupAcceptNotices.Data.AcceptNotices,
6810 setGroupAcceptNotices.NewData.ListInProfile);
6811 }
6812 6748
6813 break; 6749 m_GroupsModule.SendAgentGroupDataUpdate(this);
6750 }
6751 break;
6814 6752
6815 case PacketType.GroupTitleUpdate: 6753 case PacketType.UpdateGroupInfo:
6816 GroupTitleUpdatePacket groupTitleUpdate = 6754 UpdateGroupInfoPacket updateGroupInfo =
6817 (GroupTitleUpdatePacket)Pack; 6755 (UpdateGroupInfoPacket)Pack;
6818 6756
6819 if (m_GroupsModule != null) 6757 if (m_GroupsModule != null)
6820 { 6758 {
6821 m_GroupsModule.GroupTitleUpdate(this, 6759 m_GroupsModule.UpdateGroupInfo(this,
6822 groupTitleUpdate.AgentData.GroupID, 6760 updateGroupInfo.GroupData.GroupID,
6823 groupTitleUpdate.AgentData.TitleRoleID); 6761 Utils.BytesToString(updateGroupInfo.GroupData.Charter),
6824 } 6762 updateGroupInfo.GroupData.ShowInList,
6763 updateGroupInfo.GroupData.InsigniaID,
6764 updateGroupInfo.GroupData.MembershipFee,
6765 updateGroupInfo.GroupData.OpenEnrollment,
6766 updateGroupInfo.GroupData.AllowPublish,
6767 updateGroupInfo.GroupData.MaturePublish);
6768 }
6825 6769
6826 break; 6770 break;
6827 case PacketType.GroupNoticesListRequest:
6828 GroupNoticesListRequestPacket groupNoticesListRequest =
6829 (GroupNoticesListRequestPacket)Pack;
6830 6771
6831 if (m_GroupsModule != null) 6772 case PacketType.SetGroupAcceptNotices:
6832 { 6773 SetGroupAcceptNoticesPacket setGroupAcceptNotices =
6833 GroupNoticeData[] gn = 6774 (SetGroupAcceptNoticesPacket)Pack;
6834 m_GroupsModule.GroupNoticesListRequest(this,
6835 groupNoticesListRequest.Data.GroupID);
6836 6775
6837 GroupNoticesListReplyPacket groupNoticesListReply = (GroupNoticesListReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupNoticesListReply); 6776 if (m_GroupsModule != null)
6838 groupNoticesListReply.AgentData = 6777 {
6839 new GroupNoticesListReplyPacket.AgentDataBlock(); 6778 m_GroupsModule.SetGroupAcceptNotices(this,
6840 groupNoticesListReply.AgentData.AgentID = AgentId; 6779 setGroupAcceptNotices.Data.GroupID,
6841 groupNoticesListReply.AgentData.GroupID = groupNoticesListRequest.Data.GroupID; 6780 setGroupAcceptNotices.Data.AcceptNotices,
6781 setGroupAcceptNotices.NewData.ListInProfile);
6782 }
6842 6783
6843 groupNoticesListReply.Data = new GroupNoticesListReplyPacket.DataBlock[gn.Length]; 6784 break;
6844 6785
6845 int i = 0; 6786 case PacketType.GroupTitleUpdate:
6846 foreach (GroupNoticeData g in gn) 6787 GroupTitleUpdatePacket groupTitleUpdate =
6847 { 6788 (GroupTitleUpdatePacket)Pack;
6848 groupNoticesListReply.Data[i] = new GroupNoticesListReplyPacket.DataBlock();
6849 groupNoticesListReply.Data[i].NoticeID =
6850 g.NoticeID;
6851 groupNoticesListReply.Data[i].Timestamp =
6852 g.Timestamp;
6853 groupNoticesListReply.Data[i].FromName =
6854 Utils.StringToBytes(g.FromName);
6855 groupNoticesListReply.Data[i].Subject =
6856 Utils.StringToBytes(g.Subject);
6857 groupNoticesListReply.Data[i].HasAttachment =
6858 g.HasAttachment;
6859 groupNoticesListReply.Data[i].AssetType =
6860 g.AssetType;
6861 i++;
6862 }
6863 6789
6864 OutPacket(groupNoticesListReply, ThrottleOutPacketType.Task); 6790 if (m_GroupsModule != null)
6865 } 6791 {
6792 m_GroupsModule.GroupTitleUpdate(this,
6793 groupTitleUpdate.AgentData.GroupID,
6794 groupTitleUpdate.AgentData.TitleRoleID);
6795 }
6866 6796
6867 break; 6797 break;
6868 case PacketType.GroupNoticeRequest: 6798 case PacketType.GroupNoticesListRequest:
6869 GroupNoticeRequestPacket groupNoticeRequest = 6799 GroupNoticesListRequestPacket groupNoticesListRequest =
6870 (GroupNoticeRequestPacket)Pack; 6800 (GroupNoticesListRequestPacket)Pack;
6871 6801
6872 if (m_GroupsModule != null) 6802 if (m_GroupsModule != null)
6873 { 6803 {
6874 m_GroupsModule.GroupNoticeRequest(this, 6804 GroupNoticeData[] gn =
6875 groupNoticeRequest.Data.GroupNoticeID); 6805 m_GroupsModule.GroupNoticesListRequest(this,
6876 } 6806 groupNoticesListRequest.Data.GroupID);
6877 break; 6807
6808 GroupNoticesListReplyPacket groupNoticesListReply = (GroupNoticesListReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupNoticesListReply);
6809 groupNoticesListReply.AgentData =
6810 new GroupNoticesListReplyPacket.AgentDataBlock();
6811 groupNoticesListReply.AgentData.AgentID = AgentId;
6812 groupNoticesListReply.AgentData.GroupID = groupNoticesListRequest.Data.GroupID;
6813
6814 groupNoticesListReply.Data = new GroupNoticesListReplyPacket.DataBlock[gn.Length];
6815
6816 int i = 0;
6817 foreach (GroupNoticeData g in gn)
6818 {
6819 groupNoticesListReply.Data[i] = new GroupNoticesListReplyPacket.DataBlock();
6820 groupNoticesListReply.Data[i].NoticeID =
6821 g.NoticeID;
6822 groupNoticesListReply.Data[i].Timestamp =
6823 g.Timestamp;
6824 groupNoticesListReply.Data[i].FromName =
6825 Utils.StringToBytes(g.FromName);
6826 groupNoticesListReply.Data[i].Subject =
6827 Utils.StringToBytes(g.Subject);
6828 groupNoticesListReply.Data[i].HasAttachment =
6829 g.HasAttachment;
6830 groupNoticesListReply.Data[i].AssetType =
6831 g.AssetType;
6832 i++;
6833 }
6834
6835 OutPacket(groupNoticesListReply, ThrottleOutPacketType.Task);
6836 }
6878 6837
6879 case PacketType.GroupRoleUpdate: 6838 break;
6880 GroupRoleUpdatePacket groupRoleUpdate = 6839 case PacketType.GroupNoticeRequest:
6881 (GroupRoleUpdatePacket)Pack; 6840 GroupNoticeRequestPacket groupNoticeRequest =
6841 (GroupNoticeRequestPacket)Pack;
6882 6842
6883 if (m_GroupsModule != null) 6843 if (m_GroupsModule != null)
6884 { 6844 {
6885 foreach (GroupRoleUpdatePacket.RoleDataBlock d in 6845 m_GroupsModule.GroupNoticeRequest(this,
6886 groupRoleUpdate.RoleData) 6846 groupNoticeRequest.Data.GroupNoticeID);
6887 { 6847 }
6888 m_GroupsModule.GroupRoleUpdate(this, 6848 break;
6889 groupRoleUpdate.AgentData.GroupID, 6849
6890 d.RoleID, 6850 case PacketType.GroupRoleUpdate:
6891 Utils.BytesToString(d.Name), 6851 GroupRoleUpdatePacket groupRoleUpdate =
6892 Utils.BytesToString(d.Description), 6852 (GroupRoleUpdatePacket)Pack;
6893 Utils.BytesToString(d.Title), 6853
6894 d.Powers, 6854 if (m_GroupsModule != null)
6895 d.UpdateType); 6855 {
6896 } 6856 foreach (GroupRoleUpdatePacket.RoleDataBlock d in
6857 groupRoleUpdate.RoleData)
6858 {
6859 m_GroupsModule.GroupRoleUpdate(this,
6860 groupRoleUpdate.AgentData.GroupID,
6861 d.RoleID,
6862 Utils.BytesToString(d.Name),
6863 Utils.BytesToString(d.Description),
6864 Utils.BytesToString(d.Title),
6865 d.Powers,
6866 d.UpdateType);
6897 } 6867 }
6898 break; 6868 }
6869 break;
6899 6870
6900 case PacketType.GroupRoleChanges: 6871 case PacketType.GroupRoleChanges:
6901 GroupRoleChangesPacket groupRoleChanges = 6872 GroupRoleChangesPacket groupRoleChanges =
6902 (GroupRoleChangesPacket)Pack; 6873 (GroupRoleChangesPacket)Pack;
6903 6874
6904 if (m_GroupsModule != null) 6875 if (m_GroupsModule != null)
6876 {
6877 foreach (GroupRoleChangesPacket.RoleChangeBlock d in
6878 groupRoleChanges.RoleChange)
6905 { 6879 {
6906 foreach (GroupRoleChangesPacket.RoleChangeBlock d in 6880 m_GroupsModule.GroupRoleChanges(this,
6907 groupRoleChanges.RoleChange) 6881 groupRoleChanges.AgentData.GroupID,
6908 { 6882 d.RoleID,
6909 m_GroupsModule.GroupRoleChanges(this, 6883 d.MemberID,
6910 groupRoleChanges.AgentData.GroupID, 6884 d.Change);
6911 d.RoleID,
6912 d.MemberID,
6913 d.Change);
6914 }
6915 } 6885 }
6916 break; 6886 }
6887 break;
6917 6888
6918 default: 6889 default:
6919 m_log.Warn("[CLIENT]: unhandled packet " + Pack.ToString()); 6890 m_log.Warn("[CLIENT]: unhandled packet " + Pack);
6920 break; 6891 break;
6921 6892
6922 #endregion 6893 #endregion
6923 }
6924 } 6894 }
6925 6895
6926 PacketPool.Instance.ReturnPacket(Pack); 6896 PacketPool.Instance.ReturnPacket(Pack);
@@ -6967,7 +6937,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6967 public void SendBlueBoxMessage(UUID FromAvatarID, UUID fromSessionID, String FromAvatarName, String Message) 6937 public void SendBlueBoxMessage(UUID FromAvatarID, UUID fromSessionID, String FromAvatarName, String Message)
6968 { 6938 {
6969 if (!ChildAgentStatus()) 6939 if (!ChildAgentStatus())
6970 SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)1, (uint)Util.UnixTimeSinceEpoch()); 6940 SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, 1, (uint)Util.UnixTimeSinceEpoch());
6971 6941
6972 //SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch()); 6942 //SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch());
6973 } 6943 }
@@ -7145,7 +7115,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7145 { 7115 {
7146 Transfer.TransferInfo.Params = new byte[20]; 7116 Transfer.TransferInfo.Params = new byte[20];
7147 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); 7117 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
7148 int assType = (int)req.AssetInf.Type; 7118 int assType = req.AssetInf.Type;
7149 Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); 7119 Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
7150 } 7120 }
7151 else if (req.AssetRequestSource == 3) 7121 else if (req.AssetRequestSource == 3)
@@ -7155,7 +7125,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7155 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); 7125 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
7156 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16); 7126 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16);
7157 } 7127 }
7158 Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; 7128 Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
7159 Transfer.TransferInfo.TransferID = req.TransferRequestID; 7129 Transfer.TransferInfo.TransferID = req.TransferRequestID;
7160 Transfer.Header.Zerocoded = true; 7130 Transfer.Header.Zerocoded = true;
7161 OutPacket(Transfer, ThrottleOutPacketType.Asset); 7131 OutPacket(Transfer, ThrottleOutPacketType.Asset);
@@ -7217,8 +7187,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7217 { 7187 {
7218 ClientInfo info = m_PacketHandler.GetClientInfo(); 7188 ClientInfo info = m_PacketHandler.GetClientInfo();
7219 7189
7220 info.userEP = this.m_userEndPoint; 7190 info.userEP = m_userEndPoint;
7221 info.proxyEP = this.m_proxyEndPoint; 7191 info.proxyEP = m_proxyEndPoint;
7222 info.agentcircuit = new sAgentCircuitData(RequestClientInfo()); 7192 info.agentcircuit = new sAgentCircuitData(RequestClientInfo());
7223 7193
7224 return info; 7194 return info;
@@ -7234,7 +7204,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7234 public void SendParcelMediaCommand(uint flags, ParcelMediaCommandEnum command, float time) 7204 public void SendParcelMediaCommand(uint flags, ParcelMediaCommandEnum command, float time)
7235 { 7205 {
7236 ParcelMediaCommandMessagePacket commandMessagePacket = new ParcelMediaCommandMessagePacket(); 7206 ParcelMediaCommandMessagePacket commandMessagePacket = new ParcelMediaCommandMessagePacket();
7237 commandMessagePacket.CommandBlock.Flags = (uint) flags; 7207 commandMessagePacket.CommandBlock.Flags = flags;
7238 commandMessagePacket.CommandBlock.Command =(uint) command; 7208 commandMessagePacket.CommandBlock.Command =(uint) command;
7239 commandMessagePacket.CommandBlock.Time = time; 7209 commandMessagePacket.CommandBlock.Time = time;
7240 7210
@@ -7348,7 +7318,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7348 switch (option) 7318 switch (option)
7349 { 7319 {
7350 case "ReliableIsImportant": 7320 case "ReliableIsImportant":
7351 bool val = false; 7321 bool val;
7352 7322
7353 if (bool.TryParse(value, out val)) 7323 if (bool.TryParse(value, out val))
7354 m_PacketHandler.ReliableIsImportant = val; 7324 m_PacketHandler.ReliableIsImportant = val;
@@ -7594,7 +7564,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7594 packet.EventData.Name = Utils.StringToBytes(data.name); 7564 packet.EventData.Name = Utils.StringToBytes(data.name);
7595 packet.EventData.Category = Utils.StringToBytes(data.category); 7565 packet.EventData.Category = Utils.StringToBytes(data.category);
7596 packet.EventData.Desc = Utils.StringToBytes(data.description); 7566 packet.EventData.Desc = Utils.StringToBytes(data.description);
7597 packet.EventData.Date = Utils.StringToBytes(data.date.ToString()); 7567 packet.EventData.Date = Utils.StringToBytes(data.date);
7598 packet.EventData.DateUTC = data.dateUTC; 7568 packet.EventData.DateUTC = data.dateUTC;
7599 packet.EventData.Duration = data.duration; 7569 packet.EventData.Duration = data.duration;
7600 packet.EventData.Cover = data.cover; 7570 packet.EventData.Cover = data.cover;
@@ -7671,8 +7641,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7671 7641
7672 public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data) 7642 public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data)
7673 { 7643 {
7674 int i;
7675
7676 AvatarGroupsReplyPacket p = (AvatarGroupsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarGroupsReply); 7644 AvatarGroupsReplyPacket p = (AvatarGroupsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarGroupsReply);
7677 7645
7678 p.AgentData = new AvatarGroupsReplyPacket.AgentDataBlock(); 7646 p.AgentData = new AvatarGroupsReplyPacket.AgentDataBlock();
@@ -7680,7 +7648,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7680 p.AgentData.AvatarID = avatarID; 7648 p.AgentData.AvatarID = avatarID;
7681 7649
7682 p.GroupData = new AvatarGroupsReplyPacket.GroupDataBlock[data.Length]; 7650 p.GroupData = new AvatarGroupsReplyPacket.GroupDataBlock[data.Length];
7683 i = 0; 7651 int i = 0;
7684 foreach (GroupMembershipData m in data) 7652 foreach (GroupMembershipData m in data)
7685 { 7653 {
7686 p.GroupData[i] = new AvatarGroupsReplyPacket.GroupDataBlock(); 7654 p.GroupData[i] = new AvatarGroupsReplyPacket.GroupDataBlock();