31 using System.Collections.Generic;
32 using System.Collections;
33 using System.Reflection;
34 using System.Threading;
37 using OpenSim.Framework;
38 using OpenSim.Region.Framework.Interfaces;
39 using OpenSim.Region.Framework.Scenes.Scripting;
40 using OpenSim.Region.Framework.Scenes.Serialization;
43 namespace OpenSim.
Region.Framework.Scenes
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 private byte[] m_inventoryFileData =
new byte[0];
50 private uint m_inventoryFileNameSerial = 0;
51 private bool m_inventoryPrivileged =
false;
52 private object m_inventoryFileLock =
new object();
54 private Dictionary<UUID, ArrayList> m_scriptErrors =
new Dictionary<UUID, ArrayList>();
65 protected uint m_inventorySerial = 0;
75 internal bool HasInventoryChanged;
80 protected internal uint Serial
82 get {
return m_inventorySerial; }
83 set { m_inventorySerial = value; }
107 return m_items.Count;
127 HasInventoryChanged =
true;
142 m_items.LockItemsForWrite(
true);
144 if (Items.Count == 0)
146 m_items.LockItemsForWrite(
false);
150 IList<TaskInventoryItem> items =
new List<TaskInventoryItem>(Items.Values);
155 item.ResetIDs(m_part.UUID);
156 Items.Add(item.ItemID, item);
158 m_items.LockItemsForWrite(
false);
163 m_items.LockItemsForWrite(
true);
165 if (Items.Count == 0)
167 m_items.LockItemsForWrite(
false);
171 IList<TaskInventoryItem> items =
new List<TaskInventoryItem>(Items.Values);
176 item.ParentPartID = m_part.UUID;
177 item.ParentID = m_part.UUID;
178 Items.Add(item.ItemID, item);
180 m_items.LockItemsForWrite(
false);
189 List<TaskInventoryItem> items = GetInventoryItems();
191 if (items.Count == 0)
194 m_items.LockItemsForWrite(
true);
195 HasInventoryChanged =
true;
196 m_part.ParentGroup.HasGroupChanged =
true;
200 item.LastOwnerID = item.OwnerID;
202 item.OwnerID = ownerId;
204 item.PermsGranter = UUID.Zero;
205 item.OwnerChanged =
true;
207 m_items.LockItemsForWrite(
false);
216 m_items.LockItemsForWrite(
true);
217 if (0 == Items.Count)
219 m_items.LockItemsForWrite(
false);
226 if (!m_part.ParentGroup.IsAttachment)
228 HasInventoryChanged =
true;
229 m_part.ParentGroup.HasGroupChanged =
true;
232 IList<TaskInventoryItem> items =
new List<TaskInventoryItem>(Items.Values);
237 item.GroupID = groupID;
240 m_items.LockItemsForWrite(
false);
243 private void QueryScriptStates()
245 if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null)
248 Items.LockItemsForRead(
true);
251 if (item.
InvType == (
int)InventoryType.LSL)
254 if (TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running))
259 Items.LockItemsForRead(
false);
271 return TryGetScriptInstanceRunning(m_part.ParentGroup.Scene, item, out running);
278 if (item.
InvType != (
int)InventoryType.LSL)
296 int scriptsValidForStarting = 0;
298 List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
300 if (CreateScriptInstance(item, startParam, postOnRez, engine, stateSource))
301 scriptsValidForStarting++;
303 return scriptsValidForStarting;
308 ArrayList ret =
new ArrayList();
316 ArrayList errors = e.GetScriptErrors(itemID);
317 foreach (
Object line
in errors)
334 List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
337 RemoveScriptInstance(item.
ItemID, sceneObjectBeingDeleted);
338 m_part.RemoveScriptEvents(item.ItemID);
347 GetInventoryItems(InventoryType.LSL).ForEach(i => StopScriptInstance(i));
360 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.
ItemID, m_part.UUID, item.
OwnerID))
362 StoreScriptError(item.
ItemID,
"no permission");
366 m_part.AddFlag(PrimFlags.Scripted);
368 if (m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts)
371 if (stateSource == 2 &&
372 m_part.ParentGroup.Scene.m_trustBinaries)
374 m_items.LockItemsForWrite(
true);
375 m_items[item.ItemID].PermsMask = 0;
376 m_items[item.ItemID].PermsGranter = UUID.Zero;
377 m_items.LockItemsForWrite(
false);
378 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
379 m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
380 StoreScriptErrors(item.
ItemID, null);
381 m_part.ParentGroup.AddActiveScriptCount(1);
382 m_part.ScheduleFullUpdate();
386 AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
389 string msg = String.Format(
"asset ID {0} could not be found", item.AssetID);
390 StoreScriptError(item.
ItemID, msg);
392 "[PRIM INVENTORY]: Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
393 item.Name, item.ItemID, m_part.AbsolutePosition,
394 m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
400 if (m_part.ParentGroup.m_savedScriptState != null)
403 m_items.LockItemsForWrite(
true);
405 m_items[item.ItemID].OldItemID = item.OldItemID;
406 m_items[item.ItemID].PermsMask = 0;
407 m_items[item.ItemID].PermsGranter = UUID.Zero;
409 m_items.LockItemsForWrite(
false);
411 string script = Utils.BytesToString(asset.Data);
412 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
413 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
414 StoreScriptErrors(item.
ItemID, null);
416 m_part.ParentGroup.Scene.EventManager.TriggerStopScript(
417 m_part.LocalId, item.ItemID);
418 m_part.ParentGroup.AddActiveScriptCount(1);
419 m_part.ScheduleFullUpdate();
425 private UUID RestoreSavedScriptState(UUID loadedID, UUID oldID, UUID newID)
432 if (engines.Length == 0)
435 UUID stateID = oldID;
436 if (!m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID))
438 if (m_part.ParentGroup.m_savedScriptState.ContainsKey(stateID))
440 XmlDocument doc =
new XmlDocument();
442 doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]);
452 XmlNode n = doc.SelectSingleNode(
"ScriptState");
455 XmlDocument newDoc =
new XmlDocument();
457 XmlElement rootN = newDoc.CreateElement(
"",
"State",
"");
458 XmlAttribute uuidA = newDoc.CreateAttribute(
"",
"UUID",
"");
459 uuidA.Value = stateID.ToString();
460 rootN.Attributes.Append(uuidA);
461 XmlAttribute engineA = newDoc.CreateAttribute(
"",
"Engine",
"");
462 engineA.Value =
"XEngine";
463 rootN.Attributes.Append(engineA);
465 newDoc.AppendChild(rootN);
467 XmlNode stateN = newDoc.ImportNode(n,
true);
468 rootN.AppendChild(stateN);
475 m_part.ParentGroup.m_savedScriptState[stateID] = newDoc.OuterXml;
482 if (e.
SetXMLState(newID, m_part.ParentGroup.m_savedScriptState[stateID]))
487 m_part.ParentGroup.m_savedScriptState.Remove(stateID);
502 lock (m_scriptErrors)
505 m_scriptErrors.Remove(itemId);
507 CreateScriptInstanceInternal(itemId, startParam, postOnRez, engine, stateSource);
511 private void CreateScriptInstanceInternal(UUID itemId,
int startParam,
bool postOnRez,
string engine,
int stateSource)
513 m_items.LockItemsForRead(
true);
515 if (m_items.ContainsKey(itemId))
518 m_items.LockItemsForRead(
false);
520 CreateScriptInstance(it, startParam, postOnRez, engine, stateSource);
524 m_items.LockItemsForRead(
false);
525 string msg = String.Format(
"couldn't be found for prim {0}, {1} at {2} in {3}", m_part.Name, m_part.UUID,
526 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
527 StoreScriptError(itemId, msg);
529 "[PRIM INVENTORY]: " +
530 "Couldn't start script with ID {0} since it {1}", itemId, msg);
546 lock (m_scriptErrors)
548 m_scriptErrors[itemId] = null;
552 CreateScriptInstanceInternal(itemId, startParam, postOnRez, engine, stateSource);
555 lock (m_scriptErrors)
557 while ((errors = m_scriptErrors[itemId]) == null)
559 if (!System.Threading.Monitor.Wait(m_scriptErrors, 15000))
562 "[PRIM INVENTORY]: " +
563 "timedout waiting for script {0} errors", itemId);
564 errors = m_scriptErrors[itemId];
567 errors =
new ArrayList(1);
568 errors.Add(
"timedout waiting for errors");
573 m_scriptErrors.Remove(itemId);
579 private void StoreScriptErrors(UUID itemId, ArrayList errors)
581 lock (m_scriptErrors)
585 if (!m_scriptErrors.ContainsKey(itemId))
594 m_scriptErrors[itemId] = errors;
595 System.Threading.Monitor.PulseAll(m_scriptErrors);
603 errors = GetScriptErrors(itemId);
608 errors =
new ArrayList();
612 lock (m_scriptErrors)
614 m_scriptErrors[itemId] = errors;
615 System.Threading.Monitor.PulseAll(m_scriptErrors);
620 private void StoreScriptError(UUID itemId,
string message)
622 ArrayList errors =
new ArrayList(1);
624 StoreScriptErrors(itemId, errors);
637 if (m_items.ContainsKey(itemId))
639 if (!sceneObjectBeingDeleted)
640 m_part.RemoveScriptEvents(itemId);
642 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemId);
643 m_part.ParentGroup.AddActiveScriptCount(-1);
648 "[PRIM INVENTORY]: " +
649 "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
650 itemId, m_part.Name, m_part.UUID,
651 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
668 m_items.TryGetValue(itemId, out scriptItem);
670 if (scriptItem != null)
672 StopScriptInstance(scriptItem);
677 "[PRIM INVENTORY]: " +
678 "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
679 itemId, m_part.Name, m_part.UUID,
680 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
694 if (m_part.ParentGroup.Scene != null)
695 m_part.ParentGroup.Scene.EventManager.TriggerStopScript(m_part.LocalId, item.ItemID);
706 private bool InventoryContainsName(
string name)
708 m_items.LockItemsForRead(
true);
711 if (item.
Name == name)
713 m_items.LockItemsForRead(
false);
717 m_items.LockItemsForRead(
false);
727 private string FindAvailableInventoryName(
string name)
729 if (!InventoryContainsName(name))
735 string tryName=String.Format(
"{0} {1}", name, suffix);
736 if (!InventoryContainsName(tryName))
750 AddInventoryItem(item.
Name, item, allowedDrop);
759 m_items.LockItemsForRead(
true);
760 List<TaskInventoryItem> il =
new List<TaskInventoryItem>(m_items.Values);
761 m_items.LockItemsForRead(
false);
766 if (i.
InvType == (
int)InventoryType.LSL)
767 RemoveScriptInstance(i.
ItemID,
false);
774 AddInventoryItem(item.
Name, item, allowedDrop);
790 name = FindAvailableInventoryName(name);
794 item.ParentID = m_part.UUID;
795 item.ParentPartID = m_part.UUID;
797 item.GroupID = m_part.GroupID;
799 m_items.LockItemsForWrite(
true);
800 m_items.Add(item.ItemID, item);
801 m_items.LockItemsForWrite(
false);
803 m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
805 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
809 HasInventoryChanged =
true;
810 m_part.ParentGroup.HasGroupChanged =
true;
822 m_items.LockItemsForWrite(
true);
825 m_items.Add(item.ItemID, item);
828 m_items.LockItemsForWrite(
false);
841 m_items.LockItemsForRead(
true);
842 m_items.TryGetValue(itemId, out item);
843 m_items.LockItemsForRead(
false);
849 m_items.LockItemsForRead(
true);
852 if (item.
Name == name)
854 m_items.LockItemsForRead(
false);
858 m_items.LockItemsForRead(
false);
865 List<TaskInventoryItem> items =
new List<TaskInventoryItem>();
867 m_items.LockItemsForRead(
true);
871 if (item.
Name == name)
875 m_items.LockItemsForRead(
false);
882 AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
884 if (null == rezAsset)
887 "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}",
888 item.AssetID, item.Name, m_part.Name);
896 bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data,
false, out objlist, out veclist, out bbox, out offsetHeight);
898 for (
int i = 0; i < objlist.Count; i++)
916 if (objlist.Count == 1)
918 rootPart.Name = item.Name;
919 rootPart.Description = item.Description;
941 group.SetGroup(m_part.GroupID, null);
944 if ((rootPart.OwnerID != item.
OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.
Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
946 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
950 if ((item.
Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
952 if ((item.
Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
954 if ((item.
Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
958 group.ApplyNextOwnerPermissions();
965 if ((part.
OwnerID != item.
OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.
Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
967 part.LastOwnerID = part.OwnerID;
968 part.OwnerID = item.OwnerID;
969 part.Inventory.ChangeInventoryOwner(item.OwnerID);
972 if ((item.
Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
973 part.EveryoneMask = item.EveryonePermissions;
974 if ((item.
Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
975 part.NextOwnerMask = item.NextPermissions;
976 if ((item.
Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
977 part.GroupMask = item.GroupPermissions;
980 rootPart.TrimPermissions();
1004 m_items.LockItemsForWrite(
true);
1006 if (m_items.ContainsKey(item.
ItemID))
1010 item.ParentID = m_part.UUID;
1011 item.ParentPartID = m_part.UUID;
1016 item.
GroupID = m_part.GroupID;
1019 item.AssetID = m_items[item.ItemID].AssetID;
1021 m_items[item.ItemID] = item;
1022 m_inventorySerial++;
1023 if (fireScriptEvents)
1024 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
1026 if (considerChanged)
1028 HasInventoryChanged =
true;
1029 m_part.ParentGroup.HasGroupChanged =
true;
1031 m_items.LockItemsForWrite(
false);
1037 "[PRIM INVENTORY]: " +
1038 "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
1039 item.ItemID, m_part.Name, m_part.UUID,
1040 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
1042 m_items.LockItemsForWrite(
false);
1055 m_items.LockItemsForRead(
true);
1057 if (m_items.ContainsKey(itemID))
1059 int type = m_items[itemID].InvType;
1060 m_items.LockItemsForRead(
false);
1063 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
1065 m_items.LockItemsForWrite(
true);
1066 m_items.Remove(itemID);
1067 m_items.LockItemsForWrite(
false);
1068 m_inventorySerial++;
1069 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
1071 HasInventoryChanged =
true;
1072 m_part.ParentGroup.HasGroupChanged =
true;
1074 int scriptcount = 0;
1075 m_items.LockItemsForRead(
true);
1078 if (item.
Type == 10)
1083 m_items.LockItemsForRead(
false);
1086 if (scriptcount <= 0)
1088 m_part.RemFlag(PrimFlags.Scripted);
1091 m_part.ScheduleFullUpdate();
1097 m_items.LockItemsForRead(
false);
1099 "[PRIM INVENTORY]: " +
1100 "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
1101 itemID, m_part.Name, m_part.UUID);
1115 lock (m_inventoryFileLock)
1117 string filename =
"inventory_" + UUID.Random().ToString() +
".tmp";
1119 bool changed =
false;
1120 if (m_inventoryFileNameSerial < m_inventorySerial)
1122 m_inventoryFileNameSerial = m_inventorySerial;
1126 if (m_inventoryFileData.Length < 2)
1129 bool includeAssets =
false;
1130 if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.
AgentId))
1131 includeAssets =
true;
1133 if (m_inventoryPrivileged != includeAssets)
1137 Items.LockItemsForRead(
true);
1139 if (m_inventorySerial == 0)
1141 Items.LockItemsForRead(
false);
1142 client.SendTaskInventory(m_part.UUID, 0,
new byte[0]);
1147 if (m_items.Count == 0)
1149 Items.LockItemsForRead(
false);
1150 client.SendTaskInventory(m_part.UUID, 0,
new byte[0]);
1156 Items.LockItemsForRead(
false);
1158 xferManager.AddNewFile(filename,
1159 m_inventoryFileData);
1160 client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
1161 Util.StringToBytes256(filename));
1166 m_inventoryPrivileged = includeAssets;
1172 UUID ownerID = item.OwnerID;
1173 uint everyoneMask = 0;
1174 uint baseMask = item.BasePermissions;
1175 uint ownerMask = item.CurrentPermissions;
1176 uint groupMask = item.GroupPermissions;
1178 invString.AddItemStart();
1179 invString.AddNameValueLine(
"item_id", item.ItemID.ToString());
1180 invString.AddNameValueLine(
"parent_id", m_part.UUID.ToString());
1182 invString.AddPermissionsStart();
1184 invString.AddNameValueLine(
"base_mask", Utils.UIntToHexString(baseMask));
1185 invString.AddNameValueLine(
"owner_mask", Utils.UIntToHexString(ownerMask));
1186 invString.AddNameValueLine(
"group_mask", Utils.UIntToHexString(groupMask));
1187 invString.AddNameValueLine(
"everyone_mask", Utils.UIntToHexString(everyoneMask));
1188 invString.AddNameValueLine(
"next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
1190 invString.AddNameValueLine(
"creator_id", item.CreatorID.ToString());
1191 invString.AddNameValueLine(
"owner_id", ownerID.ToString());
1193 invString.AddNameValueLine(
"last_owner_id", item.LastOwnerID.ToString());
1195 invString.AddNameValueLine(
"group_id", item.GroupID.ToString());
1196 invString.AddSectionEnd();
1199 invString.AddNameValueLine(
"asset_id", item.AssetID.ToString());
1201 invString.AddNameValueLine(
"asset_id", UUID.Zero.ToString());
1202 invString.AddNameValueLine(
"type", Utils.AssetTypeToString((AssetType)item.
Type));
1203 invString.AddNameValueLine(
"inv_type", Utils.InventoryTypeToString((InventoryType)item.
InvType));
1204 invString.AddNameValueLine(
"flags", Utils.UIntToHexString(item.Flags));
1206 invString.AddSaleStart();
1207 invString.AddNameValueLine(
"sale_type",
"not");
1208 invString.AddNameValueLine(
"sale_price",
"0");
1209 invString.AddSectionEnd();
1211 invString.AddNameValueLine(
"name", item.Name +
"|");
1212 invString.AddNameValueLine(
"desc", item.Description +
"|");
1214 invString.AddNameValueLine(
"creation_date", item.CreationDate.ToString());
1215 invString.AddSectionEnd();
1218 Items.LockItemsForRead(
false);
1220 m_inventoryFileData = Utils.StringToBytes(invString.BuildString);
1222 if (m_inventoryFileData.Length > 2)
1224 xferManager.AddNewFile(filename, m_inventoryFileData);
1225 client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,
1226 Util.StringToBytes256(filename));
1230 client.SendTaskInventory(m_part.UUID, 0,
new byte[0]);
1247 Items.LockItemsForRead(
true);
1250 datastore.StorePrimInventory(m_part.UUID, Items.Values);
1254 HasInventoryChanged =
false;
1256 Items.LockItemsForRead(
false);
1264 public string BuildString = String.Empty;
1268 BuildString +=
"\tinv_object\t0\n\t{\n";
1269 AddNameValueLine(
"obj_id", folderID.ToString());
1270 AddNameValueLine(
"parent_id", parentID.ToString());
1271 AddNameValueLine(
"type",
"category");
1272 AddNameValueLine(
"name",
"Contents|");
1278 BuildString +=
"\tinv_item\t0\n";
1284 BuildString +=
"\tpermissions 0\n";
1290 BuildString +=
"\tsale_info\t0\n";
1296 BuildString +=
"\t{\n";
1301 BuildString +=
"\t}\n";
1306 BuildString += addLine;
1311 BuildString +=
"\t\t";
1312 BuildString += name +
"\t";
1313 BuildString += value +
"\n";
1323 uint mask=0x7fffffff;
1334 if (item.
InvType == (
int)InventoryType.Object)
1337 mask &= ~((uint)PermissionMask.Copy >> 13);
1339 mask &= ~((uint)PermissionMask.Transfer >> 13);
1341 mask &= ~((uint)PermissionMask.Modify >> 13);
1367 item.CurrentPermissions &= item.NextPermissions;
1368 item.BasePermissions &= item.NextPermissions;
1369 item.EveryonePermissions &= item.NextPermissions;
1370 item.OwnerChanged =
true;
1372 item.PermsGranter = UUID.Zero;
1380 item.CurrentPermissions = perms;
1381 item.BasePermissions = perms;
1384 m_inventorySerial++;
1385 HasInventoryChanged =
true;
1396 if (item.
InvType == (
int)InventoryType.LSL)
1412 Items.LockItemsForRead(
true);
1415 if (item.
InvType == (
int)InventoryType.LSL)
1420 Items.LockItemsForRead(
false);
1430 if (engines.Length == 0)
1434 List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
1454 List<UUID> ret =
new List<UUID>();
1457 ret.Add(item.ItemID);
1464 List<TaskInventoryItem> ret =
new List<TaskInventoryItem>();
1466 Items.LockItemsForRead(
true);
1467 ret =
new List<TaskInventoryItem>(m_items.Values);
1468 Items.LockItemsForRead(
false);
1475 List<TaskInventoryItem> ret =
new List<TaskInventoryItem>();
1477 Items.LockItemsForRead(
true);
1480 if (item.
InvType == (
int)type)
1483 Items.LockItemsForRead(
false);
1490 return GetScriptStates(
false);
1495 Dictionary<UUID, string> ret =
new Dictionary<UUID, string>();
1497 if (m_part.ParentGroup.Scene == null)
1502 if (engines.Length == 0)
1505 List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
1517 string n = e.GetXMLState(item.ItemID);
1527 if (!ret.ContainsKey(item.
ItemID))
1541 if (engines.Length == 0)
1544 List<TaskInventoryItem> scripts = GetInventoryItems(InventoryType.LSL);
1556 engine.ResumeScript(item.ItemID);
1559 engine.PostScriptEvent(item.ItemID,
"changed",
new Object[] { (int)
Changed.OWNER });
1561 item.OwnerChanged =
false;
void RequestInventoryFile(IClientAPI client, IXfer xferManager)
Serialize all the metadata for the items in this prim's inventory ready for sending to the client ...
bool TryGetScriptInstanceRunning(UUID itemId, out bool running)
Try to get the script running status.
void ResetObjectID()
Reset parent object UUID for all the items in the prim's inventory.
bool SetXMLState(UUID itemID, string xml)
delegate void RemoveInventoryItem(IClientAPI remoteClient, List< UUID > itemIDs)
bool ScriptRunning
This used ONLY during copy. It can't be relied on at other times!
List< UUID > GetInventoryList()
Get the uuids of all items in this inventory
bool GetScriptState(UUID itemID)
Returns true if a script is running.
void ForceInventoryPersistence()
Force the task inventory of this prim to persist at the next update sweep
void ChangeInventoryOwner(UUID ownerId)
Change every item in this inventory to a new owner.
void AddInventoryItem(string name, TaskInventoryItem item, bool allowedDrop)
Add an item to this prim's inventory.
void StopScriptInstance(UUID itemId)
Stop a script which is in this prim's inventory.
A dictionary containing task inventory items. Indexed by item UUID.
uint MaskEffectivePermissions()
void RestoreInventoryItems(ICollection< TaskInventoryItem > items)
Restore a whole collection of items to the prim's inventory at once. We assume that the items already...
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
void AddInventoryItem(TaskInventoryItem item, bool allowedDrop)
Add an item to this prim's inventory. If an item with the same name already exists, then an alternative name is chosen.
Represents an item in a task inventory
SceneObjectPartInventory(SceneObjectPart part)
Constructor
int ScriptCount()
Returns the count of scripts in this parts inventory.
int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
Start all the scripts contained in this entity's inventory
void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted)
Stop and remove a script which is in this prim's inventory.
bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged)
void StopScriptInstances()
Stop all the scripts in this prim.
void ApplyGodPermissions(uint perms)
Asset class. All Assets are reference by this class or a class derived from this class ...
bool CreateScriptInstance(TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource)
Start a script which is in this prim's inventory.
bool GetRezReadySceneObjects(TaskInventoryItem item, out List< SceneObjectGroup > objlist, out List< Vector3 > veclist, out Vector3 bbox, out float offsetHeight)
Get the scene object(s) referenced by an inventory item.
List< TaskInventoryItem > GetInventoryItems(string name)
Get inventory items by name.
ArrayList CreateScriptInstanceEr(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
Start a script which is in this prim's inventory and return any compilation error messages...
void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
Add an item to this prim's inventory. If an item with the same name already exists, it is replaced.
void ProcessInventoryBackup(ISimulationDataService datastore)
Process inventory backup
void RemoveScriptInstances(bool sceneObjectBeingDeleted)
Stop and remove all the scripts in this prim.
delegate void UpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, UUID itemID, InventoryItemBase itemUpd)
void AddLine(string addLine)
void ResetInventoryIDs()
Reset UUIDs for all the items in the prim's inventory.
List< TaskInventoryItem > GetInventoryItems(InventoryType type)
Get inventory items by type.
void StopScriptInstance(TaskInventoryItem item)
Stop a script which is in this prim's inventory.
TaskInventoryItem GetInventoryItem(string name)
Gets an inventory item by name
void ApplyNextOwnerPermissions()
InventoryStringBuilder(UUID folderID, UUID parentID)
Dictionary< UUID, string > GetScriptStates()
Get the xml representing the saved states of scripts in this inventory.
int RemoveInventoryItem(UUID itemID)
Remove an item from this prim's inventory
OpenSim.Framework.PermissionMask PermissionMask
void AddPermissionsStart()
TaskInventoryItem GetInventoryItem(UUID itemId)
Returns an existing inventory item. Returns the original, so any changes will be live.
bool UpdateInventoryItem(TaskInventoryItem item)
Update an existing inventory item.
ArrayList GetScriptErrors(UUID itemID)
bool CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
Start a script which is in this prim's inventory. Some processing may occur in the background...
bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents)
void ChangeInventoryGroup(UUID groupID)
Change every item in this inventory to a new group.
Interface to an entity's (SceneObjectPart's) inventory
int RunningScriptCount()
Returns the count of running scripts in this parts inventory.
bool HasScript(UUID itemID, out bool running)
static bool TryGetScriptInstanceRunning(Scene scene, TaskInventoryItem item, out bool running)
Dictionary< UUID, string > GetScriptStates(bool oldIDs)
List< TaskInventoryItem > GetInventoryItems()
Get all inventory items.
bool ContainsScripts()
Returns true if this part inventory contains any scripts. False otherwise.
void AddNameValueLine(string name, string value)