From 57519b6dba97d7e7a2de71af9d58c93b4750bde8 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 16 Jan 2008 18:35:34 +0000 Subject: * Store task inventory when an object is taken into agent inventory * This means that you can take an object from a region and rez it somewhere else, with its inventory intact. * As for earlier, at this stage only scripts can be placed in inventory * This isn't an efficient implementation, a better one will probably need to come along soonish --- .../Scenes/SceneObjectPart.Inventory.cs | 90 +++++++++++++--------- 1 file changed, 53 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index fc74c4e..5132a6c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -57,30 +57,46 @@ namespace OpenSim.Region.Environment.Scenes get { return m_folderID; } set { m_folderID = value; } } + + /// + /// Serial count for inventory file , used to tell if inventory has changed + /// no need for this to be part of Database backup + /// + protected uint m_inventorySerial = 0; + + public uint InventorySerial + { + get { return m_inventorySerial; } + set { m_inventorySerial = value; } + } /// /// Holds in memory prim inventory /// - protected IDictionary m_taskInventory - = new Dictionary(); + protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary(); - [XmlIgnore] - public IDictionary TaskInventory + public TaskInventoryDictionary TaskInventory { get { return m_taskInventory; } + set { m_taskInventory = value; } } /// - /// Serial count for inventory file , used to tell if inventory has changed - /// no need for this to be part of Database backup + /// Reset LLUUIDs for all the items in the prim's inventory. This involves either generating + /// new ones or setting existing UUIDs to the correct parent UUIDs /// - protected uint m_inventorySerial = 0; - - public uint InventorySerial + /// public void AddInventoryItem(TaskInventoryItem item) { - item.parent_id = m_folderID; - item.creation_date = 1000; + item.ParentID = m_folderID; + item.CreationDate = 1000; item.ParentPartID = UUID; - m_taskInventory.Add(item.item_id, item); + m_taskInventory.Add(item.ItemID, item); m_inventorySerial++; } @@ -188,7 +204,7 @@ namespace OpenSim.Region.Environment.Scenes { foreach (TaskInventoryItem item in items) { - m_taskInventory.Add(item.item_id, item); + m_taskInventory.Add(item.ItemID, item); } m_inventorySerial++; @@ -224,9 +240,9 @@ namespace OpenSim.Region.Environment.Scenes /// false if the item did not exist, true if the update occurred succesfully public bool UpdateInventoryItem(TaskInventoryItem item) { - if (m_taskInventory.ContainsKey(item.item_id)) + if (m_taskInventory.ContainsKey(item.ItemID)) { - m_taskInventory[item.item_id] = item; + m_taskInventory[item.ItemID] = item; m_inventorySerial++; return true; @@ -236,7 +252,7 @@ namespace OpenSim.Region.Environment.Scenes MainLog.Instance.Error( "PRIMINVENTORY", "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory", - item.item_id, Name, UUID); + item.ItemID, Name, UUID); } return false; @@ -252,7 +268,7 @@ namespace OpenSim.Region.Environment.Scenes { if (m_taskInventory.ContainsKey(itemID)) { - int type = m_taskInventory[itemID].inv_type; + int type = m_taskInventory[itemID].InvType; m_taskInventory.Remove(itemID); m_inventorySerial++; @@ -296,8 +312,8 @@ namespace OpenSim.Region.Environment.Scenes foreach (TaskInventoryItem item in m_taskInventory.Values) { invString.AddItemStart(); - invString.AddNameValueLine("item_id", item.item_id.ToString()); - invString.AddNameValueLine("parent_id", item.parent_id.ToString()); + invString.AddNameValueLine("item_id", item.ItemID.ToString()); + invString.AddNameValueLine("parent_id", item.ParentID.ToString()); invString.AddPermissionsStart(); invString.AddNameValueLine("base_mask", "0x7FFFFFFF"); @@ -305,19 +321,19 @@ namespace OpenSim.Region.Environment.Scenes invString.AddNameValueLine("group_mask", "0x7FFFFFFF"); invString.AddNameValueLine("everyone_mask", "0x7FFFFFFF"); invString.AddNameValueLine("next_owner_mask", "0x7FFFFFFF"); - invString.AddNameValueLine("creator_id", item.creator_id.ToString()); - invString.AddNameValueLine("owner_id", item.owner_id.ToString()); - invString.AddNameValueLine("last_owner_id", item.last_owner_id.ToString()); - invString.AddNameValueLine("group_id", item.group_id.ToString()); + invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); + invString.AddNameValueLine("owner_id", item.OwnerID.ToString()); + invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); + invString.AddNameValueLine("group_id", item.GroupID.ToString()); invString.AddSectionEnd(); - invString.AddNameValueLine("asset_id", item.asset_id.ToString()); - invString.AddNameValueLine("type", TaskInventoryItem.Types[item.type]); - invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.inv_type]); + invString.AddNameValueLine("asset_id", item.AssetID.ToString()); + invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); + invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); invString.AddNameValueLine("flags", "0x00"); - invString.AddNameValueLine("name", item.name + "|"); - invString.AddNameValueLine("desc", item.desc + "|"); - invString.AddNameValueLine("creation_date", item.creation_date.ToString()); + invString.AddNameValueLine("name", item.Name + "|"); + invString.AddNameValueLine("desc", item.Description + "|"); + invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); invString.AddSectionEnd(); } -- cgit v1.1