aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLRegionData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs2
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs2
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs2
-rw-r--r--OpenSim/Data/Tests/BasicRegionTest.cs16
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs40
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs27
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs67
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs (renamed from OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs)240
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs4
23 files changed, 252 insertions, 199 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
index 6298a19..c29f566 100644
--- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
@@ -718,7 +718,7 @@ VALUES
718 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); 718 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
719 } 719 }
720 720
721 prim.RestoreInventoryItems(inventory); 721 prim.Inventory.RestoreInventoryItems(inventory);
722 722
723 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in 723 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in
724 // every item). This data should really be stored in the prim table itself. 724 // every item). This data should really be stored in the prim table itself.
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 1daefe4..2e36123 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -511,7 +511,7 @@ namespace OpenSim.Data.MySQL
511 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); 511 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
512 } 512 }
513 513
514 prim.RestoreInventoryItems(inventory); 514 prim.Inventory.RestoreInventoryItems(inventory);
515 515
516 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in 516 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in
517 // every item). This data should really be stored in the prim table itself. 517 // every item). This data should really be stored in the prim table itself.
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 833f1b7..475cd71 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -261,7 +261,7 @@ namespace OpenSim.Data.NHibernate
261 } 261 }
262 262
263 if (inventory.Count > 0) 263 if (inventory.Count > 0)
264 p.RestoreInventoryItems(inventory); 264 p.Inventory.RestoreInventoryItems(inventory);
265 } 265 }
266 foreach (SceneObjectGroup g in SOG.Values) 266 foreach (SceneObjectGroup g in SOG.Values)
267 { 267 {
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index a959d56..c436205 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -514,7 +514,7 @@ namespace OpenSim.Data.SQLite
514 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); 514 //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
515 } 515 }
516 516
517 prim.RestoreInventoryItems(inventory); 517 prim.Inventory.RestoreInventoryItems(inventory);
518 518
519 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in 519 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in
520 // every item). This data should really be stored in the prim table itself. 520 // every item). This data should really be stored in the prim table itself.
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs
index a7d62d0..e68ec2e 100644
--- a/OpenSim/Data/Tests/BasicRegionTest.cs
+++ b/OpenSim/Data/Tests/BasicRegionTest.cs
@@ -255,8 +255,8 @@ namespace OpenSim.Data.Tests
255 sop.GroupPosition = groupos; 255 sop.GroupPosition = groupos;
256 sop.RotationOffset = rotoff; 256 sop.RotationOffset = rotoff;
257 sop.CreatorID = creator; 257 sop.CreatorID = creator;
258 sop.InventorySerial = iserial; 258 sop.Inventory.Serial = iserial;
259 sop.TaskInventory = dic; 259 sop.Inventory.Items = dic;
260 sop.ObjectFlags = objf; 260 sop.ObjectFlags = objf;
261 sop.Name = name; 261 sop.Name = name;
262 sop.Material = material; 262 sop.Material = material;
@@ -287,8 +287,8 @@ namespace OpenSim.Data.Tests
287 Assert.That(rotoff,Is.EqualTo(sop.RotationOffset)); 287 Assert.That(rotoff,Is.EqualTo(sop.RotationOffset));
288 Assert.That(uuid,Is.EqualTo(sop.UUID)); 288 Assert.That(uuid,Is.EqualTo(sop.UUID));
289 Assert.That(creator,Is.EqualTo(sop.CreatorID)); 289 Assert.That(creator,Is.EqualTo(sop.CreatorID));
290 Assert.That(iserial,Is.EqualTo(sop.InventorySerial)); 290 Assert.That(iserial,Is.EqualTo(sop.Inventory.Serial));
291 Assert.That(dic,Is.EqualTo(sop.TaskInventory)); 291 Assert.That(dic,Is.EqualTo(sop.Inventory.Items));
292 Assert.That(objf,Is.EqualTo(sop.ObjectFlags)); 292 Assert.That(objf,Is.EqualTo(sop.ObjectFlags));
293 Assert.That(name,Is.EqualTo(sop.Name)); 293 Assert.That(name,Is.EqualTo(sop.Name));
294 Assert.That(material,Is.EqualTo(sop.Material)); 294 Assert.That(material,Is.EqualTo(sop.Material));
@@ -337,7 +337,7 @@ namespace OpenSim.Data.Tests
337 Assert.That(uuid,Is.EqualTo(p.UUID)); 337 Assert.That(uuid,Is.EqualTo(p.UUID));
338 Assert.That(creator,Is.EqualTo(p.CreatorID)); 338 Assert.That(creator,Is.EqualTo(p.CreatorID));
339 //Assert.That(iserial,Is.EqualTo(p.InventorySerial)); 339 //Assert.That(iserial,Is.EqualTo(p.InventorySerial));
340 Assert.That(dic,Is.EqualTo(p.TaskInventory)); 340 Assert.That(dic,Is.EqualTo(p.Inventory.Items));
341 //Assert.That(objf,Is.EqualTo(p.ObjectFlags)); 341 //Assert.That(objf,Is.EqualTo(p.ObjectFlags));
342 Assert.That(name,Is.EqualTo(p.Name)); 342 Assert.That(name,Is.EqualTo(p.Name));
343 Assert.That(material,Is.EqualTo(p.Material)); 343 Assert.That(material,Is.EqualTo(p.Material));
@@ -415,7 +415,7 @@ namespace OpenSim.Data.Tests
415 sog2.RootPart.GroupPosition = groupos; 415 sog2.RootPart.GroupPosition = groupos;
416 sog2.RootPart.RotationOffset = rotoff; 416 sog2.RootPart.RotationOffset = rotoff;
417 sog2.RootPart.CreatorID = creator; 417 sog2.RootPart.CreatorID = creator;
418 sog2.RootPart.TaskInventory = dic; 418 sog2.RootPart.Inventory.Items = dic;
419 sog2.RootPart.Name = name; 419 sog2.RootPart.Name = name;
420 sog2.RootPart.Material = material; 420 sog2.RootPart.Material = material;
421 sog2.RootPart.ScriptAccessPin = pin; 421 sog2.RootPart.ScriptAccessPin = pin;
@@ -449,7 +449,7 @@ namespace OpenSim.Data.Tests
449 Assert.That(name,Is.EqualTo(p.Name)); 449 Assert.That(name,Is.EqualTo(p.Name));
450 Assert.That(rotoff,Is.EqualTo(p.RotationOffset)); 450 Assert.That(rotoff,Is.EqualTo(p.RotationOffset));
451 Assert.That(creator,Is.EqualTo(p.CreatorID)); 451 Assert.That(creator,Is.EqualTo(p.CreatorID));
452 Assert.That(dic,Is.EqualTo(p.TaskInventory)); 452 Assert.That(dic,Is.EqualTo(p.Inventory.Items));
453 Assert.That(name,Is.EqualTo(p.Name)); 453 Assert.That(name,Is.EqualTo(p.Name));
454 Assert.That(material,Is.EqualTo(p.Material)); 454 Assert.That(material,Is.EqualTo(p.Material));
455 Assert.That(pin,Is.EqualTo(p.ScriptAccessPin)); 455 Assert.That(pin,Is.EqualTo(p.ScriptAccessPin));
@@ -534,7 +534,7 @@ namespace OpenSim.Data.Tests
534 // TODO: seriously??? this is the way we need to loop to get this? 534 // TODO: seriously??? this is the way we need to loop to get this?
535 535
536 List<TaskInventoryItem> list = new List<TaskInventoryItem>(); 536 List<TaskInventoryItem> list = new List<TaskInventoryItem>();
537 foreach (UUID uuid in sog.RootPart.GetInventoryList()) 537 foreach (UUID uuid in sog.RootPart.Inventory.GetInventoryList())
538 { 538 {
539 list.Add(sog.GetInventoryItem(sog.RootPart.LocalId, uuid)); 539 list.Add(sog.GetInventoryItem(sog.RootPart.LocalId, uuid));
540 } 540 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 978a2da..9874886 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4998,7 +4998,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4998 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 4998 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
4999 break; 4999 break;
5000 5000
5001 TaskInventoryItem ti = part.GetInventoryItem(itemID); 5001 TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID);
5002 if (ti == null) 5002 if (ti == null)
5003 break; 5003 break;
5004 5004
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs
index 05b7fa3..3ef2e1f 100644
--- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -267,7 +267,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
267 267
268 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset); 268 m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset);
269 269
270 if (part.UpdateInventoryItem(item)) 270 if (part.Inventory.UpdateInventoryItem(item))
271 part.GetProperties(remoteClient); 271 part.GetProperties(remoteClient);
272 } 272 }
273 273
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index e41f975..d7865b2 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -796,7 +796,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
796 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 796 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
797 return false; 797 return false;
798 798
799 TaskInventoryItem ti = part.GetInventoryItem(notecard); 799 TaskInventoryItem ti = part.Inventory.GetInventoryItem(notecard);
800 800
801 if (ti == null) 801 if (ti == null)
802 return false; 802 return false;
@@ -1188,7 +1188,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1188 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 1188 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
1189 return false; 1189 return false;
1190 1190
1191 TaskInventoryItem ti = part.GetInventoryItem(script); 1191 TaskInventoryItem ti = part.Inventory.GetInventoryItem(script);
1192 1192
1193 if (ti == null) 1193 if (ti == null)
1194 return false; 1194 return false;
@@ -1266,7 +1266,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
1266 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 1266 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
1267 return false; 1267 return false;
1268 1268
1269 TaskInventoryItem ti = part.GetInventoryItem(notecard); 1269 TaskInventoryItem ti = part.Inventory.GetInventoryItem(notecard);
1270 1270
1271 if (ti == null) 1271 if (ti == null)
1272 return false; 1272 return false;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 19b8e16..686f4ba 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -280,7 +280,7 @@ namespace OpenSim.Region.Environment.Scenes
280 280
281 if (isScriptRunning) 281 if (isScriptRunning)
282 { 282 {
283 part.RemoveScriptInstance(item.ItemID); 283 part.Inventory.RemoveScriptInstance(item.ItemID);
284 } 284 }
285 // Update item with new asset 285 // Update item with new asset
286 item.AssetID = asset.FullID; 286 item.AssetID = asset.FullID;
@@ -292,7 +292,7 @@ namespace OpenSim.Region.Environment.Scenes
292 { 292 {
293 // Needs to determine which engine was running it and use that 293 // Needs to determine which engine was running it and use that
294 // 294 //
295 part.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); 295 part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0);
296 } 296 }
297 else 297 else
298 { 298 {
@@ -945,7 +945,7 @@ namespace OpenSim.Region.Environment.Scenes
945 945
946 private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) 946 private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId)
947 { 947 {
948 TaskInventoryItem taskItem = part.GetInventoryItem(itemId); 948 TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
949 949
950 if (null == taskItem) 950 if (null == taskItem)
951 { 951 {
@@ -995,7 +995,7 @@ namespace OpenSim.Region.Environment.Scenes
995 if (!ExternalChecks.ExternalChecksBypassPermissions()) 995 if (!ExternalChecks.ExternalChecksBypassPermissions())
996 { 996 {
997 if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 997 if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
998 part.RemoveInventoryItem(itemId); 998 part.Inventory.RemoveInventoryItem(itemId);
999 } 999 }
1000 1000
1001 return agentItem; 1001 return agentItem;
@@ -1040,7 +1040,7 @@ namespace OpenSim.Region.Environment.Scenes
1040 return; 1040 return;
1041 } 1041 }
1042 1042
1043 TaskInventoryItem taskItem = part.GetInventoryItem(itemId); 1043 TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
1044 1044
1045 if (null == taskItem) 1045 if (null == taskItem)
1046 { 1046 {
@@ -1104,7 +1104,7 @@ namespace OpenSim.Region.Environment.Scenes
1104 /// <param name="itemId"></param> 1104 /// <param name="itemId"></param>
1105 public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId) 1105 public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId)
1106 { 1106 {
1107 TaskInventoryItem srcTaskItem = part.GetInventoryItem(itemId); 1107 TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId);
1108 1108
1109 if (srcTaskItem == null) 1109 if (srcTaskItem == null)
1110 { 1110 {
@@ -1184,10 +1184,10 @@ namespace OpenSim.Region.Environment.Scenes
1184 destTaskItem.InvType = srcTaskItem.InvType; 1184 destTaskItem.InvType = srcTaskItem.InvType;
1185 destTaskItem.Type = srcTaskItem.Type; 1185 destTaskItem.Type = srcTaskItem.Type;
1186 1186
1187 destPart.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID); 1187 destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID);
1188 1188
1189 if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1189 if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1190 part.RemoveInventoryItem(itemId); 1190 part.Inventory.RemoveInventoryItem(itemId);
1191 1191
1192 ScenePresence avatar; 1192 ScenePresence avatar;
1193 1193
@@ -1254,7 +1254,7 @@ namespace OpenSim.Region.Environment.Scenes
1254 1254
1255 if (part != null) 1255 if (part != null)
1256 { 1256 {
1257 TaskInventoryItem currentItem = part.GetInventoryItem(itemID); 1257 TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID);
1258 bool allowInventoryDrop = (part.GetEffectiveObjectFlags() 1258 bool allowInventoryDrop = (part.GetEffectiveObjectFlags()
1259 & (uint)PrimFlags.AllowInventoryDrop) != 0; 1259 & (uint)PrimFlags.AllowInventoryDrop) != 0;
1260 1260
@@ -1314,7 +1314,7 @@ namespace OpenSim.Region.Environment.Scenes
1314 agentTransactions.HandleTaskItemUpdateFromTransaction( 1314 agentTransactions.HandleTaskItemUpdateFromTransaction(
1315 remoteClient, part, transactionID, currentItem); 1315 remoteClient, part, transactionID, currentItem);
1316 } 1316 }
1317 if (part.UpdateInventoryItem(itemInfo)) 1317 if (part.Inventory.UpdateInventoryItem(itemInfo))
1318 part.GetProperties(remoteClient); 1318 part.GetProperties(remoteClient);
1319 } 1319 }
1320 } 1320 }
@@ -1364,7 +1364,7 @@ namespace OpenSim.Region.Environment.Scenes
1364 part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); 1364 part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
1365 // TODO: switch to posting on_rez here when scripts 1365 // TODO: switch to posting on_rez here when scripts
1366 // have state in inventory 1366 // have state in inventory
1367 part.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); 1367 part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
1368 1368
1369 // m_log.InfoFormat("[PRIMINVENTORY]: " + 1369 // m_log.InfoFormat("[PRIMINVENTORY]: " +
1370 // "Rezzed script {0} into prim local ID {1} for user {2}", 1370 // "Rezzed script {0} into prim local ID {1} for user {2}",
@@ -1430,10 +1430,10 @@ namespace OpenSim.Region.Environment.Scenes
1430 taskItem.PermsMask = 0; 1430 taskItem.PermsMask = 0;
1431 taskItem.AssetID = asset.FullID; 1431 taskItem.AssetID = asset.FullID;
1432 1432
1433 part.AddInventoryItem(taskItem, false); 1433 part.Inventory.AddInventoryItem(taskItem, false);
1434 part.GetProperties(remoteClient); 1434 part.GetProperties(remoteClient);
1435 1435
1436 part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); 1436 part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
1437 } 1437 }
1438 } 1438 }
1439 1439
@@ -1445,7 +1445,7 @@ namespace OpenSim.Region.Environment.Scenes
1445 /// <param name="localID"></param> 1445 /// <param name="localID"></param>
1446 public void RezScript(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param) 1446 public void RezScript(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param)
1447 { 1447 {
1448 TaskInventoryItem srcTaskItem = srcPart.GetInventoryItem(srcId); 1448 TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId);
1449 1449
1450 if (srcTaskItem == null) 1450 if (srcTaskItem == null)
1451 { 1451 {
@@ -1525,11 +1525,11 @@ namespace OpenSim.Region.Environment.Scenes
1525 destTaskItem.InvType = srcTaskItem.InvType; 1525 destTaskItem.InvType = srcTaskItem.InvType;
1526 destTaskItem.Type = srcTaskItem.Type; 1526 destTaskItem.Type = srcTaskItem.Type;
1527 1527
1528 destPart.AddInventoryItemExclusive(destTaskItem, false); 1528 destPart.Inventory.AddInventoryItemExclusive(destTaskItem, false);
1529 1529
1530 if (running > 0) 1530 if (running > 0)
1531 { 1531 {
1532 destPart.CreateScriptInstance(destTaskItem, 0, false, DefaultScriptEngine, 0); 1532 destPart.Inventory.CreateScriptInstance(destTaskItem, 0, false, DefaultScriptEngine, 0);
1533 } 1533 }
1534 1534
1535 ScenePresence avatar; 1535 ScenePresence avatar;
@@ -2064,7 +2064,7 @@ namespace OpenSim.Region.Environment.Scenes
2064 { 2064 {
2065 part.LastOwnerID = part.OwnerID; 2065 part.LastOwnerID = part.OwnerID;
2066 part.OwnerID = item.Owner; 2066 part.OwnerID = item.Owner;
2067 part.ChangeInventoryOwner(item.Owner); 2067 part.Inventory.ChangeInventoryOwner(item.Owner);
2068 } 2068 }
2069 else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam! 2069 else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
2070 { 2070 {
@@ -2178,7 +2178,7 @@ namespace OpenSim.Region.Environment.Scenes
2178 { 2178 {
2179 part.LastOwnerID = part.OwnerID; 2179 part.LastOwnerID = part.OwnerID;
2180 part.OwnerID = item.OwnerID; 2180 part.OwnerID = item.OwnerID;
2181 part.ChangeInventoryOwner(item.OwnerID); 2181 part.Inventory.ChangeInventoryOwner(item.OwnerID);
2182 } 2182 }
2183 else if ((item.CurrentPermissions & 8) != 0) // Slam! 2183 else if ((item.CurrentPermissions & 8) != 0) // Slam!
2184 { 2184 {
@@ -2200,7 +2200,7 @@ namespace OpenSim.Region.Environment.Scenes
2200 if (!ExternalChecks.ExternalChecksBypassPermissions()) 2200 if (!ExternalChecks.ExternalChecksBypassPermissions())
2201 { 2201 {
2202 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 2202 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
2203 sourcePart.RemoveInventoryItem(item.ItemID); 2203 sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
2204 } 2204 }
2205 return rootPart.ParentGroup; 2205 return rootPart.ParentGroup;
2206 } 2206 }
@@ -2368,7 +2368,7 @@ namespace OpenSim.Region.Environment.Scenes
2368 if (part != null && part.ParentGroup != null) 2368 if (part != null && part.ParentGroup != null)
2369 { 2369 {
2370 part.ParentGroup.SetOwnerId(ownerID); 2370 part.ParentGroup.SetOwnerId(ownerID);
2371 part.ChangeInventoryOwner(ownerID); 2371 part.Inventory.ChangeInventoryOwner(ownerID);
2372 part.ParentGroup.SetGroup(groupID, remoteClient); 2372 part.ParentGroup.SetGroup(groupID, remoteClient);
2373 } 2373 }
2374 } 2374 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 221af44..9c29c44 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -4277,8 +4277,8 @@ namespace OpenSim.Region.Environment.Scenes
4277 { 4277 {
4278 foreach (SceneObjectPart child in partList) 4278 foreach (SceneObjectPart child in partList)
4279 { 4279 {
4280 child.ChangeInventoryOwner(remoteClient.AgentId); 4280 child.Inventory.ChangeInventoryOwner(remoteClient.AgentId);
4281 child.ApplyNextOwnerPermissions(); 4281 child.Inventory.ApplyNextOwnerPermissions();
4282 } 4282 }
4283 } 4283 }
4284 4284
@@ -4355,13 +4355,13 @@ namespace OpenSim.Region.Environment.Scenes
4355 break; 4355 break;
4356 4356
4357 case 3: // Sell contents 4357 case 3: // Sell contents
4358 List<UUID> invList = part.GetInventoryList(); 4358 List<UUID> invList = part.Inventory.GetInventoryList();
4359 4359
4360 bool okToSell = true; 4360 bool okToSell = true;
4361 4361
4362 foreach (UUID invID in invList) 4362 foreach (UUID invID in invList)
4363 { 4363 {
4364 TaskInventoryItem item = part.GetInventoryItem(invID); 4364 TaskInventoryItem item = part.Inventory.GetInventoryItem(invID);
4365 if ((item.CurrentPermissions & 4365 if ((item.CurrentPermissions &
4366 (uint)PermissionMask.Transfer) == 0) 4366 (uint)PermissionMask.Transfer) == 0)
4367 { 4367 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
index 21c7905..9ca5564 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Environment.Scenes
50 { 50 {
51 foreach (SceneObjectPart part in m_parts.Values) 51 foreach (SceneObjectPart part in m_parts.Values)
52 { 52 {
53 part.ForceInventoryPersistence(); 53 part.Inventory.ForceInventoryPersistence();
54 } 54 }
55 } 55 }
56 } 56 }
@@ -66,8 +66,7 @@ namespace OpenSim.Region.Environment.Scenes
66 { 66 {
67 foreach (SceneObjectPart part in m_parts.Values) 67 foreach (SceneObjectPart part in m_parts.Values)
68 { 68 {
69 part.CreateScriptInstances(startParam, postOnRez, engine, 69 part.Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource);
70 stateSource);
71 } 70 }
72 } 71 }
73 } 72 }
@@ -81,7 +80,7 @@ namespace OpenSim.Region.Environment.Scenes
81 { 80 {
82 foreach (SceneObjectPart part in m_parts.Values) 81 foreach (SceneObjectPart part in m_parts.Values)
83 { 82 {
84 part.RemoveScriptInstances(); 83 part.Inventory.RemoveScriptInstances();
85 } 84 }
86 } 85 }
87 } 86 }
@@ -96,7 +95,7 @@ namespace OpenSim.Region.Environment.Scenes
96 SceneObjectPart part = GetChildPart(localID); 95 SceneObjectPart part = GetChildPart(localID);
97 if (part != null) 96 if (part != null)
98 { 97 {
99 return part.GetInventoryFileName(remoteClient, localID); 98 return part.Inventory.GetInventoryFileName(remoteClient, localID);
100 } 99 }
101 else 100 else
102 { 101 {
@@ -118,7 +117,7 @@ namespace OpenSim.Region.Environment.Scenes
118 SceneObjectPart part = GetChildPart(localID); 117 SceneObjectPart part = GetChildPart(localID);
119 if (part != null) 118 if (part != null)
120 { 119 {
121 part.RequestInventoryFile(client, xferManager); 120 part.Inventory.RequestInventoryFile(client, xferManager);
122 } 121 }
123 else 122 else
124 { 123 {
@@ -191,7 +190,7 @@ namespace OpenSim.Region.Environment.Scenes
191 addFromAllowedDrop = remoteClient.AgentId != part.OwnerID; 190 addFromAllowedDrop = remoteClient.AgentId != part.OwnerID;
192 } 191 }
193 192
194 part.AddInventoryItem(taskItem, addFromAllowedDrop); 193 part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
195 194
196 return true; 195 return true;
197 } 196 }
@@ -217,7 +216,7 @@ namespace OpenSim.Region.Environment.Scenes
217 SceneObjectPart part = GetChildPart(primID); 216 SceneObjectPart part = GetChildPart(primID);
218 if (part != null) 217 if (part != null)
219 { 218 {
220 return part.GetInventoryItem(itemID); 219 return part.Inventory.GetInventoryItem(itemID);
221 } 220 }
222 else 221 else
223 { 222 {
@@ -241,7 +240,7 @@ namespace OpenSim.Region.Environment.Scenes
241 SceneObjectPart part = GetChildPart(item.ParentPartID); 240 SceneObjectPart part = GetChildPart(item.ParentPartID);
242 if (part != null) 241 if (part != null)
243 { 242 {
244 part.UpdateInventoryItem(item); 243 part.Inventory.UpdateInventoryItem(item);
245 244
246 return true; 245 return true;
247 } 246 }
@@ -261,7 +260,7 @@ namespace OpenSim.Region.Environment.Scenes
261 SceneObjectPart part = GetChildPart(localID); 260 SceneObjectPart part = GetChildPart(localID);
262 if (part != null) 261 if (part != null)
263 { 262 {
264 int type = part.RemoveInventoryItem(itemID); 263 int type = part.Inventory.RemoveInventoryItem(itemID);
265 264
266 return type; 265 return type;
267 } 266 }
@@ -280,7 +279,7 @@ namespace OpenSim.Region.Environment.Scenes
280 foreach (SceneObjectPart part in m_parts.Values) 279 foreach (SceneObjectPart part in m_parts.Values)
281 { 280 {
282 ownerMask &= part.OwnerMask; 281 ownerMask &= part.OwnerMask;
283 perms &= part.MaskEffectivePermissions(); 282 perms &= part.Inventory.MaskEffectivePermissions();
284 } 283 }
285 284
286 if ((ownerMask & (uint)PermissionMask.Modify) == 0) 285 if ((ownerMask & (uint)PermissionMask.Modify) == 0)
@@ -303,7 +302,7 @@ namespace OpenSim.Region.Environment.Scenes
303 public void ApplyNextOwnerPermissions() 302 public void ApplyNextOwnerPermissions()
304 { 303 {
305 foreach (SceneObjectPart part in m_parts.Values) 304 foreach (SceneObjectPart part in m_parts.Values)
306 part.ApplyNextOwnerPermissions(); 305 part.Inventory.ApplyNextOwnerPermissions();
307 } 306 }
308 307
309 public string GetStateSnapshot() 308 public string GetStateSnapshot()
@@ -313,13 +312,13 @@ namespace OpenSim.Region.Environment.Scenes
313 312
314 foreach (SceneObjectPart part in m_parts.Values) 313 foreach (SceneObjectPart part in m_parts.Values)
315 { 314 {
316 foreach (string a in part.GetScriptAssemblies()) 315 foreach (string a in part.Inventory.GetScriptAssemblies())
317 { 316 {
318 if (a != "" && !assemblies.Contains(a)) 317 if (a != "" && !assemblies.Contains(a))
319 assemblies.Add(a); 318 assemblies.Add(a);
320 } 319 }
321 320
322 foreach (KeyValuePair<UUID, string> s in part.GetScriptStates()) 321 foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates())
323 { 322 {
324 states[s.Key] = s.Value; 323 states[s.Key] = s.Value;
325 } 324 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index f9eaa89..fcda37b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1044,7 +1044,7 @@ namespace OpenSim.Region.Environment.Scenes
1044 { 1044 {
1045 foreach (SceneObjectPart part in m_parts.Values) 1045 foreach (SceneObjectPart part in m_parts.Values)
1046 { 1046 {
1047// part.RemoveScriptInstances(); 1047// part.Inventory.RemoveScriptInstances();
1048 1048
1049 List<ScenePresence> avatars = Scene.GetScenePresences(); 1049 List<ScenePresence> avatars = Scene.GetScenePresences();
1050 for (int i = 0; i < avatars.Count; i++) 1050 for (int i = 0; i < avatars.Count; i++)
@@ -1251,7 +1251,7 @@ namespace OpenSim.Region.Environment.Scenes
1251 1251
1252 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); 1252 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
1253 1253
1254 backup_group.ForEachPart(delegate(SceneObjectPart part) { part.ProcessInventoryBackup(datastore); }); 1254 backup_group.ForEachPart(delegate(SceneObjectPart part) { part.Inventory.ProcessInventoryBackup(datastore); });
1255 1255
1256 backup_group = null; 1256 backup_group = null;
1257 } 1257 }
@@ -2828,7 +2828,7 @@ namespace OpenSim.Region.Environment.Scenes
2828 foreach (SceneObjectPart part in m_parts.Values) 2828 foreach (SceneObjectPart part in m_parts.Values)
2829 { 2829 {
2830 part.SetGroup(GroupID, client); 2830 part.SetGroup(GroupID, client);
2831 part.ChangeInventoryGroup(GroupID); 2831 part.Inventory.ChangeInventoryGroup(GroupID);
2832 } 2832 }
2833 2833
2834 HasGroupChanged = true; 2834 HasGroupChanged = true;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 888643e..250c803 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -28,20 +28,20 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.Reflection;
31using System.Runtime.Serialization; 32using System.Runtime.Serialization;
32using System.Security.Permissions; 33using System.Security.Permissions;
33using System.Xml; 34using System.Xml;
34using System.Xml.Serialization; 35using System.Xml.Serialization;
35 36using log4net;
36using OpenMetaverse; 37using OpenMetaverse;
37using OpenMetaverse.Packets; 38using OpenMetaverse.Packets;
38
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Region.Environment.Scenes.Scripting; 40using OpenSim.Region.Environment.Scenes.Scripting;
41using OpenSim.Region.Physics.Manager; 41using OpenSim.Region.Physics.Manager;
42 42
43namespace OpenSim.Region.Environment.Scenes 43namespace OpenSim.Region.Environment.Scenes
44{ 44{
45 #region Enumerations 45 #region Enumerations
46 46
47 [Flags] 47 [Flags]
@@ -92,8 +92,10 @@ namespace OpenSim.Region.Environment.Scenes
92 #endregion Enumerations 92 #endregion Enumerations
93 93
94 [Serializable] 94 [Serializable]
95 public partial class SceneObjectPart : IScriptHost, ISerializable 95 public class SceneObjectPart : IScriptHost, ISerializable
96 { 96 {
97 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
98
97 #region Fields 99 #region Fields
98 100
99 [XmlIgnore] 101 [XmlIgnore]
@@ -140,6 +142,12 @@ namespace OpenSim.Region.Environment.Scenes
140 public uint AttachmentPoint = (byte)0; 142 public uint AttachmentPoint = (byte)0;
141 [XmlIgnore] 143 [XmlIgnore]
142 public PhysicsVector RotationAxis = new PhysicsVector(1f,1f,1f); 144 public PhysicsVector RotationAxis = new PhysicsVector(1f,1f,1f);
145
146 /// <summary>
147 /// This part's inventory
148 /// </summary>
149 [XmlIgnore]
150 public readonly SceneObjectPartInventory Inventory;
143 151
144 [XmlIgnore] 152 [XmlIgnore]
145 public bool Undoing = false; 153 public bool Undoing = false;
@@ -218,6 +226,8 @@ namespace OpenSim.Region.Environment.Scenes
218 m_TextureAnimation = new byte[0]; 226 m_TextureAnimation = new byte[0];
219 m_particleSystem = new byte[0]; 227 m_particleSystem = new byte[0];
220 Rezzed = DateTime.Now; 228 Rezzed = DateTime.Now;
229
230 Inventory = new SceneObjectPartInventory(this);
221 } 231 }
222 232
223 /// <summary> 233 /// <summary>
@@ -266,6 +276,8 @@ namespace OpenSim.Region.Environment.Scenes
266 276
267 TrimPermissions(); 277 TrimPermissions();
268 //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); 278 //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
279
280 Inventory = new SceneObjectPartInventory(this);
269 } 281 }
270 282
271 protected SceneObjectPart(SerializationInfo info, StreamingContext context) 283 protected SceneObjectPart(SerializationInfo info, StreamingContext context)
@@ -285,6 +297,8 @@ namespace OpenSim.Region.Environment.Scenes
285 297
286 //System.Console.WriteLine("SceneObjectPart Deserialize END"); 298 //System.Console.WriteLine("SceneObjectPart Deserialize END");
287 Rezzed = DateTime.Now; 299 Rezzed = DateTime.Now;
300
301 Inventory = new SceneObjectPartInventory(this);
288 } 302 }
289 303
290 #endregion Constructors 304 #endregion Constructors
@@ -332,16 +346,22 @@ namespace OpenSim.Region.Environment.Scenes
332 set { } // Don't allow assignment, or legacy prims wil b0rk 346 set { } // Don't allow assignment, or legacy prims wil b0rk
333 } 347 }
334 348
349 /// <value>
350 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes
351 /// </value>
335 public uint InventorySerial 352 public uint InventorySerial
336 { 353 {
337 get { return m_inventorySerial; } 354 get { return Inventory.Serial; }
338 set { m_inventorySerial = value; } 355 set { Inventory.Serial = value; }
339 } 356 }
340 357
358 /// <value>
359 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes
360 /// </value>
341 public TaskInventoryDictionary TaskInventory 361 public TaskInventoryDictionary TaskInventory
342 { 362 {
343 get { return m_taskInventory; } 363 get { return Inventory.Items; }
344 set { m_taskInventory = value; } 364 set { Inventory.Items = value; }
345 } 365 }
346 366
347 public uint ObjectFlags 367 public uint ObjectFlags
@@ -1239,7 +1259,7 @@ if (m_shape != null) {
1239 dupe._category = _category; 1259 dupe._category = _category;
1240 dupe.m_rezzed = m_rezzed; 1260 dupe.m_rezzed = m_rezzed;
1241 1261
1242 dupe.TaskInventory = (TaskInventoryDictionary)dupe.TaskInventory.Clone(); 1262 dupe.Inventory.Items = (TaskInventoryDictionary)dupe.Inventory.Items.Clone();
1243 1263
1244 if (userExposed) 1264 if (userExposed)
1245 dupe.ResetIDs(linkNum); 1265 dupe.ResetIDs(linkNum);
@@ -1412,7 +1432,7 @@ if (m_shape != null) {
1412 throw new ArgumentNullException("info"); 1432 throw new ArgumentNullException("info");
1413 } 1433 }
1414 1434
1415 info.AddValue("m_inventoryFileName", GetInventoryFileName()); 1435 info.AddValue("m_inventoryFileName", Inventory.GetInventoryFileName());
1416 info.AddValue("m_folderID", UUID); 1436 info.AddValue("m_folderID", UUID);
1417 info.AddValue("PhysActor", PhysActor); 1437 info.AddValue("PhysActor", PhysActor);
1418 1438
@@ -1452,7 +1472,7 @@ if (m_shape != null) {
1452 info.AddValue("m_updateFlag", m_updateFlag); 1472 info.AddValue("m_updateFlag", m_updateFlag);
1453 info.AddValue("CreatorID", _creatorID.Guid); 1473 info.AddValue("CreatorID", _creatorID.Guid);
1454 1474
1455 info.AddValue("m_inventorySerial", m_inventorySerial); 1475 info.AddValue("m_inventorySerial", Inventory.Serial);
1456 info.AddValue("m_uuid", m_uuid.Guid); 1476 info.AddValue("m_uuid", m_uuid.Guid);
1457 info.AddValue("m_localID", m_localId); 1477 info.AddValue("m_localID", m_localId);
1458 info.AddValue("m_name", m_name); 1478 info.AddValue("m_name", m_name);
@@ -1929,8 +1949,7 @@ if (m_shape != null) {
1929 UUID = UUID.Random(); 1949 UUID = UUID.Random();
1930 LinkNum = linkNum; 1950 LinkNum = linkNum;
1931 LocalId = 0; 1951 LocalId = 0;
1932 1952 Inventory.ResetInventoryIDs();
1933 ResetInventoryIDs();
1934 } 1953 }
1935 1954
1936 /// <summary> 1955 /// <summary>
@@ -2993,7 +3012,7 @@ if (m_shape != null) {
2993 if (god) 3012 if (god)
2994 { 3013 {
2995 _baseMask = ApplyMask(_baseMask, set, mask); 3014 _baseMask = ApplyMask(_baseMask, set, mask);
2996 ApplyGodPermissions(_baseMask); 3015 Inventory.ApplyGodPermissions(_baseMask);
2997 } 3016 }
2998 3017
2999 break; 3018 break;
@@ -3394,9 +3413,19 @@ if (m_shape != null) {
3394 RotationalVelocity, state, FromAssetID, 3413 RotationalVelocity, state, FromAssetID,
3395 OwnerID, (int)AttachmentPoint); 3414 OwnerID, (int)AttachmentPoint);
3396 } 3415 }
3397 } 3416
3398} 3417 public void AddScriptLPS(int count)
3399 3418 {
3400 3419 m_parentGroup.AddScriptLPS(count);
3401 3420 }
3421
3422 public void ApplyNextOwnerPermissions()
3423 {
3424 _baseMask &= _nextOwnerMask;
3425 _ownerMask &= _nextOwnerMask;
3426 _everyoneMask &= _nextOwnerMask;
3402 3427
3428 Inventory.ApplyNextOwnerPermissions();
3429 }
3430 }
3431}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs
index ba638e5..0a6f22c 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs
@@ -38,12 +38,17 @@ using OpenSim.Region.Environment.Scenes.Scripting;
38 38
39namespace OpenSim.Region.Environment.Scenes 39namespace OpenSim.Region.Environment.Scenes
40{ 40{
41 public partial class SceneObjectPart : IScriptHost 41 public class SceneObjectPartInventory
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private string m_inventoryFileName = String.Empty; 45 private string m_inventoryFileName = String.Empty;
46 private int m_inventoryFileNameSerial = 0; 46 private int m_inventoryFileNameSerial = 0;
47
48 /// <value>
49 /// The part to which the inventory belongs.
50 /// </value>
51 private SceneObjectPart m_part;
47 52
48 /// <summary> 53 /// <summary>
49 /// Serial count for inventory file , used to tell if inventory has changed 54 /// Serial count for inventory file , used to tell if inventory has changed
@@ -54,12 +59,41 @@ namespace OpenSim.Region.Environment.Scenes
54 /// <summary> 59 /// <summary>
55 /// Holds in memory prim inventory 60 /// Holds in memory prim inventory
56 /// </summary> 61 /// </summary>
57 protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary(); 62 protected TaskInventoryDictionary m_items = new TaskInventoryDictionary();
58 63
59 /// <summary> 64 /// <summary>
60 /// Tracks whether inventory has changed since the last persistent backup 65 /// Tracks whether inventory has changed since the last persistent backup
61 /// </summary> 66 /// </summary>
62 protected bool HasInventoryChanged; 67 protected bool HasInventoryChanged;
68
69 /// <value>
70 /// Inventory serial number
71 /// </value>
72 public uint Serial
73 {
74 get { return m_inventorySerial; }
75 set { m_inventorySerial = value; }
76 }
77
78 /// <value>
79 /// Raw inventory data
80 /// </value>
81 public TaskInventoryDictionary Items
82 {
83 get { return m_items; }
84 set { m_items = value; }
85 }
86
87 /// <summary>
88 /// Constructor
89 /// </summary>
90 /// <param name="part">
91 /// A <see cref="SceneObjectPart"/>
92 /// </param>
93 public SceneObjectPartInventory(SceneObjectPart part)
94 {
95 m_part = part;
96 }
63 97
64 /// <summary> 98 /// <summary>
65 /// Force the task inventory of this prim to persist at the next update sweep 99 /// Force the task inventory of this prim to persist at the next update sweep
@@ -67,7 +101,7 @@ namespace OpenSim.Region.Environment.Scenes
67 public void ForceInventoryPersistence() 101 public void ForceInventoryPersistence()
68 { 102 {
69 HasInventoryChanged = true; 103 HasInventoryChanged = true;
70 } 104 }
71 105
72 /// <summary> 106 /// <summary>
73 /// Reset UUIDs for all the items in the prim's inventory. This involves either generating 107 /// Reset UUIDs for all the items in the prim's inventory. This involves either generating
@@ -78,40 +112,40 @@ namespace OpenSim.Region.Environment.Scenes
78 /// <param name="linkNum">Link number for the part</param> 112 /// <param name="linkNum">Link number for the part</param>
79 public void ResetInventoryIDs() 113 public void ResetInventoryIDs()
80 { 114 {
81 lock (TaskInventory) 115 lock (Items)
82 { 116 {
83 if (0 == TaskInventory.Count) 117 if (0 == Items.Count)
84 return; 118 return;
85 119
86 HasInventoryChanged = true; 120 HasInventoryChanged = true;
87 ParentGroup.HasGroupChanged = true; 121 m_part.ParentGroup.HasGroupChanged = true;
88 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(TaskInventory.Values); 122 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
89 TaskInventory.Clear(); 123 Items.Clear();
90 124
91 foreach (TaskInventoryItem item in items) 125 foreach (TaskInventoryItem item in items)
92 { 126 {
93 item.ResetIDs(UUID); 127 item.ResetIDs(m_part.UUID);
94 TaskInventory.Add(item.ItemID, item); 128 Items.Add(item.ItemID, item);
95 } 129 }
96 } 130 }
97 } 131 }
98 132
99 /// <summary> 133 /// <summary>
100 /// Change every item in this prim's inventory to a new owner. 134 /// Change every item in this inventory to a new owner.
101 /// </summary> 135 /// </summary>
102 /// <param name="ownerId"></param> 136 /// <param name="ownerId"></param>
103 public void ChangeInventoryOwner(UUID ownerId) 137 public void ChangeInventoryOwner(UUID ownerId)
104 { 138 {
105 lock (TaskInventory) 139 lock (Items)
106 { 140 {
107 if (0 == TaskInventory.Count) 141 if (0 == Items.Count)
108 { 142 {
109 return; 143 return;
110 } 144 }
111 145
112 HasInventoryChanged = true; 146 HasInventoryChanged = true;
113 ParentGroup.HasGroupChanged = true; 147 m_part.ParentGroup.HasGroupChanged = true;
114 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(TaskInventory.Values); 148 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
115 foreach (TaskInventoryItem item in items) 149 foreach (TaskInventoryItem item in items)
116 { 150 {
117 if (ownerId != item.OwnerID) 151 if (ownerId != item.OwnerID)
@@ -123,18 +157,22 @@ namespace OpenSim.Region.Environment.Scenes
123 } 157 }
124 } 158 }
125 159
160 /// <summary>
161 /// Change every item in this inventory to a new group.
162 /// </summary>
163 /// <param name="groupID"></param>
126 public void ChangeInventoryGroup(UUID groupID) 164 public void ChangeInventoryGroup(UUID groupID)
127 { 165 {
128 lock (TaskInventory) 166 lock (Items)
129 { 167 {
130 if (0 == TaskInventory.Count) 168 if (0 == Items.Count)
131 { 169 {
132 return; 170 return;
133 } 171 }
134 172
135 HasInventoryChanged = true; 173 HasInventoryChanged = true;
136 ParentGroup.HasGroupChanged = true; 174 m_part.ParentGroup.HasGroupChanged = true;
137 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(TaskInventory.Values); 175 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
138 foreach (TaskInventoryItem item in items) 176 foreach (TaskInventoryItem item in items)
139 { 177 {
140 if (groupID != item.GroupID) 178 if (groupID != item.GroupID)
@@ -150,9 +188,9 @@ namespace OpenSim.Region.Environment.Scenes
150 /// </summary> 188 /// </summary>
151 public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) 189 public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
152 { 190 {
153 lock (m_taskInventory) 191 lock (m_items)
154 { 192 {
155 foreach (TaskInventoryItem item in m_taskInventory.Values) 193 foreach (TaskInventoryItem item in Items.Values)
156 { 194 {
157 if ((int)InventoryType.LSL == item.InvType) 195 if ((int)InventoryType.LSL == item.InvType)
158 { 196 {
@@ -167,14 +205,14 @@ namespace OpenSim.Region.Environment.Scenes
167 /// </summary> 205 /// </summary>
168 public void RemoveScriptInstances() 206 public void RemoveScriptInstances()
169 { 207 {
170 lock (m_taskInventory) 208 lock (Items)
171 { 209 {
172 foreach (TaskInventoryItem item in m_taskInventory.Values) 210 foreach (TaskInventoryItem item in Items.Values)
173 { 211 {
174 if ((int)InventoryType.LSL == item.InvType) 212 if ((int)InventoryType.LSL == item.InvType)
175 { 213 {
176 RemoveScriptInstance(item.ItemID); 214 RemoveScriptInstance(item.ItemID);
177 RemoveScriptEvents(item.ItemID); 215 m_part.RemoveScriptEvents(item.ItemID);
178 } 216 }
179 } 217 }
180 } 218 }
@@ -192,14 +230,14 @@ namespace OpenSim.Region.Environment.Scenes
192 // "Starting script {0}, {1} in prim {2}, {3}", 230 // "Starting script {0}, {1} in prim {2}, {3}",
193 // item.Name, item.ItemID, Name, UUID); 231 // item.Name, item.ItemID, Name, UUID);
194 232
195 if (!m_parentGroup.Scene.ExternalChecks.ExternalChecksCanRunScript(item.ItemID, UUID, item.OwnerID)) 233 if (!m_part.ParentGroup.Scene.ExternalChecks.ExternalChecksCanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
196 return; 234 return;
197 235
198 AddFlag(PrimFlags.Scripted); 236 m_part.AddFlag(PrimFlags.Scripted);
199 237
200 if (!m_parentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) 238 if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts)
201 { 239 {
202 AssetCache cache = m_parentGroup.Scene.AssetCache; 240 AssetCache cache = m_part.ParentGroup.Scene.AssetCache;
203 241
204 cache.GetAsset(item.AssetID, delegate(UUID assetID, AssetBase asset) 242 cache.GetAsset(item.AssetID, delegate(UUID assetID, AssetBase asset)
205 { 243 {
@@ -212,13 +250,13 @@ namespace OpenSim.Region.Environment.Scenes
212 } 250 }
213 else 251 else
214 { 252 {
215 m_taskInventory[item.ItemID].PermsMask = 0; 253 m_items[item.ItemID].PermsMask = 0;
216 m_taskInventory[item.ItemID].PermsGranter = UUID.Zero; 254 m_items[item.ItemID].PermsGranter = UUID.Zero;
217 string script = Utils.BytesToString(asset.Data); 255 string script = Utils.BytesToString(asset.Data);
218 m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID, script, 256 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
219 startParam, postOnRez, engine, stateSource); 257 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
220 m_parentGroup.AddActiveScriptCount(1); 258 m_part.ParentGroup.AddActiveScriptCount(1);
221 ScheduleFullUpdate(); 259 m_part.ScheduleFullUpdate();
222 } 260 }
223 }, false); 261 }, false);
224 } 262 }
@@ -232,18 +270,18 @@ namespace OpenSim.Region.Environment.Scenes
232 /// </param> 270 /// </param>
233 public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) 271 public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
234 { 272 {
235 lock (m_taskInventory) 273 lock (m_items)
236 { 274 {
237 if (m_taskInventory.ContainsKey(itemId)) 275 if (m_items.ContainsKey(itemId))
238 { 276 {
239 CreateScriptInstance(m_taskInventory[itemId], startParam, postOnRez, engine, stateSource); 277 CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource);
240 } 278 }
241 else 279 else
242 { 280 {
243 m_log.ErrorFormat( 281 m_log.ErrorFormat(
244 "[PRIM INVENTORY]: " + 282 "[PRIM INVENTORY]: " +
245 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}", 283 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}",
246 itemId, Name, UUID); 284 itemId, m_part.Name, m_part.UUID);
247 } 285 }
248 } 286 }
249 } 287 }
@@ -254,17 +292,17 @@ namespace OpenSim.Region.Environment.Scenes
254 /// <param name="itemId"></param> 292 /// <param name="itemId"></param>
255 public void RemoveScriptInstance(UUID itemId) 293 public void RemoveScriptInstance(UUID itemId)
256 { 294 {
257 if (m_taskInventory.ContainsKey(itemId)) 295 if (m_items.ContainsKey(itemId))
258 { 296 {
259 m_parentGroup.Scene.EventManager.TriggerRemoveScript(LocalId, itemId); 297 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemId);
260 m_parentGroup.AddActiveScriptCount(-1); 298 m_part.ParentGroup.AddActiveScriptCount(-1);
261 } 299 }
262 else 300 else
263 { 301 {
264 m_log.ErrorFormat( 302 m_log.ErrorFormat(
265 "[PRIM INVENTORY]: " + 303 "[PRIM INVENTORY]: " +
266 "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}", 304 "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}",
267 itemId, Name, UUID); 305 itemId, m_part.Name, m_part.UUID);
268 } 306 }
269 } 307 }
270 308
@@ -276,7 +314,7 @@ namespace OpenSim.Region.Environment.Scenes
276 /// <returns></returns> 314 /// <returns></returns>
277 private bool InventoryContainsName(string name) 315 private bool InventoryContainsName(string name)
278 { 316 {
279 foreach (TaskInventoryItem item in m_taskInventory.Values) 317 foreach (TaskInventoryItem item in Items.Values)
280 { 318 {
281 if (item.Name == name) 319 if (item.Name == name)
282 return true; 320 return true;
@@ -322,7 +360,7 @@ namespace OpenSim.Region.Environment.Scenes
322 /// <param name="item"></param> 360 /// <param name="item"></param>
323 public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) 361 public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
324 { 362 {
325 List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_taskInventory.Values); 363 List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_items.Values);
326 foreach (TaskInventoryItem i in il) 364 foreach (TaskInventoryItem i in il)
327 { 365 {
328 if (i.Name == item.Name) 366 if (i.Name == item.Name)
@@ -355,24 +393,24 @@ namespace OpenSim.Region.Environment.Scenes
355 if (name == String.Empty) 393 if (name == String.Empty)
356 return; 394 return;
357 395
358 item.ParentID = UUID; 396 item.ParentID = m_part.UUID;
359 item.ParentPartID = UUID; 397 item.ParentPartID = m_part.UUID;
360 item.Name = name; 398 item.Name = name;
361 399
362 lock (m_taskInventory) 400 lock (m_items)
363 { 401 {
364 m_taskInventory.Add(item.ItemID, item); 402 m_items.Add(item.ItemID, item);
365 403
366 if (allowedDrop) 404 if (allowedDrop)
367 TriggerScriptChangedEvent(Changed.ALLOWED_DROP); 405 m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
368 else 406 else
369 TriggerScriptChangedEvent(Changed.INVENTORY); 407 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
370 } 408 }
371 409
372 m_inventorySerial++; 410 m_inventorySerial++;
373 //m_inventorySerial += 2; 411 //m_inventorySerial += 2;
374 HasInventoryChanged = true; 412 HasInventoryChanged = true;
375 ParentGroup.HasGroupChanged = true; 413 m_part.ParentGroup.HasGroupChanged = true;
376 } 414 }
377 415
378 /// <summary> 416 /// <summary>
@@ -384,12 +422,12 @@ namespace OpenSim.Region.Environment.Scenes
384 /// <param name="items"></param> 422 /// <param name="items"></param>
385 public void RestoreInventoryItems(ICollection<TaskInventoryItem> items) 423 public void RestoreInventoryItems(ICollection<TaskInventoryItem> items)
386 { 424 {
387 lock (m_taskInventory) 425 lock (m_items)
388 { 426 {
389 foreach (TaskInventoryItem item in items) 427 foreach (TaskInventoryItem item in items)
390 { 428 {
391 m_taskInventory.Add(item.ItemID, item); 429 m_items.Add(item.ItemID, item);
392 TriggerScriptChangedEvent(Changed.INVENTORY); 430 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
393 } 431 }
394 } 432 }
395 433
@@ -404,7 +442,7 @@ namespace OpenSim.Region.Environment.Scenes
404 public TaskInventoryItem GetInventoryItem(UUID itemId) 442 public TaskInventoryItem GetInventoryItem(UUID itemId)
405 { 443 {
406 TaskInventoryItem item; 444 TaskInventoryItem item;
407 m_taskInventory.TryGetValue(itemId, out item); 445 m_items.TryGetValue(itemId, out item);
408 446
409 return item; 447 return item;
410 } 448 }
@@ -417,22 +455,20 @@ namespace OpenSim.Region.Environment.Scenes
417 /// <returns>false if the item did not exist, true if the update occurred successfully</returns> 455 /// <returns>false if the item did not exist, true if the update occurred successfully</returns>
418 public bool UpdateInventoryItem(TaskInventoryItem item) 456 public bool UpdateInventoryItem(TaskInventoryItem item)
419 { 457 {
420 lock (m_taskInventory) 458 lock (m_items)
421 { 459 {
422 if (m_taskInventory.ContainsKey(item.ItemID)) 460 if (m_items.ContainsKey(item.ItemID))
423 { 461 {
424 item.ParentID = UUID; 462 item.ParentID = m_part.UUID;
425 item.ParentPartID = UUID; 463 item.ParentPartID = m_part.UUID;
426 item.Flags=m_taskInventory[item.ItemID].Flags; 464 item.Flags = m_items[item.ItemID].Flags;
427 if (item.AssetID == UUID.Zero) 465 if (item.AssetID == UUID.Zero)
428 { 466 {
429 item.AssetID = m_taskInventory[item.ItemID].AssetID; 467 item.AssetID = m_items[item.ItemID].AssetID;
430 } 468 }
431 else if ((InventoryType)item.Type == InventoryType.Notecard) 469 else if ((InventoryType)item.Type == InventoryType.Notecard)
432 { 470 {
433 ScenePresence presence = 471 ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID);
434 m_parentGroup.Scene.GetScenePresence(
435 item.OwnerID);
436 472
437 if (presence != null) 473 if (presence != null)
438 { 474 {
@@ -441,12 +477,12 @@ namespace OpenSim.Region.Environment.Scenes
441 } 477 }
442 } 478 }
443 479
444 m_taskInventory[item.ItemID] = item; 480 m_items[item.ItemID] = item;
445 m_inventorySerial++; 481 m_inventorySerial++;
446 TriggerScriptChangedEvent(Changed.INVENTORY); 482 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
447 483
448 HasInventoryChanged = true; 484 HasInventoryChanged = true;
449 ParentGroup.HasGroupChanged = true; 485 m_part.ParentGroup.HasGroupChanged = true;
450 486
451 return true; 487 return true;
452 } 488 }
@@ -455,18 +491,13 @@ namespace OpenSim.Region.Environment.Scenes
455 m_log.ErrorFormat( 491 m_log.ErrorFormat(
456 "[PRIM INVENTORY]: " + 492 "[PRIM INVENTORY]: " +
457 "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", 493 "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
458 item.ItemID, Name, UUID); 494 item.ItemID, m_part.Name, m_part.UUID);
459 } 495 }
460 } 496 }
461 497
462 return false; 498 return false;
463 } 499 }
464 500
465 public void AddScriptLPS(int count)
466 {
467 m_parentGroup.AddScriptLPS(count);
468 }
469
470 /// <summary> 501 /// <summary>
471 /// Remove an item from this prim's inventory 502 /// Remove an item from this prim's inventory
472 /// </summary> 503 /// </summary>
@@ -475,37 +506,36 @@ namespace OpenSim.Region.Environment.Scenes
475 /// in this prim's inventory.</returns> 506 /// in this prim's inventory.</returns>
476 public int RemoveInventoryItem(UUID itemID) 507 public int RemoveInventoryItem(UUID itemID)
477 { 508 {
478 lock (m_taskInventory) 509 lock (m_items)
479 { 510 {
480 if (m_taskInventory.ContainsKey(itemID)) 511 if (m_items.ContainsKey(itemID))
481 { 512 {
482 int type = m_taskInventory[itemID].InvType; 513 int type = m_items[itemID].InvType;
483 m_taskInventory.Remove(itemID); 514 m_items.Remove(itemID);
484 m_inventorySerial++; 515 m_inventorySerial++;
485 TriggerScriptChangedEvent(Changed.INVENTORY); 516 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
486 517
487 HasInventoryChanged = true; 518 HasInventoryChanged = true;
488 ParentGroup.HasGroupChanged = true; 519 m_part.ParentGroup.HasGroupChanged = true;
489 520
490 int scriptcount = 0; 521 int scriptcount = 0;
491 lock (m_taskInventory) 522 lock (m_items)
492 { 523 {
493 foreach (TaskInventoryItem item in m_taskInventory.Values) 524 foreach (TaskInventoryItem item in m_items.Values)
494 { 525 {
495 if (item.Type == 10) 526 if (item.Type == 10)
496 { 527 {
497 scriptcount++; 528 scriptcount++;
498 } 529 }
499 } 530 }
500
501 } 531 }
502 532
503 if (scriptcount <= 0) 533 if (scriptcount <= 0)
504 { 534 {
505 RemFlag(PrimFlags.Scripted); 535 m_part.RemFlag(PrimFlags.Scripted);
506 } 536 }
507 537
508 ScheduleFullUpdate(); 538 m_part.ScheduleFullUpdate();
509 539
510 return type; 540 return type;
511 } 541 }
@@ -514,7 +544,7 @@ namespace OpenSim.Region.Environment.Scenes
514 m_log.ErrorFormat( 544 m_log.ErrorFormat(
515 "[PRIM INVENTORY]: " + 545 "[PRIM INVENTORY]: " +
516 "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory", 546 "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
517 itemID, Name, UUID); 547 itemID, m_part.Name, m_part.UUID);
518 } 548 }
519 } 549 }
520 550
@@ -545,13 +575,13 @@ namespace OpenSim.Region.Environment.Scenes
545 575
546 if (m_inventorySerial > 0) 576 if (m_inventorySerial > 0)
547 { 577 {
548 client.SendTaskInventory(m_uuid, (short)m_inventorySerial, 578 client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial,
549 Utils.StringToBytes(GetInventoryFileName())); 579 Utils.StringToBytes(GetInventoryFileName()));
550 return true; 580 return true;
551 } 581 }
552 else 582 else
553 { 583 {
554 client.SendTaskInventory(m_uuid, 0, new byte[0]); 584 client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
555 return false; 585 return false;
556 } 586 }
557 } 587 }
@@ -567,11 +597,11 @@ namespace OpenSim.Region.Environment.Scenes
567 // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches 597 // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches
568 // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality 598 // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality
569 // isn't available (such as drag from prim inventory to agent inventory) 599 // isn't available (such as drag from prim inventory to agent inventory)
570 InventoryStringBuilder invString = new InventoryStringBuilder(UUID, UUID.Zero); 600 InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
571 601
572 lock (m_taskInventory) 602 lock (m_items)
573 { 603 {
574 foreach (TaskInventoryItem item in m_taskInventory.Values) 604 foreach (TaskInventoryItem item in m_items.Values)
575 { 605 {
576 UUID ownerID = item.OwnerID; 606 UUID ownerID = item.OwnerID;
577 uint everyoneMask = 0; 607 uint everyoneMask = 0;
@@ -580,7 +610,7 @@ namespace OpenSim.Region.Environment.Scenes
580 610
581 invString.AddItemStart(); 611 invString.AddItemStart();
582 invString.AddNameValueLine("item_id", item.ItemID.ToString()); 612 invString.AddNameValueLine("item_id", item.ItemID.ToString());
583 invString.AddNameValueLine("parent_id", UUID.ToString()); 613 invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
584 614
585 invString.AddPermissionsStart(); 615 invString.AddPermissionsStart();
586 616
@@ -635,9 +665,9 @@ namespace OpenSim.Region.Environment.Scenes
635 { 665 {
636 if (HasInventoryChanged) 666 if (HasInventoryChanged)
637 { 667 {
638 lock (TaskInventory) 668 lock (Items)
639 { 669 {
640 datastore.StorePrimInventory(UUID, TaskInventory.Values); 670 datastore.StorePrimInventory(m_part.UUID, Items.Values);
641 } 671 }
642 672
643 HasInventoryChanged = false; 673 HasInventoryChanged = false;
@@ -707,7 +737,7 @@ namespace OpenSim.Region.Environment.Scenes
707 { 737 {
708 uint mask=0x7fffffff; 738 uint mask=0x7fffffff;
709 739
710 foreach (TaskInventoryItem item in m_taskInventory.Values) 740 foreach (TaskInventoryItem item in m_items.Values)
711 { 741 {
712 if (item.InvType != 6) 742 if (item.InvType != 6)
713 { 743 {
@@ -740,11 +770,7 @@ namespace OpenSim.Region.Environment.Scenes
740 770
741 public void ApplyNextOwnerPermissions() 771 public void ApplyNextOwnerPermissions()
742 { 772 {
743 _baseMask &= _nextOwnerMask; 773 foreach (TaskInventoryItem item in m_items.Values)
744 _ownerMask &= _nextOwnerMask;
745 _everyoneMask &= _nextOwnerMask;
746
747 foreach (TaskInventoryItem item in m_taskInventory.Values)
748 { 774 {
749 if (item.InvType == 6 && (item.CurrentPermissions & 7) != 0) 775 if (item.InvType == 6 && (item.CurrentPermissions & 7) != 0)
750 { 776 {
@@ -760,12 +786,12 @@ namespace OpenSim.Region.Environment.Scenes
760 item.EveryonePermissions &= item.NextPermissions; 786 item.EveryonePermissions &= item.NextPermissions;
761 } 787 }
762 788
763 TriggerScriptChangedEvent(Changed.OWNER); 789 m_part.TriggerScriptChangedEvent(Changed.OWNER);
764 } 790 }
765 791
766 public void ApplyGodPermissions(uint perms) 792 public void ApplyGodPermissions(uint perms)
767 { 793 {
768 foreach (TaskInventoryItem item in m_taskInventory.Values) 794 foreach (TaskInventoryItem item in m_items.Values)
769 { 795 {
770 item.CurrentPermissions = perms; 796 item.CurrentPermissions = perms;
771 item.BasePermissions = perms; 797 item.BasePermissions = perms;
@@ -774,7 +800,7 @@ namespace OpenSim.Region.Environment.Scenes
774 800
775 public bool ContainsScripts() 801 public bool ContainsScripts()
776 { 802 {
777 foreach (TaskInventoryItem item in m_taskInventory.Values) 803 foreach (TaskInventoryItem item in m_items.Values)
778 { 804 {
779 if (item.InvType == 10) 805 if (item.InvType == 10)
780 { 806 {
@@ -788,7 +814,7 @@ namespace OpenSim.Region.Environment.Scenes
788 { 814 {
789 List<UUID> ret = new List<UUID>(); 815 List<UUID> ret = new List<UUID>();
790 816
791 foreach (TaskInventoryItem item in m_taskInventory.Values) 817 foreach (TaskInventoryItem item in m_items.Values)
792 ret.Add(item.ItemID); 818 ret.Add(item.ItemID);
793 819
794 return ret; 820 return ret;
@@ -796,11 +822,11 @@ namespace OpenSim.Region.Environment.Scenes
796 822
797 public string[] GetScriptAssemblies() 823 public string[] GetScriptAssemblies()
798 { 824 {
799 IScriptModule[] engines = m_parentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 825 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
800 826
801 List<string> ret = new List<string>(); 827 List<string> ret = new List<string>();
802 828
803 foreach (TaskInventoryItem item in m_taskInventory.Values) 829 foreach (TaskInventoryItem item in m_items.Values)
804 { 830 {
805 if (item.InvType == 10) 831 if (item.InvType == 10)
806 { 832 {
@@ -821,10 +847,10 @@ namespace OpenSim.Region.Environment.Scenes
821 847
822 public Dictionary<UUID, string> GetScriptStates() 848 public Dictionary<UUID, string> GetScriptStates()
823 { 849 {
824 IScriptModule[] engines = m_parentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 850 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
825 Dictionary<UUID, string> ret = new Dictionary<UUID, string>(); 851 Dictionary<UUID, string> ret = new Dictionary<UUID, string>();
826 852
827 foreach (TaskInventoryItem item in m_taskInventory.Values) 853 foreach (TaskInventoryItem item in m_items.Values)
828 { 854 {
829 if (item.InvType == 10) 855 if (item.InvType == 10)
830 { 856 {
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 61fa83d..b293f9e 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -2558,7 +2558,7 @@ namespace OpenSim.Region.Environment.Scenes
2558 { 2558 {
2559 if (gobj != null) 2559 if (gobj != null)
2560 { 2560 {
2561 if (gobj.RootPart.ContainsScripts()) 2561 if (gobj.RootPart.Inventory.ContainsScripts())
2562 return true; 2562 return true;
2563 } 2563 }
2564 } 2564 }
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index d1dbf94..72766a4 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -268,7 +268,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
268 localID); 268 localID);
269 269
270 TaskInventoryItem item = 270 TaskInventoryItem item =
271 part.GetInventoryItem(itemID); 271 part.Inventory.GetInventoryItem(itemID);
272 272
273 ScenePresence presence = 273 ScenePresence presence =
274 myScriptEngine.World.GetScenePresence( 274 myScriptEngine.World.GetScenePresence(
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index fc6024a..bd60759 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -570,15 +570,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
570 570
571 #endregion 571 #endregion
572 572
573
574 public void ResetScript(uint localID, UUID itemID) 573 public void ResetScript(uint localID, UUID itemID)
575 { 574 {
576 InstanceData id = GetScript(localID, itemID); 575 InstanceData id = GetScript(localID, itemID);
577 string script = id.Source; 576 string script = id.Source;
578 StopScript(localID, itemID); 577 StopScript(localID, itemID);
579 SceneObjectPart part = World.GetSceneObjectPart(localID); 578 SceneObjectPart part = World.GetSceneObjectPart(localID);
580 part.GetInventoryItem(itemID).PermsMask = 0; 579 part.Inventory.GetInventoryItem(itemID).PermsMask = 0;
581 part.GetInventoryItem(itemID).PermsGranter = UUID.Zero; 580 part.Inventory.GetInventoryItem(itemID).PermsGranter = UUID.Zero;
582 StartScript(localID, itemID, script, id.StartParam, false); 581 StartScript(localID, itemID, script, id.StartParam, false);
583 } 582 }
584 583
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a06ed9b..15ce756 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3320,7 +3320,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3320 { 3320 {
3321 if (item.Name == name) 3321 if (item.Name == name)
3322 { 3322 {
3323 m_host.RemoveInventoryItem(item.ItemID); 3323 m_host.Inventory.RemoveInventoryItem(item.ItemID);
3324 return; 3324 return;
3325 } 3325 }
3326 } 3326 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index f46fdae..3d1fe3b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1032,7 +1032,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1032 taskItem.PermsMask = 0; 1032 taskItem.PermsMask = 0;
1033 taskItem.AssetID = asset.FullID; 1033 taskItem.AssetID = asset.FullID;
1034 1034
1035 m_host.AddInventoryItem(taskItem, false); 1035 m_host.Inventory.AddInventoryItem(taskItem, false);
1036 } 1036 }
1037 } 1037 }
1038} 1038}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 08f5491..983926f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -302,7 +302,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
302 if (part.AttachmentPoint != 0) // Attached so ignore 302 if (part.AttachmentPoint != 0) // Attached so ignore
303 continue; 303 continue;
304 304
305 if (part.ContainsScripts()) 305 if (part.Inventory.ContainsScripts())
306 { 306 {
307 objtype |= ACTIVE | SCRIPTED; // Scripted and active. It COULD have one hidden ... 307 objtype |= ACTIVE | SCRIPTED; // Scripted and active. It COULD have one hidden ...
308 } 308 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 14266dd..a061fde 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -141,7 +141,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
141 141
142 foreach (SceneObjectPart p in part.ParentGroup.Children.Values) 142 foreach (SceneObjectPart p in part.ParentGroup.Children.Values)
143 { 143 {
144 if (p.ContainsScripts()) 144 if (p.Inventory.ContainsScripts())
145 { 145 {
146 Type |= 0x08; // Scripted 146 Type |= 0x08; // Scripted
147 break; 147 break;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 48463d1..ad86494 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -696,8 +696,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
696 696
697 Stop(0); 697 Stop(0);
698 SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID); 698 SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
699 part.GetInventoryItem(m_ItemID).PermsMask = 0; 699 part.Inventory.GetInventoryItem(m_ItemID).PermsMask = 0;
700 part.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero; 700 part.Inventory.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero;
701 AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID); 701 AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);
702 m_EventQueue.Clear(); 702 m_EventQueue.Clear();
703 m_Script.ResetVars(); 703 m_Script.ResetVars();
@@ -721,8 +721,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
721 721
722 m_Script.ResetVars(); 722 m_Script.ResetVars();
723 SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID); 723 SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
724 part.GetInventoryItem(m_ItemID).PermsMask = 0; 724 part.Inventory.GetInventoryItem(m_ItemID).PermsMask = 0;
725 part.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero; 725 part.Inventory.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero;
726 AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID); 726 AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);
727 727
728 m_EventQueue.Clear(); 728 m_EventQueue.Clear();
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 98d4f3b..0b19e85 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -366,7 +366,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
366 localID); 366 localID);
367 367
368 TaskInventoryItem item = 368 TaskInventoryItem item =
369 part.GetInventoryItem(itemID); 369 part.Inventory.GetInventoryItem(itemID);
370 370
371 ScenePresence presence = 371 ScenePresence presence =
372 m_Scene.GetScenePresence( 372 m_Scene.GetScenePresence(
@@ -464,7 +464,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
464 return false; 464 return false;
465 } 465 }
466 466
467 TaskInventoryItem item = part.GetInventoryItem(itemID); 467 TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
468 if (item == null) 468 if (item == null)
469 return false; 469 return false;
470 470