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