From 9e8dd941f13c0a0b2a5e76cb69b055d7af02d3bc Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 14 May 2008 04:57:32 +0000 Subject: * Refactored OutPacket out of ScenePresence * Down to 65 warnings. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 33 ++++++++++++++++++++++ .../Modules/Avatar/Groups/GroupsModule.cs | 2 +- .../Environment/Modules/World/NPC/NPCAvatar.cs | 9 ++++++ OpenSim/Region/Environment/Scenes/ScenePresence.cs | 31 +++++--------------- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 11 +++++++- 5 files changed, 60 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e1e8854..b8f055e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5739,6 +5739,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP offp.AgentBlock = offpb; OutPacket(offp, ThrottleOutPacketType.Task); } + + public void SendSitResponse(LLUUID TargetID, LLVector3 OffsetPos, LLQuaternion SitOrientation, bool autopilot, + LLVector3 CameraAtOffset, LLVector3 CameraEyeOffset, bool ForceMouseLook) + { + AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket(); + avatarSitResponse.SitObject.ID = TargetID; + if (CameraAtOffset != LLVector3.Zero) + { + avatarSitResponse.SitTransform.CameraAtOffset = CameraAtOffset; + avatarSitResponse.SitTransform.CameraEyeOffset = CameraEyeOffset; + } + avatarSitResponse.SitTransform.ForceMouselook = ForceMouseLook; + avatarSitResponse.SitTransform.AutoPilot = autopilot; + avatarSitResponse.SitTransform.SitPosition = OffsetPos; + avatarSitResponse.SitTransform.SitRotation = SitOrientation; + + OutPacket(avatarSitResponse, ThrottleOutPacketType.Task); + } + public void SendAdminResponse(LLUUID Token, uint AdminLevel) + { + GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket(); + GrantGodlikePowersPacket.GrantDataBlock gdb = new GrantGodlikePowersPacket.GrantDataBlock(); + GrantGodlikePowersPacket.AgentDataBlock adb = new GrantGodlikePowersPacket.AgentDataBlock(); + + adb.AgentID = AgentId; + adb.SessionID = SessionId; // More security + gdb.GodLevel = (byte)AdminLevel; + gdb.Token = Token; + //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock; + respondPacket.GrantData = gdb; + respondPacket.AgentData = adb; + OutPacket(respondPacket, ThrottleOutPacketType.Task); + } public ClientInfo GetClientInfo() { //MainLog.Instance.Verbose("CLIENT", "GetClientInfo BGN"); diff --git a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs index f9e81f0..0f7f2f2 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs @@ -176,7 +176,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups ActiveGroupTitle = grp.ActiveGroupTitle; } - //remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname, lastname, ActiveGroupPowers, ActiveGroupName, ActiveGroupTitle); + remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname, lastname, ActiveGroupPowers, ActiveGroupName, ActiveGroupTitle); } } } diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index e5d295b..3126f1c 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -92,7 +92,16 @@ namespace OpenSim.Region.Environment.Modules.World.NPC { } + public void SendSitResponse(LLUUID TargetID, LLVector3 OffsetPos, LLQuaternion SitOrientation, bool autopilot, + LLVector3 CameraAtOffset, LLVector3 CameraEyeOffset, bool ForceMouseLook) + { + + } + public void SendAdminResponse(LLUUID Token, uint AdminLevel) + { + + } public LLUUID GetDefaultAnimation(string name) { return LLUUID.Zero; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 3189b10..6f0fbdf 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -942,10 +942,10 @@ namespace OpenSim.Region.Environment.Scenes private void SendSitResponse(IClientAPI remoteClient, LLUUID targetID, LLVector3 offset) { - AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket(); - - avatarSitResponse.SitObject.ID = targetID; + + + bool autopilot = true; LLVector3 pos = new LLVector3(); LLQuaternion sitOrientation = new LLQuaternion(0, 0, 0, 1); @@ -1000,12 +1000,8 @@ namespace OpenSim.Region.Environment.Scenes } } - avatarSitResponse.SitTransform.AutoPilot = autopilot; - avatarSitResponse.SitTransform.SitPosition = offset; - avatarSitResponse.SitTransform.SitRotation = sitOrientation; - - remoteClient.OutPacket(avatarSitResponse, ThrottleOutPacketType.Task); - + ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, LLVector3.Zero, LLVector3.Zero, false); + // This calls HandleAgentSit twice, once from here, and the client calls // HandleAgentSit itself after it gets to the location // It doesn't get to the location until we've moved them there though @@ -1710,29 +1706,16 @@ namespace OpenSim.Region.Environment.Scenes /// public void GrantGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token, bool godStatus) { - GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket(); - GrantGodlikePowersPacket.GrantDataBlock gdb = new GrantGodlikePowersPacket.GrantDataBlock(); - GrantGodlikePowersPacket.AgentDataBlock adb = new GrantGodlikePowersPacket.AgentDataBlock(); - - adb.AgentID = agentID; - adb.SessionID = sessionID; // More security - if (godStatus) { - gdb.GodLevel = (byte)250; m_godlevel = 250; } else { - gdb.GodLevel = (byte)0; m_godlevel = 0; } - - gdb.Token = token; - //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock; - respondPacket.GrantData = gdb; - respondPacket.AgentData = adb; - ControllingClient.OutPacket(respondPacket, ThrottleOutPacketType.Task); + + ControllingClient.SendAdminResponse(token, (uint)m_godlevel); } /// diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 19494c2..68f3ecb 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -563,7 +563,6 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public void SendAgentOffline(LLUUID[] agentIDs) { @@ -574,6 +573,16 @@ namespace OpenSim.Region.Examples.SimpleModule } + public void SendSitResponse(LLUUID TargetID, LLVector3 OffsetPos, LLQuaternion SitOrientation, bool autopilot, + LLVector3 CameraAtOffset, LLVector3 CameraEyeOffset, bool ForceMouseLook) + { + } + + public void SendAdminResponse(LLUUID Token, uint AdminLevel) + { + + } + private void Update() { frame++; -- cgit v1.1