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