From 16596b6ad0af373cccde83d8faa01fa996c1023a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Feb 2019 21:56:27 +0000 Subject: [PATCH] add LSL_Key osGetInventoryLastOwner(string itemNameorid) --- .../Shared/Api/Implementation/OSSL_Api.cs | 21 +++++++++++++++++-- .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/OSSL_Stub.cs | 6 ++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e114a53455..070176b131 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -4874,8 +4874,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return Math.Atan2(mcross, dot); } - -//******* link sound public void osAdjustSoundVolume(LSL_Integer linknum, LSL_Float volume) { m_host.AddScriptLPS(1); @@ -5406,5 +5404,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 1; } + public LSL_Key osGetInventoryLastOwner(string itemNameorid) + { + m_host.AddScriptLPS(1); + + TaskInventoryItem item = null; + UUID itemID; + if (UUID.TryParse(itemNameorid, out itemID)) + item = m_host.Inventory.GetInventoryItem(itemID); + else + item = m_host.Inventory.GetInventoryItem(itemNameorid); + + if (item == null) + return UUID.Zero.ToString(); + + UUID id = item.LastOwnerID; + if(id == UUID.Zero) + id= item.OwnerID; + return id.ToString(); + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 67c0261625..727757783e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -547,5 +547,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer osApproxEquals(vector va, vector vb, LSL_Float margin); LSL_Integer osApproxEquals(rotation ra, rotation rb); LSL_Integer osApproxEquals(rotation ra, rotation rb, LSL_Float margin); + LSL_Key osGetInventoryLastOwner(string itemNameOrId); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 76d334b915..bc64ac4ee4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -1366,5 +1366,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osApproxEquals(ra, rb, margin); } + + public LSL_Key osGetInventoryLastOwner(string itemNameOrId) + { + return m_OSSL_Functions.osGetInventoryLastOwner(itemNameOrId); + } + } }