refactor: In llGetInventoryKey() use existing GetInventoryItem()

0.7.4.1
Justin Clark-Casey (justincc) 2012-07-04 21:25:58 +01:00
parent 4b2b14dad1
commit 0e3fce9b5c
1 changed files with 9 additions and 15 deletions

View File

@ -4703,22 +4703,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
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))
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
if (inv.Value.Name == name)
{
if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
{
return inv.Value.AssetID.ToString();
}
else
{
return UUID.Zero.ToString();
}
}
}
return item.AssetID.ToString();
}
return UUID.Zero.ToString();