From 4a57112f19c0e4eb3545fdc0cbbbd68ce46c6eaa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 17 Mar 2012 04:02:23 +0000 Subject: Add osGetInventoryDesc() as per http://opensimulator.org/mantis/view.php?id=5927 This allows one to get description data for a given prim inventory item. Thanks MarcelEdward and GuduleLapointe! --- CONTRIBUTORS.txt | 1 + .../Shared/Api/Implementation/OSSL_Api.cs | 23 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 ++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ 4 files changed, 31 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index de5a6fc..e6956bb 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -107,6 +107,7 @@ what it is today. * M.Igarashi * maimedleech * Mana Janus +* MarcelEdward * Mic Bowman * Michelle Argus * Michael Cortez (The Flotsam Project, http://osflotsam.org/) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3dbc31a..2ecd890 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2957,5 +2957,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } + + /// + /// Get the description from an inventory item + /// + /// + /// Item description + public LSL_String osGetInventoryDesc(string item) + { + m_host.AddScriptLPS(1); + + lock (m_host.TaskInventory) + { + foreach (KeyValuePair inv in m_host.TaskInventory) + { + if (inv.Value.Name == item) + { + return inv.Value.Description.ToString(); + } + } + } + + return String.Empty; + } } } \ 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 a5b906f..8f9efc0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -229,5 +229,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List osGetAvatarList(); LSL_String osUnixTimeToTimestamp(long time); + + LSL_String osGetInventoryDesc(string item); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e048da2..09e5992 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -863,5 +863,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osUnixTimeToTimestamp(time); } + + public LSL_String osGetInventoryDesc(string item) + { + return m_OSSL_Functions.osGetInventoryDesc(item); + } } } -- cgit v1.1