From 2bd03b7c8c3b14ea5e7b709aa9e1a3d63ed67e09 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 18 May 2008 03:21:22 +0000 Subject: * Group type stuff. Nothing spectacular. two packets, sorta almost semi half tiny amount implemented. --- OpenSim/Framework/IClientAPI.cs | 4 +- .../Region/ClientStack/LindenUDP/LLClientView.cs | 55 +++++++++++++++++++++- .../Modules/Avatar/Groups/GroupsModule.cs | 54 +++++++++++++++++---- .../Environment/Modules/World/NPC/NPCAvatar.cs | 7 +++ OpenSim/Region/Environment/Scenes/InnerScene.cs | 23 +++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 1 + .../Region/Environment/Scenes/SceneObjectGroup.cs | 11 +++++ .../Region/Environment/Scenes/SceneObjectPart.cs | 8 +++- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 6 +++ 9 files changed, 157 insertions(+), 12 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 098943c..109e70b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -813,8 +813,9 @@ namespace OpenSim.Framework event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest; event EstateDebugRegionRequest OnEstateDebugRegionRequest; event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; + event UUIDNameRequest OnUUIDGroupNameRequest; - + event RequestObjectPropertiesFamily OnObjectGroupRequest; [Obsolete("IClientAPI.OutPacket SHOULD NOT EXIST outside of LLClientView please refactor appropriately.")] void OutPacket(Packet newPack, ThrottleOutPacketType packType); @@ -983,6 +984,7 @@ namespace OpenSim.Framework void SendGroupMembership(GroupData[] GroupMembership); + void SendGroupNameReply(LLUUID groupLLUID, string GroupName); byte[] GetThrottlesPacked(float multiplier); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a86941f..fa608a9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -249,6 +249,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP private ForceReleaseControls handlerForceReleaseControls = null; + private UUIDNameRequest handlerUUIDGroupNameRequest = null; + + private RequestObjectPropertiesFamily handlerObjectGroupRequest = null; + /* Properties */ public LLUUID SecureSessionId @@ -828,12 +832,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event UUIDNameRequest OnTeleportHomeRequest; + public event UUIDNameRequest OnUUIDGroupNameRequest; + public event ScriptAnswer OnScriptAnswer; public event RequestPayPrice OnRequestPayPrice; public event AgentSit OnUndo; public event ForceReleaseControls OnForceReleaseControls; + public event RequestObjectPropertiesFamily OnObjectGroupRequest; + public event DetailedEstateDataRequest OnDetailedEstateDataRequest; public event SetEstateFlagsRequest OnSetEstateFlagsRequest; public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture; @@ -3044,6 +3052,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest); AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest); + AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); + AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest); } private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack) @@ -3090,6 +3100,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP } + private bool HandleUUIDGroupNameRequest(IClientAPI sender, Packet Pack) + { + UUIDGroupNameRequestPacket upack = (UUIDGroupNameRequestPacket) Pack; + + for (int i=0;i< upack.UUIDNameBlock.Length; i++) + { + handlerUUIDGroupNameRequest = OnUUIDGroupNameRequest; + if (handlerUUIDGroupNameRequest != null) + { + handlerUUIDGroupNameRequest(upack.UUIDNameBlock[i].ID,this); + } + } + + return true; + } + + public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack) + { + + ObjectGroupPacket ogpack = (ObjectGroupPacket)Pack; + handlerObjectGroupRequest = OnObjectGroupRequest; + if (handlerObjectGroupRequest != null) + { + for (int i = 0; i < ogpack.ObjectData.Length; i++) + { + handlerObjectGroupRequest(this, ogpack.AgentData.GroupID, ogpack.ObjectData[i].ObjectLocalID, LLUUID.Zero); + } + } + return true; + } + + + private bool HandleViewerEffect(IClientAPI sender, Packet Pack) { ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; @@ -5838,7 +5881,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(Groupupdate, ThrottleOutPacketType.Task); } - + public void SendGroupNameReply(LLUUID groupLLUID, string GroupName) + { + UUIDGroupNameReplyPacket pack = new UUIDGroupNameReplyPacket(); + UUIDGroupNameReplyPacket.UUIDNameBlockBlock[] uidnameblock = new UUIDGroupNameReplyPacket.UUIDNameBlockBlock[1]; + UUIDGroupNameReplyPacket.UUIDNameBlockBlock uidnamebloc = new UUIDGroupNameReplyPacket.UUIDNameBlockBlock(); + uidnamebloc.ID = groupLLUID; + uidnamebloc.GroupName = Helpers.StringToField(GroupName); + uidnameblock[0] = uidnamebloc; + pack.UUIDNameBlock = uidnameblock; + OutPacket(pack, 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 8f3eb62..a83730e 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs @@ -44,6 +44,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups private Dictionary m_grouplistmap = new Dictionary(); private Dictionary m_groupmap = new Dictionary(); private Dictionary m_iclientmap = new Dictionary(); + private Dictionary m_groupUUIDGroup = new Dictionary(); + private LLUUID opensimulatorGroupID = new LLUUID("00000000-68f9-1111-024e-222222111123"); + private List m_scene = new List(); #region IRegionModule Members @@ -57,6 +60,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnGridInstantMessageToGroupsModule += OnGridInstantMessage; + lock (m_groupUUIDGroup) + { + + GroupData OpenSimulatorGroup = new GroupData(); + OpenSimulatorGroup.ActiveGroupTitle = "OpenSimulator Tester"; + OpenSimulatorGroup.GroupID = opensimulatorGroupID; + OpenSimulatorGroup.groupName = "OpenSimulator Testing"; + OpenSimulatorGroup.ActiveGroupPowers = GroupPowers.LandAllowSetHome; + OpenSimulatorGroup.GroupTitles.Add("OpenSimulator Tester"); + if (!m_groupUUIDGroup.ContainsKey(opensimulatorGroupID)) + m_groupUUIDGroup.Add(opensimulatorGroupID, OpenSimulatorGroup); + } //scene.EventManager. } @@ -102,6 +117,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups // Subscribe to instant messages client.OnInstantMessage += OnInstantMessage; client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; + client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; lock (m_iclientmap) { if (!m_iclientmap.ContainsKey(client.AgentId)) @@ -109,13 +125,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups m_iclientmap.Add(client.AgentId, client); } } - GroupData OpenSimulatorGroup = new GroupData(); - OpenSimulatorGroup.ActiveGroupTitle = "OpenSimulator Tester"; - OpenSimulatorGroup.GroupID = new LLUUID("00000000-68f9-1111-024e-222222111120"); - OpenSimulatorGroup.GroupMembers.Add(client.AgentId); - OpenSimulatorGroup.groupName = "OpenSimulator Testing"; - OpenSimulatorGroup.ActiveGroupPowers = GroupPowers.LandAllowSetHome; - OpenSimulatorGroup.GroupTitles.Add("OpenSimulator Tester"); + GroupData OpenSimulatorGroup = null; + lock (m_groupUUIDGroup) + { + OpenSimulatorGroup = m_groupUUIDGroup[opensimulatorGroupID]; + if (!OpenSimulatorGroup.GroupMembers.Contains(client.AgentId)) + { + OpenSimulatorGroup.GroupMembers.Add(client.AgentId); + m_groupUUIDGroup[opensimulatorGroupID] = OpenSimulatorGroup; + } + + } + lock (m_groupmap) { if (!m_groupmap.ContainsKey(client.AgentId)) @@ -124,7 +145,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups } } GroupList testGroupList = new GroupList(); - testGroupList.m_GroupList.Add(new LLUUID("00000000-68f9-1111-024e-222222111120")); + testGroupList.m_GroupList.Add(OpenSimulatorGroup.GroupID); lock (m_grouplistmap) { @@ -133,7 +154,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups m_grouplistmap.Add(client.AgentId, testGroupList); } } - m_log.Info("[GROUP]: Adding " + client.Name + " to OpenSimulator Tester group"); + m_log.Info("[GROUP]: Adding " + client.Name + " to " + OpenSimulatorGroup.groupName + " "); GroupData[] updateGroups = new GroupData[1]; updateGroups[0] = OpenSimulatorGroup; @@ -201,7 +222,22 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID), msg.binaryBucket); } + private void HandleUUIDGroupNameRequest(LLUUID id,IClientAPI remote_client) + { + string groupnamereply = "Unknown"; + LLUUID groupUUID = LLUUID.Zero; + lock (m_groupUUIDGroup) + { + if (m_groupUUIDGroup.ContainsKey(id)) + { + GroupData grp = m_groupUUIDGroup[id]; + groupnamereply = grp.groupName; + groupUUID = grp.GroupID; + } + } + remote_client.SendGroupNameReply(groupUUID, groupnamereply); + } private void OnClientClosed(LLUUID agentID) { lock (m_iclientmap) diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 815a505..71ea0e4 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -236,6 +236,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event RequestAsset OnRequestAsset; public event UUIDNameRequest OnNameFromUUIDRequest; + public event UUIDNameRequest OnUUIDGroupNameRequest; public event ParcelPropertiesRequest OnParcelPropertiesRequest; public event ParcelDivideRequest OnParcelDivideRequest; @@ -270,6 +271,8 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event ForceReleaseControls OnForceReleaseControls; + public event RequestObjectPropertiesFamily OnObjectGroupRequest; + public event DetailedEstateDataRequest OnDetailedEstateDataRequest; public event SetEstateFlagsRequest OnSetEstateFlagsRequest; public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture; @@ -756,6 +759,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public void sendLandParcelOverlay(byte[] data, int sequence_id) { } + + public void SendGroupNameReply(LLUUID groupLLUID, string GroupName) + { + } #endregion } } diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 352fdf9..7a460a2 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -330,7 +330,30 @@ namespace OpenSim.Region.Environment.Scenes } + public void HandleObjectGroupUpdate( + IClientAPI remoteClient, LLUUID GroupID, uint objectLocalID, LLUUID Garbage) + { + List EntityList = GetEntities(); + foreach (EntityBase obj in EntityList) + { + if (obj is SceneObjectGroup) + { + if (((SceneObjectGroup)obj).LocalId == objectLocalID) + { + SceneObjectGroup group = (SceneObjectGroup)obj; + + if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID, remoteClient.AgentId)) + group.SetGroup(GroupID, remoteClient); + else + remoteClient.SendAgentAlertMessage("You don't have permission to set the group", false); + + } + } + } + + + } /// /// Event Handling routine for Attach Object /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a798f40..d4b85c2 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1651,6 +1651,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnSetStartLocationRequest += SetHomeRezPoint; client.OnUndo += m_innerScene.HandleUndo; + client.OnObjectGroupRequest += m_innerScene.HandleObjectGroupUpdate; EventManager.TriggerOnNewClient(client); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 635a989..44e4c81 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -2510,5 +2510,16 @@ namespace OpenSim.Region.Environment.Scenes } } } + public void SetGroup(LLUUID GroupID, IClientAPI client) + { + lock (m_parts) + { + foreach (SceneObjectPart part in m_parts.Values) + { + part.SetGroup(GroupID, client); + } + } + ScheduleGroupForFullUpdate(); + } } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index a7b7692..a23083c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -2760,13 +2760,19 @@ namespace OpenSim.Region.Environment.Scenes public void GetProperties(IClientAPI client) { - client.SendObjectPropertiesReply(LLUUID.Zero, (ulong)CreationDate, CreatorID, LLUUID.Zero, LLUUID.Zero, + client.SendObjectPropertiesReply(LLUUID.Zero, (ulong)CreationDate, CreatorID, LLUUID.Zero, GroupID, LLUUID.Zero, (short)InventorySerial, LastOwnerID, UUID, OwnerID, ParentGroup.RootPart.TouchName, new byte[0], ParentGroup.RootPart.SitName, Name, Description, ParentGroup.RootPart.OwnerMask, ParentGroup.RootPart.NextOwnerMask, ParentGroup.RootPart.GroupMask, ParentGroup.RootPart.EveryoneMask, ParentGroup.RootPart.BaseMask); } + public void SetGroup(LLUUID groupID, IClientAPI client) + { + GroupID = groupID; + GetProperties(client); + m_updateFlag = 2; + } } } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index ca8636f..93ab411 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -140,6 +140,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event RequestAsset OnRequestAsset; public event UUIDNameRequest OnNameFromUUIDRequest; + public event UUIDNameRequest OnUUIDGroupNameRequest; public event ParcelPropertiesRequest OnParcelPropertiesRequest; public event ParcelDivideRequest OnParcelDivideRequest; @@ -173,6 +174,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event AgentSit OnUndo; public event ForceReleaseControls OnForceReleaseControls; + public event RequestObjectPropertiesFamily OnObjectGroupRequest; public event DetailedEstateDataRequest OnDetailedEstateDataRequest; public event SetEstateFlagsRequest OnSetEstateFlagsRequest; @@ -754,5 +756,9 @@ namespace OpenSim.Region.Examples.SimpleModule public void sendLandParcelOverlay(byte[] data, int sequence_id) { } + + public void SendGroupNameReply(LLUUID groupLLUID, string GroupName) + { + } } } -- cgit v1.1