aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Framework/AgentInventory.cs
diff options
context:
space:
mode:
authorMW2007-03-25 17:34:58 +0000
committerMW2007-03-25 17:34:58 +0000
commit40af8c256165eb6fb56f58e3c13ee9293e052f66 (patch)
treeadd744edd5c35ddc6de735cfab4ae39e944755d1 /OpenSim.Framework/AgentInventory.cs
parentAdding the only stuff that makes sense (diff)
downloadopensim-SC_OLD-40af8c256165eb6fb56f58e3c13ee9293e052f66.zip
opensim-SC_OLD-40af8c256165eb6fb56f58e3c13ee9293e052f66.tar.gz
opensim-SC_OLD-40af8c256165eb6fb56f58e3c13ee9293e052f66.tar.bz2
opensim-SC_OLD-40af8c256165eb6fb56f58e3c13ee9293e052f66.tar.xz
You want large textures, you shall have! - Xfer system now working for large asset uploads
Fixed the VS solution file. Now forwars ViewerEffect messages onto the other clients Renamed OpenSim.Framework/Inventory.cs to OpenSim.Framework/AgentInventory.cs
Diffstat (limited to 'OpenSim.Framework/AgentInventory.cs')
-rw-r--r--OpenSim.Framework/AgentInventory.cs140
1 files changed, 140 insertions, 0 deletions
diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs
new file mode 100644
index 0000000..8ab2f3a
--- /dev/null
+++ b/OpenSim.Framework/AgentInventory.cs
@@ -0,0 +1,140 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Assets;
6
7namespace OpenSim.Framework.Inventory
8{
9 public class AgentInventory
10 {
11 //Holds the local copy of Inventory info for a agent
12 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
13 public Dictionary<LLUUID, InventoryItem> InventoryItems;
14 public InventoryFolder InventoryRoot;
15 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
16 public LLUUID AgentID;
17 public AvatarWearable[] Wearables;
18
19 public AgentInventory()
20 {
21 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
22 InventoryItems = new Dictionary<LLUUID, InventoryItem>();
23 this.Initialise();
24 }
25
26 public virtual void Initialise()
27 {
28 Wearables = new AvatarWearable[13]; //should be 12 of these
29 for (int i = 0; i < 13; i++)
30 {
31 Wearables[i] = new AvatarWearable();
32 }
33
34 InventoryRoot = new InventoryFolder();
35 InventoryRoot.FolderID = LLUUID.Random();
36 InventoryRoot.ParentID = new LLUUID();
37 InventoryRoot.Version = 1;
38 InventoryRoot.DefaultType = 8;
39 InventoryRoot.FolderName = "My Inventory";
40 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
41 }
42
43 public bool CreateNewFolder(LLUUID folderID, ushort type)
44 {
45 InventoryFolder Folder = new InventoryFolder();
46 Folder.FolderID = folderID;
47 Folder.OwnerID = this.AgentID;
48 Folder.DefaultType = type;
49 this.InventoryFolders.Add(Folder.FolderID, Folder);
50
51 return (true);
52 }
53
54 public bool UpdateItem(LLUUID itemID, AssetBase asset)
55 {
56 if(this.InventoryItems.ContainsKey(itemID))
57 {
58 InventoryItem Item = this.InventoryItems[itemID];
59 Item.AssetID = asset.FullID;
60 Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated());
61 //TODO need to update the rest of the info
62 }
63 return true;
64 }
65
66 public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
67 {
68 if (this.InventoryFolders.ContainsKey(folderID))
69 {
70 LLUUID NewItemID = LLUUID.Random();
71
72 InventoryItem Item = new InventoryItem();
73 Item.FolderID = folderID;
74 Item.OwnerID = AgentID;
75 Item.AssetID = asset.FullID;
76 Item.ItemID = NewItemID;
77 Item.Type = asset.Type;
78 Item.Name = asset.Name;
79 Item.Description = asset.Description;
80 Item.InvType = asset.InvType;
81 this.InventoryItems.Add(Item.ItemID, Item);
82 InventoryFolder Folder = InventoryFolders[Item.FolderID];
83 Folder.Items.Add(Item);
84 return (Item.ItemID);
85 }
86 else
87 {
88 return (null);
89 }
90 }
91 }
92
93 public class InventoryFolder
94 {
95 public List<InventoryItem> Items;
96 //public List<InventoryFolder> Subfolders;
97 public LLUUID FolderID;
98 public LLUUID OwnerID;
99 public LLUUID ParentID;
100 public string FolderName;
101 public ushort DefaultType;
102 public ushort Version;
103
104 public InventoryFolder()
105 {
106 Items = new List<InventoryItem>();
107 //Subfolders = new List<InventoryFolder>();
108 }
109
110 }
111
112 public class InventoryItem
113 {
114 public LLUUID FolderID;
115 public LLUUID OwnerID;
116 public LLUUID ItemID;
117 public LLUUID AssetID;
118 public LLUUID CreatorID;
119 public sbyte InvType;
120 public sbyte Type;
121 public string Name;
122 public string Description;
123
124 public InventoryItem()
125 {
126 this.CreatorID = LLUUID.Zero;
127 }
128 }
129
130 public class AvatarWearable
131 {
132 public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
133 public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
134
135 public AvatarWearable()
136 {
137
138 }
139 }
140}