mantis 8577: add key osGetInventoryItemKey(string name) to get a inventory item ID within prim inventory. the llGetInventory does return the asset it, not item.

This commit is contained in:
UbitUmarov
2019-08-16 21:22:16 +01:00
parent 9ddd2e842e
commit 64c56fc52b
5 changed files with 87 additions and 55 deletions

View File

@@ -5479,6 +5479,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return id.ToString();
}
public LSL_Key osGetInventoryItemKey(LSL_String name)
{
m_host.AddScriptLPS(1);
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
if (item == null)
return UUID.Zero.ToString();
if ((item.CurrentPermissions
& (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
== (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
{
return item.ItemID.ToString();
}
return UUID.Zero.ToString();
}
public LSL_String osGetInventoryName(LSL_Key itemId)
{
m_host.AddScriptLPS(1);

View File

@@ -549,6 +549,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Integer osApproxEquals(rotation ra, rotation rb);
LSL_Integer osApproxEquals(rotation ra, rotation rb, LSL_Float margin);
LSL_Key osGetInventoryLastOwner(LSL_String itemNameOrId);
LSL_Key osGetInventoryItemKey(LSL_String name);
LSL_String osGetInventoryName(LSL_Key itemId);
LSL_String osGetInventoryDesc(LSL_String itemNameOrId);
LSL_Key osGetLastChangedEventKey();

View File

@@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public partial class ScriptBaseClass
{
// SCRIPTS CONSTANTS
public static readonly LSLInteger OS_APIVERSION = 5;
public static readonly LSLInteger OS_APIVERSION = 6;
public static readonly LSLInteger TRUE = 1;
public static readonly LSLInteger FALSE = 0;

View File

@@ -1382,6 +1382,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetInventoryLastOwner(itemNameOrId);
}
public LSL_Key osGetInventoryItemKey(LSL_String name)
{
return m_OSSL_Functions.osGetInventoryItemKey(name);
}
public LSL_String osGetInventoryName(LSL_Key itemId)
{
return m_OSSL_Functions.osGetInventoryName(itemId);