refactor: In llGetInventoryPermMask() use existing GetInventoryItem()

0.7.3-extended
Justin Clark-Casey (justincc) 2012-07-04 21:47:20 +01:00
parent 795443cff1
commit 6ff0e58db7
1 changed files with 21 additions and 24 deletions

View File

@ -8898,43 +8898,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return -1; return -1;
} }
public void llSetInventoryPermMask(string item, int mask, int value) public void llSetInventoryPermMask(string itemName, int mask, int value)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false)) if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
{ {
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
{ {
lock (m_host.TaskInventory) TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName);
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) if (item != null)
{
if (inv.Value.Name == item)
{ {
switch (mask) switch (mask)
{ {
case 0: case 0:
inv.Value.BasePermissions = (uint)value; item.BasePermissions = (uint)value;
break; break;
case 1: case 1:
inv.Value.CurrentPermissions = (uint)value; item.CurrentPermissions = (uint)value;
break; break;
case 2: case 2:
inv.Value.GroupPermissions = (uint)value; item.GroupPermissions = (uint)value;
break; break;
case 3: case 3:
inv.Value.EveryonePermissions = (uint)value; item.EveryonePermissions = (uint)value;
break; break;
case 4: case 4:
inv.Value.NextPermissions = (uint)value; item.NextPermissions = (uint)value;
break; break;
} }
} }
} }
} }
} }
}
}
public LSL_String llGetInventoryCreator(string item) public LSL_String llGetInventoryCreator(string item)
{ {