From 6ab5b523f8b6bdd056cb033c17811ae720564428 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 6 Oct 2008 00:09:49 +0000 Subject: Implements ObjectOwner god mode packet (Set Owner To Me admin option) --- OpenSim/Framework/IClientAPI.cs | 2 ++ OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 16 ++++++++++++++++ .../Region/Environment/Modules/World/NPC/NPCAvatar.cs | 1 + OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 16 ++++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 2 ++ OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 1 + 6 files changed, 38 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 7095387..dbaa0a8 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -308,6 +308,7 @@ namespace OpenSim.Framework public delegate void DeactivateGesture(IClientAPI client, UUID gestureid); public delegate void TerrainUnacked(IClientAPI remoteClient, int patchX, int patchY); + public delegate void ObjectOwner(IClientAPI remoteClient, UUID ownerID, UUID groupID, List localIDs); public delegate void DirPlacesQuery(IClientAPI remoteClient, UUID queryID, string queryText, int queryFlags, int category, string simName, int queryStart); @@ -546,6 +547,7 @@ namespace OpenSim.Framework event TerrainUnacked OnUnackedTerrain; event ActivateGesture OnActivateGesture; event DeactivateGesture OnDeactivateGesture; + event ObjectOwner OnObjectOwner; event DirPlacesQuery OnDirPlacesQuery; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 92275e8..102b9c4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -259,6 +259,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //Gesture private ActivateGesture handlerActivateGesture = null; private DeactivateGesture handlerDeactivateGesture = null; + private ObjectOwner handlerObjectOwner = null; private DirPlacesQuery handlerDirPlacesQuery = null; @@ -987,6 +988,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ActivateGesture OnActivateGesture; public event DeactivateGesture OnDeactivateGesture; + public event ObjectOwner OnObjectOwner; public event DirPlacesQuery OnDirPlacesQuery; @@ -6186,6 +6188,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerDeactivateGesture(this, deactivateGesturePacket.Data[0].ItemID); } break; + case PacketType.ObjectOwner: + ObjectOwnerPacket objectOwnerPacket = (ObjectOwnerPacket)Pack; + + List localIDs = new List(); + + foreach (ObjectOwnerPacket.ObjectDataBlock d in objectOwnerPacket.ObjectData) + localIDs.Add(d.ObjectLocalID); + + handlerObjectOwner = OnObjectOwner; + if (handlerObjectOwner != null) + { + handlerObjectOwner(this, objectOwnerPacket.HeaderData.OwnerID, objectOwnerPacket.HeaderData.GroupID, localIDs); + } + break; #endregion diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index ff54ed3..972491d 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -321,6 +321,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event ActivateGesture OnActivateGesture; public event DeactivateGesture OnDeactivateGesture; + public event ObjectOwner OnObjectOwner; public event DirPlacesQuery OnDirPlacesQuery; diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 729572a..04076da 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -2340,5 +2340,21 @@ namespace OpenSim.Region.Environment.Scenes { EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID); } + + void ObjectOwner(IClientAPI remoteClient, UUID ownerID, UUID groupID, List localIDs) + { + if (!ExternalChecks.ExternalChecksCanBeGodLike(remoteClient.AgentId)) + return; + + foreach (uint localID in localIDs) + { + SceneObjectPart part = GetSceneObjectPart(localID); + if (part != null && part.ParentGroup != null) + { + part.ParentGroup.SetOwnerId(ownerID); + part.ParentGroup.SetGroup(groupID, remoteClient); + } + } + } } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index fcd50a9..735de7e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2227,6 +2227,8 @@ namespace OpenSim.Region.Environment.Scenes client.OnActivateGesture += ActivateGesture; client.OnDeactivateGesture += DeactivateGesture; + client.OnObjectOwner += ObjectOwner; + // EventManager.TriggerOnNewClient(client); } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 60a66aa..b7ff879 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -216,6 +216,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event ActivateGesture OnActivateGesture; public event DeactivateGesture OnDeactivateGesture; + public event ObjectOwner OnObjectOwner; public event DirPlacesQuery OnDirPlacesQuery; -- cgit v1.1