diff options
Diffstat (limited to 'OpenSim.Framework/AgentInventory.cs')
-rw-r--r-- | OpenSim.Framework/AgentInventory.cs | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs index 8ab2f3a..1abf59a 100644 --- a/OpenSim.Framework/AgentInventory.cs +++ b/OpenSim.Framework/AgentInventory.cs | |||
@@ -11,7 +11,7 @@ namespace OpenSim.Framework.Inventory | |||
11 | //Holds the local copy of Inventory info for a agent | 11 | //Holds the local copy of Inventory info for a agent |
12 | public Dictionary<LLUUID, InventoryFolder> InventoryFolders; | 12 | public Dictionary<LLUUID, InventoryFolder> InventoryFolders; |
13 | public Dictionary<LLUUID, InventoryItem> InventoryItems; | 13 | public Dictionary<LLUUID, InventoryItem> InventoryItems; |
14 | public InventoryFolder InventoryRoot; | 14 | public InventoryFolder InventoryRoot = new InventoryFolder(); |
15 | public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server | 15 | public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server |
16 | public LLUUID AgentID; | 16 | public LLUUID AgentID; |
17 | public AvatarWearable[] Wearables; | 17 | public AvatarWearable[] Wearables; |
@@ -30,14 +30,16 @@ namespace OpenSim.Framework.Inventory | |||
30 | { | 30 | { |
31 | Wearables[i] = new AvatarWearable(); | 31 | Wearables[i] = new AvatarWearable(); |
32 | } | 32 | } |
33 | 33 | ||
34 | InventoryRoot = new InventoryFolder(); | 34 | InventoryRoot = new InventoryFolder(); |
35 | InventoryRoot.FolderID = LLUUID.Random(); | 35 | InventoryRoot.FolderID = LLUUID.Random(); |
36 | InventoryRoot.ParentID = new LLUUID(); | 36 | InventoryRoot.ParentID = new LLUUID(); |
37 | InventoryRoot.Version = 1; | 37 | InventoryRoot.Version = 1; |
38 | InventoryRoot.DefaultType = 8; | 38 | InventoryRoot.DefaultType = 8; |
39 | InventoryRoot.OwnerID = this.AgentID; | ||
39 | InventoryRoot.FolderName = "My Inventory"; | 40 | InventoryRoot.FolderName = "My Inventory"; |
40 | InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); | 41 | InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); |
42 | |||
41 | } | 43 | } |
42 | 44 | ||
43 | public bool CreateNewFolder(LLUUID folderID, ushort type) | 45 | public bool CreateNewFolder(LLUUID folderID, ushort type) |
@@ -47,10 +49,61 @@ namespace OpenSim.Framework.Inventory | |||
47 | Folder.OwnerID = this.AgentID; | 49 | Folder.OwnerID = this.AgentID; |
48 | Folder.DefaultType = type; | 50 | Folder.DefaultType = type; |
49 | this.InventoryFolders.Add(Folder.FolderID, Folder); | 51 | this.InventoryFolders.Add(Folder.FolderID, Folder); |
52 | return (true); | ||
53 | } | ||
54 | |||
55 | public void CreateRootFolder(LLUUID newAgentID, bool createTextures) | ||
56 | { | ||
57 | this.AgentID = newAgentID; | ||
58 | /* InventoryRoot = new InventoryFolder(); | ||
59 | InventoryRoot.FolderID = LLUUID.Random(); | ||
60 | InventoryRoot.ParentID = new LLUUID(); | ||
61 | InventoryRoot.Version = 1; | ||
62 | InventoryRoot.DefaultType = 8; | ||
63 | InventoryRoot.OwnerID = this.AgentID; | ||
64 | InventoryRoot.FolderName = "My Inventory-"; | ||
65 | InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);*/ | ||
66 | InventoryRoot.OwnerID = this.AgentID; | ||
67 | if (createTextures) | ||
68 | { | ||
69 | this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName) | ||
74 | { | ||
75 | InventoryFolder Folder = new InventoryFolder(); | ||
76 | Folder.FolderID = folderID; | ||
77 | Folder.OwnerID = this.AgentID; | ||
78 | Folder.DefaultType = type; | ||
79 | Folder.FolderName = folderName; | ||
80 | this.InventoryFolders.Add(Folder.FolderID, Folder); | ||
81 | |||
82 | return (true); | ||
83 | } | ||
84 | |||
85 | public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent) | ||
86 | { | ||
87 | InventoryFolder Folder = new InventoryFolder(); | ||
88 | Folder.FolderID = folderID; | ||
89 | Folder.OwnerID = this.AgentID; | ||
90 | Folder.DefaultType = type; | ||
91 | Folder.FolderName = folderName; | ||
92 | Folder.ParentID = parent; | ||
93 | this.InventoryFolders.Add(Folder.FolderID, Folder); | ||
50 | 94 | ||
51 | return (true); | 95 | return (true); |
52 | } | 96 | } |
53 | 97 | ||
98 | public bool HasFolder(LLUUID folderID) | ||
99 | { | ||
100 | if (this.InventoryFolders.ContainsKey(folderID)) | ||
101 | { | ||
102 | return true; | ||
103 | } | ||
104 | return false; | ||
105 | } | ||
106 | |||
54 | public bool UpdateItem(LLUUID itemID, AssetBase asset) | 107 | public bool UpdateItem(LLUUID itemID, AssetBase asset) |
55 | { | 108 | { |
56 | if(this.InventoryItems.ContainsKey(itemID)) | 109 | if(this.InventoryItems.ContainsKey(itemID)) |
@@ -96,7 +149,7 @@ namespace OpenSim.Framework.Inventory | |||
96 | //public List<InventoryFolder> Subfolders; | 149 | //public List<InventoryFolder> Subfolders; |
97 | public LLUUID FolderID; | 150 | public LLUUID FolderID; |
98 | public LLUUID OwnerID; | 151 | public LLUUID OwnerID; |
99 | public LLUUID ParentID; | 152 | public LLUUID ParentID = LLUUID.Zero; |
100 | public string FolderName; | 153 | public string FolderName; |
101 | public ushort DefaultType; | 154 | public ushort DefaultType; |
102 | public ushort Version; | 155 | public ushort Version; |