diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 4847 |
1 files changed, 2 insertions, 4845 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6cc0bd2..0b90b55 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -11025,4855 +11025,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11025 | /// <param name="Pack">OpenMetaverse.packet</param> | 11025 | /// <param name="Pack">OpenMetaverse.packet</param> |
11026 | public void ProcessInPacket(Packet Pack) | 11026 | public void ProcessInPacket(Packet Pack) |
11027 | { | 11027 | { |
11028 | 11028 | if (!ProcessPacketMethod(Pack)) | |
11029 | if (ProcessPacketMethod(Pack)) | ||
11030 | { | ||
11031 | PacketPool.Instance.ReturnPacket(Pack); | ||
11032 | return; | ||
11033 | } | ||
11034 | |||
11035 | // Main packet processing conditional | ||
11036 | switch (Pack.Type) | ||
11037 | { | 11029 | { |
11038 | #region CommentedOut | 11030 | m_log.Warn("[CLIENT]: unhandled packet " + Pack); |
11039 | /* | ||
11040 | #region Scene/Avatar | ||
11041 | |||
11042 | |||
11043 | case PacketType.AvatarPropertiesRequest: | ||
11044 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | ||
11045 | |||
11046 | #region Packet Session and User Check | ||
11047 | if (m_checkPackets) | ||
11048 | { | ||
11049 | if (avatarProperties.AgentData.SessionID != SessionId || | ||
11050 | avatarProperties.AgentData.AgentID != AgentId) | ||
11051 | break; | ||
11052 | } | ||
11053 | #endregion | ||
11054 | |||
11055 | RequestAvatarProperties handlerRequestAvatarProperties = OnRequestAvatarProperties; | ||
11056 | if (handlerRequestAvatarProperties != null) | ||
11057 | { | ||
11058 | handlerRequestAvatarProperties(this, avatarProperties.AgentData.AvatarID); | ||
11059 | } | ||
11060 | |||
11061 | break; | ||
11062 | |||
11063 | case PacketType.ChatFromViewer: | ||
11064 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | ||
11065 | |||
11066 | #region Packet Session and User Check | ||
11067 | if (m_checkPackets) | ||
11068 | { | ||
11069 | if (inchatpack.AgentData.SessionID != SessionId || | ||
11070 | inchatpack.AgentData.AgentID != AgentId) | ||
11071 | break; | ||
11072 | } | ||
11073 | #endregion | ||
11074 | |||
11075 | string fromName = String.Empty; //ClientAvatar.firstname + " " + ClientAvatar.lastname; | ||
11076 | byte[] message = inchatpack.ChatData.Message; | ||
11077 | byte type = inchatpack.ChatData.Type; | ||
11078 | Vector3 fromPos = new Vector3(); // ClientAvatar.Pos; | ||
11079 | // UUID fromAgentID = AgentId; | ||
11080 | |||
11081 | int channel = inchatpack.ChatData.Channel; | ||
11082 | |||
11083 | if (OnChatFromClient != null) | ||
11084 | { | ||
11085 | OSChatMessage args = new OSChatMessage(); | ||
11086 | args.Channel = channel; | ||
11087 | args.From = fromName; | ||
11088 | args.Message = Utils.BytesToString(message); | ||
11089 | args.Type = (ChatTypeEnum)type; | ||
11090 | args.Position = fromPos; | ||
11091 | |||
11092 | args.Scene = Scene; | ||
11093 | args.Sender = this; | ||
11094 | args.SenderUUID = this.AgentId; | ||
11095 | |||
11096 | ChatMessage handlerChatFromClient = OnChatFromClient; | ||
11097 | if (handlerChatFromClient != null) | ||
11098 | handlerChatFromClient(this, args); | ||
11099 | } | ||
11100 | break; | ||
11101 | |||
11102 | case PacketType.AvatarPropertiesUpdate: | ||
11103 | AvatarPropertiesUpdatePacket avatarProps = (AvatarPropertiesUpdatePacket)Pack; | ||
11104 | |||
11105 | #region Packet Session and User Check | ||
11106 | if (m_checkPackets) | ||
11107 | { | ||
11108 | if (avatarProps.AgentData.SessionID != SessionId || | ||
11109 | avatarProps.AgentData.AgentID != AgentId) | ||
11110 | break; | ||
11111 | } | ||
11112 | #endregion | ||
11113 | |||
11114 | UpdateAvatarProperties handlerUpdateAvatarProperties = OnUpdateAvatarProperties; | ||
11115 | if (handlerUpdateAvatarProperties != null) | ||
11116 | { | ||
11117 | AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = avatarProps.PropertiesData; | ||
11118 | UserProfileData UserProfile = new UserProfileData(); | ||
11119 | UserProfile.ID = AgentId; | ||
11120 | UserProfile.AboutText = Utils.BytesToString(Properties.AboutText); | ||
11121 | UserProfile.FirstLifeAboutText = Utils.BytesToString(Properties.FLAboutText); | ||
11122 | UserProfile.FirstLifeImage = Properties.FLImageID; | ||
11123 | UserProfile.Image = Properties.ImageID; | ||
11124 | UserProfile.ProfileUrl = Utils.BytesToString(Properties.ProfileURL); | ||
11125 | |||
11126 | handlerUpdateAvatarProperties(this, UserProfile); | ||
11127 | } | ||
11128 | break; | ||
11129 | |||
11130 | case PacketType.ScriptDialogReply: | ||
11131 | ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; | ||
11132 | |||
11133 | #region Packet Session and User Check | ||
11134 | if (m_checkPackets) | ||
11135 | { | ||
11136 | if (rdialog.AgentData.SessionID != SessionId || | ||
11137 | rdialog.AgentData.AgentID != AgentId) | ||
11138 | break; | ||
11139 | } | ||
11140 | #endregion | ||
11141 | |||
11142 | int ch = rdialog.Data.ChatChannel; | ||
11143 | byte[] msg = rdialog.Data.ButtonLabel; | ||
11144 | if (OnChatFromClient != null) | ||
11145 | { | ||
11146 | OSChatMessage args = new OSChatMessage(); | ||
11147 | args.Channel = ch; | ||
11148 | args.From = String.Empty; | ||
11149 | args.Message = Utils.BytesToString(msg); | ||
11150 | args.Type = ChatTypeEnum.Shout; | ||
11151 | args.Position = new Vector3(); | ||
11152 | args.Scene = Scene; | ||
11153 | args.Sender = this; | ||
11154 | ChatMessage handlerChatFromClient2 = OnChatFromClient; | ||
11155 | if (handlerChatFromClient2 != null) | ||
11156 | handlerChatFromClient2(this, args); | ||
11157 | } | ||
11158 | |||
11159 | break; | ||
11160 | |||
11161 | case PacketType.ImprovedInstantMessage: | ||
11162 | ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; | ||
11163 | |||
11164 | #region Packet Session and User Check | ||
11165 | if (m_checkPackets) | ||
11166 | { | ||
11167 | if (msgpack.AgentData.SessionID != SessionId || | ||
11168 | msgpack.AgentData.AgentID != AgentId) | ||
11169 | break; | ||
11170 | } | ||
11171 | #endregion | ||
11172 | |||
11173 | string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); | ||
11174 | string IMmessage = Utils.BytesToString(msgpack.MessageBlock.Message); | ||
11175 | ImprovedInstantMessage handlerInstantMessage = OnInstantMessage; | ||
11176 | |||
11177 | if (handlerInstantMessage != null) | ||
11178 | { | ||
11179 | GridInstantMessage im = new GridInstantMessage(Scene, | ||
11180 | msgpack.AgentData.AgentID, | ||
11181 | IMfromName, | ||
11182 | msgpack.MessageBlock.ToAgentID, | ||
11183 | msgpack.MessageBlock.Dialog, | ||
11184 | msgpack.MessageBlock.FromGroup, | ||
11185 | IMmessage, | ||
11186 | msgpack.MessageBlock.ID, | ||
11187 | msgpack.MessageBlock.Offline != 0 ? true : false, | ||
11188 | msgpack.MessageBlock.Position, | ||
11189 | msgpack.MessageBlock.BinaryBucket); | ||
11190 | |||
11191 | handlerInstantMessage(this, im); | ||
11192 | } | ||
11193 | break; | ||
11194 | |||
11195 | case PacketType.AcceptFriendship: | ||
11196 | AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack; | ||
11197 | |||
11198 | #region Packet Session and User Check | ||
11199 | if (m_checkPackets) | ||
11200 | { | ||
11201 | if (afriendpack.AgentData.SessionID != SessionId || | ||
11202 | afriendpack.AgentData.AgentID != AgentId) | ||
11203 | break; | ||
11204 | } | ||
11205 | #endregion | ||
11206 | |||
11207 | // My guess is this is the folder to stick the calling card into | ||
11208 | List<UUID> callingCardFolders = new List<UUID>(); | ||
11209 | |||
11210 | UUID agentID = afriendpack.AgentData.AgentID; | ||
11211 | UUID transactionID = afriendpack.TransactionBlock.TransactionID; | ||
11212 | |||
11213 | for (int fi = 0; fi < afriendpack.FolderData.Length; fi++) | ||
11214 | { | ||
11215 | callingCardFolders.Add(afriendpack.FolderData[fi].FolderID); | ||
11216 | } | ||
11217 | |||
11218 | FriendActionDelegate handlerApproveFriendRequest = OnApproveFriendRequest; | ||
11219 | if (handlerApproveFriendRequest != null) | ||
11220 | { | ||
11221 | handlerApproveFriendRequest(this, agentID, transactionID, callingCardFolders); | ||
11222 | } | ||
11223 | break; | ||
11224 | |||
11225 | case PacketType.DeclineFriendship: | ||
11226 | DeclineFriendshipPacket dfriendpack = (DeclineFriendshipPacket)Pack; | ||
11227 | |||
11228 | #region Packet Session and User Check | ||
11229 | if (m_checkPackets) | ||
11230 | { | ||
11231 | if (dfriendpack.AgentData.SessionID != SessionId || | ||
11232 | dfriendpack.AgentData.AgentID != AgentId) | ||
11233 | break; | ||
11234 | } | ||
11235 | #endregion | ||
11236 | |||
11237 | if (OnDenyFriendRequest != null) | ||
11238 | { | ||
11239 | OnDenyFriendRequest(this, | ||
11240 | dfriendpack.AgentData.AgentID, | ||
11241 | dfriendpack.TransactionBlock.TransactionID, | ||
11242 | null); | ||
11243 | } | ||
11244 | break; | ||
11245 | |||
11246 | case PacketType.TerminateFriendship: | ||
11247 | TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack; | ||
11248 | |||
11249 | #region Packet Session and User Check | ||
11250 | if (m_checkPackets) | ||
11251 | { | ||
11252 | if (tfriendpack.AgentData.SessionID != SessionId || | ||
11253 | tfriendpack.AgentData.AgentID != AgentId) | ||
11254 | break; | ||
11255 | } | ||
11256 | #endregion | ||
11257 | |||
11258 | UUID listOwnerAgentID = tfriendpack.AgentData.AgentID; | ||
11259 | UUID exFriendID = tfriendpack.ExBlock.OtherID; | ||
11260 | |||
11261 | FriendshipTermination handlerTerminateFriendship = OnTerminateFriendship; | ||
11262 | if (handlerTerminateFriendship != null) | ||
11263 | { | ||
11264 | handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); | ||
11265 | } | ||
11266 | break; | ||
11267 | |||
11268 | case PacketType.RezObject: | ||
11269 | RezObjectPacket rezPacket = (RezObjectPacket)Pack; | ||
11270 | |||
11271 | #region Packet Session and User Check | ||
11272 | if (m_checkPackets) | ||
11273 | { | ||
11274 | if (rezPacket.AgentData.SessionID != SessionId || | ||
11275 | rezPacket.AgentData.AgentID != AgentId) | ||
11276 | break; | ||
11277 | } | ||
11278 | #endregion | ||
11279 | |||
11280 | RezObject handlerRezObject = OnRezObject; | ||
11281 | if (handlerRezObject != null) | ||
11282 | { | ||
11283 | handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, | ||
11284 | rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID, | ||
11285 | rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection, | ||
11286 | rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem, | ||
11287 | rezPacket.RezData.FromTaskID); | ||
11288 | } | ||
11289 | break; | ||
11290 | |||
11291 | case PacketType.DeRezObject: | ||
11292 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)Pack; | ||
11293 | |||
11294 | #region Packet Session and User Check | ||
11295 | if (m_checkPackets) | ||
11296 | { | ||
11297 | if (DeRezPacket.AgentData.SessionID != SessionId || | ||
11298 | DeRezPacket.AgentData.AgentID != AgentId) | ||
11299 | break; | ||
11300 | } | ||
11301 | #endregion | ||
11302 | |||
11303 | DeRezObject handlerDeRezObject = OnDeRezObject; | ||
11304 | if (handlerDeRezObject != null) | ||
11305 | { | ||
11306 | List<uint> deRezIDs = new List<uint>(); | ||
11307 | |||
11308 | foreach (DeRezObjectPacket.ObjectDataBlock data in | ||
11309 | DeRezPacket.ObjectData) | ||
11310 | { | ||
11311 | deRezIDs.Add(data.ObjectLocalID); | ||
11312 | } | ||
11313 | // It just so happens that the values on the DeRezAction enumerator match the Destination | ||
11314 | // values given by a Second Life client | ||
11315 | handlerDeRezObject(this, deRezIDs, | ||
11316 | DeRezPacket.AgentBlock.GroupID, | ||
11317 | (DeRezAction)DeRezPacket.AgentBlock.Destination, | ||
11318 | DeRezPacket.AgentBlock.DestinationID); | ||
11319 | |||
11320 | } | ||
11321 | break; | ||
11322 | |||
11323 | case PacketType.ModifyLand: | ||
11324 | ModifyLandPacket modify = (ModifyLandPacket)Pack; | ||
11325 | |||
11326 | #region Packet Session and User Check | ||
11327 | if (m_checkPackets) | ||
11328 | { | ||
11329 | if (modify.AgentData.SessionID != SessionId || | ||
11330 | modify.AgentData.AgentID != AgentId) | ||
11331 | break; | ||
11332 | } | ||
11333 | |||
11334 | #endregion | ||
11335 | //m_log.Info("[LAND]: LAND:" + modify.ToString()); | ||
11336 | if (modify.ParcelData.Length > 0) | ||
11337 | { | ||
11338 | if (OnModifyTerrain != null) | ||
11339 | { | ||
11340 | for (int i = 0; i < modify.ParcelData.Length; i++) | ||
11341 | { | ||
11342 | ModifyTerrain handlerModifyTerrain = OnModifyTerrain; | ||
11343 | if (handlerModifyTerrain != null) | ||
11344 | { | ||
11345 | handlerModifyTerrain(AgentId, modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, | ||
11346 | modify.ModifyBlock.BrushSize, | ||
11347 | modify.ModifyBlock.Action, modify.ParcelData[i].North, | ||
11348 | modify.ParcelData[i].West, modify.ParcelData[i].South, | ||
11349 | modify.ParcelData[i].East, AgentId); | ||
11350 | } | ||
11351 | } | ||
11352 | } | ||
11353 | } | ||
11354 | |||
11355 | break; | ||
11356 | |||
11357 | case PacketType.RegionHandshakeReply: | ||
11358 | |||
11359 | Action<IClientAPI> handlerRegionHandShakeReply = OnRegionHandShakeReply; | ||
11360 | if (handlerRegionHandShakeReply != null) | ||
11361 | { | ||
11362 | handlerRegionHandShakeReply(this); | ||
11363 | } | ||
11364 | |||
11365 | break; | ||
11366 | |||
11367 | case PacketType.AgentWearablesRequest: | ||
11368 | GenericCall2 handlerRequestWearables = OnRequestWearables; | ||
11369 | |||
11370 | if (handlerRequestWearables != null) | ||
11371 | { | ||
11372 | handlerRequestWearables(); | ||
11373 | } | ||
11374 | |||
11375 | Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData; | ||
11376 | |||
11377 | if (handlerRequestAvatarsData != null) | ||
11378 | { | ||
11379 | handlerRequestAvatarsData(this); | ||
11380 | } | ||
11381 | |||
11382 | break; | ||
11383 | |||
11384 | case PacketType.AgentSetAppearance: | ||
11385 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; | ||
11386 | |||
11387 | #region Packet Session and User Check | ||
11388 | if (m_checkPackets) | ||
11389 | { | ||
11390 | if (appear.AgentData.SessionID != SessionId || | ||
11391 | appear.AgentData.AgentID != AgentId) | ||
11392 | break; | ||
11393 | } | ||
11394 | #endregion | ||
11395 | |||
11396 | SetAppearance handlerSetAppearance = OnSetAppearance; | ||
11397 | if (handlerSetAppearance != null) | ||
11398 | { | ||
11399 | // Temporarily protect ourselves from the mantis #951 failure. | ||
11400 | // However, we could do this for several other handlers where a failure isn't terminal | ||
11401 | // for the client session anyway, in order to protect ourselves against bad code in plugins | ||
11402 | try | ||
11403 | { | ||
11404 | byte[] visualparams = new byte[appear.VisualParam.Length]; | ||
11405 | for (int i = 0; i < appear.VisualParam.Length; i++) | ||
11406 | visualparams[i] = appear.VisualParam[i].ParamValue; | ||
11407 | |||
11408 | Primitive.TextureEntry te = null; | ||
11409 | if (appear.ObjectData.TextureEntry.Length > 1) | ||
11410 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | ||
11411 | |||
11412 | handlerSetAppearance(te, visualparams); | ||
11413 | } | ||
11414 | catch (Exception e) | ||
11415 | { | ||
11416 | m_log.ErrorFormat( | ||
11417 | "[CLIENT VIEW]: AgentSetApperance packet handler threw an exception, {0}", | ||
11418 | e); | ||
11419 | } | ||
11420 | } | ||
11421 | |||
11422 | break; | ||
11423 | |||
11424 | case PacketType.AgentIsNowWearing: | ||
11425 | if (OnAvatarNowWearing != null) | ||
11426 | { | ||
11427 | AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket)Pack; | ||
11428 | |||
11429 | #region Packet Session and User Check | ||
11430 | if (m_checkPackets) | ||
11431 | { | ||
11432 | if (nowWearing.AgentData.SessionID != SessionId || | ||
11433 | nowWearing.AgentData.AgentID != AgentId) | ||
11434 | break; | ||
11435 | } | ||
11436 | #endregion | ||
11437 | |||
11438 | AvatarWearingArgs wearingArgs = new AvatarWearingArgs(); | ||
11439 | for (int i = 0; i < nowWearing.WearableData.Length; i++) | ||
11440 | { | ||
11441 | AvatarWearingArgs.Wearable wearable = | ||
11442 | new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID, | ||
11443 | nowWearing.WearableData[i].WearableType); | ||
11444 | wearingArgs.NowWearing.Add(wearable); | ||
11445 | } | ||
11446 | |||
11447 | AvatarNowWearing handlerAvatarNowWearing = OnAvatarNowWearing; | ||
11448 | if (handlerAvatarNowWearing != null) | ||
11449 | { | ||
11450 | handlerAvatarNowWearing(this, wearingArgs); | ||
11451 | } | ||
11452 | } | ||
11453 | break; | ||
11454 | |||
11455 | case PacketType.RezSingleAttachmentFromInv: | ||
11456 | RezSingleAttachmentFromInv handlerRezSingleAttachment = OnRezSingleAttachmentFromInv; | ||
11457 | if (handlerRezSingleAttachment != null) | ||
11458 | { | ||
11459 | RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket)Pack; | ||
11460 | |||
11461 | #region Packet Session and User Check | ||
11462 | if (m_checkPackets) | ||
11463 | { | ||
11464 | if (rez.AgentData.SessionID != SessionId || | ||
11465 | rez.AgentData.AgentID != AgentId) | ||
11466 | break; | ||
11467 | } | ||
11468 | #endregion | ||
11469 | |||
11470 | handlerRezSingleAttachment(this, rez.ObjectData.ItemID, | ||
11471 | rez.ObjectData.AttachmentPt); | ||
11472 | } | ||
11473 | |||
11474 | break; | ||
11475 | |||
11476 | case PacketType.RezMultipleAttachmentsFromInv: | ||
11477 | RezMultipleAttachmentsFromInv handlerRezMultipleAttachments = OnRezMultipleAttachmentsFromInv; | ||
11478 | if (handlerRezMultipleAttachments != null) | ||
11479 | { | ||
11480 | RezMultipleAttachmentsFromInvPacket rez = (RezMultipleAttachmentsFromInvPacket)Pack; | ||
11481 | handlerRezMultipleAttachments(this, rez.HeaderData, | ||
11482 | rez.ObjectData); | ||
11483 | } | ||
11484 | |||
11485 | break; | ||
11486 | |||
11487 | case PacketType.DetachAttachmentIntoInv: | ||
11488 | UUIDNameRequest handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv; | ||
11489 | if (handlerDetachAttachmentIntoInv != null) | ||
11490 | { | ||
11491 | DetachAttachmentIntoInvPacket detachtoInv = (DetachAttachmentIntoInvPacket)Pack; | ||
11492 | |||
11493 | #region Packet Session and User Check | ||
11494 | // UNSUPPORTED ON THIS PACKET | ||
11495 | #endregion | ||
11496 | |||
11497 | UUID itemID = detachtoInv.ObjectData.ItemID; | ||
11498 | // UUID ATTACH_agentID = detachtoInv.ObjectData.AgentID; | ||
11499 | |||
11500 | handlerDetachAttachmentIntoInv(itemID, this); | ||
11501 | } | ||
11502 | break; | ||
11503 | |||
11504 | case PacketType.ObjectAttach: | ||
11505 | if (OnObjectAttach != null) | ||
11506 | { | ||
11507 | ObjectAttachPacket att = (ObjectAttachPacket)Pack; | ||
11508 | |||
11509 | #region Packet Session and User Check | ||
11510 | if (m_checkPackets) | ||
11511 | { | ||
11512 | if (att.AgentData.SessionID != SessionId || | ||
11513 | att.AgentData.AgentID != AgentId) | ||
11514 | break; | ||
11515 | } | ||
11516 | #endregion | ||
11517 | |||
11518 | ObjectAttach handlerObjectAttach = OnObjectAttach; | ||
11519 | |||
11520 | if (handlerObjectAttach != null) | ||
11521 | { | ||
11522 | if (att.ObjectData.Length > 0) | ||
11523 | { | ||
11524 | handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation, false); | ||
11525 | } | ||
11526 | } | ||
11527 | } | ||
11528 | break; | ||
11529 | |||
11530 | case PacketType.ObjectDetach: | ||
11531 | ObjectDetachPacket dett = (ObjectDetachPacket)Pack; | ||
11532 | |||
11533 | #region Packet Session and User Check | ||
11534 | if (m_checkPackets) | ||
11535 | { | ||
11536 | if (dett.AgentData.SessionID != SessionId || | ||
11537 | dett.AgentData.AgentID != AgentId) | ||
11538 | break; | ||
11539 | } | ||
11540 | #endregion | ||
11541 | |||
11542 | for (int j = 0; j < dett.ObjectData.Length; j++) | ||
11543 | { | ||
11544 | uint obj = dett.ObjectData[j].ObjectLocalID; | ||
11545 | ObjectDeselect handlerObjectDetach = OnObjectDetach; | ||
11546 | if (handlerObjectDetach != null) | ||
11547 | { | ||
11548 | handlerObjectDetach(obj, this); | ||
11549 | } | ||
11550 | |||
11551 | } | ||
11552 | break; | ||
11553 | |||
11554 | case PacketType.ObjectDrop: | ||
11555 | ObjectDropPacket dropp = (ObjectDropPacket)Pack; | ||
11556 | |||
11557 | #region Packet Session and User Check | ||
11558 | if (m_checkPackets) | ||
11559 | { | ||
11560 | if (dropp.AgentData.SessionID != SessionId || | ||
11561 | dropp.AgentData.AgentID != AgentId) | ||
11562 | break; | ||
11563 | } | ||
11564 | #endregion | ||
11565 | |||
11566 | for (int j = 0; j < dropp.ObjectData.Length; j++) | ||
11567 | { | ||
11568 | uint obj = dropp.ObjectData[j].ObjectLocalID; | ||
11569 | ObjectDrop handlerObjectDrop = OnObjectDrop; | ||
11570 | if (handlerObjectDrop != null) | ||
11571 | { | ||
11572 | handlerObjectDrop(obj, this); | ||
11573 | } | ||
11574 | } | ||
11575 | break; | ||
11576 | |||
11577 | case PacketType.SetAlwaysRun: | ||
11578 | SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; | ||
11579 | |||
11580 | #region Packet Session and User Check | ||
11581 | if (m_checkPackets) | ||
11582 | { | ||
11583 | if (run.AgentData.SessionID != SessionId || | ||
11584 | run.AgentData.AgentID != AgentId) | ||
11585 | break; | ||
11586 | } | ||
11587 | #endregion | ||
11588 | |||
11589 | SetAlwaysRun handlerSetAlwaysRun = OnSetAlwaysRun; | ||
11590 | if (handlerSetAlwaysRun != null) | ||
11591 | handlerSetAlwaysRun(this, run.AgentData.AlwaysRun); | ||
11592 | |||
11593 | break; | ||
11594 | |||
11595 | case PacketType.CompleteAgentMovement: | ||
11596 | GenericCall2 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; | ||
11597 | if (handlerCompleteMovementToRegion != null) | ||
11598 | { | ||
11599 | handlerCompleteMovementToRegion(); | ||
11600 | } | ||
11601 | handlerCompleteMovementToRegion = null; | ||
11602 | |||
11603 | break; | ||
11604 | |||
11605 | case PacketType.AgentAnimation: | ||
11606 | AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; | ||
11607 | |||
11608 | #region Packet Session and User Check | ||
11609 | if (m_checkPackets) | ||
11610 | { | ||
11611 | if (AgentAni.AgentData.SessionID != SessionId || | ||
11612 | AgentAni.AgentData.AgentID != AgentId) | ||
11613 | break; | ||
11614 | } | ||
11615 | #endregion | ||
11616 | |||
11617 | StartAnim handlerStartAnim = null; | ||
11618 | StopAnim handlerStopAnim = null; | ||
11619 | |||
11620 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | ||
11621 | { | ||
11622 | if (AgentAni.AnimationList[i].StartAnim) | ||
11623 | { | ||
11624 | handlerStartAnim = OnStartAnim; | ||
11625 | if (handlerStartAnim != null) | ||
11626 | { | ||
11627 | handlerStartAnim(this, AgentAni.AnimationList[i].AnimID); | ||
11628 | } | ||
11629 | } | ||
11630 | else | ||
11631 | { | ||
11632 | handlerStopAnim = OnStopAnim; | ||
11633 | if (handlerStopAnim != null) | ||
11634 | { | ||
11635 | handlerStopAnim(this, AgentAni.AnimationList[i].AnimID); | ||
11636 | } | ||
11637 | } | ||
11638 | } | ||
11639 | break; | ||
11640 | |||
11641 | case PacketType.AgentRequestSit: | ||
11642 | if (OnAgentRequestSit != null) | ||
11643 | { | ||
11644 | AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack; | ||
11645 | |||
11646 | #region Packet Session and User Check | ||
11647 | if (m_checkPackets) | ||
11648 | { | ||
11649 | if (agentRequestSit.AgentData.SessionID != SessionId || | ||
11650 | agentRequestSit.AgentData.AgentID != AgentId) | ||
11651 | break; | ||
11652 | } | ||
11653 | #endregion | ||
11654 | |||
11655 | AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit; | ||
11656 | if (handlerAgentRequestSit != null) | ||
11657 | handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, | ||
11658 | agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); | ||
11659 | } | ||
11660 | break; | ||
11661 | |||
11662 | case PacketType.AgentSit: | ||
11663 | if (OnAgentSit != null) | ||
11664 | { | ||
11665 | AgentSitPacket agentSit = (AgentSitPacket)Pack; | ||
11666 | |||
11667 | #region Packet Session and User Check | ||
11668 | if (m_checkPackets) | ||
11669 | { | ||
11670 | if (agentSit.AgentData.SessionID != SessionId || | ||
11671 | agentSit.AgentData.AgentID != AgentId) | ||
11672 | break; | ||
11673 | } | ||
11674 | #endregion | ||
11675 | |||
11676 | AgentSit handlerAgentSit = OnAgentSit; | ||
11677 | if (handlerAgentSit != null) | ||
11678 | { | ||
11679 | OnAgentSit(this, agentSit.AgentData.AgentID); | ||
11680 | } | ||
11681 | } | ||
11682 | break; | ||
11683 | |||
11684 | case PacketType.SoundTrigger: | ||
11685 | SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack; | ||
11686 | |||
11687 | #region Packet Session and User Check | ||
11688 | if (m_checkPackets) | ||
11689 | { | ||
11690 | // UNSUPPORTED ON THIS PACKET | ||
11691 | } | ||
11692 | #endregion | ||
11693 | |||
11694 | SoundTrigger handlerSoundTrigger = OnSoundTrigger; | ||
11695 | if (handlerSoundTrigger != null) | ||
11696 | { | ||
11697 | handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID, | ||
11698 | soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID, | ||
11699 | soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position, | ||
11700 | soundTriggerPacket.SoundData.Handle); | ||
11701 | |||
11702 | } | ||
11703 | break; | ||
11704 | |||
11705 | case PacketType.AvatarPickerRequest: | ||
11706 | AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; | ||
11707 | |||
11708 | #region Packet Session and User Check | ||
11709 | if (m_checkPackets) | ||
11710 | { | ||
11711 | if (avRequestQuery.AgentData.SessionID != SessionId || | ||
11712 | avRequestQuery.AgentData.AgentID != AgentId) | ||
11713 | break; | ||
11714 | } | ||
11715 | #endregion | ||
11716 | |||
11717 | AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData; | ||
11718 | AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data; | ||
11719 | //m_log.Debug("Agent Sends:" + Utils.BytesToString(querydata.Name)); | ||
11720 | |||
11721 | AvatarPickerRequest handlerAvatarPickerRequest = OnAvatarPickerRequest; | ||
11722 | if (handlerAvatarPickerRequest != null) | ||
11723 | { | ||
11724 | handlerAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID, | ||
11725 | Utils.BytesToString(querydata.Name)); | ||
11726 | } | ||
11727 | break; | ||
11728 | |||
11729 | case PacketType.AgentDataUpdateRequest: | ||
11730 | AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack; | ||
11731 | |||
11732 | #region Packet Session and User Check | ||
11733 | if (m_checkPackets) | ||
11734 | { | ||
11735 | if (avRequestDataUpdatePacket.AgentData.SessionID != SessionId || | ||
11736 | avRequestDataUpdatePacket.AgentData.AgentID != AgentId) | ||
11737 | break; | ||
11738 | } | ||
11739 | #endregion | ||
11740 | |||
11741 | FetchInventory handlerAgentDataUpdateRequest = OnAgentDataUpdateRequest; | ||
11742 | |||
11743 | if (handlerAgentDataUpdateRequest != null) | ||
11744 | { | ||
11745 | handlerAgentDataUpdateRequest(this, avRequestDataUpdatePacket.AgentData.AgentID, avRequestDataUpdatePacket.AgentData.SessionID); | ||
11746 | } | ||
11747 | |||
11748 | break; | ||
11749 | |||
11750 | case PacketType.UserInfoRequest: | ||
11751 | UserInfoRequest handlerUserInfoRequest = OnUserInfoRequest; | ||
11752 | if (handlerUserInfoRequest != null) | ||
11753 | { | ||
11754 | handlerUserInfoRequest(this); | ||
11755 | } | ||
11756 | else | ||
11757 | { | ||
11758 | SendUserInfoReply(false, true, ""); | ||
11759 | } | ||
11760 | break; | ||
11761 | |||
11762 | case PacketType.UpdateUserInfo: | ||
11763 | UpdateUserInfoPacket updateUserInfo = (UpdateUserInfoPacket)Pack; | ||
11764 | |||
11765 | #region Packet Session and User Check | ||
11766 | if (m_checkPackets) | ||
11767 | { | ||
11768 | if (updateUserInfo.AgentData.SessionID != SessionId || | ||
11769 | updateUserInfo.AgentData.AgentID != AgentId) | ||
11770 | break; | ||
11771 | } | ||
11772 | #endregion | ||
11773 | |||
11774 | UpdateUserInfo handlerUpdateUserInfo = OnUpdateUserInfo; | ||
11775 | if (handlerUpdateUserInfo != null) | ||
11776 | { | ||
11777 | bool visible = true; | ||
11778 | string DirectoryVisibility = | ||
11779 | Utils.BytesToString(updateUserInfo.UserData.DirectoryVisibility); | ||
11780 | if (DirectoryVisibility == "hidden") | ||
11781 | visible = false; | ||
11782 | |||
11783 | handlerUpdateUserInfo( | ||
11784 | updateUserInfo.UserData.IMViaEMail, | ||
11785 | visible, this); | ||
11786 | } | ||
11787 | break; | ||
11788 | |||
11789 | case PacketType.SetStartLocationRequest: | ||
11790 | SetStartLocationRequestPacket avSetStartLocationRequestPacket = (SetStartLocationRequestPacket)Pack; | ||
11791 | |||
11792 | #region Packet Session and User Check | ||
11793 | if (m_checkPackets) | ||
11794 | { | ||
11795 | if (avSetStartLocationRequestPacket.AgentData.SessionID != SessionId || | ||
11796 | avSetStartLocationRequestPacket.AgentData.AgentID != AgentId) | ||
11797 | break; | ||
11798 | } | ||
11799 | #endregion | ||
11800 | |||
11801 | if (avSetStartLocationRequestPacket.AgentData.AgentID == AgentId && avSetStartLocationRequestPacket.AgentData.SessionID == SessionId) | ||
11802 | { | ||
11803 | TeleportLocationRequest handlerSetStartLocationRequest = OnSetStartLocationRequest; | ||
11804 | if (handlerSetStartLocationRequest != null) | ||
11805 | { | ||
11806 | handlerSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos, | ||
11807 | avSetStartLocationRequestPacket.StartLocationData.LocationLookAt, | ||
11808 | avSetStartLocationRequestPacket.StartLocationData.LocationID); | ||
11809 | } | ||
11810 | } | ||
11811 | break; | ||
11812 | |||
11813 | case PacketType.AgentThrottle: | ||
11814 | AgentThrottlePacket atpack = (AgentThrottlePacket)Pack; | ||
11815 | |||
11816 | #region Packet Session and User Check | ||
11817 | if (m_checkPackets) | ||
11818 | { | ||
11819 | if (atpack.AgentData.SessionID != SessionId || | ||
11820 | atpack.AgentData.AgentID != AgentId) | ||
11821 | break; | ||
11822 | } | ||
11823 | #endregion | ||
11824 | |||
11825 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); | ||
11826 | break; | ||
11827 | |||
11828 | case PacketType.AgentPause: | ||
11829 | m_udpClient.IsPaused = true; | ||
11830 | break; | ||
11831 | |||
11832 | case PacketType.AgentResume: | ||
11833 | m_udpClient.IsPaused = false; | ||
11834 | SendStartPingCheck(m_udpClient.CurrentPingSequence++); | ||
11835 | |||
11836 | break; | ||
11837 | |||
11838 | case PacketType.ForceScriptControlRelease: | ||
11839 | ForceReleaseControls handlerForceReleaseControls = OnForceReleaseControls; | ||
11840 | if (handlerForceReleaseControls != null) | ||
11841 | { | ||
11842 | handlerForceReleaseControls(this, AgentId); | ||
11843 | } | ||
11844 | break; | ||
11845 | |||
11846 | #endregion | ||
11847 | |||
11848 | |||
11849 | //#region Objects/m_sceneObjects | ||
11850 | |||
11851 | case PacketType.ObjectLink: | ||
11852 | ObjectLinkPacket link = (ObjectLinkPacket)Pack; | ||
11853 | |||
11854 | #region Packet Session and User Check | ||
11855 | if (m_checkPackets) | ||
11856 | { | ||
11857 | if (link.AgentData.SessionID != SessionId || | ||
11858 | link.AgentData.AgentID != AgentId) | ||
11859 | break; | ||
11860 | } | ||
11861 | #endregion | ||
11862 | |||
11863 | uint parentprimid = 0; | ||
11864 | List<uint> childrenprims = new List<uint>(); | ||
11865 | if (link.ObjectData.Length > 1) | ||
11866 | { | ||
11867 | parentprimid = link.ObjectData[0].ObjectLocalID; | ||
11868 | |||
11869 | for (int i = 1; i < link.ObjectData.Length; i++) | ||
11870 | { | ||
11871 | childrenprims.Add(link.ObjectData[i].ObjectLocalID); | ||
11872 | } | ||
11873 | } | ||
11874 | LinkObjects handlerLinkObjects = OnLinkObjects; | ||
11875 | if (handlerLinkObjects != null) | ||
11876 | { | ||
11877 | handlerLinkObjects(this, parentprimid, childrenprims); | ||
11878 | } | ||
11879 | break; | ||
11880 | |||
11881 | case PacketType.ObjectDelink: | ||
11882 | ObjectDelinkPacket delink = (ObjectDelinkPacket)Pack; | ||
11883 | |||
11884 | #region Packet Session and User Check | ||
11885 | if (m_checkPackets) | ||
11886 | { | ||
11887 | if (delink.AgentData.SessionID != SessionId || | ||
11888 | delink.AgentData.AgentID != AgentId) | ||
11889 | break; | ||
11890 | } | ||
11891 | #endregion | ||
11892 | |||
11893 | // It appears the prim at index 0 is not always the root prim (for | ||
11894 | // instance, when one prim of a link set has been edited independently | ||
11895 | // of the others). Therefore, we'll pass all the ids onto the delink | ||
11896 | // method for it to decide which is the root. | ||
11897 | List<uint> prims = new List<uint>(); | ||
11898 | for (int i = 0; i < delink.ObjectData.Length; i++) | ||
11899 | { | ||
11900 | prims.Add(delink.ObjectData[i].ObjectLocalID); | ||
11901 | } | ||
11902 | DelinkObjects handlerDelinkObjects = OnDelinkObjects; | ||
11903 | if (handlerDelinkObjects != null) | ||
11904 | { | ||
11905 | handlerDelinkObjects(prims); | ||
11906 | } | ||
11907 | |||
11908 | break; | ||
11909 | |||
11910 | case PacketType.ObjectAdd: | ||
11911 | if (OnAddPrim != null) | ||
11912 | { | ||
11913 | ObjectAddPacket addPacket = (ObjectAddPacket)Pack; | ||
11914 | |||
11915 | #region Packet Session and User Check | ||
11916 | if (m_checkPackets) | ||
11917 | { | ||
11918 | if (addPacket.AgentData.SessionID != SessionId || | ||
11919 | addPacket.AgentData.AgentID != AgentId) | ||
11920 | break; | ||
11921 | } | ||
11922 | #endregion | ||
11923 | |||
11924 | PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); | ||
11925 | // m_log.Info("[REZData]: " + addPacket.ToString()); | ||
11926 | //BypassRaycast: 1 | ||
11927 | //RayStart: <69.79469, 158.2652, 98.40343> | ||
11928 | //RayEnd: <61.97724, 141.995, 92.58341> | ||
11929 | //RayTargetID: 00000000-0000-0000-0000-000000000000 | ||
11930 | |||
11931 | //Check to see if adding the prim is allowed; useful for any module wanting to restrict the | ||
11932 | //object from rezing initially | ||
11933 | |||
11934 | AddNewPrim handlerAddPrim = OnAddPrim; | ||
11935 | if (handlerAddPrim != null) | ||
11936 | handlerAddPrim(AgentId, ActiveGroupId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection); | ||
11937 | } | ||
11938 | break; | ||
11939 | |||
11940 | case PacketType.ObjectShape: | ||
11941 | ObjectShapePacket shapePacket = (ObjectShapePacket)Pack; | ||
11942 | |||
11943 | #region Packet Session and User Check | ||
11944 | if (m_checkPackets) | ||
11945 | { | ||
11946 | if (shapePacket.AgentData.SessionID != SessionId || | ||
11947 | shapePacket.AgentData.AgentID != AgentId) | ||
11948 | break; | ||
11949 | } | ||
11950 | #endregion | ||
11951 | |||
11952 | UpdateShape handlerUpdatePrimShape = null; | ||
11953 | for (int i = 0; i < shapePacket.ObjectData.Length; i++) | ||
11954 | { | ||
11955 | handlerUpdatePrimShape = OnUpdatePrimShape; | ||
11956 | if (handlerUpdatePrimShape != null) | ||
11957 | { | ||
11958 | UpdateShapeArgs shapeData = new UpdateShapeArgs(); | ||
11959 | shapeData.ObjectLocalID = shapePacket.ObjectData[i].ObjectLocalID; | ||
11960 | shapeData.PathBegin = shapePacket.ObjectData[i].PathBegin; | ||
11961 | shapeData.PathCurve = shapePacket.ObjectData[i].PathCurve; | ||
11962 | shapeData.PathEnd = shapePacket.ObjectData[i].PathEnd; | ||
11963 | shapeData.PathRadiusOffset = shapePacket.ObjectData[i].PathRadiusOffset; | ||
11964 | shapeData.PathRevolutions = shapePacket.ObjectData[i].PathRevolutions; | ||
11965 | shapeData.PathScaleX = shapePacket.ObjectData[i].PathScaleX; | ||
11966 | shapeData.PathScaleY = shapePacket.ObjectData[i].PathScaleY; | ||
11967 | shapeData.PathShearX = shapePacket.ObjectData[i].PathShearX; | ||
11968 | shapeData.PathShearY = shapePacket.ObjectData[i].PathShearY; | ||
11969 | shapeData.PathSkew = shapePacket.ObjectData[i].PathSkew; | ||
11970 | shapeData.PathTaperX = shapePacket.ObjectData[i].PathTaperX; | ||
11971 | shapeData.PathTaperY = shapePacket.ObjectData[i].PathTaperY; | ||
11972 | shapeData.PathTwist = shapePacket.ObjectData[i].PathTwist; | ||
11973 | shapeData.PathTwistBegin = shapePacket.ObjectData[i].PathTwistBegin; | ||
11974 | shapeData.ProfileBegin = shapePacket.ObjectData[i].ProfileBegin; | ||
11975 | shapeData.ProfileCurve = shapePacket.ObjectData[i].ProfileCurve; | ||
11976 | shapeData.ProfileEnd = shapePacket.ObjectData[i].ProfileEnd; | ||
11977 | shapeData.ProfileHollow = shapePacket.ObjectData[i].ProfileHollow; | ||
11978 | |||
11979 | handlerUpdatePrimShape(m_agentId, shapePacket.ObjectData[i].ObjectLocalID, | ||
11980 | shapeData); | ||
11981 | } | ||
11982 | } | ||
11983 | break; | ||
11984 | |||
11985 | case PacketType.ObjectExtraParams: | ||
11986 | ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack; | ||
11987 | |||
11988 | #region Packet Session and User Check | ||
11989 | if (m_checkPackets) | ||
11990 | { | ||
11991 | if (extraPar.AgentData.SessionID != SessionId || | ||
11992 | extraPar.AgentData.AgentID != AgentId) | ||
11993 | break; | ||
11994 | } | ||
11995 | #endregion | ||
11996 | |||
11997 | ObjectExtraParams handlerUpdateExtraParams = OnUpdateExtraParams; | ||
11998 | if (handlerUpdateExtraParams != null) | ||
11999 | { | ||
12000 | for (int i = 0; i < extraPar.ObjectData.Length; i++) | ||
12001 | { | ||
12002 | handlerUpdateExtraParams(m_agentId, extraPar.ObjectData[i].ObjectLocalID, | ||
12003 | extraPar.ObjectData[i].ParamType, | ||
12004 | extraPar.ObjectData[i].ParamInUse, extraPar.ObjectData[i].ParamData); | ||
12005 | } | ||
12006 | } | ||
12007 | break; | ||
12008 | |||
12009 | case PacketType.ObjectDuplicate: | ||
12010 | ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; | ||
12011 | |||
12012 | #region Packet Session and User Check | ||
12013 | if (m_checkPackets) | ||
12014 | { | ||
12015 | if (dupe.AgentData.SessionID != SessionId || | ||
12016 | dupe.AgentData.AgentID != AgentId) | ||
12017 | break; | ||
12018 | } | ||
12019 | #endregion | ||
12020 | |||
12021 | ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData; | ||
12022 | |||
12023 | ObjectDuplicate handlerObjectDuplicate = null; | ||
12024 | |||
12025 | for (int i = 0; i < dupe.ObjectData.Length; i++) | ||
12026 | { | ||
12027 | handlerObjectDuplicate = OnObjectDuplicate; | ||
12028 | if (handlerObjectDuplicate != null) | ||
12029 | { | ||
12030 | handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, | ||
12031 | dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID, | ||
12032 | AgentandGroupData.GroupID); | ||
12033 | } | ||
12034 | } | ||
12035 | |||
12036 | break; | ||
12037 | |||
12038 | case PacketType.RequestMultipleObjects: | ||
12039 | RequestMultipleObjectsPacket incomingRequest = (RequestMultipleObjectsPacket)Pack; | ||
12040 | |||
12041 | #region Packet Session and User Check | ||
12042 | if (m_checkPackets) | ||
12043 | { | ||
12044 | if (incomingRequest.AgentData.SessionID != SessionId || | ||
12045 | incomingRequest.AgentData.AgentID != AgentId) | ||
12046 | break; | ||
12047 | } | ||
12048 | #endregion | ||
12049 | |||
12050 | ObjectRequest handlerObjectRequest = null; | ||
12051 | |||
12052 | for (int i = 0; i < incomingRequest.ObjectData.Length; i++) | ||
12053 | { | ||
12054 | handlerObjectRequest = OnObjectRequest; | ||
12055 | if (handlerObjectRequest != null) | ||
12056 | { | ||
12057 | handlerObjectRequest(incomingRequest.ObjectData[i].ID, this); | ||
12058 | } | ||
12059 | } | ||
12060 | break; | ||
12061 | |||
12062 | case PacketType.ObjectSelect: | ||
12063 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | ||
12064 | |||
12065 | #region Packet Session and User Check | ||
12066 | if (m_checkPackets) | ||
12067 | { | ||
12068 | if (incomingselect.AgentData.SessionID != SessionId || | ||
12069 | incomingselect.AgentData.AgentID != AgentId) | ||
12070 | break; | ||
12071 | } | ||
12072 | #endregion | ||
12073 | |||
12074 | ObjectSelect handlerObjectSelect = null; | ||
12075 | |||
12076 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | ||
12077 | { | ||
12078 | handlerObjectSelect = OnObjectSelect; | ||
12079 | if (handlerObjectSelect != null) | ||
12080 | { | ||
12081 | handlerObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this); | ||
12082 | } | ||
12083 | } | ||
12084 | break; | ||
12085 | |||
12086 | case PacketType.ObjectDeselect: | ||
12087 | ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack; | ||
12088 | |||
12089 | #region Packet Session and User Check | ||
12090 | if (m_checkPackets) | ||
12091 | { | ||
12092 | if (incomingdeselect.AgentData.SessionID != SessionId || | ||
12093 | incomingdeselect.AgentData.AgentID != AgentId) | ||
12094 | break; | ||
12095 | } | ||
12096 | #endregion | ||
12097 | |||
12098 | ObjectDeselect handlerObjectDeselect = null; | ||
12099 | |||
12100 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) | ||
12101 | { | ||
12102 | handlerObjectDeselect = OnObjectDeselect; | ||
12103 | if (handlerObjectDeselect != null) | ||
12104 | { | ||
12105 | OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this); | ||
12106 | } | ||
12107 | } | ||
12108 | break; | ||
12109 | |||
12110 | case PacketType.ObjectPosition: | ||
12111 | // DEPRECATED: but till libsecondlife removes it, people will use it | ||
12112 | ObjectPositionPacket position = (ObjectPositionPacket)Pack; | ||
12113 | |||
12114 | #region Packet Session and User Check | ||
12115 | if (m_checkPackets) | ||
12116 | { | ||
12117 | if (position.AgentData.SessionID != SessionId || | ||
12118 | position.AgentData.AgentID != AgentId) | ||
12119 | break; | ||
12120 | } | ||
12121 | #endregion | ||
12122 | |||
12123 | |||
12124 | for (int i = 0; i < position.ObjectData.Length; i++) | ||
12125 | { | ||
12126 | UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; | ||
12127 | if (handlerUpdateVector != null) | ||
12128 | handlerUpdateVector(position.ObjectData[i].ObjectLocalID, position.ObjectData[i].Position, this); | ||
12129 | } | ||
12130 | |||
12131 | break; | ||
12132 | |||
12133 | case PacketType.ObjectScale: | ||
12134 | // DEPRECATED: but till libsecondlife removes it, people will use it | ||
12135 | ObjectScalePacket scale = (ObjectScalePacket)Pack; | ||
12136 | |||
12137 | #region Packet Session and User Check | ||
12138 | if (m_checkPackets) | ||
12139 | { | ||
12140 | if (scale.AgentData.SessionID != SessionId || | ||
12141 | scale.AgentData.AgentID != AgentId) | ||
12142 | break; | ||
12143 | } | ||
12144 | #endregion | ||
12145 | |||
12146 | for (int i = 0; i < scale.ObjectData.Length; i++) | ||
12147 | { | ||
12148 | UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | ||
12149 | if (handlerUpdatePrimGroupScale != null) | ||
12150 | handlerUpdatePrimGroupScale(scale.ObjectData[i].ObjectLocalID, scale.ObjectData[i].Scale, this); | ||
12151 | } | ||
12152 | |||
12153 | break; | ||
12154 | |||
12155 | case PacketType.ObjectRotation: | ||
12156 | // DEPRECATED: but till libsecondlife removes it, people will use it | ||
12157 | ObjectRotationPacket rotation = (ObjectRotationPacket)Pack; | ||
12158 | |||
12159 | #region Packet Session and User Check | ||
12160 | if (m_checkPackets) | ||
12161 | { | ||
12162 | if (rotation.AgentData.SessionID != SessionId || | ||
12163 | rotation.AgentData.AgentID != AgentId) | ||
12164 | break; | ||
12165 | } | ||
12166 | #endregion | ||
12167 | |||
12168 | for (int i = 0; i < rotation.ObjectData.Length; i++) | ||
12169 | { | ||
12170 | UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; | ||
12171 | if (handlerUpdatePrimRotation != null) | ||
12172 | handlerUpdatePrimRotation(rotation.ObjectData[i].ObjectLocalID, rotation.ObjectData[i].Rotation, this); | ||
12173 | } | ||
12174 | |||
12175 | break; | ||
12176 | |||
12177 | case PacketType.ObjectFlagUpdate: | ||
12178 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; | ||
12179 | |||
12180 | #region Packet Session and User Check | ||
12181 | if (m_checkPackets) | ||
12182 | { | ||
12183 | if (flags.AgentData.SessionID != SessionId || | ||
12184 | flags.AgentData.AgentID != AgentId) | ||
12185 | break; | ||
12186 | } | ||
12187 | #endregion | ||
12188 | |||
12189 | UpdatePrimFlags handlerUpdatePrimFlags = OnUpdatePrimFlags; | ||
12190 | |||
12191 | if (handlerUpdatePrimFlags != null) | ||
12192 | { | ||
12193 | byte[] data = Pack.ToBytes(); | ||
12194 | // 46,47,48 are special positions within the packet | ||
12195 | // This may change so perhaps we need a better way | ||
12196 | // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) | ||
12197 | bool UsePhysics = (data[46] != 0) ? true : false; | ||
12198 | bool IsTemporary = (data[47] != 0) ? true : false; | ||
12199 | bool IsPhantom = (data[48] != 0) ? true : false; | ||
12200 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); | ||
12201 | } | ||
12202 | break; | ||
12203 | case PacketType.ObjectImage: | ||
12204 | ObjectImagePacket imagePack = (ObjectImagePacket)Pack; | ||
12205 | |||
12206 | UpdatePrimTexture handlerUpdatePrimTexture = null; | ||
12207 | for (int i = 0; i < imagePack.ObjectData.Length; i++) | ||
12208 | { | ||
12209 | handlerUpdatePrimTexture = OnUpdatePrimTexture; | ||
12210 | if (handlerUpdatePrimTexture != null) | ||
12211 | { | ||
12212 | handlerUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, | ||
12213 | imagePack.ObjectData[i].TextureEntry, this); | ||
12214 | } | ||
12215 | } | ||
12216 | break; | ||
12217 | |||
12218 | case PacketType.ObjectGrab: | ||
12219 | ObjectGrabPacket grab = (ObjectGrabPacket)Pack; | ||
12220 | |||
12221 | #region Packet Session and User Check | ||
12222 | if (m_checkPackets) | ||
12223 | { | ||
12224 | if (grab.AgentData.SessionID != SessionId || | ||
12225 | grab.AgentData.AgentID != AgentId) | ||
12226 | break; | ||
12227 | } | ||
12228 | #endregion | ||
12229 | |||
12230 | GrabObject handlerGrabObject = OnGrabObject; | ||
12231 | |||
12232 | if (handlerGrabObject != null) | ||
12233 | { | ||
12234 | List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>(); | ||
12235 | if ((grab.SurfaceInfo != null) && (grab.SurfaceInfo.Length > 0)) | ||
12236 | { | ||
12237 | foreach (ObjectGrabPacket.SurfaceInfoBlock surfaceInfo in grab.SurfaceInfo) | ||
12238 | { | ||
12239 | SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs(); | ||
12240 | arg.Binormal = surfaceInfo.Binormal; | ||
12241 | arg.FaceIndex = surfaceInfo.FaceIndex; | ||
12242 | arg.Normal = surfaceInfo.Normal; | ||
12243 | arg.Position = surfaceInfo.Position; | ||
12244 | arg.STCoord = surfaceInfo.STCoord; | ||
12245 | arg.UVCoord = surfaceInfo.UVCoord; | ||
12246 | touchArgs.Add(arg); | ||
12247 | } | ||
12248 | } | ||
12249 | handlerGrabObject(grab.ObjectData.LocalID, grab.ObjectData.GrabOffset, this, touchArgs); | ||
12250 | } | ||
12251 | break; | ||
12252 | |||
12253 | case PacketType.ObjectGrabUpdate: | ||
12254 | ObjectGrabUpdatePacket grabUpdate = (ObjectGrabUpdatePacket)Pack; | ||
12255 | |||
12256 | #region Packet Session and User Check | ||
12257 | if (m_checkPackets) | ||
12258 | { | ||
12259 | if (grabUpdate.AgentData.SessionID != SessionId || | ||
12260 | grabUpdate.AgentData.AgentID != AgentId) | ||
12261 | break; | ||
12262 | } | ||
12263 | #endregion | ||
12264 | |||
12265 | MoveObject handlerGrabUpdate = OnGrabUpdate; | ||
12266 | |||
12267 | if (handlerGrabUpdate != null) | ||
12268 | { | ||
12269 | List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>(); | ||
12270 | if ((grabUpdate.SurfaceInfo != null) && (grabUpdate.SurfaceInfo.Length > 0)) | ||
12271 | { | ||
12272 | foreach (ObjectGrabUpdatePacket.SurfaceInfoBlock surfaceInfo in grabUpdate.SurfaceInfo) | ||
12273 | { | ||
12274 | SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs(); | ||
12275 | arg.Binormal = surfaceInfo.Binormal; | ||
12276 | arg.FaceIndex = surfaceInfo.FaceIndex; | ||
12277 | arg.Normal = surfaceInfo.Normal; | ||
12278 | arg.Position = surfaceInfo.Position; | ||
12279 | arg.STCoord = surfaceInfo.STCoord; | ||
12280 | arg.UVCoord = surfaceInfo.UVCoord; | ||
12281 | touchArgs.Add(arg); | ||
12282 | } | ||
12283 | } | ||
12284 | handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, | ||
12285 | grabUpdate.ObjectData.GrabPosition, this, touchArgs); | ||
12286 | } | ||
12287 | break; | ||
12288 | |||
12289 | case PacketType.ObjectDeGrab: | ||
12290 | ObjectDeGrabPacket deGrab = (ObjectDeGrabPacket)Pack; | ||
12291 | |||
12292 | #region Packet Session and User Check | ||
12293 | if (m_checkPackets) | ||
12294 | { | ||
12295 | if (deGrab.AgentData.SessionID != SessionId || | ||
12296 | deGrab.AgentData.AgentID != AgentId) | ||
12297 | break; | ||
12298 | } | ||
12299 | #endregion | ||
12300 | |||
12301 | DeGrabObject handlerDeGrabObject = OnDeGrabObject; | ||
12302 | if (handlerDeGrabObject != null) | ||
12303 | { | ||
12304 | List<SurfaceTouchEventArgs> touchArgs = new List<SurfaceTouchEventArgs>(); | ||
12305 | if ((deGrab.SurfaceInfo != null) && (deGrab.SurfaceInfo.Length > 0)) | ||
12306 | { | ||
12307 | foreach (ObjectDeGrabPacket.SurfaceInfoBlock surfaceInfo in deGrab.SurfaceInfo) | ||
12308 | { | ||
12309 | SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs(); | ||
12310 | arg.Binormal = surfaceInfo.Binormal; | ||
12311 | arg.FaceIndex = surfaceInfo.FaceIndex; | ||
12312 | arg.Normal = surfaceInfo.Normal; | ||
12313 | arg.Position = surfaceInfo.Position; | ||
12314 | arg.STCoord = surfaceInfo.STCoord; | ||
12315 | arg.UVCoord = surfaceInfo.UVCoord; | ||
12316 | touchArgs.Add(arg); | ||
12317 | } | ||
12318 | } | ||
12319 | handlerDeGrabObject(deGrab.ObjectData.LocalID, this, touchArgs); | ||
12320 | } | ||
12321 | break; | ||
12322 | |||
12323 | case PacketType.ObjectSpinStart: | ||
12324 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinStart packet"); | ||
12325 | ObjectSpinStartPacket spinStart = (ObjectSpinStartPacket)Pack; | ||
12326 | |||
12327 | #region Packet Session and User Check | ||
12328 | if (m_checkPackets) | ||
12329 | { | ||
12330 | if (spinStart.AgentData.SessionID != SessionId || | ||
12331 | spinStart.AgentData.AgentID != AgentId) | ||
12332 | break; | ||
12333 | } | ||
12334 | #endregion | ||
12335 | |||
12336 | SpinStart handlerSpinStart = OnSpinStart; | ||
12337 | if (handlerSpinStart != null) | ||
12338 | { | ||
12339 | handlerSpinStart(spinStart.ObjectData.ObjectID, this); | ||
12340 | } | ||
12341 | break; | ||
12342 | case PacketType.ObjectSpinUpdate: | ||
12343 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinUpdate packet"); | ||
12344 | ObjectSpinUpdatePacket spinUpdate = (ObjectSpinUpdatePacket)Pack; | ||
12345 | |||
12346 | #region Packet Session and User Check | ||
12347 | if (m_checkPackets) | ||
12348 | { | ||
12349 | if (spinUpdate.AgentData.SessionID != SessionId || | ||
12350 | spinUpdate.AgentData.AgentID != AgentId) | ||
12351 | break; | ||
12352 | } | ||
12353 | #endregion | ||
12354 | |||
12355 | Vector3 axis; | ||
12356 | float angle; | ||
12357 | spinUpdate.ObjectData.Rotation.GetAxisAngle(out axis, out angle); | ||
12358 | //m_log.Warn("[CLIENT]: ObjectSpinUpdate packet rot axis:" + axis + " angle:" + angle); | ||
12359 | |||
12360 | SpinObject handlerSpinUpdate = OnSpinUpdate; | ||
12361 | if (handlerSpinUpdate != null) | ||
12362 | { | ||
12363 | handlerSpinUpdate(spinUpdate.ObjectData.ObjectID, spinUpdate.ObjectData.Rotation, this); | ||
12364 | } | ||
12365 | break; | ||
12366 | |||
12367 | |||
12368 | case PacketType.ObjectSpinStop: | ||
12369 | //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); | ||
12370 | ObjectSpinStopPacket spinStop = (ObjectSpinStopPacket)Pack; | ||
12371 | |||
12372 | #region Packet Session and User Check | ||
12373 | if (m_checkPackets) | ||
12374 | { | ||
12375 | if (spinStop.AgentData.SessionID != SessionId || | ||
12376 | spinStop.AgentData.AgentID != AgentId) | ||
12377 | break; | ||
12378 | } | ||
12379 | #endregion | ||
12380 | |||
12381 | SpinStop handlerSpinStop = OnSpinStop; | ||
12382 | if (handlerSpinStop != null) | ||
12383 | { | ||
12384 | handlerSpinStop(spinStop.ObjectData.ObjectID, this); | ||
12385 | } | ||
12386 | break; | ||
12387 | |||
12388 | case PacketType.ObjectDescription: | ||
12389 | ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack; | ||
12390 | |||
12391 | #region Packet Session and User Check | ||
12392 | if (m_checkPackets) | ||
12393 | { | ||
12394 | if (objDes.AgentData.SessionID != SessionId || | ||
12395 | objDes.AgentData.AgentID != AgentId) | ||
12396 | break; | ||
12397 | } | ||
12398 | #endregion | ||
12399 | |||
12400 | GenericCall7 handlerObjectDescription = null; | ||
12401 | |||
12402 | for (int i = 0; i < objDes.ObjectData.Length; i++) | ||
12403 | { | ||
12404 | handlerObjectDescription = OnObjectDescription; | ||
12405 | if (handlerObjectDescription != null) | ||
12406 | { | ||
12407 | handlerObjectDescription(this, objDes.ObjectData[i].LocalID, | ||
12408 | Util.FieldToString(objDes.ObjectData[i].Description)); | ||
12409 | } | ||
12410 | } | ||
12411 | break; | ||
12412 | |||
12413 | case PacketType.ObjectName: | ||
12414 | ObjectNamePacket objName = (ObjectNamePacket)Pack; | ||
12415 | |||
12416 | #region Packet Session and User Check | ||
12417 | if (m_checkPackets) | ||
12418 | { | ||
12419 | if (objName.AgentData.SessionID != SessionId || | ||
12420 | objName.AgentData.AgentID != AgentId) | ||
12421 | break; | ||
12422 | } | ||
12423 | #endregion | ||
12424 | |||
12425 | GenericCall7 handlerObjectName = null; | ||
12426 | for (int i = 0; i < objName.ObjectData.Length; i++) | ||
12427 | { | ||
12428 | handlerObjectName = OnObjectName; | ||
12429 | if (handlerObjectName != null) | ||
12430 | { | ||
12431 | handlerObjectName(this, objName.ObjectData[i].LocalID, | ||
12432 | Util.FieldToString(objName.ObjectData[i].Name)); | ||
12433 | } | ||
12434 | } | ||
12435 | break; | ||
12436 | |||
12437 | case PacketType.ObjectPermissions: | ||
12438 | if (OnObjectPermissions != null) | ||
12439 | { | ||
12440 | ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack; | ||
12441 | |||
12442 | #region Packet Session and User Check | ||
12443 | if (m_checkPackets) | ||
12444 | { | ||
12445 | if (newobjPerms.AgentData.SessionID != SessionId || | ||
12446 | newobjPerms.AgentData.AgentID != AgentId) | ||
12447 | break; | ||
12448 | } | ||
12449 | #endregion | ||
12450 | |||
12451 | UUID AgentID = newobjPerms.AgentData.AgentID; | ||
12452 | UUID SessionID = newobjPerms.AgentData.SessionID; | ||
12453 | |||
12454 | ObjectPermissions handlerObjectPermissions = null; | ||
12455 | |||
12456 | for (int i = 0; i < newobjPerms.ObjectData.Length; i++) | ||
12457 | { | ||
12458 | ObjectPermissionsPacket.ObjectDataBlock permChanges = newobjPerms.ObjectData[i]; | ||
12459 | |||
12460 | byte field = permChanges.Field; | ||
12461 | uint localID = permChanges.ObjectLocalID; | ||
12462 | uint mask = permChanges.Mask; | ||
12463 | byte set = permChanges.Set; | ||
12464 | |||
12465 | handlerObjectPermissions = OnObjectPermissions; | ||
12466 | |||
12467 | if (handlerObjectPermissions != null) | ||
12468 | handlerObjectPermissions(this, AgentID, SessionID, field, localID, mask, set); | ||
12469 | } | ||
12470 | } | ||
12471 | |||
12472 | // Here's our data, | ||
12473 | // PermField contains the field the info goes into | ||
12474 | // PermField determines which mask we're changing | ||
12475 | // | ||
12476 | // chmask is the mask of the change | ||
12477 | // setTF is whether we're adding it or taking it away | ||
12478 | // | ||
12479 | // objLocalID is the localID of the object. | ||
12480 | |||
12481 | // Unfortunately, we have to pass the event the packet because objData is an array | ||
12482 | // That means multiple object perms may be updated in a single packet. | ||
12483 | |||
12484 | break; | ||
12485 | |||
12486 | case PacketType.Undo: | ||
12487 | UndoPacket undoitem = (UndoPacket)Pack; | ||
12488 | |||
12489 | #region Packet Session and User Check | ||
12490 | if (m_checkPackets) | ||
12491 | { | ||
12492 | if (undoitem.AgentData.SessionID != SessionId || | ||
12493 | undoitem.AgentData.AgentID != AgentId) | ||
12494 | break; | ||
12495 | } | ||
12496 | #endregion | ||
12497 | |||
12498 | if (undoitem.ObjectData.Length > 0) | ||
12499 | { | ||
12500 | for (int i = 0; i < undoitem.ObjectData.Length; i++) | ||
12501 | { | ||
12502 | UUID objiD = undoitem.ObjectData[i].ObjectID; | ||
12503 | AgentSit handlerOnUndo = OnUndo; | ||
12504 | if (handlerOnUndo != null) | ||
12505 | { | ||
12506 | handlerOnUndo(this, objiD); | ||
12507 | } | ||
12508 | |||
12509 | } | ||
12510 | } | ||
12511 | break; | ||
12512 | |||
12513 | case PacketType.ObjectDuplicateOnRay: | ||
12514 | ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack; | ||
12515 | |||
12516 | #region Packet Session and User Check | ||
12517 | if (m_checkPackets) | ||
12518 | { | ||
12519 | if (dupeOnRay.AgentData.SessionID != SessionId || | ||
12520 | dupeOnRay.AgentData.AgentID != AgentId) | ||
12521 | break; | ||
12522 | } | ||
12523 | #endregion | ||
12524 | |||
12525 | ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null; | ||
12526 | |||
12527 | for (int i = 0; i < dupeOnRay.ObjectData.Length; i++) | ||
12528 | { | ||
12529 | handlerObjectDuplicateOnRay = OnObjectDuplicateOnRay; | ||
12530 | if (handlerObjectDuplicateOnRay != null) | ||
12531 | { | ||
12532 | handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, | ||
12533 | dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, | ||
12534 | dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, | ||
12535 | dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); | ||
12536 | } | ||
12537 | } | ||
12538 | |||
12539 | break; | ||
12540 | |||
12541 | case PacketType.RequestObjectPropertiesFamily: | ||
12542 | //This powers the little tooltip that appears when you move your mouse over an object | ||
12543 | RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack; | ||
12544 | |||
12545 | #region Packet Session and User Check | ||
12546 | if (m_checkPackets) | ||
12547 | { | ||
12548 | if (packToolTip.AgentData.SessionID != SessionId || | ||
12549 | packToolTip.AgentData.AgentID != AgentId) | ||
12550 | break; | ||
12551 | } | ||
12552 | #endregion | ||
12553 | |||
12554 | RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData; | ||
12555 | |||
12556 | RequestObjectPropertiesFamily handlerRequestObjectPropertiesFamily = OnRequestObjectPropertiesFamily; | ||
12557 | |||
12558 | if (handlerRequestObjectPropertiesFamily != null) | ||
12559 | { | ||
12560 | handlerRequestObjectPropertiesFamily(this, m_agentId, packObjBlock.RequestFlags, | ||
12561 | packObjBlock.ObjectID); | ||
12562 | } | ||
12563 | |||
12564 | break; | ||
12565 | |||
12566 | case PacketType.ObjectIncludeInSearch: | ||
12567 | //This lets us set objects to appear in search (stuff like DataSnapshot, etc) | ||
12568 | ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack; | ||
12569 | ObjectIncludeInSearch handlerObjectIncludeInSearch = null; | ||
12570 | |||
12571 | #region Packet Session and User Check | ||
12572 | if (m_checkPackets) | ||
12573 | { | ||
12574 | if (packInSearch.AgentData.SessionID != SessionId || | ||
12575 | packInSearch.AgentData.AgentID != AgentId) | ||
12576 | break; | ||
12577 | } | ||
12578 | #endregion | ||
12579 | |||
12580 | foreach (ObjectIncludeInSearchPacket.ObjectDataBlock objData in packInSearch.ObjectData) | ||
12581 | { | ||
12582 | bool inSearch = objData.IncludeInSearch; | ||
12583 | uint localID = objData.ObjectLocalID; | ||
12584 | |||
12585 | handlerObjectIncludeInSearch = OnObjectIncludeInSearch; | ||
12586 | |||
12587 | if (handlerObjectIncludeInSearch != null) | ||
12588 | { | ||
12589 | handlerObjectIncludeInSearch(this, inSearch, localID); | ||
12590 | } | ||
12591 | } | ||
12592 | break; | ||
12593 | |||
12594 | case PacketType.ScriptAnswerYes: | ||
12595 | ScriptAnswerYesPacket scriptAnswer = (ScriptAnswerYesPacket)Pack; | ||
12596 | |||
12597 | #region Packet Session and User Check | ||
12598 | if (m_checkPackets) | ||
12599 | { | ||
12600 | if (scriptAnswer.AgentData.SessionID != SessionId || | ||
12601 | scriptAnswer.AgentData.AgentID != AgentId) | ||
12602 | break; | ||
12603 | } | ||
12604 | #endregion | ||
12605 | |||
12606 | ScriptAnswer handlerScriptAnswer = OnScriptAnswer; | ||
12607 | if (handlerScriptAnswer != null) | ||
12608 | { | ||
12609 | handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions); | ||
12610 | } | ||
12611 | break; | ||
12612 | |||
12613 | case PacketType.ObjectClickAction: | ||
12614 | ObjectClickActionPacket ocpacket = (ObjectClickActionPacket)Pack; | ||
12615 | |||
12616 | #region Packet Session and User Check | ||
12617 | if (m_checkPackets) | ||
12618 | { | ||
12619 | if (ocpacket.AgentData.SessionID != SessionId || | ||
12620 | ocpacket.AgentData.AgentID != AgentId) | ||
12621 | break; | ||
12622 | } | ||
12623 | #endregion | ||
12624 | |||
12625 | GenericCall7 handlerObjectClickAction = OnObjectClickAction; | ||
12626 | if (handlerObjectClickAction != null) | ||
12627 | { | ||
12628 | foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData) | ||
12629 | { | ||
12630 | byte action = odata.ClickAction; | ||
12631 | uint localID = odata.ObjectLocalID; | ||
12632 | handlerObjectClickAction(this, localID, action.ToString()); | ||
12633 | } | ||
12634 | } | ||
12635 | break; | ||
12636 | |||
12637 | case PacketType.ObjectMaterial: | ||
12638 | ObjectMaterialPacket ompacket = (ObjectMaterialPacket)Pack; | ||
12639 | |||
12640 | #region Packet Session and User Check | ||
12641 | if (m_checkPackets) | ||
12642 | { | ||
12643 | if (ompacket.AgentData.SessionID != SessionId || | ||
12644 | ompacket.AgentData.AgentID != AgentId) | ||
12645 | break; | ||
12646 | } | ||
12647 | #endregion | ||
12648 | |||
12649 | GenericCall7 handlerObjectMaterial = OnObjectMaterial; | ||
12650 | if (handlerObjectMaterial != null) | ||
12651 | { | ||
12652 | foreach (ObjectMaterialPacket.ObjectDataBlock odata in ompacket.ObjectData) | ||
12653 | { | ||
12654 | byte material = odata.Material; | ||
12655 | uint localID = odata.ObjectLocalID; | ||
12656 | handlerObjectMaterial(this, localID, material.ToString()); | ||
12657 | } | ||
12658 | } | ||
12659 | break; | ||
12660 | |||
12661 | //#endregion | ||
12662 | |||
12663 | //#region Inventory/Asset/Other related packets | ||
12664 | |||
12665 | case PacketType.RequestImage: | ||
12666 | RequestImagePacket imageRequest = (RequestImagePacket)Pack; | ||
12667 | //m_log.Debug("image request: " + Pack.ToString()); | ||
12668 | |||
12669 | #region Packet Session and User Check | ||
12670 | if (m_checkPackets) | ||
12671 | { | ||
12672 | if (imageRequest.AgentData.SessionID != SessionId || | ||
12673 | imageRequest.AgentData.AgentID != AgentId) | ||
12674 | break; | ||
12675 | } | ||
12676 | #endregion | ||
12677 | |||
12678 | //handlerTextureRequest = null; | ||
12679 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) | ||
12680 | { | ||
12681 | if (OnRequestTexture != null) | ||
12682 | { | ||
12683 | TextureRequestArgs args = new TextureRequestArgs(); | ||
12684 | |||
12685 | RequestImagePacket.RequestImageBlock block = imageRequest.RequestImage[i]; | ||
12686 | |||
12687 | args.RequestedAssetID = block.Image; | ||
12688 | args.DiscardLevel = block.DiscardLevel; | ||
12689 | args.PacketNumber = block.Packet; | ||
12690 | args.Priority = block.DownloadPriority; | ||
12691 | args.requestSequence = imageRequest.Header.Sequence; | ||
12692 | |||
12693 | // NOTE: This is not a built in part of the LLUDP protocol, but we double the | ||
12694 | // priority of avatar textures to get avatars rezzing in faster than the | ||
12695 | // surrounding scene | ||
12696 | if ((ImageType)block.Type == ImageType.Baked) | ||
12697 | args.Priority *= 2.0f; | ||
12698 | |||
12699 | //handlerTextureRequest = OnRequestTexture; | ||
12700 | |||
12701 | //if (handlerTextureRequest != null) | ||
12702 | //OnRequestTexture(this, args); | ||
12703 | |||
12704 | // in the end, we null this, so we have to check if it's null | ||
12705 | if (m_imageManager != null) | ||
12706 | { | ||
12707 | m_imageManager.EnqueueReq(args); | ||
12708 | } | ||
12709 | } | ||
12710 | } | ||
12711 | break; | ||
12712 | |||
12713 | case PacketType.TransferRequest: | ||
12714 | //m_log.Debug("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); | ||
12715 | |||
12716 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | ||
12717 | //m_log.Debug("Transfer Request: " + transfer.ToString()); | ||
12718 | // Validate inventory transfers | ||
12719 | // Has to be done here, because AssetCache can't do it | ||
12720 | // | ||
12721 | UUID taskID = UUID.Zero; | ||
12722 | if (transfer.TransferInfo.SourceType == 3) | ||
12723 | { | ||
12724 | taskID = new UUID(transfer.TransferInfo.Params, 48); | ||
12725 | UUID itemID = new UUID(transfer.TransferInfo.Params, 64); | ||
12726 | UUID requestID = new UUID(transfer.TransferInfo.Params, 80); | ||
12727 | if (!(((Scene)m_scene).Permissions.BypassPermissions())) | ||
12728 | { | ||
12729 | if (taskID != UUID.Zero) // Prim | ||
12730 | { | ||
12731 | SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); | ||
12732 | if (part == null) | ||
12733 | break; | ||
12734 | |||
12735 | if (part.OwnerID != AgentId) | ||
12736 | break; | ||
12737 | |||
12738 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | ||
12739 | break; | ||
12740 | |||
12741 | TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID); | ||
12742 | if (ti == null) | ||
12743 | break; | ||
12744 | |||
12745 | if (ti.OwnerID != AgentId) | ||
12746 | break; | ||
12747 | |||
12748 | if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) | ||
12749 | break; | ||
12750 | |||
12751 | if (ti.AssetID != requestID) | ||
12752 | break; | ||
12753 | } | ||
12754 | else // Agent | ||
12755 | { | ||
12756 | IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>(); | ||
12757 | InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId); | ||
12758 | assetRequestItem = invService.GetItem(assetRequestItem); | ||
12759 | if (assetRequestItem == null) | ||
12760 | { | ||
12761 | assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); | ||
12762 | if (assetRequestItem == null) | ||
12763 | return; | ||
12764 | } | ||
12765 | |||
12766 | // At this point, we need to apply perms | ||
12767 | // only to notecards and scripts. All | ||
12768 | // other asset types are always available | ||
12769 | // | ||
12770 | if (assetRequestItem.AssetType == 10) | ||
12771 | { | ||
12772 | if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId)) | ||
12773 | { | ||
12774 | SendAgentAlertMessage("Insufficient permissions to view script", false); | ||
12775 | break; | ||
12776 | } | ||
12777 | } | ||
12778 | else if (assetRequestItem.AssetType == 7) | ||
12779 | { | ||
12780 | if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId)) | ||
12781 | { | ||
12782 | SendAgentAlertMessage("Insufficient permissions to view notecard", false); | ||
12783 | break; | ||
12784 | } | ||
12785 | } | ||
12786 | |||
12787 | if (assetRequestItem.AssetID != requestID) | ||
12788 | break; | ||
12789 | } | ||
12790 | } | ||
12791 | } | ||
12792 | |||
12793 | //m_assetCache.AddAssetRequest(this, transfer); | ||
12794 | |||
12795 | MakeAssetRequest(transfer, taskID); | ||
12796 | |||
12797 | // RequestAsset = OnRequestAsset; | ||
12798 | // if (RequestAsset != null) | ||
12799 | // { | ||
12800 | // RequestAsset(this, transfer); | ||
12801 | // } | ||
12802 | |||
12803 | break; | ||
12804 | |||
12805 | case PacketType.AssetUploadRequest: | ||
12806 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; | ||
12807 | |||
12808 | |||
12809 | // m_log.Debug("upload request " + request.ToString()); | ||
12810 | // m_log.Debug("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString()); | ||
12811 | UUID temp = UUID.Combine(request.AssetBlock.TransactionID, SecureSessionId); | ||
12812 | |||
12813 | UDPAssetUploadRequest handlerAssetUploadRequest = OnAssetUploadRequest; | ||
12814 | |||
12815 | if (handlerAssetUploadRequest != null) | ||
12816 | { | ||
12817 | handlerAssetUploadRequest(this, temp, | ||
12818 | request.AssetBlock.TransactionID, request.AssetBlock.Type, | ||
12819 | request.AssetBlock.AssetData, request.AssetBlock.StoreLocal, | ||
12820 | request.AssetBlock.Tempfile); | ||
12821 | } | ||
12822 | break; | ||
12823 | |||
12824 | case PacketType.RequestXfer: | ||
12825 | RequestXferPacket xferReq = (RequestXferPacket)Pack; | ||
12826 | |||
12827 | RequestXfer handlerRequestXfer = OnRequestXfer; | ||
12828 | |||
12829 | if (handlerRequestXfer != null) | ||
12830 | { | ||
12831 | handlerRequestXfer(this, xferReq.XferID.ID, Util.FieldToString(xferReq.XferID.Filename)); | ||
12832 | } | ||
12833 | break; | ||
12834 | |||
12835 | case PacketType.SendXferPacket: | ||
12836 | SendXferPacketPacket xferRec = (SendXferPacketPacket)Pack; | ||
12837 | |||
12838 | XferReceive handlerXferReceive = OnXferReceive; | ||
12839 | if (handlerXferReceive != null) | ||
12840 | { | ||
12841 | handlerXferReceive(this, xferRec.XferID.ID, xferRec.XferID.Packet, xferRec.DataPacket.Data); | ||
12842 | } | ||
12843 | break; | ||
12844 | |||
12845 | case PacketType.ConfirmXferPacket: | ||
12846 | ConfirmXferPacketPacket confirmXfer = (ConfirmXferPacketPacket)Pack; | ||
12847 | |||
12848 | ConfirmXfer handlerConfirmXfer = OnConfirmXfer; | ||
12849 | if (handlerConfirmXfer != null) | ||
12850 | { | ||
12851 | handlerConfirmXfer(this, confirmXfer.XferID.ID, confirmXfer.XferID.Packet); | ||
12852 | } | ||
12853 | break; | ||
12854 | |||
12855 | case PacketType.AbortXfer: | ||
12856 | AbortXferPacket abortXfer = (AbortXferPacket)Pack; | ||
12857 | AbortXfer handlerAbortXfer = OnAbortXfer; | ||
12858 | if (handlerAbortXfer != null) | ||
12859 | { | ||
12860 | handlerAbortXfer(this, abortXfer.XferID.ID); | ||
12861 | } | ||
12862 | |||
12863 | break; | ||
12864 | |||
12865 | case PacketType.CreateInventoryFolder: | ||
12866 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | ||
12867 | |||
12868 | #region Packet Session and User Check | ||
12869 | if (m_checkPackets) | ||
12870 | { | ||
12871 | if (invFolder.AgentData.SessionID != SessionId || | ||
12872 | invFolder.AgentData.AgentID != AgentId) | ||
12873 | break; | ||
12874 | } | ||
12875 | #endregion | ||
12876 | |||
12877 | CreateInventoryFolder handlerCreateInventoryFolder = OnCreateNewInventoryFolder; | ||
12878 | if (handlerCreateInventoryFolder != null) | ||
12879 | { | ||
12880 | handlerCreateInventoryFolder(this, invFolder.FolderData.FolderID, | ||
12881 | (ushort)invFolder.FolderData.Type, | ||
12882 | Util.FieldToString(invFolder.FolderData.Name), | ||
12883 | invFolder.FolderData.ParentID); | ||
12884 | } | ||
12885 | break; | ||
12886 | |||
12887 | case PacketType.UpdateInventoryFolder: | ||
12888 | if (OnUpdateInventoryFolder != null) | ||
12889 | { | ||
12890 | UpdateInventoryFolderPacket invFolderx = (UpdateInventoryFolderPacket)Pack; | ||
12891 | |||
12892 | #region Packet Session and User Check | ||
12893 | if (m_checkPackets) | ||
12894 | { | ||
12895 | if (invFolderx.AgentData.SessionID != SessionId || | ||
12896 | invFolderx.AgentData.AgentID != AgentId) | ||
12897 | break; | ||
12898 | } | ||
12899 | #endregion | ||
12900 | |||
12901 | UpdateInventoryFolder handlerUpdateInventoryFolder = null; | ||
12902 | |||
12903 | for (int i = 0; i < invFolderx.FolderData.Length; i++) | ||
12904 | { | ||
12905 | handlerUpdateInventoryFolder = OnUpdateInventoryFolder; | ||
12906 | if (handlerUpdateInventoryFolder != null) | ||
12907 | { | ||
12908 | OnUpdateInventoryFolder(this, invFolderx.FolderData[i].FolderID, | ||
12909 | (ushort)invFolderx.FolderData[i].Type, | ||
12910 | Util.FieldToString(invFolderx.FolderData[i].Name), | ||
12911 | invFolderx.FolderData[i].ParentID); | ||
12912 | } | ||
12913 | } | ||
12914 | } | ||
12915 | break; | ||
12916 | |||
12917 | case PacketType.MoveInventoryFolder: | ||
12918 | if (OnMoveInventoryFolder != null) | ||
12919 | { | ||
12920 | MoveInventoryFolderPacket invFoldery = (MoveInventoryFolderPacket)Pack; | ||
12921 | |||
12922 | #region Packet Session and User Check | ||
12923 | if (m_checkPackets) | ||
12924 | { | ||
12925 | if (invFoldery.AgentData.SessionID != SessionId || | ||
12926 | invFoldery.AgentData.AgentID != AgentId) | ||
12927 | break; | ||
12928 | } | ||
12929 | #endregion | ||
12930 | |||
12931 | MoveInventoryFolder handlerMoveInventoryFolder = null; | ||
12932 | |||
12933 | for (int i = 0; i < invFoldery.InventoryData.Length; i++) | ||
12934 | { | ||
12935 | handlerMoveInventoryFolder = OnMoveInventoryFolder; | ||
12936 | if (handlerMoveInventoryFolder != null) | ||
12937 | { | ||
12938 | OnMoveInventoryFolder(this, invFoldery.InventoryData[i].FolderID, | ||
12939 | invFoldery.InventoryData[i].ParentID); | ||
12940 | } | ||
12941 | } | ||
12942 | } | ||
12943 | break; | ||
12944 | |||
12945 | case PacketType.CreateInventoryItem: | ||
12946 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; | ||
12947 | |||
12948 | #region Packet Session and User Check | ||
12949 | if (m_checkPackets) | ||
12950 | { | ||
12951 | if (createItem.AgentData.SessionID != SessionId || | ||
12952 | createItem.AgentData.AgentID != AgentId) | ||
12953 | break; | ||
12954 | } | ||
12955 | #endregion | ||
12956 | |||
12957 | CreateNewInventoryItem handlerCreateNewInventoryItem = OnCreateNewInventoryItem; | ||
12958 | if (handlerCreateNewInventoryItem != null) | ||
12959 | { | ||
12960 | handlerCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, | ||
12961 | createItem.InventoryBlock.FolderID, | ||
12962 | createItem.InventoryBlock.CallbackID, | ||
12963 | Util.FieldToString(createItem.InventoryBlock.Description), | ||
12964 | Util.FieldToString(createItem.InventoryBlock.Name), | ||
12965 | createItem.InventoryBlock.InvType, | ||
12966 | createItem.InventoryBlock.Type, | ||
12967 | createItem.InventoryBlock.WearableType, | ||
12968 | createItem.InventoryBlock.NextOwnerMask, | ||
12969 | Util.UnixTimeSinceEpoch()); | ||
12970 | } | ||
12971 | break; | ||
12972 | |||
12973 | case PacketType.FetchInventory: | ||
12974 | if (OnFetchInventory != null) | ||
12975 | { | ||
12976 | FetchInventoryPacket FetchInventoryx = (FetchInventoryPacket)Pack; | ||
12977 | |||
12978 | #region Packet Session and User Check | ||
12979 | if (m_checkPackets) | ||
12980 | { | ||
12981 | if (FetchInventoryx.AgentData.SessionID != SessionId || | ||
12982 | FetchInventoryx.AgentData.AgentID != AgentId) | ||
12983 | break; | ||
12984 | } | ||
12985 | #endregion | ||
12986 | |||
12987 | FetchInventory handlerFetchInventory = null; | ||
12988 | |||
12989 | for (int i = 0; i < FetchInventoryx.InventoryData.Length; i++) | ||
12990 | { | ||
12991 | handlerFetchInventory = OnFetchInventory; | ||
12992 | |||
12993 | if (handlerFetchInventory != null) | ||
12994 | { | ||
12995 | OnFetchInventory(this, FetchInventoryx.InventoryData[i].ItemID, | ||
12996 | FetchInventoryx.InventoryData[i].OwnerID); | ||
12997 | } | ||
12998 | } | ||
12999 | } | ||
13000 | break; | ||
13001 | |||
13002 | case PacketType.FetchInventoryDescendents: | ||
13003 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | ||
13004 | |||
13005 | #region Packet Session and User Check | ||
13006 | if (m_checkPackets) | ||
13007 | { | ||
13008 | if (Fetch.AgentData.SessionID != SessionId || | ||
13009 | Fetch.AgentData.AgentID != AgentId) | ||
13010 | break; | ||
13011 | } | ||
13012 | #endregion | ||
13013 | |||
13014 | FetchInventoryDescendents handlerFetchInventoryDescendents = OnFetchInventoryDescendents; | ||
13015 | if (handlerFetchInventoryDescendents != null) | ||
13016 | { | ||
13017 | handlerFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, | ||
13018 | Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, | ||
13019 | Fetch.InventoryData.SortOrder); | ||
13020 | } | ||
13021 | break; | ||
13022 | |||
13023 | case PacketType.PurgeInventoryDescendents: | ||
13024 | PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket)Pack; | ||
13025 | |||
13026 | #region Packet Session and User Check | ||
13027 | if (m_checkPackets) | ||
13028 | { | ||
13029 | if (Purge.AgentData.SessionID != SessionId || | ||
13030 | Purge.AgentData.AgentID != AgentId) | ||
13031 | break; | ||
13032 | } | ||
13033 | #endregion | ||
13034 | |||
13035 | PurgeInventoryDescendents handlerPurgeInventoryDescendents = OnPurgeInventoryDescendents; | ||
13036 | if (handlerPurgeInventoryDescendents != null) | ||
13037 | { | ||
13038 | handlerPurgeInventoryDescendents(this, Purge.InventoryData.FolderID); | ||
13039 | } | ||
13040 | break; | ||
13041 | |||
13042 | case PacketType.UpdateInventoryItem: | ||
13043 | UpdateInventoryItemPacket inventoryItemUpdate = (UpdateInventoryItemPacket)Pack; | ||
13044 | |||
13045 | #region Packet Session and User Check | ||
13046 | if (m_checkPackets) | ||
13047 | { | ||
13048 | if (inventoryItemUpdate.AgentData.SessionID != SessionId || | ||
13049 | inventoryItemUpdate.AgentData.AgentID != AgentId) | ||
13050 | break; | ||
13051 | } | ||
13052 | #endregion | ||
13053 | |||
13054 | if (OnUpdateInventoryItem != null) | ||
13055 | { | ||
13056 | UpdateInventoryItem handlerUpdateInventoryItem = null; | ||
13057 | for (int i = 0; i < inventoryItemUpdate.InventoryData.Length; i++) | ||
13058 | { | ||
13059 | handlerUpdateInventoryItem = OnUpdateInventoryItem; | ||
13060 | |||
13061 | if (handlerUpdateInventoryItem != null) | ||
13062 | { | ||
13063 | InventoryItemBase itemUpd = new InventoryItemBase(); | ||
13064 | itemUpd.ID = inventoryItemUpdate.InventoryData[i].ItemID; | ||
13065 | itemUpd.Name = Util.FieldToString(inventoryItemUpdate.InventoryData[i].Name); | ||
13066 | itemUpd.Description = Util.FieldToString(inventoryItemUpdate.InventoryData[i].Description); | ||
13067 | itemUpd.GroupID = inventoryItemUpdate.InventoryData[i].GroupID; | ||
13068 | itemUpd.GroupOwned = inventoryItemUpdate.InventoryData[i].GroupOwned; | ||
13069 | itemUpd.GroupPermissions = inventoryItemUpdate.InventoryData[i].GroupMask; | ||
13070 | itemUpd.NextPermissions = inventoryItemUpdate.InventoryData[i].NextOwnerMask; | ||
13071 | itemUpd.EveryOnePermissions = inventoryItemUpdate.InventoryData[i].EveryoneMask; | ||
13072 | itemUpd.CreationDate = inventoryItemUpdate.InventoryData[i].CreationDate; | ||
13073 | itemUpd.Folder = inventoryItemUpdate.InventoryData[i].FolderID; | ||
13074 | itemUpd.InvType = inventoryItemUpdate.InventoryData[i].InvType; | ||
13075 | itemUpd.SalePrice = inventoryItemUpdate.InventoryData[i].SalePrice; | ||
13076 | itemUpd.SaleType = inventoryItemUpdate.InventoryData[i].SaleType; | ||
13077 | itemUpd.Flags = inventoryItemUpdate.InventoryData[i].Flags; | ||
13078 | |||
13079 | OnUpdateInventoryItem(this, inventoryItemUpdate.InventoryData[i].TransactionID, | ||
13080 | inventoryItemUpdate.InventoryData[i].ItemID, | ||
13081 | itemUpd); | ||
13082 | } | ||
13083 | } | ||
13084 | } | ||
13085 | break; | ||
13086 | |||
13087 | case PacketType.CopyInventoryItem: | ||
13088 | CopyInventoryItemPacket copyitem = (CopyInventoryItemPacket)Pack; | ||
13089 | |||
13090 | #region Packet Session and User Check | ||
13091 | if (m_checkPackets) | ||
13092 | { | ||
13093 | if (copyitem.AgentData.SessionID != SessionId || | ||
13094 | copyitem.AgentData.AgentID != AgentId) | ||
13095 | break; | ||
13096 | } | ||
13097 | #endregion | ||
13098 | |||
13099 | CopyInventoryItem handlerCopyInventoryItem = null; | ||
13100 | if (OnCopyInventoryItem != null) | ||
13101 | { | ||
13102 | foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData) | ||
13103 | { | ||
13104 | handlerCopyInventoryItem = OnCopyInventoryItem; | ||
13105 | if (handlerCopyInventoryItem != null) | ||
13106 | { | ||
13107 | handlerCopyInventoryItem(this, datablock.CallbackID, datablock.OldAgentID, | ||
13108 | datablock.OldItemID, datablock.NewFolderID, | ||
13109 | Util.FieldToString(datablock.NewName)); | ||
13110 | } | ||
13111 | } | ||
13112 | } | ||
13113 | break; | ||
13114 | |||
13115 | case PacketType.MoveInventoryItem: | ||
13116 | MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack; | ||
13117 | |||
13118 | #region Packet Session and User Check | ||
13119 | if (m_checkPackets) | ||
13120 | { | ||
13121 | if (moveitem.AgentData.SessionID != SessionId || | ||
13122 | moveitem.AgentData.AgentID != AgentId) | ||
13123 | break; | ||
13124 | } | ||
13125 | #endregion | ||
13126 | |||
13127 | if (OnMoveInventoryItem != null) | ||
13128 | { | ||
13129 | MoveInventoryItem handlerMoveInventoryItem = null; | ||
13130 | InventoryItemBase itm = null; | ||
13131 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
13132 | foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) | ||
13133 | { | ||
13134 | itm = new InventoryItemBase(datablock.ItemID, AgentId); | ||
13135 | itm.Folder = datablock.FolderID; | ||
13136 | itm.Name = Util.FieldToString(datablock.NewName); | ||
13137 | // weird, comes out as empty string | ||
13138 | //m_log.DebugFormat("[XXX] new name: {0}", itm.Name); | ||
13139 | items.Add(itm); | ||
13140 | } | ||
13141 | handlerMoveInventoryItem = OnMoveInventoryItem; | ||
13142 | if (handlerMoveInventoryItem != null) | ||
13143 | { | ||
13144 | handlerMoveInventoryItem(this, items); | ||
13145 | } | ||
13146 | } | ||
13147 | break; | ||
13148 | |||
13149 | case PacketType.RemoveInventoryItem: | ||
13150 | RemoveInventoryItemPacket removeItem = (RemoveInventoryItemPacket)Pack; | ||
13151 | |||
13152 | #region Packet Session and User Check | ||
13153 | if (m_checkPackets) | ||
13154 | { | ||
13155 | if (removeItem.AgentData.SessionID != SessionId || | ||
13156 | removeItem.AgentData.AgentID != AgentId) | ||
13157 | break; | ||
13158 | } | ||
13159 | #endregion | ||
13160 | |||
13161 | if (OnRemoveInventoryItem != null) | ||
13162 | { | ||
13163 | RemoveInventoryItem handlerRemoveInventoryItem = null; | ||
13164 | List<UUID> uuids = new List<UUID>(); | ||
13165 | foreach (RemoveInventoryItemPacket.InventoryDataBlock datablock in removeItem.InventoryData) | ||
13166 | { | ||
13167 | uuids.Add(datablock.ItemID); | ||
13168 | } | ||
13169 | handlerRemoveInventoryItem = OnRemoveInventoryItem; | ||
13170 | if (handlerRemoveInventoryItem != null) | ||
13171 | { | ||
13172 | handlerRemoveInventoryItem(this, uuids); | ||
13173 | } | ||
13174 | |||
13175 | } | ||
13176 | break; | ||
13177 | |||
13178 | case PacketType.RemoveInventoryFolder: | ||
13179 | RemoveInventoryFolderPacket removeFolder = (RemoveInventoryFolderPacket)Pack; | ||
13180 | |||
13181 | #region Packet Session and User Check | ||
13182 | if (m_checkPackets) | ||
13183 | { | ||
13184 | if (removeFolder.AgentData.SessionID != SessionId || | ||
13185 | removeFolder.AgentData.AgentID != AgentId) | ||
13186 | break; | ||
13187 | } | ||
13188 | #endregion | ||
13189 | |||
13190 | if (OnRemoveInventoryFolder != null) | ||
13191 | { | ||
13192 | RemoveInventoryFolder handlerRemoveInventoryFolder = null; | ||
13193 | List<UUID> uuids = new List<UUID>(); | ||
13194 | foreach (RemoveInventoryFolderPacket.FolderDataBlock datablock in removeFolder.FolderData) | ||
13195 | { | ||
13196 | uuids.Add(datablock.FolderID); | ||
13197 | } | ||
13198 | handlerRemoveInventoryFolder = OnRemoveInventoryFolder; | ||
13199 | if (handlerRemoveInventoryFolder != null) | ||
13200 | { | ||
13201 | handlerRemoveInventoryFolder(this, uuids); | ||
13202 | } | ||
13203 | } | ||
13204 | break; | ||
13205 | |||
13206 | case PacketType.RemoveInventoryObjects: | ||
13207 | RemoveInventoryObjectsPacket removeObject = (RemoveInventoryObjectsPacket)Pack; | ||
13208 | #region Packet Session and User Check | ||
13209 | if (m_checkPackets) | ||
13210 | { | ||
13211 | if (removeObject.AgentData.SessionID != SessionId || | ||
13212 | removeObject.AgentData.AgentID != AgentId) | ||
13213 | break; | ||
13214 | } | ||
13215 | #endregion | ||
13216 | if (OnRemoveInventoryFolder != null) | ||
13217 | { | ||
13218 | RemoveInventoryFolder handlerRemoveInventoryFolder = null; | ||
13219 | List<UUID> uuids = new List<UUID>(); | ||
13220 | foreach (RemoveInventoryObjectsPacket.FolderDataBlock datablock in removeObject.FolderData) | ||
13221 | { | ||
13222 | uuids.Add(datablock.FolderID); | ||
13223 | } | ||
13224 | handlerRemoveInventoryFolder = OnRemoveInventoryFolder; | ||
13225 | if (handlerRemoveInventoryFolder != null) | ||
13226 | { | ||
13227 | handlerRemoveInventoryFolder(this, uuids); | ||
13228 | } | ||
13229 | } | ||
13230 | |||
13231 | if (OnRemoveInventoryItem != null) | ||
13232 | { | ||
13233 | RemoveInventoryItem handlerRemoveInventoryItem = null; | ||
13234 | List<UUID> uuids = new List<UUID>(); | ||
13235 | foreach (RemoveInventoryObjectsPacket.ItemDataBlock datablock in removeObject.ItemData) | ||
13236 | { | ||
13237 | uuids.Add(datablock.ItemID); | ||
13238 | } | ||
13239 | handlerRemoveInventoryItem = OnRemoveInventoryItem; | ||
13240 | if (handlerRemoveInventoryItem != null) | ||
13241 | { | ||
13242 | handlerRemoveInventoryItem(this, uuids); | ||
13243 | } | ||
13244 | } | ||
13245 | break; | ||
13246 | |||
13247 | case PacketType.RequestTaskInventory: | ||
13248 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; | ||
13249 | |||
13250 | #region Packet Session and User Check | ||
13251 | if (m_checkPackets) | ||
13252 | { | ||
13253 | if (requesttask.AgentData.SessionID != SessionId || | ||
13254 | requesttask.AgentData.AgentID != AgentId) | ||
13255 | break; | ||
13256 | } | ||
13257 | #endregion | ||
13258 | |||
13259 | RequestTaskInventory handlerRequestTaskInventory = OnRequestTaskInventory; | ||
13260 | if (handlerRequestTaskInventory != null) | ||
13261 | { | ||
13262 | handlerRequestTaskInventory(this, requesttask.InventoryData.LocalID); | ||
13263 | } | ||
13264 | break; | ||
13265 | |||
13266 | case PacketType.UpdateTaskInventory: | ||
13267 | UpdateTaskInventoryPacket updatetask = (UpdateTaskInventoryPacket)Pack; | ||
13268 | |||
13269 | #region Packet Session and User Check | ||
13270 | if (m_checkPackets) | ||
13271 | { | ||
13272 | if (updatetask.AgentData.SessionID != SessionId || | ||
13273 | updatetask.AgentData.AgentID != AgentId) | ||
13274 | break; | ||
13275 | } | ||
13276 | #endregion | ||
13277 | |||
13278 | if (OnUpdateTaskInventory != null) | ||
13279 | { | ||
13280 | if (updatetask.UpdateData.Key == 0) | ||
13281 | { | ||
13282 | UpdateTaskInventory handlerUpdateTaskInventory = OnUpdateTaskInventory; | ||
13283 | if (handlerUpdateTaskInventory != null) | ||
13284 | { | ||
13285 | TaskInventoryItem newTaskItem = new TaskInventoryItem(); | ||
13286 | newTaskItem.ItemID = updatetask.InventoryData.ItemID; | ||
13287 | newTaskItem.ParentID = updatetask.InventoryData.FolderID; | ||
13288 | newTaskItem.CreatorID = updatetask.InventoryData.CreatorID; | ||
13289 | newTaskItem.OwnerID = updatetask.InventoryData.OwnerID; | ||
13290 | newTaskItem.GroupID = updatetask.InventoryData.GroupID; | ||
13291 | newTaskItem.BasePermissions = updatetask.InventoryData.BaseMask; | ||
13292 | newTaskItem.CurrentPermissions = updatetask.InventoryData.OwnerMask; | ||
13293 | newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask; | ||
13294 | newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask; | ||
13295 | newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask; | ||
13296 | //newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned; | ||
13297 | newTaskItem.Type = updatetask.InventoryData.Type; | ||
13298 | newTaskItem.InvType = updatetask.InventoryData.InvType; | ||
13299 | newTaskItem.Flags = updatetask.InventoryData.Flags; | ||
13300 | //newTaskItem.SaleType=updatetask.InventoryData.SaleType; | ||
13301 | //newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;; | ||
13302 | newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name); | ||
13303 | newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description); | ||
13304 | newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate; | ||
13305 | handlerUpdateTaskInventory(this, updatetask.InventoryData.TransactionID, | ||
13306 | newTaskItem, updatetask.UpdateData.LocalID); | ||
13307 | } | ||
13308 | } | ||
13309 | } | ||
13310 | |||
13311 | break; | ||
13312 | |||
13313 | case PacketType.RemoveTaskInventory: | ||
13314 | |||
13315 | RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack; | ||
13316 | |||
13317 | #region Packet Session and User Check | ||
13318 | if (m_checkPackets) | ||
13319 | { | ||
13320 | if (removeTask.AgentData.SessionID != SessionId || | ||
13321 | removeTask.AgentData.AgentID != AgentId) | ||
13322 | break; | ||
13323 | } | ||
13324 | #endregion | ||
13325 | |||
13326 | RemoveTaskInventory handlerRemoveTaskItem = OnRemoveTaskItem; | ||
13327 | |||
13328 | if (handlerRemoveTaskItem != null) | ||
13329 | { | ||
13330 | handlerRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID); | ||
13331 | } | ||
13332 | |||
13333 | break; | ||
13334 | |||
13335 | case PacketType.MoveTaskInventory: | ||
13336 | |||
13337 | MoveTaskInventoryPacket moveTaskInventoryPacket = (MoveTaskInventoryPacket)Pack; | ||
13338 | |||
13339 | #region Packet Session and User Check | ||
13340 | if (m_checkPackets) | ||
13341 | { | ||
13342 | if (moveTaskInventoryPacket.AgentData.SessionID != SessionId || | ||
13343 | moveTaskInventoryPacket.AgentData.AgentID != AgentId) | ||
13344 | break; | ||
13345 | } | ||
13346 | #endregion | ||
13347 | |||
13348 | MoveTaskInventory handlerMoveTaskItem = OnMoveTaskItem; | ||
13349 | |||
13350 | if (handlerMoveTaskItem != null) | ||
13351 | { | ||
13352 | handlerMoveTaskItem( | ||
13353 | this, moveTaskInventoryPacket.AgentData.FolderID, | ||
13354 | moveTaskInventoryPacket.InventoryData.LocalID, | ||
13355 | moveTaskInventoryPacket.InventoryData.ItemID); | ||
13356 | } | ||
13357 | |||
13358 | break; | ||
13359 | |||
13360 | case PacketType.RezScript: | ||
13361 | //m_log.Debug(Pack.ToString()); | ||
13362 | RezScriptPacket rezScriptx = (RezScriptPacket)Pack; | ||
13363 | |||
13364 | #region Packet Session and User Check | ||
13365 | if (m_checkPackets) | ||
13366 | { | ||
13367 | if (rezScriptx.AgentData.SessionID != SessionId || | ||
13368 | rezScriptx.AgentData.AgentID != AgentId) | ||
13369 | break; | ||
13370 | } | ||
13371 | #endregion | ||
13372 | |||
13373 | RezScript handlerRezScript = OnRezScript; | ||
13374 | InventoryItemBase item = new InventoryItemBase(); | ||
13375 | item.ID = rezScriptx.InventoryBlock.ItemID; | ||
13376 | item.Folder = rezScriptx.InventoryBlock.FolderID; | ||
13377 | item.CreatorId = rezScriptx.InventoryBlock.CreatorID.ToString(); | ||
13378 | item.Owner = rezScriptx.InventoryBlock.OwnerID; | ||
13379 | item.BasePermissions = rezScriptx.InventoryBlock.BaseMask; | ||
13380 | item.CurrentPermissions = rezScriptx.InventoryBlock.OwnerMask; | ||
13381 | item.EveryOnePermissions = rezScriptx.InventoryBlock.EveryoneMask; | ||
13382 | item.NextPermissions = rezScriptx.InventoryBlock.NextOwnerMask; | ||
13383 | item.GroupPermissions = rezScriptx.InventoryBlock.GroupMask; | ||
13384 | item.GroupOwned = rezScriptx.InventoryBlock.GroupOwned; | ||
13385 | item.GroupID = rezScriptx.InventoryBlock.GroupID; | ||
13386 | item.AssetType = rezScriptx.InventoryBlock.Type; | ||
13387 | item.InvType = rezScriptx.InventoryBlock.InvType; | ||
13388 | item.Flags = rezScriptx.InventoryBlock.Flags; | ||
13389 | item.SaleType = rezScriptx.InventoryBlock.SaleType; | ||
13390 | item.SalePrice = rezScriptx.InventoryBlock.SalePrice; | ||
13391 | item.Name = Util.FieldToString(rezScriptx.InventoryBlock.Name); | ||
13392 | item.Description = Util.FieldToString(rezScriptx.InventoryBlock.Description); | ||
13393 | item.CreationDate = rezScriptx.InventoryBlock.CreationDate; | ||
13394 | |||
13395 | if (handlerRezScript != null) | ||
13396 | { | ||
13397 | handlerRezScript(this, item, rezScriptx.InventoryBlock.TransactionID, rezScriptx.UpdateBlock.ObjectLocalID); | ||
13398 | } | ||
13399 | break; | ||
13400 | |||
13401 | case PacketType.MapLayerRequest: | ||
13402 | RequestMapLayer(); | ||
13403 | break; | ||
13404 | case PacketType.MapBlockRequest: | ||
13405 | MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; | ||
13406 | |||
13407 | #region Packet Session and User Check | ||
13408 | if (m_checkPackets) | ||
13409 | { | ||
13410 | if (MapRequest.AgentData.SessionID != SessionId || | ||
13411 | MapRequest.AgentData.AgentID != AgentId) | ||
13412 | break; | ||
13413 | } | ||
13414 | #endregion | ||
13415 | |||
13416 | RequestMapBlocks handlerRequestMapBlocks = OnRequestMapBlocks; | ||
13417 | if (handlerRequestMapBlocks != null) | ||
13418 | { | ||
13419 | handlerRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, | ||
13420 | MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY, MapRequest.AgentData.Flags); | ||
13421 | } | ||
13422 | break; | ||
13423 | case PacketType.MapNameRequest: | ||
13424 | MapNameRequestPacket map = (MapNameRequestPacket)Pack; | ||
13425 | |||
13426 | #region Packet Session and User Check | ||
13427 | if (m_checkPackets) | ||
13428 | { | ||
13429 | if (map.AgentData.SessionID != SessionId || | ||
13430 | map.AgentData.AgentID != AgentId) | ||
13431 | break; | ||
13432 | } | ||
13433 | #endregion | ||
13434 | |||
13435 | string mapName = Util.UTF8.GetString(map.NameData.Name, 0, | ||
13436 | map.NameData.Name.Length - 1); | ||
13437 | RequestMapName handlerMapNameRequest = OnMapNameRequest; | ||
13438 | if (handlerMapNameRequest != null) | ||
13439 | { | ||
13440 | handlerMapNameRequest(this, mapName); | ||
13441 | } | ||
13442 | break; | ||
13443 | |||
13444 | case PacketType.TeleportLandmarkRequest: | ||
13445 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; | ||
13446 | |||
13447 | #region Packet Session and User Check | ||
13448 | if (m_checkPackets) | ||
13449 | { | ||
13450 | if (tpReq.Info.SessionID != SessionId || | ||
13451 | tpReq.Info.AgentID != AgentId) | ||
13452 | break; | ||
13453 | } | ||
13454 | #endregion | ||
13455 | |||
13456 | UUID lmid = tpReq.Info.LandmarkID; | ||
13457 | AssetLandmark lm; | ||
13458 | if (lmid != UUID.Zero) | ||
13459 | { | ||
13460 | //AssetBase lma = m_assetCache.GetAsset(lmid, false); | ||
13461 | AssetBase lma = m_assetService.Get(lmid.ToString()); | ||
13462 | |||
13463 | if (lma == null) | ||
13464 | { | ||
13465 | // Failed to find landmark | ||
13466 | TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); | ||
13467 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | ||
13468 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | ||
13469 | OutPacket(tpCancel, ThrottleOutPacketType.Task); | ||
13470 | } | ||
13471 | |||
13472 | try | ||
13473 | { | ||
13474 | lm = new AssetLandmark(lma); | ||
13475 | } | ||
13476 | catch (NullReferenceException) | ||
13477 | { | ||
13478 | // asset not found generates null ref inside the assetlandmark constructor. | ||
13479 | TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); | ||
13480 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | ||
13481 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | ||
13482 | OutPacket(tpCancel, ThrottleOutPacketType.Task); | ||
13483 | break; | ||
13484 | } | ||
13485 | } | ||
13486 | else | ||
13487 | { | ||
13488 | // Teleport home request | ||
13489 | UUIDNameRequest handlerTeleportHomeRequest = OnTeleportHomeRequest; | ||
13490 | if (handlerTeleportHomeRequest != null) | ||
13491 | { | ||
13492 | handlerTeleportHomeRequest(AgentId, this); | ||
13493 | } | ||
13494 | break; | ||
13495 | } | ||
13496 | |||
13497 | TeleportLandmarkRequest handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest; | ||
13498 | if (handlerTeleportLandmarkRequest != null) | ||
13499 | { | ||
13500 | handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position); | ||
13501 | } | ||
13502 | else | ||
13503 | { | ||
13504 | //no event handler so cancel request | ||
13505 | |||
13506 | |||
13507 | TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); | ||
13508 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | ||
13509 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | ||
13510 | OutPacket(tpCancel, ThrottleOutPacketType.Task); | ||
13511 | |||
13512 | } | ||
13513 | break; | ||
13514 | |||
13515 | case PacketType.TeleportLocationRequest: | ||
13516 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; | ||
13517 | // m_log.Debug(tpLocReq.ToString()); | ||
13518 | |||
13519 | #region Packet Session and User Check | ||
13520 | if (m_checkPackets) | ||
13521 | { | ||
13522 | if (tpLocReq.AgentData.SessionID != SessionId || | ||
13523 | tpLocReq.AgentData.AgentID != AgentId) | ||
13524 | break; | ||
13525 | } | ||
13526 | #endregion | ||
13527 | |||
13528 | TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest; | ||
13529 | if (handlerTeleportLocationRequest != null) | ||
13530 | { | ||
13531 | handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, | ||
13532 | tpLocReq.Info.LookAt, 16); | ||
13533 | } | ||
13534 | else | ||
13535 | { | ||
13536 | //no event handler so cancel request | ||
13537 | TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel); | ||
13538 | tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; | ||
13539 | tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; | ||
13540 | OutPacket(tpCancel, ThrottleOutPacketType.Task); | ||
13541 | } | ||
13542 | break; | ||
13543 | |||
13544 | //#endregion | ||
13545 | |||
13546 | case PacketType.UUIDNameRequest: | ||
13547 | UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; | ||
13548 | |||
13549 | foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) | ||
13550 | { | ||
13551 | UUIDNameRequest handlerNameRequest = OnNameFromUUIDRequest; | ||
13552 | if (handlerNameRequest != null) | ||
13553 | { | ||
13554 | handlerNameRequest(UUIDBlock.ID, this); | ||
13555 | } | ||
13556 | } | ||
13557 | break; | ||
13558 | |||
13559 | //#region Parcel related packets | ||
13560 | |||
13561 | |||
13562 | case PacketType.RegionHandleRequest: | ||
13563 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | ||
13564 | |||
13565 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; | ||
13566 | if (handlerRegionHandleRequest != null) | ||
13567 | { | ||
13568 | handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); | ||
13569 | } | ||
13570 | break; | ||
13571 | |||
13572 | case PacketType.ParcelInfoRequest: | ||
13573 | ParcelInfoRequestPacket pirPack = (ParcelInfoRequestPacket)Pack; | ||
13574 | |||
13575 | #region Packet Session and User Check | ||
13576 | if (m_checkPackets) | ||
13577 | { | ||
13578 | if (pirPack.AgentData.SessionID != SessionId || | ||
13579 | pirPack.AgentData.AgentID != AgentId) | ||
13580 | break; | ||
13581 | } | ||
13582 | #endregion | ||
13583 | |||
13584 | ParcelInfoRequest handlerParcelInfoRequest = OnParcelInfoRequest; | ||
13585 | if (handlerParcelInfoRequest != null) | ||
13586 | { | ||
13587 | handlerParcelInfoRequest(this, pirPack.Data.ParcelID); | ||
13588 | } | ||
13589 | break; | ||
13590 | |||
13591 | case PacketType.ParcelAccessListRequest: | ||
13592 | ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack; | ||
13593 | |||
13594 | #region Packet Session and User Check | ||
13595 | if (m_checkPackets) | ||
13596 | { | ||
13597 | if (requestPacket.AgentData.SessionID != SessionId || | ||
13598 | requestPacket.AgentData.AgentID != AgentId) | ||
13599 | break; | ||
13600 | } | ||
13601 | #endregion | ||
13602 | |||
13603 | ParcelAccessListRequest handlerParcelAccessListRequest = OnParcelAccessListRequest; | ||
13604 | |||
13605 | if (handlerParcelAccessListRequest != null) | ||
13606 | { | ||
13607 | handlerParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID, | ||
13608 | requestPacket.Data.Flags, requestPacket.Data.SequenceID, | ||
13609 | requestPacket.Data.LocalID, this); | ||
13610 | } | ||
13611 | break; | ||
13612 | |||
13613 | case PacketType.ParcelAccessListUpdate: | ||
13614 | ParcelAccessListUpdatePacket updatePacket = (ParcelAccessListUpdatePacket)Pack; | ||
13615 | |||
13616 | #region Packet Session and User Check | ||
13617 | if (m_checkPackets) | ||
13618 | { | ||
13619 | if (updatePacket.AgentData.SessionID != SessionId || | ||
13620 | updatePacket.AgentData.AgentID != AgentId) | ||
13621 | break; | ||
13622 | } | ||
13623 | #endregion | ||
13624 | |||
13625 | List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>(); | ||
13626 | foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) | ||
13627 | { | ||
13628 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
13629 | entry.AgentID = block.ID; | ||
13630 | entry.Flags = (AccessList)block.Flags; | ||
13631 | entry.Time = new DateTime(); | ||
13632 | entries.Add(entry); | ||
13633 | } | ||
13634 | |||
13635 | ParcelAccessListUpdateRequest handlerParcelAccessListUpdateRequest = OnParcelAccessListUpdateRequest; | ||
13636 | if (handlerParcelAccessListUpdateRequest != null) | ||
13637 | { | ||
13638 | handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID, | ||
13639 | updatePacket.AgentData.SessionID, updatePacket.Data.Flags, | ||
13640 | updatePacket.Data.LocalID, entries, this); | ||
13641 | } | ||
13642 | break; | ||
13643 | |||
13644 | case PacketType.ParcelPropertiesRequest: | ||
13645 | |||
13646 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; | ||
13647 | |||
13648 | #region Packet Session and User Check | ||
13649 | if (m_checkPackets) | ||
13650 | { | ||
13651 | if (propertiesRequest.AgentData.SessionID != SessionId || | ||
13652 | propertiesRequest.AgentData.AgentID != AgentId) | ||
13653 | break; | ||
13654 | } | ||
13655 | #endregion | ||
13656 | |||
13657 | ParcelPropertiesRequest handlerParcelPropertiesRequest = OnParcelPropertiesRequest; | ||
13658 | if (handlerParcelPropertiesRequest != null) | ||
13659 | { | ||
13660 | handlerParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), | ||
13661 | (int)Math.Round(propertiesRequest.ParcelData.South), | ||
13662 | (int)Math.Round(propertiesRequest.ParcelData.East), | ||
13663 | (int)Math.Round(propertiesRequest.ParcelData.North), | ||
13664 | propertiesRequest.ParcelData.SequenceID, | ||
13665 | propertiesRequest.ParcelData.SnapSelection, this); | ||
13666 | } | ||
13667 | break; | ||
13668 | |||
13669 | case PacketType.ParcelDivide: | ||
13670 | ParcelDividePacket landDivide = (ParcelDividePacket)Pack; | ||
13671 | |||
13672 | #region Packet Session and User Check | ||
13673 | if (m_checkPackets) | ||
13674 | { | ||
13675 | if (landDivide.AgentData.SessionID != SessionId || | ||
13676 | landDivide.AgentData.AgentID != AgentId) | ||
13677 | break; | ||
13678 | } | ||
13679 | #endregion | ||
13680 | |||
13681 | ParcelDivideRequest handlerParcelDivideRequest = OnParcelDivideRequest; | ||
13682 | if (handlerParcelDivideRequest != null) | ||
13683 | { | ||
13684 | handlerParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West), | ||
13685 | (int)Math.Round(landDivide.ParcelData.South), | ||
13686 | (int)Math.Round(landDivide.ParcelData.East), | ||
13687 | (int)Math.Round(landDivide.ParcelData.North), this); | ||
13688 | } | ||
13689 | break; | ||
13690 | |||
13691 | case PacketType.ParcelJoin: | ||
13692 | ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack; | ||
13693 | |||
13694 | #region Packet Session and User Check | ||
13695 | if (m_checkPackets) | ||
13696 | { | ||
13697 | if (landJoin.AgentData.SessionID != SessionId || | ||
13698 | landJoin.AgentData.AgentID != AgentId) | ||
13699 | break; | ||
13700 | } | ||
13701 | #endregion | ||
13702 | |||
13703 | ParcelJoinRequest handlerParcelJoinRequest = OnParcelJoinRequest; | ||
13704 | |||
13705 | if (handlerParcelJoinRequest != null) | ||
13706 | { | ||
13707 | handlerParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West), | ||
13708 | (int)Math.Round(landJoin.ParcelData.South), | ||
13709 | (int)Math.Round(landJoin.ParcelData.East), | ||
13710 | (int)Math.Round(landJoin.ParcelData.North), this); | ||
13711 | } | ||
13712 | break; | ||
13713 | |||
13714 | case PacketType.ParcelPropertiesUpdate: | ||
13715 | ParcelPropertiesUpdatePacket parcelPropertiesPacket = (ParcelPropertiesUpdatePacket)Pack; | ||
13716 | |||
13717 | #region Packet Session and User Check | ||
13718 | if (m_checkPackets) | ||
13719 | { | ||
13720 | if (parcelPropertiesPacket.AgentData.SessionID != SessionId || | ||
13721 | parcelPropertiesPacket.AgentData.AgentID != AgentId) | ||
13722 | break; | ||
13723 | } | ||
13724 | #endregion | ||
13725 | |||
13726 | ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest = OnParcelPropertiesUpdateRequest; | ||
13727 | |||
13728 | if (handlerParcelPropertiesUpdateRequest != null) | ||
13729 | { | ||
13730 | LandUpdateArgs args = new LandUpdateArgs(); | ||
13731 | |||
13732 | args.AuthBuyerID = parcelPropertiesPacket.ParcelData.AuthBuyerID; | ||
13733 | args.Category = (ParcelCategory)parcelPropertiesPacket.ParcelData.Category; | ||
13734 | args.Desc = Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc); | ||
13735 | args.GroupID = parcelPropertiesPacket.ParcelData.GroupID; | ||
13736 | args.LandingType = parcelPropertiesPacket.ParcelData.LandingType; | ||
13737 | args.MediaAutoScale = parcelPropertiesPacket.ParcelData.MediaAutoScale; | ||
13738 | args.MediaID = parcelPropertiesPacket.ParcelData.MediaID; | ||
13739 | args.MediaURL = Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL); | ||
13740 | args.MusicURL = Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL); | ||
13741 | args.Name = Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name); | ||
13742 | args.ParcelFlags = parcelPropertiesPacket.ParcelData.ParcelFlags; | ||
13743 | args.PassHours = parcelPropertiesPacket.ParcelData.PassHours; | ||
13744 | args.PassPrice = parcelPropertiesPacket.ParcelData.PassPrice; | ||
13745 | args.SalePrice = parcelPropertiesPacket.ParcelData.SalePrice; | ||
13746 | args.SnapshotID = parcelPropertiesPacket.ParcelData.SnapshotID; | ||
13747 | args.UserLocation = parcelPropertiesPacket.ParcelData.UserLocation; | ||
13748 | args.UserLookAt = parcelPropertiesPacket.ParcelData.UserLookAt; | ||
13749 | handlerParcelPropertiesUpdateRequest(args, parcelPropertiesPacket.ParcelData.LocalID, this); | ||
13750 | } | ||
13751 | break; | ||
13752 | |||
13753 | case PacketType.ParcelSelectObjects: | ||
13754 | ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; | ||
13755 | |||
13756 | #region Packet Session and User Check | ||
13757 | if (m_checkPackets) | ||
13758 | { | ||
13759 | if (selectPacket.AgentData.SessionID != SessionId || | ||
13760 | selectPacket.AgentData.AgentID != AgentId) | ||
13761 | break; | ||
13762 | } | ||
13763 | #endregion | ||
13764 | |||
13765 | List<UUID> returnIDs = new List<UUID>(); | ||
13766 | |||
13767 | foreach (ParcelSelectObjectsPacket.ReturnIDsBlock rb in | ||
13768 | selectPacket.ReturnIDs) | ||
13769 | { | ||
13770 | returnIDs.Add(rb.ReturnID); | ||
13771 | } | ||
13772 | |||
13773 | ParcelSelectObjects handlerParcelSelectObjects = OnParcelSelectObjects; | ||
13774 | |||
13775 | if (handlerParcelSelectObjects != null) | ||
13776 | { | ||
13777 | handlerParcelSelectObjects(selectPacket.ParcelData.LocalID, | ||
13778 | Convert.ToInt32(selectPacket.ParcelData.ReturnType), returnIDs, this); | ||
13779 | } | ||
13780 | break; | ||
13781 | |||
13782 | case PacketType.ParcelObjectOwnersRequest: | ||
13783 | //m_log.Debug(Pack.ToString()); | ||
13784 | ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack; | ||
13785 | |||
13786 | #region Packet Session and User Check | ||
13787 | if (m_checkPackets) | ||
13788 | { | ||
13789 | if (reqPacket.AgentData.SessionID != SessionId || | ||
13790 | reqPacket.AgentData.AgentID != AgentId) | ||
13791 | break; | ||
13792 | } | ||
13793 | #endregion | ||
13794 | |||
13795 | ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = OnParcelObjectOwnerRequest; | ||
13796 | |||
13797 | if (handlerParcelObjectOwnerRequest != null) | ||
13798 | { | ||
13799 | handlerParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this); | ||
13800 | } | ||
13801 | break; | ||
13802 | |||
13803 | case PacketType.ParcelGodForceOwner: | ||
13804 | ParcelGodForceOwnerPacket godForceOwnerPacket = (ParcelGodForceOwnerPacket)Pack; | ||
13805 | |||
13806 | #region Packet Session and User Check | ||
13807 | if (m_checkPackets) | ||
13808 | { | ||
13809 | if (godForceOwnerPacket.AgentData.SessionID != SessionId || | ||
13810 | godForceOwnerPacket.AgentData.AgentID != AgentId) | ||
13811 | break; | ||
13812 | } | ||
13813 | #endregion | ||
13814 | |||
13815 | ParcelGodForceOwner handlerParcelGodForceOwner = OnParcelGodForceOwner; | ||
13816 | if (handlerParcelGodForceOwner != null) | ||
13817 | { | ||
13818 | handlerParcelGodForceOwner(godForceOwnerPacket.Data.LocalID, godForceOwnerPacket.Data.OwnerID, this); | ||
13819 | } | ||
13820 | break; | ||
13821 | |||
13822 | case PacketType.ParcelRelease: | ||
13823 | ParcelReleasePacket releasePacket = (ParcelReleasePacket)Pack; | ||
13824 | |||
13825 | #region Packet Session and User Check | ||
13826 | if (m_checkPackets) | ||
13827 | { | ||
13828 | if (releasePacket.AgentData.SessionID != SessionId || | ||
13829 | releasePacket.AgentData.AgentID != AgentId) | ||
13830 | break; | ||
13831 | } | ||
13832 | #endregion | ||
13833 | |||
13834 | ParcelAbandonRequest handlerParcelAbandonRequest = OnParcelAbandonRequest; | ||
13835 | if (handlerParcelAbandonRequest != null) | ||
13836 | { | ||
13837 | handlerParcelAbandonRequest(releasePacket.Data.LocalID, this); | ||
13838 | } | ||
13839 | break; | ||
13840 | |||
13841 | case PacketType.ParcelReclaim: | ||
13842 | ParcelReclaimPacket reclaimPacket = (ParcelReclaimPacket)Pack; | ||
13843 | |||
13844 | #region Packet Session and User Check | ||
13845 | if (m_checkPackets) | ||
13846 | { | ||
13847 | if (reclaimPacket.AgentData.SessionID != SessionId || | ||
13848 | reclaimPacket.AgentData.AgentID != AgentId) | ||
13849 | break; | ||
13850 | } | ||
13851 | #endregion | ||
13852 | |||
13853 | ParcelReclaim handlerParcelReclaim = OnParcelReclaim; | ||
13854 | if (handlerParcelReclaim != null) | ||
13855 | { | ||
13856 | handlerParcelReclaim(reclaimPacket.Data.LocalID, this); | ||
13857 | } | ||
13858 | break; | ||
13859 | |||
13860 | case PacketType.ParcelReturnObjects: | ||
13861 | |||
13862 | |||
13863 | ParcelReturnObjectsPacket parcelReturnObjects = (ParcelReturnObjectsPacket)Pack; | ||
13864 | |||
13865 | #region Packet Session and User Check | ||
13866 | if (m_checkPackets) | ||
13867 | { | ||
13868 | if (parcelReturnObjects.AgentData.SessionID != SessionId || | ||
13869 | parcelReturnObjects.AgentData.AgentID != AgentId) | ||
13870 | break; | ||
13871 | } | ||
13872 | #endregion | ||
13873 | |||
13874 | UUID[] puserselectedOwnerIDs = new UUID[parcelReturnObjects.OwnerIDs.Length]; | ||
13875 | for (int parceliterator = 0; parceliterator < parcelReturnObjects.OwnerIDs.Length; parceliterator++) | ||
13876 | puserselectedOwnerIDs[parceliterator] = parcelReturnObjects.OwnerIDs[parceliterator].OwnerID; | ||
13877 | |||
13878 | UUID[] puserselectedTaskIDs = new UUID[parcelReturnObjects.TaskIDs.Length]; | ||
13879 | |||
13880 | for (int parceliterator = 0; parceliterator < parcelReturnObjects.TaskIDs.Length; parceliterator++) | ||
13881 | puserselectedTaskIDs[parceliterator] = parcelReturnObjects.TaskIDs[parceliterator].TaskID; | ||
13882 | |||
13883 | ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest = OnParcelReturnObjectsRequest; | ||
13884 | if (handlerParcelReturnObjectsRequest != null) | ||
13885 | { | ||
13886 | handlerParcelReturnObjectsRequest(parcelReturnObjects.ParcelData.LocalID, parcelReturnObjects.ParcelData.ReturnType, puserselectedOwnerIDs, puserselectedTaskIDs, this); | ||
13887 | |||
13888 | } | ||
13889 | break; | ||
13890 | |||
13891 | case PacketType.ParcelSetOtherCleanTime: | ||
13892 | ParcelSetOtherCleanTimePacket parcelSetOtherCleanTimePacket = (ParcelSetOtherCleanTimePacket)Pack; | ||
13893 | |||
13894 | #region Packet Session and User Check | ||
13895 | if (m_checkPackets) | ||
13896 | { | ||
13897 | if (parcelSetOtherCleanTimePacket.AgentData.SessionID != SessionId || | ||
13898 | parcelSetOtherCleanTimePacket.AgentData.AgentID != AgentId) | ||
13899 | break; | ||
13900 | } | ||
13901 | #endregion | ||
13902 | |||
13903 | ParcelSetOtherCleanTime handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime; | ||
13904 | if (handlerParcelSetOtherCleanTime != null) | ||
13905 | { | ||
13906 | handlerParcelSetOtherCleanTime(this, | ||
13907 | parcelSetOtherCleanTimePacket.ParcelData.LocalID, | ||
13908 | parcelSetOtherCleanTimePacket.ParcelData.OtherCleanTime); | ||
13909 | } | ||
13910 | break; | ||
13911 | |||
13912 | case PacketType.LandStatRequest: | ||
13913 | LandStatRequestPacket lsrp = (LandStatRequestPacket)Pack; | ||
13914 | |||
13915 | #region Packet Session and User Check | ||
13916 | if (m_checkPackets) | ||
13917 | { | ||
13918 | if (lsrp.AgentData.SessionID != SessionId || | ||
13919 | lsrp.AgentData.AgentID != AgentId) | ||
13920 | break; | ||
13921 | } | ||
13922 | #endregion | ||
13923 | |||
13924 | GodLandStatRequest handlerLandStatRequest = OnLandStatRequest; | ||
13925 | if (handlerLandStatRequest != null) | ||
13926 | { | ||
13927 | handlerLandStatRequest(lsrp.RequestData.ParcelLocalID, lsrp.RequestData.ReportType, lsrp.RequestData.RequestFlags, Utils.BytesToString(lsrp.RequestData.Filter), this); | ||
13928 | } | ||
13929 | break; | ||
13930 | |||
13931 | case PacketType.ParcelDwellRequest: | ||
13932 | ParcelDwellRequestPacket dwellrq = | ||
13933 | (ParcelDwellRequestPacket)Pack; | ||
13934 | |||
13935 | #region Packet Session and User Check | ||
13936 | if (m_checkPackets) | ||
13937 | { | ||
13938 | if (dwellrq.AgentData.SessionID != SessionId || | ||
13939 | dwellrq.AgentData.AgentID != AgentId) | ||
13940 | break; | ||
13941 | } | ||
13942 | #endregion | ||
13943 | |||
13944 | ParcelDwellRequest handlerParcelDwellRequest = OnParcelDwellRequest; | ||
13945 | if (handlerParcelDwellRequest != null) | ||
13946 | { | ||
13947 | handlerParcelDwellRequest(dwellrq.Data.LocalID, this); | ||
13948 | } | ||
13949 | break; | ||
13950 | |||
13951 | //#endregion | ||
13952 | |||
13953 | //#region Estate Packets | ||
13954 | |||
13955 | case PacketType.EstateOwnerMessage: | ||
13956 | EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; | ||
13957 | //m_log.Debug(messagePacket.ToString()); | ||
13958 | |||
13959 | #region Packet Session and User Check | ||
13960 | if (m_checkPackets) | ||
13961 | { | ||
13962 | if (messagePacket.AgentData.SessionID != SessionId || | ||
13963 | messagePacket.AgentData.AgentID != AgentId) | ||
13964 | break; | ||
13965 | } | ||
13966 | #endregion | ||
13967 | |||
13968 | switch (Utils.BytesToString(messagePacket.MethodData.Method)) | ||
13969 | { | ||
13970 | case "getinfo": | ||
13971 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
13972 | { | ||
13973 | OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice); | ||
13974 | } | ||
13975 | break; | ||
13976 | case "setregioninfo": | ||
13977 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
13978 | { | ||
13979 | OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter), | ||
13980 | convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), | ||
13981 | Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter), Culture.NumberFormatInfo)), | ||
13982 | (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo), | ||
13983 | Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)), | ||
13984 | convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter)); | ||
13985 | } | ||
13986 | break; | ||
13987 | // case "texturebase": | ||
13988 | // if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
13989 | // { | ||
13990 | // foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) | ||
13991 | // { | ||
13992 | // string s = Utils.BytesToString(block.Parameter); | ||
13993 | // string[] splitField = s.Split(' '); | ||
13994 | // if (splitField.Length == 2) | ||
13995 | // { | ||
13996 | // UUID tempUUID = new UUID(splitField[1]); | ||
13997 | // OnSetEstateTerrainBaseTexture(this, Convert.ToInt16(splitField[0]), tempUUID); | ||
13998 | // } | ||
13999 | // } | ||
14000 | // } | ||
14001 | // break; | ||
14002 | case "texturedetail": | ||
14003 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14004 | { | ||
14005 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) | ||
14006 | { | ||
14007 | string s = Utils.BytesToString(block.Parameter); | ||
14008 | string[] splitField = s.Split(' '); | ||
14009 | if (splitField.Length == 2) | ||
14010 | { | ||
14011 | Int16 corner = Convert.ToInt16(splitField[0]); | ||
14012 | UUID textureUUID = new UUID(splitField[1]); | ||
14013 | |||
14014 | OnSetEstateTerrainDetailTexture(this, corner, textureUUID); | ||
14015 | } | ||
14016 | } | ||
14017 | } | ||
14018 | |||
14019 | break; | ||
14020 | case "textureheights": | ||
14021 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14022 | { | ||
14023 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) | ||
14024 | { | ||
14025 | string s = Utils.BytesToString(block.Parameter); | ||
14026 | string[] splitField = s.Split(' '); | ||
14027 | if (splitField.Length == 3) | ||
14028 | { | ||
14029 | Int16 corner = Convert.ToInt16(splitField[0]); | ||
14030 | float lowValue = (float)Convert.ToDecimal(splitField[1], Culture.NumberFormatInfo); | ||
14031 | float highValue = (float)Convert.ToDecimal(splitField[2], Culture.NumberFormatInfo); | ||
14032 | |||
14033 | OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue); | ||
14034 | } | ||
14035 | } | ||
14036 | } | ||
14037 | break; | ||
14038 | case "texturecommit": | ||
14039 | OnCommitEstateTerrainTextureRequest(this); | ||
14040 | break; | ||
14041 | case "setregionterrain": | ||
14042 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14043 | { | ||
14044 | if (messagePacket.ParamList.Length != 9) | ||
14045 | { | ||
14046 | m_log.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length"); | ||
14047 | } | ||
14048 | else | ||
14049 | { | ||
14050 | try | ||
14051 | { | ||
14052 | string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter); | ||
14053 | if (!tmp.Contains(".")) tmp += ".00"; | ||
14054 | float WaterHeight = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); | ||
14055 | tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter); | ||
14056 | if (!tmp.Contains(".")) tmp += ".00"; | ||
14057 | float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); | ||
14058 | tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter); | ||
14059 | if (!tmp.Contains(".")) tmp += ".00"; | ||
14060 | float TerrainLowerLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); | ||
14061 | bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter); | ||
14062 | bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter); | ||
14063 | float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo); | ||
14064 | bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter); | ||
14065 | bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter); | ||
14066 | float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter), Culture.NumberFormatInfo); | ||
14067 | |||
14068 | OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour); | ||
14069 | |||
14070 | } | ||
14071 | catch (Exception ex) | ||
14072 | { | ||
14073 | m_log.Error("EstateOwnerMessage: Exception while setting terrain settings: \n" + messagePacket + "\n" + ex); | ||
14074 | } | ||
14075 | } | ||
14076 | } | ||
14077 | |||
14078 | break; | ||
14079 | case "restart": | ||
14080 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14081 | { | ||
14082 | // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. | ||
14083 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) | ||
14084 | { | ||
14085 | float timeSeconds; | ||
14086 | Utils.TryParseSingle(Utils.BytesToString(block.Parameter), out timeSeconds); | ||
14087 | timeSeconds = (int)timeSeconds; | ||
14088 | OnEstateRestartSimRequest(this, (int)timeSeconds); | ||
14089 | |||
14090 | } | ||
14091 | } | ||
14092 | break; | ||
14093 | case "estatechangecovenantid": | ||
14094 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14095 | { | ||
14096 | foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) | ||
14097 | { | ||
14098 | UUID newCovenantID = new UUID(Utils.BytesToString(block.Parameter)); | ||
14099 | OnEstateChangeCovenantRequest(this, newCovenantID); | ||
14100 | } | ||
14101 | } | ||
14102 | break; | ||
14103 | case "estateaccessdelta": // Estate access delta manages the banlist and allow list too. | ||
14104 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14105 | { | ||
14106 | int estateAccessType = Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | ||
14107 | OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter))); | ||
14108 | |||
14109 | } | ||
14110 | break; | ||
14111 | case "simulatormessage": | ||
14112 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14113 | { | ||
14114 | UUID invoice = messagePacket.MethodData.Invoice; | ||
14115 | UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); | ||
14116 | string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter); | ||
14117 | string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter); | ||
14118 | UUID sessionID = messagePacket.AgentData.SessionID; | ||
14119 | OnSimulatorBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message); | ||
14120 | } | ||
14121 | break; | ||
14122 | case "instantmessage": | ||
14123 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14124 | { | ||
14125 | if (messagePacket.ParamList.Length < 5) | ||
14126 | break; | ||
14127 | UUID invoice = messagePacket.MethodData.Invoice; | ||
14128 | UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); | ||
14129 | string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter); | ||
14130 | string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter); | ||
14131 | UUID sessionID = messagePacket.AgentData.SessionID; | ||
14132 | OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message); | ||
14133 | } | ||
14134 | break; | ||
14135 | case "setregiondebug": | ||
14136 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14137 | { | ||
14138 | UUID invoice = messagePacket.MethodData.Invoice; | ||
14139 | UUID SenderID = messagePacket.AgentData.AgentID; | ||
14140 | bool scripted = convertParamStringToBool(messagePacket.ParamList[0].Parameter); | ||
14141 | bool collisionEvents = convertParamStringToBool(messagePacket.ParamList[1].Parameter); | ||
14142 | bool physics = convertParamStringToBool(messagePacket.ParamList[2].Parameter); | ||
14143 | |||
14144 | OnEstateDebugRegionRequest(this, invoice, SenderID, scripted, collisionEvents, physics); | ||
14145 | } | ||
14146 | break; | ||
14147 | case "teleporthomeuser": | ||
14148 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14149 | { | ||
14150 | UUID invoice = messagePacket.MethodData.Invoice; | ||
14151 | UUID SenderID = messagePacket.AgentData.AgentID; | ||
14152 | UUID Prey; | ||
14153 | |||
14154 | UUID.TryParse(Utils.BytesToString(messagePacket.ParamList[1].Parameter), out Prey); | ||
14155 | |||
14156 | OnEstateTeleportOneUserHomeRequest(this, invoice, SenderID, Prey); | ||
14157 | } | ||
14158 | break; | ||
14159 | case "teleporthomeallusers": | ||
14160 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14161 | { | ||
14162 | UUID invoice = messagePacket.MethodData.Invoice; | ||
14163 | UUID SenderID = messagePacket.AgentData.AgentID; | ||
14164 | OnEstateTeleportAllUsersHomeRequest(this, invoice, SenderID); | ||
14165 | } | ||
14166 | break; | ||
14167 | case "colliders": | ||
14168 | handlerLandStatRequest = OnLandStatRequest; | ||
14169 | if (handlerLandStatRequest != null) | ||
14170 | { | ||
14171 | handlerLandStatRequest(0, 1, 0, "", this); | ||
14172 | } | ||
14173 | break; | ||
14174 | case "scripts": | ||
14175 | handlerLandStatRequest = OnLandStatRequest; | ||
14176 | if (handlerLandStatRequest != null) | ||
14177 | { | ||
14178 | handlerLandStatRequest(0, 0, 0, "", this); | ||
14179 | } | ||
14180 | break; | ||
14181 | case "terrain": | ||
14182 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14183 | { | ||
14184 | if (messagePacket.ParamList.Length > 0) | ||
14185 | { | ||
14186 | if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "bake") | ||
14187 | { | ||
14188 | BakeTerrain handlerBakeTerrain = OnBakeTerrain; | ||
14189 | if (handlerBakeTerrain != null) | ||
14190 | { | ||
14191 | handlerBakeTerrain(this); | ||
14192 | } | ||
14193 | } | ||
14194 | if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "download filename") | ||
14195 | { | ||
14196 | if (messagePacket.ParamList.Length > 1) | ||
14197 | { | ||
14198 | RequestTerrain handlerRequestTerrain = OnRequestTerrain; | ||
14199 | if (handlerRequestTerrain != null) | ||
14200 | { | ||
14201 | handlerRequestTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | ||
14202 | } | ||
14203 | } | ||
14204 | } | ||
14205 | if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "upload filename") | ||
14206 | { | ||
14207 | if (messagePacket.ParamList.Length > 1) | ||
14208 | { | ||
14209 | RequestTerrain handlerUploadTerrain = OnUploadTerrain; | ||
14210 | if (handlerUploadTerrain != null) | ||
14211 | { | ||
14212 | handlerUploadTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | ||
14213 | } | ||
14214 | } | ||
14215 | } | ||
14216 | |||
14217 | } | ||
14218 | |||
14219 | |||
14220 | } | ||
14221 | break; | ||
14222 | |||
14223 | case "estatechangeinfo": | ||
14224 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
14225 | { | ||
14226 | UUID invoice = messagePacket.MethodData.Invoice; | ||
14227 | UUID SenderID = messagePacket.AgentData.AgentID; | ||
14228 | UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | ||
14229 | UInt32 param2 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); | ||
14230 | |||
14231 | EstateChangeInfo handlerEstateChangeInfo = OnEstateChangeInfo; | ||
14232 | if (handlerEstateChangeInfo != null) | ||
14233 | { | ||
14234 | handlerEstateChangeInfo(this, invoice, SenderID, param1, param2); | ||
14235 | } | ||
14236 | } | ||
14237 | break; | ||
14238 | |||
14239 | default: | ||
14240 | m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket); | ||
14241 | break; | ||
14242 | } | ||
14243 | |||
14244 | //int parcelID, uint reportType, uint requestflags, string filter | ||
14245 | |||
14246 | //lsrp.RequestData.ParcelLocalID; | ||
14247 | //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts | ||
14248 | //lsrp.RequestData.RequestFlags; | ||
14249 | //lsrp.RequestData.Filter; | ||
14250 | |||
14251 | break; | ||
14252 | |||
14253 | case PacketType.RequestRegionInfo: | ||
14254 | RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData; | ||
14255 | |||
14256 | #region Packet Session and User Check | ||
14257 | if (m_checkPackets) | ||
14258 | { | ||
14259 | if (mPacket.SessionID != SessionId || | ||
14260 | mPacket.AgentID != AgentId) | ||
14261 | break; | ||
14262 | } | ||
14263 | #endregion | ||
14264 | |||
14265 | RegionInfoRequest handlerRegionInfoRequest = OnRegionInfoRequest; | ||
14266 | if (handlerRegionInfoRequest != null) | ||
14267 | { | ||
14268 | handlerRegionInfoRequest(this); | ||
14269 | } | ||
14270 | break; | ||
14271 | |||
14272 | case PacketType.EstateCovenantRequest: | ||
14273 | |||
14274 | //EstateCovenantRequestPacket.AgentDataBlock epack = | ||
14275 | // ((EstateCovenantRequestPacket)Pack).AgentData; | ||
14276 | |||
14277 | EstateCovenantRequest handlerEstateCovenantRequest = OnEstateCovenantRequest; | ||
14278 | if (handlerEstateCovenantRequest != null) | ||
14279 | { | ||
14280 | handlerEstateCovenantRequest(this); | ||
14281 | } | ||
14282 | break; | ||
14283 | |||
14284 | //#endregion | ||
14285 | |||
14286 | //#region GodPackets | ||
14287 | |||
14288 | case PacketType.RequestGodlikePowers: | ||
14289 | RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack; | ||
14290 | RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock; | ||
14291 | UUID token = rblock.Token; | ||
14292 | |||
14293 | RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData; | ||
14294 | |||
14295 | RequestGodlikePowers handlerReqGodlikePowers = OnRequestGodlikePowers; | ||
14296 | |||
14297 | if (handlerReqGodlikePowers != null) | ||
14298 | { | ||
14299 | handlerReqGodlikePowers(ablock.AgentID, ablock.SessionID, token, rblock.Godlike, this); | ||
14300 | } | ||
14301 | |||
14302 | break; | ||
14303 | |||
14304 | case PacketType.GodKickUser: | ||
14305 | GodKickUserPacket gkupack = (GodKickUserPacket)Pack; | ||
14306 | |||
14307 | if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID) | ||
14308 | { | ||
14309 | GodKickUser handlerGodKickUser = OnGodKickUser; | ||
14310 | if (handlerGodKickUser != null) | ||
14311 | { | ||
14312 | handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, | ||
14313 | gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason,gkupack.UserInfo); | ||
14314 | } | ||
14315 | } | ||
14316 | else | ||
14317 | { | ||
14318 | SendAgentAlertMessage("Kick request denied", false); | ||
14319 | } | ||
14320 | //KickUserPacket kupack = new KickUserPacket(); | ||
14321 | //KickUserPacket.UserInfoBlock kupackib = kupack.UserInfo; | ||
14322 | |||
14323 | //kupack.UserInfo.AgentID = gkupack.UserInfo.AgentID; | ||
14324 | //kupack.UserInfo.SessionID = gkupack.UserInfo.GodSessionID; | ||
14325 | |||
14326 | //kupack.TargetBlock.TargetIP = (uint)0; | ||
14327 | //kupack.TargetBlock.TargetPort = (ushort)0; | ||
14328 | //kupack.UserInfo.Reason = gkupack.UserInfo.Reason; | ||
14329 | |||
14330 | //OutPacket(kupack, ThrottleOutPacketType.Task); | ||
14331 | break; | ||
14332 | |||
14333 | //#endregion | ||
14334 | |||
14335 | //#region Economy/Transaction Packets | ||
14336 | |||
14337 | case PacketType.MoneyBalanceRequest: | ||
14338 | MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack; | ||
14339 | |||
14340 | #region Packet Session and User Check | ||
14341 | if (m_checkPackets) | ||
14342 | { | ||
14343 | if (moneybalancerequestpacket.AgentData.SessionID != SessionId || | ||
14344 | moneybalancerequestpacket.AgentData.AgentID != AgentId) | ||
14345 | break; | ||
14346 | } | ||
14347 | #endregion | ||
14348 | |||
14349 | MoneyBalanceRequest handlerMoneyBalanceRequest = OnMoneyBalanceRequest; | ||
14350 | |||
14351 | if (handlerMoneyBalanceRequest != null) | ||
14352 | { | ||
14353 | handlerMoneyBalanceRequest(this, moneybalancerequestpacket.AgentData.AgentID, moneybalancerequestpacket.AgentData.SessionID, moneybalancerequestpacket.MoneyData.TransactionID); | ||
14354 | } | ||
14355 | |||
14356 | break; | ||
14357 | |||
14358 | case PacketType.EconomyDataRequest: | ||
14359 | |||
14360 | |||
14361 | EconomyDataRequest handlerEconomoyDataRequest = OnEconomyDataRequest; | ||
14362 | if (handlerEconomoyDataRequest != null) | ||
14363 | { | ||
14364 | handlerEconomoyDataRequest(AgentId); | ||
14365 | } | ||
14366 | break; | ||
14367 | |||
14368 | case PacketType.RequestPayPrice: | ||
14369 | RequestPayPricePacket requestPayPricePacket = (RequestPayPricePacket)Pack; | ||
14370 | |||
14371 | RequestPayPrice handlerRequestPayPrice = OnRequestPayPrice; | ||
14372 | if (handlerRequestPayPrice != null) | ||
14373 | { | ||
14374 | handlerRequestPayPrice(this, requestPayPricePacket.ObjectData.ObjectID); | ||
14375 | } | ||
14376 | break; | ||
14377 | |||
14378 | case PacketType.ObjectSaleInfo: | ||
14379 | ObjectSaleInfoPacket objectSaleInfoPacket = (ObjectSaleInfoPacket)Pack; | ||
14380 | |||
14381 | #region Packet Session and User Check | ||
14382 | if (m_checkPackets) | ||
14383 | { | ||
14384 | if (objectSaleInfoPacket.AgentData.SessionID != SessionId || | ||
14385 | objectSaleInfoPacket.AgentData.AgentID != AgentId) | ||
14386 | break; | ||
14387 | } | ||
14388 | #endregion | ||
14389 | |||
14390 | ObjectSaleInfo handlerObjectSaleInfo = OnObjectSaleInfo; | ||
14391 | if (handlerObjectSaleInfo != null) | ||
14392 | { | ||
14393 | foreach (ObjectSaleInfoPacket.ObjectDataBlock d | ||
14394 | in objectSaleInfoPacket.ObjectData) | ||
14395 | { | ||
14396 | handlerObjectSaleInfo(this, | ||
14397 | objectSaleInfoPacket.AgentData.AgentID, | ||
14398 | objectSaleInfoPacket.AgentData.SessionID, | ||
14399 | d.LocalID, | ||
14400 | d.SaleType, | ||
14401 | d.SalePrice); | ||
14402 | } | ||
14403 | } | ||
14404 | break; | ||
14405 | |||
14406 | case PacketType.ObjectBuy: | ||
14407 | ObjectBuyPacket objectBuyPacket = (ObjectBuyPacket)Pack; | ||
14408 | |||
14409 | #region Packet Session and User Check | ||
14410 | if (m_checkPackets) | ||
14411 | { | ||
14412 | if (objectBuyPacket.AgentData.SessionID != SessionId || | ||
14413 | objectBuyPacket.AgentData.AgentID != AgentId) | ||
14414 | break; | ||
14415 | } | ||
14416 | #endregion | ||
14417 | |||
14418 | ObjectBuy handlerObjectBuy = OnObjectBuy; | ||
14419 | |||
14420 | if (handlerObjectBuy != null) | ||
14421 | { | ||
14422 | foreach (ObjectBuyPacket.ObjectDataBlock d | ||
14423 | in objectBuyPacket.ObjectData) | ||
14424 | { | ||
14425 | handlerObjectBuy(this, | ||
14426 | objectBuyPacket.AgentData.AgentID, | ||
14427 | objectBuyPacket.AgentData.SessionID, | ||
14428 | objectBuyPacket.AgentData.GroupID, | ||
14429 | objectBuyPacket.AgentData.CategoryID, | ||
14430 | d.ObjectLocalID, | ||
14431 | d.SaleType, | ||
14432 | d.SalePrice); | ||
14433 | } | ||
14434 | } | ||
14435 | break; | ||
14436 | |||
14437 | //#endregion | ||
14438 | |||
14439 | //#region Script Packets | ||
14440 | |||
14441 | case PacketType.GetScriptRunning: | ||
14442 | GetScriptRunningPacket scriptRunning = (GetScriptRunningPacket)Pack; | ||
14443 | |||
14444 | GetScriptRunning handlerGetScriptRunning = OnGetScriptRunning; | ||
14445 | if (handlerGetScriptRunning != null) | ||
14446 | { | ||
14447 | handlerGetScriptRunning(this, scriptRunning.Script.ObjectID, scriptRunning.Script.ItemID); | ||
14448 | } | ||
14449 | break; | ||
14450 | |||
14451 | case PacketType.SetScriptRunning: | ||
14452 | SetScriptRunningPacket setScriptRunning = (SetScriptRunningPacket)Pack; | ||
14453 | |||
14454 | #region Packet Session and User Check | ||
14455 | if (m_checkPackets) | ||
14456 | { | ||
14457 | if (setScriptRunning.AgentData.SessionID != SessionId || | ||
14458 | setScriptRunning.AgentData.AgentID != AgentId) | ||
14459 | break; | ||
14460 | } | ||
14461 | #endregion | ||
14462 | |||
14463 | SetScriptRunning handlerSetScriptRunning = OnSetScriptRunning; | ||
14464 | if (handlerSetScriptRunning != null) | ||
14465 | { | ||
14466 | handlerSetScriptRunning(this, setScriptRunning.Script.ObjectID, setScriptRunning.Script.ItemID, setScriptRunning.Script.Running); | ||
14467 | } | ||
14468 | break; | ||
14469 | |||
14470 | case PacketType.ScriptReset: | ||
14471 | ScriptResetPacket scriptResetPacket = (ScriptResetPacket)Pack; | ||
14472 | |||
14473 | #region Packet Session and User Check | ||
14474 | if (m_checkPackets) | ||
14475 | { | ||
14476 | if (scriptResetPacket.AgentData.SessionID != SessionId || | ||
14477 | scriptResetPacket.AgentData.AgentID != AgentId) | ||
14478 | break; | ||
14479 | } | ||
14480 | #endregion | ||
14481 | |||
14482 | ScriptReset handlerScriptReset = OnScriptReset; | ||
14483 | if (handlerScriptReset != null) | ||
14484 | { | ||
14485 | handlerScriptReset(this, scriptResetPacket.Script.ObjectID, scriptResetPacket.Script.ItemID); | ||
14486 | } | ||
14487 | break; | ||
14488 | |||
14489 | //#endregion | ||
14490 | |||
14491 | //#region Gesture Managment | ||
14492 | |||
14493 | case PacketType.ActivateGestures: | ||
14494 | ActivateGesturesPacket activateGesturePacket = (ActivateGesturesPacket)Pack; | ||
14495 | |||
14496 | #region Packet Session and User Check | ||
14497 | if (m_checkPackets) | ||
14498 | { | ||
14499 | if (activateGesturePacket.AgentData.SessionID != SessionId || | ||
14500 | activateGesturePacket.AgentData.AgentID != AgentId) | ||
14501 | break; | ||
14502 | } | ||
14503 | #endregion | ||
14504 | |||
14505 | ActivateGesture handlerActivateGesture = OnActivateGesture; | ||
14506 | if (handlerActivateGesture != null) | ||
14507 | { | ||
14508 | handlerActivateGesture(this, | ||
14509 | activateGesturePacket.Data[0].AssetID, | ||
14510 | activateGesturePacket.Data[0].ItemID); | ||
14511 | } | ||
14512 | else m_log.Error("Null pointer for activateGesture"); | ||
14513 | |||
14514 | break; | ||
14515 | |||
14516 | case PacketType.DeactivateGestures: | ||
14517 | DeactivateGesturesPacket deactivateGesturePacket = (DeactivateGesturesPacket)Pack; | ||
14518 | |||
14519 | #region Packet Session and User Check | ||
14520 | if (m_checkPackets) | ||
14521 | { | ||
14522 | if (deactivateGesturePacket.AgentData.SessionID != SessionId || | ||
14523 | deactivateGesturePacket.AgentData.AgentID != AgentId) | ||
14524 | break; | ||
14525 | } | ||
14526 | #endregion | ||
14527 | |||
14528 | DeactivateGesture handlerDeactivateGesture = OnDeactivateGesture; | ||
14529 | if (handlerDeactivateGesture != null) | ||
14530 | { | ||
14531 | handlerDeactivateGesture(this, deactivateGesturePacket.Data[0].ItemID); | ||
14532 | } | ||
14533 | break; | ||
14534 | case PacketType.ObjectOwner: | ||
14535 | ObjectOwnerPacket objectOwnerPacket = (ObjectOwnerPacket)Pack; | ||
14536 | |||
14537 | #region Packet Session and User Check | ||
14538 | if (m_checkPackets) | ||
14539 | { | ||
14540 | if (objectOwnerPacket.AgentData.SessionID != SessionId || | ||
14541 | objectOwnerPacket.AgentData.AgentID != AgentId) | ||
14542 | break; | ||
14543 | } | ||
14544 | #endregion | ||
14545 | |||
14546 | List<uint> localIDs = new List<uint>(); | ||
14547 | |||
14548 | foreach (ObjectOwnerPacket.ObjectDataBlock d in objectOwnerPacket.ObjectData) | ||
14549 | localIDs.Add(d.ObjectLocalID); | ||
14550 | |||
14551 | ObjectOwner handlerObjectOwner = OnObjectOwner; | ||
14552 | if (handlerObjectOwner != null) | ||
14553 | { | ||
14554 | handlerObjectOwner(this, objectOwnerPacket.HeaderData.OwnerID, objectOwnerPacket.HeaderData.GroupID, localIDs); | ||
14555 | } | ||
14556 | break; | ||
14557 | |||
14558 | //#endregion | ||
14559 | |||
14560 | case PacketType.AgentFOV: | ||
14561 | AgentFOVPacket fovPacket = (AgentFOVPacket)Pack; | ||
14562 | |||
14563 | if (fovPacket.FOVBlock.GenCounter > m_agentFOVCounter) | ||
14564 | { | ||
14565 | m_agentFOVCounter = fovPacket.FOVBlock.GenCounter; | ||
14566 | AgentFOV handlerAgentFOV = OnAgentFOV; | ||
14567 | if (handlerAgentFOV != null) | ||
14568 | { | ||
14569 | handlerAgentFOV(this, fovPacket.FOVBlock.VerticalAngle); | ||
14570 | } | ||
14571 | } | ||
14572 | break; | ||
14573 | |||
14574 | //#region unimplemented handlers | ||
14575 | |||
14576 | case PacketType.ViewerStats: | ||
14577 | // TODO: handle this packet | ||
14578 | //m_log.Warn("[CLIENT]: unhandled ViewerStats packet"); | ||
14579 | break; | ||
14580 | |||
14581 | case PacketType.MapItemRequest: | ||
14582 | MapItemRequestPacket mirpk = (MapItemRequestPacket)Pack; | ||
14583 | |||
14584 | #region Packet Session and User Check | ||
14585 | if (m_checkPackets) | ||
14586 | { | ||
14587 | if (mirpk.AgentData.SessionID != SessionId || | ||
14588 | mirpk.AgentData.AgentID != AgentId) | ||
14589 | break; | ||
14590 | } | ||
14591 | #endregion | ||
14592 | |||
14593 | //m_log.Debug(mirpk.ToString()); | ||
14594 | MapItemRequest handlerMapItemRequest = OnMapItemRequest; | ||
14595 | if (handlerMapItemRequest != null) | ||
14596 | { | ||
14597 | handlerMapItemRequest(this, mirpk.AgentData.Flags, mirpk.AgentData.EstateID, | ||
14598 | mirpk.AgentData.Godlike, mirpk.RequestData.ItemType, | ||
14599 | mirpk.RequestData.RegionHandle); | ||
14600 | |||
14601 | } | ||
14602 | break; | ||
14603 | |||
14604 | case PacketType.TransferAbort: | ||
14605 | // TODO: handle this packet | ||
14606 | //m_log.Warn("[CLIENT]: unhandled TransferAbort packet"); | ||
14607 | break; | ||
14608 | |||
14609 | case PacketType.MuteListRequest: | ||
14610 | MuteListRequestPacket muteListRequest = | ||
14611 | (MuteListRequestPacket)Pack; | ||
14612 | |||
14613 | #region Packet Session and User Check | ||
14614 | if (m_checkPackets) | ||
14615 | { | ||
14616 | if (muteListRequest.AgentData.SessionID != SessionId || | ||
14617 | muteListRequest.AgentData.AgentID != AgentId) | ||
14618 | break; | ||
14619 | } | ||
14620 | #endregion | ||
14621 | |||
14622 | MuteListRequest handlerMuteListRequest = OnMuteListRequest; | ||
14623 | if (handlerMuteListRequest != null) | ||
14624 | { | ||
14625 | handlerMuteListRequest(this, muteListRequest.MuteData.MuteCRC); | ||
14626 | } | ||
14627 | else | ||
14628 | { | ||
14629 | SendUseCachedMuteList(); | ||
14630 | } | ||
14631 | break; | ||
14632 | |||
14633 | case PacketType.UseCircuitCode: | ||
14634 | // Don't display this one, we handle it at a lower level | ||
14635 | break; | ||
14636 | |||
14637 | case PacketType.AgentHeightWidth: | ||
14638 | // TODO: handle this packet | ||
14639 | //m_log.Warn("[CLIENT]: unhandled AgentHeightWidth packet"); | ||
14640 | break; | ||
14641 | |||
14642 | case PacketType.InventoryDescendents: | ||
14643 | // TODO: handle this packet | ||
14644 | //m_log.Warn("[CLIENT]: unhandled InventoryDescent packet"); | ||
14645 | |||
14646 | break; | ||
14647 | |||
14648 | case PacketType.DirPlacesQuery: | ||
14649 | DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack; | ||
14650 | //m_log.Debug(dirPlacesQueryPacket.ToString()); | ||
14651 | |||
14652 | #region Packet Session and User Check | ||
14653 | if (m_checkPackets) | ||
14654 | { | ||
14655 | if (dirPlacesQueryPacket.AgentData.SessionID != SessionId || | ||
14656 | dirPlacesQueryPacket.AgentData.AgentID != AgentId) | ||
14657 | break; | ||
14658 | } | ||
14659 | #endregion | ||
14660 | |||
14661 | DirPlacesQuery handlerDirPlacesQuery = OnDirPlacesQuery; | ||
14662 | if (handlerDirPlacesQuery != null) | ||
14663 | { | ||
14664 | handlerDirPlacesQuery(this, | ||
14665 | dirPlacesQueryPacket.QueryData.QueryID, | ||
14666 | Utils.BytesToString( | ||
14667 | dirPlacesQueryPacket.QueryData.QueryText), | ||
14668 | (int)dirPlacesQueryPacket.QueryData.QueryFlags, | ||
14669 | (int)dirPlacesQueryPacket.QueryData.Category, | ||
14670 | Utils.BytesToString( | ||
14671 | dirPlacesQueryPacket.QueryData.SimName), | ||
14672 | dirPlacesQueryPacket.QueryData.QueryStart); | ||
14673 | } | ||
14674 | break; | ||
14675 | |||
14676 | case PacketType.DirFindQuery: | ||
14677 | DirFindQueryPacket dirFindQueryPacket = (DirFindQueryPacket)Pack; | ||
14678 | |||
14679 | #region Packet Session and User Check | ||
14680 | if (m_checkPackets) | ||
14681 | { | ||
14682 | if (dirFindQueryPacket.AgentData.SessionID != SessionId || | ||
14683 | dirFindQueryPacket.AgentData.AgentID != AgentId) | ||
14684 | break; | ||
14685 | } | ||
14686 | #endregion | ||
14687 | |||
14688 | DirFindQuery handlerDirFindQuery = OnDirFindQuery; | ||
14689 | if (handlerDirFindQuery != null) | ||
14690 | { | ||
14691 | handlerDirFindQuery(this, | ||
14692 | dirFindQueryPacket.QueryData.QueryID, | ||
14693 | Utils.BytesToString( | ||
14694 | dirFindQueryPacket.QueryData.QueryText), | ||
14695 | dirFindQueryPacket.QueryData.QueryFlags, | ||
14696 | dirFindQueryPacket.QueryData.QueryStart); | ||
14697 | } | ||
14698 | break; | ||
14699 | |||
14700 | case PacketType.DirLandQuery: | ||
14701 | DirLandQueryPacket dirLandQueryPacket = (DirLandQueryPacket)Pack; | ||
14702 | |||
14703 | #region Packet Session and User Check | ||
14704 | if (m_checkPackets) | ||
14705 | { | ||
14706 | if (dirLandQueryPacket.AgentData.SessionID != SessionId || | ||
14707 | dirLandQueryPacket.AgentData.AgentID != AgentId) | ||
14708 | break; | ||
14709 | } | ||
14710 | #endregion | ||
14711 | |||
14712 | DirLandQuery handlerDirLandQuery = OnDirLandQuery; | ||
14713 | if (handlerDirLandQuery != null) | ||
14714 | { | ||
14715 | handlerDirLandQuery(this, | ||
14716 | dirLandQueryPacket.QueryData.QueryID, | ||
14717 | dirLandQueryPacket.QueryData.QueryFlags, | ||
14718 | dirLandQueryPacket.QueryData.SearchType, | ||
14719 | dirLandQueryPacket.QueryData.Price, | ||
14720 | dirLandQueryPacket.QueryData.Area, | ||
14721 | dirLandQueryPacket.QueryData.QueryStart); | ||
14722 | } | ||
14723 | break; | ||
14724 | |||
14725 | case PacketType.DirPopularQuery: | ||
14726 | DirPopularQueryPacket dirPopularQueryPacket = (DirPopularQueryPacket)Pack; | ||
14727 | |||
14728 | #region Packet Session and User Check | ||
14729 | if (m_checkPackets) | ||
14730 | { | ||
14731 | if (dirPopularQueryPacket.AgentData.SessionID != SessionId || | ||
14732 | dirPopularQueryPacket.AgentData.AgentID != AgentId) | ||
14733 | break; | ||
14734 | } | ||
14735 | #endregion | ||
14736 | |||
14737 | DirPopularQuery handlerDirPopularQuery = OnDirPopularQuery; | ||
14738 | if (handlerDirPopularQuery != null) | ||
14739 | { | ||
14740 | handlerDirPopularQuery(this, | ||
14741 | dirPopularQueryPacket.QueryData.QueryID, | ||
14742 | dirPopularQueryPacket.QueryData.QueryFlags); | ||
14743 | } | ||
14744 | break; | ||
14745 | |||
14746 | case PacketType.DirClassifiedQuery: | ||
14747 | DirClassifiedQueryPacket dirClassifiedQueryPacket = (DirClassifiedQueryPacket)Pack; | ||
14748 | |||
14749 | #region Packet Session and User Check | ||
14750 | if (m_checkPackets) | ||
14751 | { | ||
14752 | if (dirClassifiedQueryPacket.AgentData.SessionID != SessionId || | ||
14753 | dirClassifiedQueryPacket.AgentData.AgentID != AgentId) | ||
14754 | break; | ||
14755 | } | ||
14756 | #endregion | ||
14757 | |||
14758 | DirClassifiedQuery handlerDirClassifiedQuery = OnDirClassifiedQuery; | ||
14759 | if (handlerDirClassifiedQuery != null) | ||
14760 | { | ||
14761 | handlerDirClassifiedQuery(this, | ||
14762 | dirClassifiedQueryPacket.QueryData.QueryID, | ||
14763 | Utils.BytesToString( | ||
14764 | dirClassifiedQueryPacket.QueryData.QueryText), | ||
14765 | dirClassifiedQueryPacket.QueryData.QueryFlags, | ||
14766 | dirClassifiedQueryPacket.QueryData.Category, | ||
14767 | dirClassifiedQueryPacket.QueryData.QueryStart); | ||
14768 | } | ||
14769 | break; | ||
14770 | |||
14771 | case PacketType.EventInfoRequest: | ||
14772 | EventInfoRequestPacket eventInfoRequestPacket = (EventInfoRequestPacket)Pack; | ||
14773 | |||
14774 | #region Packet Session and User Check | ||
14775 | if (m_checkPackets) | ||
14776 | { | ||
14777 | if (eventInfoRequestPacket.AgentData.SessionID != SessionId || | ||
14778 | eventInfoRequestPacket.AgentData.AgentID != AgentId) | ||
14779 | break; | ||
14780 | } | ||
14781 | #endregion | ||
14782 | |||
14783 | if (OnEventInfoRequest != null) | ||
14784 | { | ||
14785 | OnEventInfoRequest(this, eventInfoRequestPacket.EventData.EventID); | ||
14786 | } | ||
14787 | break; | ||
14788 | |||
14789 | //#region Calling Card | ||
14790 | |||
14791 | case PacketType.OfferCallingCard: | ||
14792 | OfferCallingCardPacket offerCallingCardPacket = (OfferCallingCardPacket)Pack; | ||
14793 | |||
14794 | #region Packet Session and User Check | ||
14795 | if (m_checkPackets) | ||
14796 | { | ||
14797 | if (offerCallingCardPacket.AgentData.SessionID != SessionId || | ||
14798 | offerCallingCardPacket.AgentData.AgentID != AgentId) | ||
14799 | break; | ||
14800 | } | ||
14801 | #endregion | ||
14802 | |||
14803 | if (OnOfferCallingCard != null) | ||
14804 | { | ||
14805 | OnOfferCallingCard(this, | ||
14806 | offerCallingCardPacket.AgentBlock.DestID, | ||
14807 | offerCallingCardPacket.AgentBlock.TransactionID); | ||
14808 | } | ||
14809 | break; | ||
14810 | |||
14811 | case PacketType.AcceptCallingCard: | ||
14812 | AcceptCallingCardPacket acceptCallingCardPacket = (AcceptCallingCardPacket)Pack; | ||
14813 | |||
14814 | #region Packet Session and User Check | ||
14815 | if (m_checkPackets) | ||
14816 | { | ||
14817 | if (acceptCallingCardPacket.AgentData.SessionID != SessionId || | ||
14818 | acceptCallingCardPacket.AgentData.AgentID != AgentId) | ||
14819 | break; | ||
14820 | } | ||
14821 | #endregion | ||
14822 | |||
14823 | // according to http://wiki.secondlife.com/wiki/AcceptCallingCard FolderData should | ||
14824 | // contain exactly one entry | ||
14825 | if (OnAcceptCallingCard != null && acceptCallingCardPacket.FolderData.Length > 0) | ||
14826 | { | ||
14827 | OnAcceptCallingCard(this, | ||
14828 | acceptCallingCardPacket.TransactionBlock.TransactionID, | ||
14829 | acceptCallingCardPacket.FolderData[0].FolderID); | ||
14830 | } | ||
14831 | break; | ||
14832 | |||
14833 | case PacketType.DeclineCallingCard: | ||
14834 | DeclineCallingCardPacket declineCallingCardPacket = (DeclineCallingCardPacket)Pack; | ||
14835 | |||
14836 | #region Packet Session and User Check | ||
14837 | if (m_checkPackets) | ||
14838 | { | ||
14839 | if (declineCallingCardPacket.AgentData.SessionID != SessionId || | ||
14840 | declineCallingCardPacket.AgentData.AgentID != AgentId) | ||
14841 | break; | ||
14842 | } | ||
14843 | #endregion | ||
14844 | |||
14845 | if (OnDeclineCallingCard != null) | ||
14846 | { | ||
14847 | OnDeclineCallingCard(this, | ||
14848 | declineCallingCardPacket.TransactionBlock.TransactionID); | ||
14849 | } | ||
14850 | break; | ||
14851 | //#endregion | ||
14852 | |||
14853 | //#region Groups | ||
14854 | case PacketType.ActivateGroup: | ||
14855 | ActivateGroupPacket activateGroupPacket = (ActivateGroupPacket)Pack; | ||
14856 | |||
14857 | #region Packet Session and User Check | ||
14858 | if (m_checkPackets) | ||
14859 | { | ||
14860 | if (activateGroupPacket.AgentData.SessionID != SessionId || | ||
14861 | activateGroupPacket.AgentData.AgentID != AgentId) | ||
14862 | break; | ||
14863 | } | ||
14864 | #endregion | ||
14865 | |||
14866 | if (m_GroupsModule != null) | ||
14867 | { | ||
14868 | m_GroupsModule.ActivateGroup(this, activateGroupPacket.AgentData.GroupID); | ||
14869 | m_GroupsModule.SendAgentGroupDataUpdate(this); | ||
14870 | } | ||
14871 | break; | ||
14872 | |||
14873 | |||
14874 | case PacketType.GroupTitlesRequest: | ||
14875 | GroupTitlesRequestPacket groupTitlesRequest = | ||
14876 | (GroupTitlesRequestPacket)Pack; | ||
14877 | |||
14878 | #region Packet Session and User Check | ||
14879 | if (m_checkPackets) | ||
14880 | { | ||
14881 | if (groupTitlesRequest.AgentData.SessionID != SessionId || | ||
14882 | groupTitlesRequest.AgentData.AgentID != AgentId) | ||
14883 | break; | ||
14884 | } | ||
14885 | #endregion | ||
14886 | |||
14887 | if (m_GroupsModule != null) | ||
14888 | { | ||
14889 | GroupTitlesReplyPacket groupTitlesReply = (GroupTitlesReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupTitlesReply); | ||
14890 | |||
14891 | groupTitlesReply.AgentData = | ||
14892 | new GroupTitlesReplyPacket.AgentDataBlock(); | ||
14893 | |||
14894 | groupTitlesReply.AgentData.AgentID = AgentId; | ||
14895 | groupTitlesReply.AgentData.GroupID = | ||
14896 | groupTitlesRequest.AgentData.GroupID; | ||
14897 | |||
14898 | groupTitlesReply.AgentData.RequestID = | ||
14899 | groupTitlesRequest.AgentData.RequestID; | ||
14900 | |||
14901 | List<GroupTitlesData> titles = | ||
14902 | m_GroupsModule.GroupTitlesRequest(this, | ||
14903 | groupTitlesRequest.AgentData.GroupID); | ||
14904 | |||
14905 | groupTitlesReply.GroupData = | ||
14906 | new GroupTitlesReplyPacket.GroupDataBlock[titles.Count]; | ||
14907 | |||
14908 | int i = 0; | ||
14909 | foreach (GroupTitlesData d in titles) | ||
14910 | { | ||
14911 | groupTitlesReply.GroupData[i] = | ||
14912 | new GroupTitlesReplyPacket.GroupDataBlock(); | ||
14913 | |||
14914 | groupTitlesReply.GroupData[i].Title = | ||
14915 | Util.StringToBytes256(d.Name); | ||
14916 | groupTitlesReply.GroupData[i].RoleID = | ||
14917 | d.UUID; | ||
14918 | groupTitlesReply.GroupData[i].Selected = | ||
14919 | d.Selected; | ||
14920 | i++; | ||
14921 | } | ||
14922 | |||
14923 | OutPacket(groupTitlesReply, ThrottleOutPacketType.Task); | ||
14924 | } | ||
14925 | break; | ||
14926 | |||
14927 | case PacketType.GroupProfileRequest: | ||
14928 | GroupProfileRequestPacket groupProfileRequest = | ||
14929 | (GroupProfileRequestPacket)Pack; | ||
14930 | |||
14931 | #region Packet Session and User Check | ||
14932 | if (m_checkPackets) | ||
14933 | { | ||
14934 | if (groupProfileRequest.AgentData.SessionID != SessionId || | ||
14935 | groupProfileRequest.AgentData.AgentID != AgentId) | ||
14936 | break; | ||
14937 | } | ||
14938 | #endregion | ||
14939 | |||
14940 | if (m_GroupsModule != null) | ||
14941 | { | ||
14942 | GroupProfileReplyPacket groupProfileReply = (GroupProfileReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupProfileReply); | ||
14943 | |||
14944 | groupProfileReply.AgentData = new GroupProfileReplyPacket.AgentDataBlock(); | ||
14945 | groupProfileReply.GroupData = new GroupProfileReplyPacket.GroupDataBlock(); | ||
14946 | groupProfileReply.AgentData.AgentID = AgentId; | ||
14947 | |||
14948 | GroupProfileData d = m_GroupsModule.GroupProfileRequest(this, | ||
14949 | groupProfileRequest.GroupData.GroupID); | ||
14950 | |||
14951 | groupProfileReply.GroupData.GroupID = d.GroupID; | ||
14952 | groupProfileReply.GroupData.Name = Util.StringToBytes256(d.Name); | ||
14953 | groupProfileReply.GroupData.Charter = Util.StringToBytes1024(d.Charter); | ||
14954 | groupProfileReply.GroupData.ShowInList = d.ShowInList; | ||
14955 | groupProfileReply.GroupData.MemberTitle = Util.StringToBytes256(d.MemberTitle); | ||
14956 | groupProfileReply.GroupData.PowersMask = d.PowersMask; | ||
14957 | groupProfileReply.GroupData.InsigniaID = d.InsigniaID; | ||
14958 | groupProfileReply.GroupData.FounderID = d.FounderID; | ||
14959 | groupProfileReply.GroupData.MembershipFee = d.MembershipFee; | ||
14960 | groupProfileReply.GroupData.OpenEnrollment = d.OpenEnrollment; | ||
14961 | groupProfileReply.GroupData.Money = d.Money; | ||
14962 | groupProfileReply.GroupData.GroupMembershipCount = d.GroupMembershipCount; | ||
14963 | groupProfileReply.GroupData.GroupRolesCount = d.GroupRolesCount; | ||
14964 | groupProfileReply.GroupData.AllowPublish = d.AllowPublish; | ||
14965 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; | ||
14966 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; | ||
14967 | |||
14968 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); | ||
14969 | } | ||
14970 | break; | ||
14971 | |||
14972 | case PacketType.GroupMembersRequest: | ||
14973 | GroupMembersRequestPacket groupMembersRequestPacket = | ||
14974 | (GroupMembersRequestPacket)Pack; | ||
14975 | |||
14976 | #region Packet Session and User Check | ||
14977 | if (m_checkPackets) | ||
14978 | { | ||
14979 | if (groupMembersRequestPacket.AgentData.SessionID != SessionId || | ||
14980 | groupMembersRequestPacket.AgentData.AgentID != AgentId) | ||
14981 | break; | ||
14982 | } | ||
14983 | #endregion | ||
14984 | |||
14985 | if (m_GroupsModule != null) | ||
14986 | { | ||
14987 | List<GroupMembersData> members = | ||
14988 | m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID); | ||
14989 | |||
14990 | int memberCount = members.Count; | ||
14991 | |||
14992 | while (true) | ||
14993 | { | ||
14994 | int blockCount = members.Count; | ||
14995 | if (blockCount > 40) | ||
14996 | blockCount = 40; | ||
14997 | |||
14998 | GroupMembersReplyPacket groupMembersReply = (GroupMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupMembersReply); | ||
14999 | |||
15000 | groupMembersReply.AgentData = | ||
15001 | new GroupMembersReplyPacket.AgentDataBlock(); | ||
15002 | groupMembersReply.GroupData = | ||
15003 | new GroupMembersReplyPacket.GroupDataBlock(); | ||
15004 | groupMembersReply.MemberData = | ||
15005 | new GroupMembersReplyPacket.MemberDataBlock[ | ||
15006 | blockCount]; | ||
15007 | |||
15008 | groupMembersReply.AgentData.AgentID = AgentId; | ||
15009 | groupMembersReply.GroupData.GroupID = | ||
15010 | groupMembersRequestPacket.GroupData.GroupID; | ||
15011 | groupMembersReply.GroupData.RequestID = | ||
15012 | groupMembersRequestPacket.GroupData.RequestID; | ||
15013 | groupMembersReply.GroupData.MemberCount = memberCount; | ||
15014 | |||
15015 | for (int i = 0; i < blockCount; i++) | ||
15016 | { | ||
15017 | GroupMembersData m = members[0]; | ||
15018 | members.RemoveAt(0); | ||
15019 | |||
15020 | groupMembersReply.MemberData[i] = | ||
15021 | new GroupMembersReplyPacket.MemberDataBlock(); | ||
15022 | groupMembersReply.MemberData[i].AgentID = | ||
15023 | m.AgentID; | ||
15024 | groupMembersReply.MemberData[i].Contribution = | ||
15025 | m.Contribution; | ||
15026 | groupMembersReply.MemberData[i].OnlineStatus = | ||
15027 | Util.StringToBytes256(m.OnlineStatus); | ||
15028 | groupMembersReply.MemberData[i].AgentPowers = | ||
15029 | m.AgentPowers; | ||
15030 | groupMembersReply.MemberData[i].Title = | ||
15031 | Util.StringToBytes256(m.Title); | ||
15032 | groupMembersReply.MemberData[i].IsOwner = | ||
15033 | m.IsOwner; | ||
15034 | } | ||
15035 | OutPacket(groupMembersReply, ThrottleOutPacketType.Task); | ||
15036 | if (members.Count == 0) | ||
15037 | break; | ||
15038 | } | ||
15039 | } | ||
15040 | break; | ||
15041 | |||
15042 | case PacketType.GroupRoleDataRequest: | ||
15043 | GroupRoleDataRequestPacket groupRolesRequest = | ||
15044 | (GroupRoleDataRequestPacket)Pack; | ||
15045 | |||
15046 | #region Packet Session and User Check | ||
15047 | if (m_checkPackets) | ||
15048 | { | ||
15049 | if (groupRolesRequest.AgentData.SessionID != SessionId || | ||
15050 | groupRolesRequest.AgentData.AgentID != AgentId) | ||
15051 | break; | ||
15052 | } | ||
15053 | #endregion | ||
15054 | |||
15055 | if (m_GroupsModule != null) | ||
15056 | { | ||
15057 | GroupRoleDataReplyPacket groupRolesReply = (GroupRoleDataReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleDataReply); | ||
15058 | |||
15059 | groupRolesReply.AgentData = | ||
15060 | new GroupRoleDataReplyPacket.AgentDataBlock(); | ||
15061 | |||
15062 | groupRolesReply.AgentData.AgentID = AgentId; | ||
15063 | |||
15064 | groupRolesReply.GroupData = | ||
15065 | new GroupRoleDataReplyPacket.GroupDataBlock(); | ||
15066 | |||
15067 | groupRolesReply.GroupData.GroupID = | ||
15068 | groupRolesRequest.GroupData.GroupID; | ||
15069 | |||
15070 | groupRolesReply.GroupData.RequestID = | ||
15071 | groupRolesRequest.GroupData.RequestID; | ||
15072 | |||
15073 | List<GroupRolesData> titles = | ||
15074 | m_GroupsModule.GroupRoleDataRequest(this, | ||
15075 | groupRolesRequest.GroupData.GroupID); | ||
15076 | |||
15077 | groupRolesReply.GroupData.RoleCount = | ||
15078 | titles.Count; | ||
15079 | |||
15080 | groupRolesReply.RoleData = | ||
15081 | new GroupRoleDataReplyPacket.RoleDataBlock[titles.Count]; | ||
15082 | |||
15083 | int i = 0; | ||
15084 | foreach (GroupRolesData d in titles) | ||
15085 | { | ||
15086 | groupRolesReply.RoleData[i] = | ||
15087 | new GroupRoleDataReplyPacket.RoleDataBlock(); | ||
15088 | |||
15089 | groupRolesReply.RoleData[i].RoleID = | ||
15090 | d.RoleID; | ||
15091 | groupRolesReply.RoleData[i].Name = | ||
15092 | Util.StringToBytes256(d.Name); | ||
15093 | groupRolesReply.RoleData[i].Title = | ||
15094 | Util.StringToBytes256(d.Title); | ||
15095 | groupRolesReply.RoleData[i].Description = | ||
15096 | Util.StringToBytes1024(d.Description); | ||
15097 | groupRolesReply.RoleData[i].Powers = | ||
15098 | d.Powers; | ||
15099 | groupRolesReply.RoleData[i].Members = | ||
15100 | (uint)d.Members; | ||
15101 | |||
15102 | i++; | ||
15103 | } | ||
15104 | |||
15105 | OutPacket(groupRolesReply, ThrottleOutPacketType.Task); | ||
15106 | } | ||
15107 | break; | ||
15108 | |||
15109 | case PacketType.GroupRoleMembersRequest: | ||
15110 | GroupRoleMembersRequestPacket groupRoleMembersRequest = | ||
15111 | (GroupRoleMembersRequestPacket)Pack; | ||
15112 | |||
15113 | #region Packet Session and User Check | ||
15114 | if (m_checkPackets) | ||
15115 | { | ||
15116 | if (groupRoleMembersRequest.AgentData.SessionID != SessionId || | ||
15117 | groupRoleMembersRequest.AgentData.AgentID != AgentId) | ||
15118 | break; | ||
15119 | } | ||
15120 | #endregion | ||
15121 | |||
15122 | if (m_GroupsModule != null) | ||
15123 | { | ||
15124 | List<GroupRoleMembersData> mappings = | ||
15125 | m_GroupsModule.GroupRoleMembersRequest(this, | ||
15126 | groupRoleMembersRequest.GroupData.GroupID); | ||
15127 | |||
15128 | int mappingsCount = mappings.Count; | ||
15129 | |||
15130 | while (mappings.Count > 0) | ||
15131 | { | ||
15132 | int pairs = mappings.Count; | ||
15133 | if (pairs > 32) | ||
15134 | pairs = 32; | ||
15135 | |||
15136 | GroupRoleMembersReplyPacket groupRoleMembersReply = (GroupRoleMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleMembersReply); | ||
15137 | groupRoleMembersReply.AgentData = | ||
15138 | new GroupRoleMembersReplyPacket.AgentDataBlock(); | ||
15139 | groupRoleMembersReply.AgentData.AgentID = | ||
15140 | AgentId; | ||
15141 | groupRoleMembersReply.AgentData.GroupID = | ||
15142 | groupRoleMembersRequest.GroupData.GroupID; | ||
15143 | groupRoleMembersReply.AgentData.RequestID = | ||
15144 | groupRoleMembersRequest.GroupData.RequestID; | ||
15145 | |||
15146 | groupRoleMembersReply.AgentData.TotalPairs = | ||
15147 | (uint)mappingsCount; | ||
15148 | |||
15149 | groupRoleMembersReply.MemberData = | ||
15150 | new GroupRoleMembersReplyPacket.MemberDataBlock[pairs]; | ||
15151 | |||
15152 | for (int i = 0; i < pairs; i++) | ||
15153 | { | ||
15154 | GroupRoleMembersData d = mappings[0]; | ||
15155 | mappings.RemoveAt(0); | ||
15156 | |||
15157 | groupRoleMembersReply.MemberData[i] = | ||
15158 | new GroupRoleMembersReplyPacket.MemberDataBlock(); | ||
15159 | |||
15160 | groupRoleMembersReply.MemberData[i].RoleID = | ||
15161 | d.RoleID; | ||
15162 | groupRoleMembersReply.MemberData[i].MemberID = | ||
15163 | d.MemberID; | ||
15164 | } | ||
15165 | |||
15166 | OutPacket(groupRoleMembersReply, ThrottleOutPacketType.Task); | ||
15167 | } | ||
15168 | } | ||
15169 | break; | ||
15170 | |||
15171 | case PacketType.CreateGroupRequest: | ||
15172 | CreateGroupRequestPacket createGroupRequest = | ||
15173 | (CreateGroupRequestPacket)Pack; | ||
15174 | |||
15175 | #region Packet Session and User Check | ||
15176 | if (m_checkPackets) | ||
15177 | { | ||
15178 | if (createGroupRequest.AgentData.SessionID != SessionId || | ||
15179 | createGroupRequest.AgentData.AgentID != AgentId) | ||
15180 | break; | ||
15181 | } | ||
15182 | #endregion | ||
15183 | |||
15184 | if (m_GroupsModule != null) | ||
15185 | { | ||
15186 | m_GroupsModule.CreateGroup(this, | ||
15187 | Utils.BytesToString(createGroupRequest.GroupData.Name), | ||
15188 | Utils.BytesToString(createGroupRequest.GroupData.Charter), | ||
15189 | createGroupRequest.GroupData.ShowInList, | ||
15190 | createGroupRequest.GroupData.InsigniaID, | ||
15191 | createGroupRequest.GroupData.MembershipFee, | ||
15192 | createGroupRequest.GroupData.OpenEnrollment, | ||
15193 | createGroupRequest.GroupData.AllowPublish, | ||
15194 | createGroupRequest.GroupData.MaturePublish); | ||
15195 | } | ||
15196 | break; | ||
15197 | |||
15198 | case PacketType.UpdateGroupInfo: | ||
15199 | UpdateGroupInfoPacket updateGroupInfo = | ||
15200 | (UpdateGroupInfoPacket)Pack; | ||
15201 | |||
15202 | #region Packet Session and User Check | ||
15203 | if (m_checkPackets) | ||
15204 | { | ||
15205 | if (updateGroupInfo.AgentData.SessionID != SessionId || | ||
15206 | updateGroupInfo.AgentData.AgentID != AgentId) | ||
15207 | break; | ||
15208 | } | ||
15209 | #endregion | ||
15210 | |||
15211 | if (m_GroupsModule != null) | ||
15212 | { | ||
15213 | m_GroupsModule.UpdateGroupInfo(this, | ||
15214 | updateGroupInfo.GroupData.GroupID, | ||
15215 | Utils.BytesToString(updateGroupInfo.GroupData.Charter), | ||
15216 | updateGroupInfo.GroupData.ShowInList, | ||
15217 | updateGroupInfo.GroupData.InsigniaID, | ||
15218 | updateGroupInfo.GroupData.MembershipFee, | ||
15219 | updateGroupInfo.GroupData.OpenEnrollment, | ||
15220 | updateGroupInfo.GroupData.AllowPublish, | ||
15221 | updateGroupInfo.GroupData.MaturePublish); | ||
15222 | } | ||
15223 | |||
15224 | break; | ||
15225 | |||
15226 | case PacketType.SetGroupAcceptNotices: | ||
15227 | SetGroupAcceptNoticesPacket setGroupAcceptNotices = | ||
15228 | (SetGroupAcceptNoticesPacket)Pack; | ||
15229 | |||
15230 | #region Packet Session and User Check | ||
15231 | if (m_checkPackets) | ||
15232 | { | ||
15233 | if (setGroupAcceptNotices.AgentData.SessionID != SessionId || | ||
15234 | setGroupAcceptNotices.AgentData.AgentID != AgentId) | ||
15235 | break; | ||
15236 | } | ||
15237 | #endregion | ||
15238 | |||
15239 | if (m_GroupsModule != null) | ||
15240 | { | ||
15241 | m_GroupsModule.SetGroupAcceptNotices(this, | ||
15242 | setGroupAcceptNotices.Data.GroupID, | ||
15243 | setGroupAcceptNotices.Data.AcceptNotices, | ||
15244 | setGroupAcceptNotices.NewData.ListInProfile); | ||
15245 | } | ||
15246 | |||
15247 | break; | ||
15248 | |||
15249 | case PacketType.GroupTitleUpdate: | ||
15250 | GroupTitleUpdatePacket groupTitleUpdate = | ||
15251 | (GroupTitleUpdatePacket)Pack; | ||
15252 | |||
15253 | #region Packet Session and User Check | ||
15254 | if (m_checkPackets) | ||
15255 | { | ||
15256 | if (groupTitleUpdate.AgentData.SessionID != SessionId || | ||
15257 | groupTitleUpdate.AgentData.AgentID != AgentId) | ||
15258 | break; | ||
15259 | } | ||
15260 | #endregion | ||
15261 | |||
15262 | if (m_GroupsModule != null) | ||
15263 | { | ||
15264 | m_GroupsModule.GroupTitleUpdate(this, | ||
15265 | groupTitleUpdate.AgentData.GroupID, | ||
15266 | groupTitleUpdate.AgentData.TitleRoleID); | ||
15267 | } | ||
15268 | |||
15269 | break; | ||
15270 | |||
15271 | |||
15272 | case PacketType.ParcelDeedToGroup: | ||
15273 | ParcelDeedToGroupPacket parcelDeedToGroup = (ParcelDeedToGroupPacket)Pack; | ||
15274 | if (m_GroupsModule != null) | ||
15275 | { | ||
15276 | ParcelDeedToGroup handlerParcelDeedToGroup = OnParcelDeedToGroup; | ||
15277 | if (handlerParcelDeedToGroup != null) | ||
15278 | { | ||
15279 | handlerParcelDeedToGroup(parcelDeedToGroup.Data.LocalID, parcelDeedToGroup.Data.GroupID, this); | ||
15280 | |||
15281 | } | ||
15282 | } | ||
15283 | |||
15284 | break; | ||
15285 | |||
15286 | |||
15287 | case PacketType.GroupNoticesListRequest: | ||
15288 | GroupNoticesListRequestPacket groupNoticesListRequest = | ||
15289 | (GroupNoticesListRequestPacket)Pack; | ||
15290 | |||
15291 | #region Packet Session and User Check | ||
15292 | if (m_checkPackets) | ||
15293 | { | ||
15294 | if (groupNoticesListRequest.AgentData.SessionID != SessionId || | ||
15295 | groupNoticesListRequest.AgentData.AgentID != AgentId) | ||
15296 | break; | ||
15297 | } | ||
15298 | #endregion | ||
15299 | |||
15300 | if (m_GroupsModule != null) | ||
15301 | { | ||
15302 | GroupNoticeData[] gn = | ||
15303 | m_GroupsModule.GroupNoticesListRequest(this, | ||
15304 | groupNoticesListRequest.Data.GroupID); | ||
15305 | |||
15306 | GroupNoticesListReplyPacket groupNoticesListReply = (GroupNoticesListReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupNoticesListReply); | ||
15307 | groupNoticesListReply.AgentData = | ||
15308 | new GroupNoticesListReplyPacket.AgentDataBlock(); | ||
15309 | groupNoticesListReply.AgentData.AgentID = AgentId; | ||
15310 | groupNoticesListReply.AgentData.GroupID = groupNoticesListRequest.Data.GroupID; | ||
15311 | |||
15312 | groupNoticesListReply.Data = new GroupNoticesListReplyPacket.DataBlock[gn.Length]; | ||
15313 | |||
15314 | int i = 0; | ||
15315 | foreach (GroupNoticeData g in gn) | ||
15316 | { | ||
15317 | groupNoticesListReply.Data[i] = new GroupNoticesListReplyPacket.DataBlock(); | ||
15318 | groupNoticesListReply.Data[i].NoticeID = | ||
15319 | g.NoticeID; | ||
15320 | groupNoticesListReply.Data[i].Timestamp = | ||
15321 | g.Timestamp; | ||
15322 | groupNoticesListReply.Data[i].FromName = | ||
15323 | Util.StringToBytes256(g.FromName); | ||
15324 | groupNoticesListReply.Data[i].Subject = | ||
15325 | Util.StringToBytes256(g.Subject); | ||
15326 | groupNoticesListReply.Data[i].HasAttachment = | ||
15327 | g.HasAttachment; | ||
15328 | groupNoticesListReply.Data[i].AssetType = | ||
15329 | g.AssetType; | ||
15330 | i++; | ||
15331 | } | ||
15332 | |||
15333 | OutPacket(groupNoticesListReply, ThrottleOutPacketType.Task); | ||
15334 | } | ||
15335 | |||
15336 | break; | ||
15337 | |||
15338 | case PacketType.GroupNoticeRequest: | ||
15339 | GroupNoticeRequestPacket groupNoticeRequest = | ||
15340 | (GroupNoticeRequestPacket)Pack; | ||
15341 | |||
15342 | #region Packet Session and User Check | ||
15343 | if (m_checkPackets) | ||
15344 | { | ||
15345 | if (groupNoticeRequest.AgentData.SessionID != SessionId || | ||
15346 | groupNoticeRequest.AgentData.AgentID != AgentId) | ||
15347 | break; | ||
15348 | } | ||
15349 | #endregion | ||
15350 | |||
15351 | if (m_GroupsModule != null) | ||
15352 | { | ||
15353 | m_GroupsModule.GroupNoticeRequest(this, | ||
15354 | groupNoticeRequest.Data.GroupNoticeID); | ||
15355 | } | ||
15356 | break; | ||
15357 | |||
15358 | case PacketType.GroupRoleUpdate: | ||
15359 | GroupRoleUpdatePacket groupRoleUpdate = | ||
15360 | (GroupRoleUpdatePacket)Pack; | ||
15361 | |||
15362 | #region Packet Session and User Check | ||
15363 | if (m_checkPackets) | ||
15364 | { | ||
15365 | if (groupRoleUpdate.AgentData.SessionID != SessionId || | ||
15366 | groupRoleUpdate.AgentData.AgentID != AgentId) | ||
15367 | break; | ||
15368 | } | ||
15369 | #endregion | ||
15370 | |||
15371 | if (m_GroupsModule != null) | ||
15372 | { | ||
15373 | foreach (GroupRoleUpdatePacket.RoleDataBlock d in | ||
15374 | groupRoleUpdate.RoleData) | ||
15375 | { | ||
15376 | m_GroupsModule.GroupRoleUpdate(this, | ||
15377 | groupRoleUpdate.AgentData.GroupID, | ||
15378 | d.RoleID, | ||
15379 | Utils.BytesToString(d.Name), | ||
15380 | Utils.BytesToString(d.Description), | ||
15381 | Utils.BytesToString(d.Title), | ||
15382 | d.Powers, | ||
15383 | d.UpdateType); | ||
15384 | } | ||
15385 | m_GroupsModule.NotifyChange(groupRoleUpdate.AgentData.GroupID); | ||
15386 | } | ||
15387 | break; | ||
15388 | |||
15389 | case PacketType.GroupRoleChanges: | ||
15390 | GroupRoleChangesPacket groupRoleChanges = | ||
15391 | (GroupRoleChangesPacket)Pack; | ||
15392 | |||
15393 | #region Packet Session and User Check | ||
15394 | if (m_checkPackets) | ||
15395 | { | ||
15396 | if (groupRoleChanges.AgentData.SessionID != SessionId || | ||
15397 | groupRoleChanges.AgentData.AgentID != AgentId) | ||
15398 | break; | ||
15399 | } | ||
15400 | #endregion | ||
15401 | |||
15402 | if (m_GroupsModule != null) | ||
15403 | { | ||
15404 | foreach (GroupRoleChangesPacket.RoleChangeBlock d in | ||
15405 | groupRoleChanges.RoleChange) | ||
15406 | { | ||
15407 | m_GroupsModule.GroupRoleChanges(this, | ||
15408 | groupRoleChanges.AgentData.GroupID, | ||
15409 | d.RoleID, | ||
15410 | d.MemberID, | ||
15411 | d.Change); | ||
15412 | } | ||
15413 | m_GroupsModule.NotifyChange(groupRoleChanges.AgentData.GroupID); | ||
15414 | } | ||
15415 | break; | ||
15416 | |||
15417 | case PacketType.JoinGroupRequest: | ||
15418 | JoinGroupRequestPacket joinGroupRequest = | ||
15419 | (JoinGroupRequestPacket)Pack; | ||
15420 | |||
15421 | #region Packet Session and User Check | ||
15422 | if (m_checkPackets) | ||
15423 | { | ||
15424 | if (joinGroupRequest.AgentData.SessionID != SessionId || | ||
15425 | joinGroupRequest.AgentData.AgentID != AgentId) | ||
15426 | break; | ||
15427 | } | ||
15428 | #endregion | ||
15429 | |||
15430 | if (m_GroupsModule != null) | ||
15431 | { | ||
15432 | m_GroupsModule.JoinGroupRequest(this, | ||
15433 | joinGroupRequest.GroupData.GroupID); | ||
15434 | } | ||
15435 | break; | ||
15436 | |||
15437 | case PacketType.LeaveGroupRequest: | ||
15438 | LeaveGroupRequestPacket leaveGroupRequest = | ||
15439 | (LeaveGroupRequestPacket)Pack; | ||
15440 | |||
15441 | #region Packet Session and User Check | ||
15442 | if (m_checkPackets) | ||
15443 | { | ||
15444 | if (leaveGroupRequest.AgentData.SessionID != SessionId || | ||
15445 | leaveGroupRequest.AgentData.AgentID != AgentId) | ||
15446 | break; | ||
15447 | } | ||
15448 | #endregion | ||
15449 | |||
15450 | if (m_GroupsModule != null) | ||
15451 | { | ||
15452 | m_GroupsModule.LeaveGroupRequest(this, | ||
15453 | leaveGroupRequest.GroupData.GroupID); | ||
15454 | } | ||
15455 | break; | ||
15456 | |||
15457 | case PacketType.EjectGroupMemberRequest: | ||
15458 | EjectGroupMemberRequestPacket ejectGroupMemberRequest = | ||
15459 | (EjectGroupMemberRequestPacket)Pack; | ||
15460 | |||
15461 | #region Packet Session and User Check | ||
15462 | if (m_checkPackets) | ||
15463 | { | ||
15464 | if (ejectGroupMemberRequest.AgentData.SessionID != SessionId || | ||
15465 | ejectGroupMemberRequest.AgentData.AgentID != AgentId) | ||
15466 | break; | ||
15467 | } | ||
15468 | #endregion | ||
15469 | |||
15470 | if (m_GroupsModule != null) | ||
15471 | { | ||
15472 | foreach (EjectGroupMemberRequestPacket.EjectDataBlock e | ||
15473 | in ejectGroupMemberRequest.EjectData) | ||
15474 | { | ||
15475 | m_GroupsModule.EjectGroupMemberRequest(this, | ||
15476 | ejectGroupMemberRequest.GroupData.GroupID, | ||
15477 | e.EjecteeID); | ||
15478 | } | ||
15479 | } | ||
15480 | break; | ||
15481 | |||
15482 | case PacketType.InviteGroupRequest: | ||
15483 | InviteGroupRequestPacket inviteGroupRequest = | ||
15484 | (InviteGroupRequestPacket)Pack; | ||
15485 | |||
15486 | #region Packet Session and User Check | ||
15487 | if (m_checkPackets) | ||
15488 | { | ||
15489 | if (inviteGroupRequest.AgentData.SessionID != SessionId || | ||
15490 | inviteGroupRequest.AgentData.AgentID != AgentId) | ||
15491 | break; | ||
15492 | } | ||
15493 | #endregion | ||
15494 | |||
15495 | if (m_GroupsModule != null) | ||
15496 | { | ||
15497 | foreach (InviteGroupRequestPacket.InviteDataBlock b in | ||
15498 | inviteGroupRequest.InviteData) | ||
15499 | { | ||
15500 | m_GroupsModule.InviteGroupRequest(this, | ||
15501 | inviteGroupRequest.GroupData.GroupID, | ||
15502 | b.InviteeID, | ||
15503 | b.RoleID); | ||
15504 | } | ||
15505 | } | ||
15506 | break; | ||
15507 | |||
15508 | //#endregion | ||
15509 | |||
15510 | case PacketType.StartLure: | ||
15511 | StartLurePacket startLureRequest = (StartLurePacket)Pack; | ||
15512 | |||
15513 | #region Packet Session and User Check | ||
15514 | if (m_checkPackets) | ||
15515 | { | ||
15516 | if (startLureRequest.AgentData.SessionID != SessionId || | ||
15517 | startLureRequest.AgentData.AgentID != AgentId) | ||
15518 | break; | ||
15519 | } | ||
15520 | #endregion | ||
15521 | |||
15522 | StartLure handlerStartLure = OnStartLure; | ||
15523 | if (handlerStartLure != null) | ||
15524 | handlerStartLure(startLureRequest.Info.LureType, | ||
15525 | Utils.BytesToString( | ||
15526 | startLureRequest.Info.Message), | ||
15527 | startLureRequest.TargetData[0].TargetID, | ||
15528 | this); | ||
15529 | break; | ||
15530 | |||
15531 | case PacketType.TeleportLureRequest: | ||
15532 | TeleportLureRequestPacket teleportLureRequest = | ||
15533 | (TeleportLureRequestPacket)Pack; | ||
15534 | |||
15535 | #region Packet Session and User Check | ||
15536 | if (m_checkPackets) | ||
15537 | { | ||
15538 | if (teleportLureRequest.Info.SessionID != SessionId || | ||
15539 | teleportLureRequest.Info.AgentID != AgentId) | ||
15540 | break; | ||
15541 | } | ||
15542 | #endregion | ||
15543 | |||
15544 | TeleportLureRequest handlerTeleportLureRequest = OnTeleportLureRequest; | ||
15545 | if (handlerTeleportLureRequest != null) | ||
15546 | handlerTeleportLureRequest( | ||
15547 | teleportLureRequest.Info.LureID, | ||
15548 | teleportLureRequest.Info.TeleportFlags, | ||
15549 | this); | ||
15550 | break; | ||
15551 | |||
15552 | case PacketType.ClassifiedInfoRequest: | ||
15553 | ClassifiedInfoRequestPacket classifiedInfoRequest = | ||
15554 | (ClassifiedInfoRequestPacket)Pack; | ||
15555 | |||
15556 | #region Packet Session and User Check | ||
15557 | if (m_checkPackets) | ||
15558 | { | ||
15559 | if (classifiedInfoRequest.AgentData.SessionID != SessionId || | ||
15560 | classifiedInfoRequest.AgentData.AgentID != AgentId) | ||
15561 | break; | ||
15562 | } | ||
15563 | #endregion | ||
15564 | |||
15565 | ClassifiedInfoRequest handlerClassifiedInfoRequest = OnClassifiedInfoRequest; | ||
15566 | if (handlerClassifiedInfoRequest != null) | ||
15567 | handlerClassifiedInfoRequest( | ||
15568 | classifiedInfoRequest.Data.ClassifiedID, | ||
15569 | this); | ||
15570 | break; | ||
15571 | |||
15572 | case PacketType.ClassifiedInfoUpdate: | ||
15573 | ClassifiedInfoUpdatePacket classifiedInfoUpdate = | ||
15574 | (ClassifiedInfoUpdatePacket)Pack; | ||
15575 | |||
15576 | #region Packet Session and User Check | ||
15577 | if (m_checkPackets) | ||
15578 | { | ||
15579 | if (classifiedInfoUpdate.AgentData.SessionID != SessionId || | ||
15580 | classifiedInfoUpdate.AgentData.AgentID != AgentId) | ||
15581 | break; | ||
15582 | } | ||
15583 | #endregion | ||
15584 | |||
15585 | ClassifiedInfoUpdate handlerClassifiedInfoUpdate = OnClassifiedInfoUpdate; | ||
15586 | if (handlerClassifiedInfoUpdate != null) | ||
15587 | handlerClassifiedInfoUpdate( | ||
15588 | classifiedInfoUpdate.Data.ClassifiedID, | ||
15589 | classifiedInfoUpdate.Data.Category, | ||
15590 | Utils.BytesToString( | ||
15591 | classifiedInfoUpdate.Data.Name), | ||
15592 | Utils.BytesToString( | ||
15593 | classifiedInfoUpdate.Data.Desc), | ||
15594 | classifiedInfoUpdate.Data.ParcelID, | ||
15595 | classifiedInfoUpdate.Data.ParentEstate, | ||
15596 | classifiedInfoUpdate.Data.SnapshotID, | ||
15597 | new Vector3( | ||
15598 | classifiedInfoUpdate.Data.PosGlobal), | ||
15599 | classifiedInfoUpdate.Data.ClassifiedFlags, | ||
15600 | classifiedInfoUpdate.Data.PriceForListing, | ||
15601 | this); | ||
15602 | break; | ||
15603 | |||
15604 | case PacketType.ClassifiedDelete: | ||
15605 | ClassifiedDeletePacket classifiedDelete = | ||
15606 | (ClassifiedDeletePacket)Pack; | ||
15607 | |||
15608 | #region Packet Session and User Check | ||
15609 | if (m_checkPackets) | ||
15610 | { | ||
15611 | if (classifiedDelete.AgentData.SessionID != SessionId || | ||
15612 | classifiedDelete.AgentData.AgentID != AgentId) | ||
15613 | break; | ||
15614 | } | ||
15615 | #endregion | ||
15616 | |||
15617 | ClassifiedDelete handlerClassifiedDelete = OnClassifiedDelete; | ||
15618 | if (handlerClassifiedDelete != null) | ||
15619 | handlerClassifiedDelete( | ||
15620 | classifiedDelete.Data.ClassifiedID, | ||
15621 | this); | ||
15622 | break; | ||
15623 | |||
15624 | case PacketType.ClassifiedGodDelete: | ||
15625 | ClassifiedGodDeletePacket classifiedGodDelete = | ||
15626 | (ClassifiedGodDeletePacket)Pack; | ||
15627 | |||
15628 | #region Packet Session and User Check | ||
15629 | if (m_checkPackets) | ||
15630 | { | ||
15631 | if (classifiedGodDelete.AgentData.SessionID != SessionId || | ||
15632 | classifiedGodDelete.AgentData.AgentID != AgentId) | ||
15633 | break; | ||
15634 | } | ||
15635 | #endregion | ||
15636 | |||
15637 | ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; | ||
15638 | if (handlerClassifiedGodDelete != null) | ||
15639 | handlerClassifiedGodDelete( | ||
15640 | classifiedGodDelete.Data.ClassifiedID, | ||
15641 | this); | ||
15642 | break; | ||
15643 | |||
15644 | case PacketType.EventGodDelete: | ||
15645 | EventGodDeletePacket eventGodDelete = | ||
15646 | (EventGodDeletePacket)Pack; | ||
15647 | |||
15648 | #region Packet Session and User Check | ||
15649 | if (m_checkPackets) | ||
15650 | { | ||
15651 | if (eventGodDelete.AgentData.SessionID != SessionId || | ||
15652 | eventGodDelete.AgentData.AgentID != AgentId) | ||
15653 | break; | ||
15654 | } | ||
15655 | #endregion | ||
15656 | |||
15657 | EventGodDelete handlerEventGodDelete = OnEventGodDelete; | ||
15658 | if (handlerEventGodDelete != null) | ||
15659 | handlerEventGodDelete( | ||
15660 | eventGodDelete.EventData.EventID, | ||
15661 | eventGodDelete.QueryData.QueryID, | ||
15662 | Utils.BytesToString( | ||
15663 | eventGodDelete.QueryData.QueryText), | ||
15664 | eventGodDelete.QueryData.QueryFlags, | ||
15665 | eventGodDelete.QueryData.QueryStart, | ||
15666 | this); | ||
15667 | break; | ||
15668 | |||
15669 | case PacketType.EventNotificationAddRequest: | ||
15670 | EventNotificationAddRequestPacket eventNotificationAdd = | ||
15671 | (EventNotificationAddRequestPacket)Pack; | ||
15672 | |||
15673 | #region Packet Session and User Check | ||
15674 | if (m_checkPackets) | ||
15675 | { | ||
15676 | if (eventNotificationAdd.AgentData.SessionID != SessionId || | ||
15677 | eventNotificationAdd.AgentData.AgentID != AgentId) | ||
15678 | break; | ||
15679 | } | ||
15680 | #endregion | ||
15681 | |||
15682 | EventNotificationAddRequest handlerEventNotificationAddRequest = OnEventNotificationAddRequest; | ||
15683 | if (handlerEventNotificationAddRequest != null) | ||
15684 | handlerEventNotificationAddRequest( | ||
15685 | eventNotificationAdd.EventData.EventID, this); | ||
15686 | break; | ||
15687 | |||
15688 | case PacketType.EventNotificationRemoveRequest: | ||
15689 | EventNotificationRemoveRequestPacket eventNotificationRemove = | ||
15690 | (EventNotificationRemoveRequestPacket)Pack; | ||
15691 | |||
15692 | #region Packet Session and User Check | ||
15693 | if (m_checkPackets) | ||
15694 | { | ||
15695 | if (eventNotificationRemove.AgentData.SessionID != SessionId || | ||
15696 | eventNotificationRemove.AgentData.AgentID != AgentId) | ||
15697 | break; | ||
15698 | } | ||
15699 | #endregion | ||
15700 | |||
15701 | EventNotificationRemoveRequest handlerEventNotificationRemoveRequest = OnEventNotificationRemoveRequest; | ||
15702 | if (handlerEventNotificationRemoveRequest != null) | ||
15703 | handlerEventNotificationRemoveRequest( | ||
15704 | eventNotificationRemove.EventData.EventID, this); | ||
15705 | break; | ||
15706 | |||
15707 | case PacketType.RetrieveInstantMessages: | ||
15708 | RetrieveInstantMessagesPacket rimpInstantMessagePack = (RetrieveInstantMessagesPacket)Pack; | ||
15709 | |||
15710 | #region Packet Session and User Check | ||
15711 | if (m_checkPackets) | ||
15712 | { | ||
15713 | if (rimpInstantMessagePack.AgentData.SessionID != SessionId || | ||
15714 | rimpInstantMessagePack.AgentData.AgentID != AgentId) | ||
15715 | break; | ||
15716 | } | ||
15717 | #endregion | ||
15718 | |||
15719 | RetrieveInstantMessages handlerRetrieveInstantMessages = OnRetrieveInstantMessages; | ||
15720 | if (handlerRetrieveInstantMessages != null) | ||
15721 | handlerRetrieveInstantMessages(this); | ||
15722 | break; | ||
15723 | |||
15724 | case PacketType.PickDelete: | ||
15725 | PickDeletePacket pickDelete = | ||
15726 | (PickDeletePacket)Pack; | ||
15727 | |||
15728 | #region Packet Session and User Check | ||
15729 | if (m_checkPackets) | ||
15730 | { | ||
15731 | if (pickDelete.AgentData.SessionID != SessionId || | ||
15732 | pickDelete.AgentData.AgentID != AgentId) | ||
15733 | break; | ||
15734 | } | ||
15735 | #endregion | ||
15736 | |||
15737 | PickDelete handlerPickDelete = OnPickDelete; | ||
15738 | if (handlerPickDelete != null) | ||
15739 | handlerPickDelete(this, pickDelete.Data.PickID); | ||
15740 | break; | ||
15741 | |||
15742 | case PacketType.PickGodDelete: | ||
15743 | PickGodDeletePacket pickGodDelete = | ||
15744 | (PickGodDeletePacket)Pack; | ||
15745 | |||
15746 | #region Packet Session and User Check | ||
15747 | if (m_checkPackets) | ||
15748 | { | ||
15749 | if (pickGodDelete.AgentData.SessionID != SessionId || | ||
15750 | pickGodDelete.AgentData.AgentID != AgentId) | ||
15751 | break; | ||
15752 | } | ||
15753 | #endregion | ||
15754 | |||
15755 | PickGodDelete handlerPickGodDelete = OnPickGodDelete; | ||
15756 | if (handlerPickGodDelete != null) | ||
15757 | handlerPickGodDelete(this, | ||
15758 | pickGodDelete.AgentData.AgentID, | ||
15759 | pickGodDelete.Data.PickID, | ||
15760 | pickGodDelete.Data.QueryID); | ||
15761 | break; | ||
15762 | |||
15763 | case PacketType.PickInfoUpdate: | ||
15764 | PickInfoUpdatePacket pickInfoUpdate = | ||
15765 | (PickInfoUpdatePacket)Pack; | ||
15766 | |||
15767 | #region Packet Session and User Check | ||
15768 | if (m_checkPackets) | ||
15769 | { | ||
15770 | if (pickInfoUpdate.AgentData.SessionID != SessionId || | ||
15771 | pickInfoUpdate.AgentData.AgentID != AgentId) | ||
15772 | break; | ||
15773 | } | ||
15774 | #endregion | ||
15775 | |||
15776 | PickInfoUpdate handlerPickInfoUpdate = OnPickInfoUpdate; | ||
15777 | if (handlerPickInfoUpdate != null) | ||
15778 | handlerPickInfoUpdate(this, | ||
15779 | pickInfoUpdate.Data.PickID, | ||
15780 | pickInfoUpdate.Data.CreatorID, | ||
15781 | pickInfoUpdate.Data.TopPick, | ||
15782 | Utils.BytesToString(pickInfoUpdate.Data.Name), | ||
15783 | Utils.BytesToString(pickInfoUpdate.Data.Desc), | ||
15784 | pickInfoUpdate.Data.SnapshotID, | ||
15785 | pickInfoUpdate.Data.SortOrder, | ||
15786 | pickInfoUpdate.Data.Enabled); | ||
15787 | break; | ||
15788 | |||
15789 | case PacketType.AvatarNotesUpdate: | ||
15790 | AvatarNotesUpdatePacket avatarNotesUpdate = | ||
15791 | (AvatarNotesUpdatePacket)Pack; | ||
15792 | |||
15793 | #region Packet Session and User Check | ||
15794 | if (m_checkPackets) | ||
15795 | { | ||
15796 | if (avatarNotesUpdate.AgentData.SessionID != SessionId || | ||
15797 | avatarNotesUpdate.AgentData.AgentID != AgentId) | ||
15798 | break; | ||
15799 | } | ||
15800 | #endregion | ||
15801 | |||
15802 | AvatarNotesUpdate handlerAvatarNotesUpdate = OnAvatarNotesUpdate; | ||
15803 | if (handlerAvatarNotesUpdate != null) | ||
15804 | handlerAvatarNotesUpdate(this, | ||
15805 | avatarNotesUpdate.Data.TargetID, | ||
15806 | Utils.BytesToString(avatarNotesUpdate.Data.Notes)); | ||
15807 | break; | ||
15808 | |||
15809 | case PacketType.AvatarInterestsUpdate: | ||
15810 | AvatarInterestsUpdatePacket avatarInterestUpdate = | ||
15811 | (AvatarInterestsUpdatePacket)Pack; | ||
15812 | |||
15813 | #region Packet Session and User Check | ||
15814 | if (m_checkPackets) | ||
15815 | { | ||
15816 | if (avatarInterestUpdate.AgentData.SessionID != SessionId || | ||
15817 | avatarInterestUpdate.AgentData.AgentID != AgentId) | ||
15818 | break; | ||
15819 | } | ||
15820 | #endregion | ||
15821 | |||
15822 | AvatarInterestUpdate handlerAvatarInterestUpdate = OnAvatarInterestUpdate; | ||
15823 | if (handlerAvatarInterestUpdate != null) | ||
15824 | handlerAvatarInterestUpdate(this, | ||
15825 | avatarInterestUpdate.PropertiesData.WantToMask, | ||
15826 | Utils.BytesToString(avatarInterestUpdate.PropertiesData.WantToText), | ||
15827 | avatarInterestUpdate.PropertiesData.SkillsMask, | ||
15828 | Utils.BytesToString(avatarInterestUpdate.PropertiesData.SkillsText), | ||
15829 | Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText)); | ||
15830 | break; | ||
15831 | |||
15832 | case PacketType.GrantUserRights: | ||
15833 | GrantUserRightsPacket GrantUserRights = | ||
15834 | (GrantUserRightsPacket)Pack; | ||
15835 | #region Packet Session and User Check | ||
15836 | if (m_checkPackets) | ||
15837 | { | ||
15838 | if (GrantUserRights.AgentData.SessionID != SessionId || | ||
15839 | GrantUserRights.AgentData.AgentID != AgentId) | ||
15840 | break; | ||
15841 | } | ||
15842 | #endregion | ||
15843 | GrantUserFriendRights GrantUserRightsHandler = OnGrantUserRights; | ||
15844 | if (GrantUserRightsHandler != null) | ||
15845 | GrantUserRightsHandler(this, | ||
15846 | GrantUserRights.AgentData.AgentID, | ||
15847 | GrantUserRights.Rights[0].AgentRelated, | ||
15848 | GrantUserRights.Rights[0].RelatedRights); | ||
15849 | break; | ||
15850 | |||
15851 | case PacketType.PlacesQuery: | ||
15852 | PlacesQueryPacket placesQueryPacket = | ||
15853 | (PlacesQueryPacket)Pack; | ||
15854 | |||
15855 | PlacesQuery handlerPlacesQuery = OnPlacesQuery; | ||
15856 | |||
15857 | if (handlerPlacesQuery != null) | ||
15858 | handlerPlacesQuery(placesQueryPacket.AgentData.QueryID, | ||
15859 | placesQueryPacket.TransactionData.TransactionID, | ||
15860 | Utils.BytesToString( | ||
15861 | placesQueryPacket.QueryData.QueryText), | ||
15862 | placesQueryPacket.QueryData.QueryFlags, | ||
15863 | (byte)placesQueryPacket.QueryData.Category, | ||
15864 | Utils.BytesToString( | ||
15865 | placesQueryPacket.QueryData.SimName), | ||
15866 | this); | ||
15867 | break; | ||
15868 | */ | ||
15869 | #endregion | ||
15870 | default: | ||
15871 | m_log.Warn("[CLIENT]: unhandled packet " + Pack); | ||
15872 | break; | ||
15873 | } | 11031 | } |
15874 | 11032 | ||
15875 | PacketPool.Instance.ReturnPacket(Pack); | 11033 | PacketPool.Instance.ReturnPacket(Pack); |
15876 | |||
15877 | } | 11034 | } |
15878 | 11035 | ||
15879 | private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) | 11036 | private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) |