From 8db97f7dab5d73507bdbc2b9c41b0c85462478e0 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sun, 22 Nov 2009 05:13:50 -0500 Subject: * Switched over 15 more packet types from the 5000 line switch to the Packet handler delegate --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 299 ++++++++++++++++++++- 1 file changed, 293 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5cf59d8..d20a84f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4312,11 +4312,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); AddLocalPacketHandler(PacketType.AgentIsNowWearing, HandlerAgentIsNowWearing); + AddLocalPacketHandler(PacketType.RezSingleAttachmentFromInv, HandlerRezSingleAttachmentFromInv); + AddLocalPacketHandler(PacketType.RezMultipleAttachmentsFromInv, HandleRezMultipleAttachmentsFromInv); + AddLocalPacketHandler(PacketType.DetachAttachmentIntoInv, HandleDetachAttachmentIntoInv); + AddLocalPacketHandler(PacketType.ObjectAttach, HandleObjectAttach); + AddLocalPacketHandler(PacketType.ObjectDetach, HandleObjectDetach); + AddLocalPacketHandler(PacketType.ObjectDrop, HandleObjectDrop); + AddLocalPacketHandler(PacketType.SetAlwaysRun, HandleSetAlwaysRun); + AddLocalPacketHandler(PacketType.CompleteAgentMovement, HandleCompleteAgentMovement); + AddLocalPacketHandler(PacketType.AgentAnimation, HandleAgentAnimation); + AddLocalPacketHandler(PacketType.AgentRequestSit, HandleAgentRequestSit); + AddLocalPacketHandler(PacketType.AgentSit, HandleAgentSit); + AddLocalPacketHandler(PacketType.SoundTrigger, HandleSoundTrigger); //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); - //AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); + } #region Packet Handlers @@ -4974,6 +4986,281 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } + private bool HandlerRezSingleAttachmentFromInv(IClientAPI sender, Packet Pack) + { + RezSingleAttachmentFromInv handlerRezSingleAttachment = OnRezSingleAttachmentFromInv; + if (handlerRezSingleAttachment != null) + { + RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (rez.AgentData.SessionID != SessionId || + rez.AgentData.AgentID != AgentId) + return true; + } + #endregion + + handlerRezSingleAttachment(this, rez.ObjectData.ItemID, + rez.ObjectData.AttachmentPt); + } + + return true; + } + + private bool HandleRezMultipleAttachmentsFromInv(IClientAPI sender, Packet Pack) + { + RezMultipleAttachmentsFromInv handlerRezMultipleAttachments = OnRezMultipleAttachmentsFromInv; + if (handlerRezMultipleAttachments != null) + { + RezMultipleAttachmentsFromInvPacket rez = (RezMultipleAttachmentsFromInvPacket)Pack; + handlerRezMultipleAttachments(this, rez.HeaderData, + rez.ObjectData); + } + + return true; + } + + private bool HandleDetachAttachmentIntoInv(IClientAPI sender, Packet Pack) + { + UUIDNameRequest handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv; + if (handlerDetachAttachmentIntoInv != null) + { + DetachAttachmentIntoInvPacket detachtoInv = (DetachAttachmentIntoInvPacket)Pack; + + #region Packet Session and User Check + // UNSUPPORTED ON THIS PACKET + #endregion + + UUID itemID = detachtoInv.ObjectData.ItemID; + // UUID ATTACH_agentID = detachtoInv.ObjectData.AgentID; + + handlerDetachAttachmentIntoInv(itemID, this); + } + return true; + } + + private bool HandleObjectAttach(IClientAPI sender, Packet Pack) + { + if (OnObjectAttach != null) + { + ObjectAttachPacket att = (ObjectAttachPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (att.AgentData.SessionID != SessionId || + att.AgentData.AgentID != AgentId) + return true; + } + #endregion + + ObjectAttach handlerObjectAttach = OnObjectAttach; + + if (handlerObjectAttach != null) + { + if (att.ObjectData.Length > 0) + { + handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation, false); + } + } + } + return true; + } + + private bool HandleObjectDetach(IClientAPI sender, Packet Pack) + { + ObjectDetachPacket dett = (ObjectDetachPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (dett.AgentData.SessionID != SessionId || + dett.AgentData.AgentID != AgentId) + return true; + } + #endregion + + for (int j = 0; j < dett.ObjectData.Length; j++) + { + uint obj = dett.ObjectData[j].ObjectLocalID; + ObjectDeselect handlerObjectDetach = OnObjectDetach; + if (handlerObjectDetach != null) + { + handlerObjectDetach(obj, this); + } + + } + return true; + } + + private bool HandleObjectDrop(IClientAPI sender, Packet Pack) + { + ObjectDropPacket dropp = (ObjectDropPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (dropp.AgentData.SessionID != SessionId || + dropp.AgentData.AgentID != AgentId) + return true; + } + #endregion + + for (int j = 0; j < dropp.ObjectData.Length; j++) + { + uint obj = dropp.ObjectData[j].ObjectLocalID; + ObjectDrop handlerObjectDrop = OnObjectDrop; + if (handlerObjectDrop != null) + { + handlerObjectDrop(obj, this); + } + } + return true; + } + + private bool HandleSetAlwaysRun(IClientAPI sender, Packet Pack) + { + SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (run.AgentData.SessionID != SessionId || + run.AgentData.AgentID != AgentId) + return true; + } + #endregion + + SetAlwaysRun handlerSetAlwaysRun = OnSetAlwaysRun; + if (handlerSetAlwaysRun != null) + handlerSetAlwaysRun(this, run.AgentData.AlwaysRun); + + return true; + } + + private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) + { + GenericCall2 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; + if (handlerCompleteMovementToRegion != null) + { + handlerCompleteMovementToRegion(); + } + handlerCompleteMovementToRegion = null; + + return true; + } + + private bool HandleAgentAnimation(IClientAPI sender, Packet Pack) + { + AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (AgentAni.AgentData.SessionID != SessionId || + AgentAni.AgentData.AgentID != AgentId) + return true; + } + #endregion + + StartAnim handlerStartAnim = null; + StopAnim handlerStopAnim = null; + + for (int i = 0; i < AgentAni.AnimationList.Length; i++) + { + if (AgentAni.AnimationList[i].StartAnim) + { + handlerStartAnim = OnStartAnim; + if (handlerStartAnim != null) + { + handlerStartAnim(this, AgentAni.AnimationList[i].AnimID); + } + } + else + { + handlerStopAnim = OnStopAnim; + if (handlerStopAnim != null) + { + handlerStopAnim(this, AgentAni.AnimationList[i].AnimID); + } + } + } + return true; + } + + private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) + { + if (OnAgentRequestSit != null) + { + AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (agentRequestSit.AgentData.SessionID != SessionId || + agentRequestSit.AgentData.AgentID != AgentId) + return true; + } + #endregion + + AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit; + if (handlerAgentRequestSit != null) + handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, + agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); + } + return true; + } + + private bool HandleAgentSit(IClientAPI sender, Packet Pack) + { + if (OnAgentSit != null) + { + AgentSitPacket agentSit = (AgentSitPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (agentSit.AgentData.SessionID != SessionId || + agentSit.AgentData.AgentID != AgentId) + return true; + } + #endregion + + AgentSit handlerAgentSit = OnAgentSit; + if (handlerAgentSit != null) + { + OnAgentSit(this, agentSit.AgentData.AgentID); + } + } + return true; + } + + private bool HandleSoundTrigger(IClientAPI sender, Packet Pack) + { + SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + // UNSUPPORTED ON THIS PACKET + } + #endregion + + SoundTrigger handlerSoundTrigger = OnSoundTrigger; + if (handlerSoundTrigger != null) + { + handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID, + soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID, + soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position, + soundTriggerPacket.SoundData.Handle); + + } + return true; + } + + #endregion Packet Handlers public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question) @@ -5884,8 +6171,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } break; -*/ - #endregion + case PacketType.RezSingleAttachmentFromInv: RezSingleAttachmentFromInv handlerRezSingleAttachment = OnRezSingleAttachmentFromInv; if (handlerRezSingleAttachment != null) @@ -5917,7 +6203,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.DetachAttachmentIntoInv: UUIDNameRequest handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv; if (handlerDetachAttachmentIntoInv != null) @@ -6025,7 +6311,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerSetAlwaysRun(this, run.AgentData.AlwaysRun); break; - + case PacketType.CompleteAgentMovement: GenericCall2 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) @@ -6135,7 +6421,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + */ + #endregion case PacketType.AvatarPickerRequest: AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; -- cgit v1.1 From 9f5c2acd128828d220bf7e47bd4fe13d7a2a910b Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 23 Nov 2009 11:26:06 +0900 Subject: Formatting cleanup. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 36 ++++++++++------------ 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d20a84f..6c1d14a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -823,7 +823,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Column for (int j = y1 + 1; j <= y2; j++) SendLayerData(x2, j, map); - + if (x2 - x1 > 0) SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); } @@ -1281,10 +1281,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // if (totalItems == 0 && totalFolders == 0) currentPacket = CreateInventoryDescendentsPacket(ownerID, folderID, version, items.Count + folders.Count, 0, 0); - + // To preserve SL compatibility, we will NOT combine folders and items in one packet // - while(itemsSent < totalItems || foldersSent < totalFolders) + while (itemsSent < totalItems || foldersSent < totalFolders) { if (currentPacket == null) // Start a new packet { @@ -1304,7 +1304,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (foldersToSend-- > 0) currentPacket.FolderData[foldersSent % MAX_FOLDERS_PER_PACKET] = CreateFolderDataBlock(folders[foldersSent++]); - else if(itemsToSend-- > 0) + else if (itemsToSend-- > 0) currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]); else { @@ -2058,7 +2058,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP packet.AgentData.SessionID = SessionId; packet.Effect = effectBlocks; - + OutPacket(packet, ThrottleOutPacketType.State); } @@ -2757,7 +2757,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } llsd.Add("GroupData", GroupData); llsd.Add("NewGroupData", NewGroupData); - + IEventQueue eq = this.Scene.RequestModuleInterface(); if (eq != null) { @@ -5752,8 +5752,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; } - - // Main packet processing conditional switch (Pack.Type) { @@ -5779,7 +5777,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.ChatFromViewer: ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; @@ -5818,7 +5816,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerChatFromClient(this, args); } break; - + case PacketType.AvatarPropertiesUpdate: AvatarPropertiesUpdatePacket avatarProps = (AvatarPropertiesUpdatePacket)Pack; @@ -5846,7 +5844,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerUpdateAvatarProperties(this, UserProfile); } break; - + case PacketType.ScriptDialogReply: ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; @@ -5877,7 +5875,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.ImprovedInstantMessage: ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; @@ -5911,7 +5909,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerInstantMessage(this, im); } break; - + case PacketType.AcceptFriendship: AcceptFriendshipPacket afriendpack = (AcceptFriendshipPacket)Pack; @@ -5984,7 +5982,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); } break; - + case PacketType.RezObject: RezObjectPacket rezPacket = (RezObjectPacket)Pack; @@ -6039,7 +6037,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.ModifyLand: ModifyLandPacket modify = (ModifyLandPacket)Pack; @@ -6203,7 +6201,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } break; - + case PacketType.DetachAttachmentIntoInv: UUIDNameRequest handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv; if (handlerDetachAttachmentIntoInv != null) @@ -6311,7 +6309,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerSetAlwaysRun(this, run.AgentData.AlwaysRun); break; - + case PacketType.CompleteAgentMovement: GenericCall2 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) @@ -10479,7 +10477,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Utils.BytesToString(avatarInterestUpdate.PropertiesData.SkillsText), Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText)); break; - + case PacketType.GrantUserRights: GrantUserRightsPacket GrantUserRights = (GrantUserRightsPacket)Pack; @@ -10498,7 +10496,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP GrantUserRights.Rights[0].AgentRelated, GrantUserRights.Rights[0].RelatedRights); break; - + case PacketType.PlacesQuery: PlacesQueryPacket placesQueryPacket = (PlacesQueryPacket)Pack; -- cgit v1.1