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,38 +8898,35 @@ 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);
if (item != null)
{ {
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) switch (mask)
{ {
if (inv.Value.Name == item) case 0:
{ item.BasePermissions = (uint)value;
switch (mask) break;
{ case 1:
case 0: item.CurrentPermissions = (uint)value;
inv.Value.BasePermissions = (uint)value; break;
break; case 2:
case 1: item.GroupPermissions = (uint)value;
inv.Value.CurrentPermissions = (uint)value; break;
break; case 3:
case 2: item.EveryonePermissions = (uint)value;
inv.Value.GroupPermissions = (uint)value; break;
break; case 4:
case 3: item.NextPermissions = (uint)value;
inv.Value.EveryonePermissions = (uint)value; break;
break;
case 4:
inv.Value.NextPermissions = (uint)value;
break;
}
}
} }
} }
} }