refactor: In llGetInventoryPermMask() use existing GetInventoryItem()

0.7.4.1
Justin Clark-Casey (justincc) 2012-07-04 21:47:20 +01:00
parent f9fa34408d
commit d933bdbd59
1 changed files with 21 additions and 24 deletions

View File

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