aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-23 18:13:04 +0000
committerJustin Clarke Casey2008-06-23 18:13:04 +0000
commitac46c89c897c5a99a2aa2f3194ab2123bbe56583 (patch)
treeb92b33cdf880a5111f85282a0d70f8638dda92ef /OpenSim
parent* Remove all use of asset.InvType, as outlined in mailing list discussion (diff)
downloadopensim-SC_OLD-ac46c89c897c5a99a2aa2f3194ab2123bbe56583.zip
opensim-SC_OLD-ac46c89c897c5a99a2aa2f3194ab2123bbe56583.tar.gz
opensim-SC_OLD-ac46c89c897c5a99a2aa2f3194ab2123bbe56583.tar.bz2
opensim-SC_OLD-ac46c89c897c5a99a2aa2f3194ab2123bbe56583.tar.xz
* minor: Remove crusty old unused agent inventory classes
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/AgentInventory.cs256
-rw-r--r--OpenSim/Framework/AssetBase.cs3
2 files changed, 3 insertions, 256 deletions
diff --git a/OpenSim/Framework/AgentInventory.cs b/OpenSim/Framework/AgentInventory.cs
deleted file mode 100644
index e3f078b..0000000
--- a/OpenSim/Framework/AgentInventory.cs
+++ /dev/null
@@ -1,256 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using libsecondlife;
31using libsecondlife.Packets;
32
33namespace OpenSim.Framework
34{
35 public class AgentInventory
36 {
37 //Holds the local copy of Inventory info for a agent
38 public LLUUID AgentID;
39 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
40 public Dictionary<LLUUID, InventoryItem> InventoryItems;
41 public InventoryFolder InventoryRoot;
42 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
43 public AvatarWearable[] Wearables;
44
45 public AgentInventory()
46 {
47 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
48 InventoryItems = new Dictionary<LLUUID, InventoryItem>();
49 Initialise();
50 }
51
52 public virtual void Initialise()
53 {
54 Wearables = new AvatarWearable[13];
55 for (int i = 0; i < 13; i++)
56 {
57 Wearables[i] = new AvatarWearable();
58 }
59 }
60
61 public bool CreateNewFolder(LLUUID folderID, ushort type)
62 {
63 InventoryFolder Folder = new InventoryFolder();
64 Folder.FolderID = folderID;
65 Folder.OwnerID = AgentID;
66 Folder.DefaultType = type;
67 InventoryFolders.Add(Folder.FolderID, Folder);
68 return (true);
69 }
70
71 public void CreateRootFolder(LLUUID newAgentID)
72 {
73 AgentID = newAgentID;
74 InventoryRoot = new InventoryFolder();
75 InventoryRoot.FolderID = LLUUID.Random();
76 InventoryRoot.ParentID = LLUUID.Zero;
77 InventoryRoot.Version = 1;
78 InventoryRoot.DefaultType = 8;
79 InventoryRoot.OwnerID = AgentID;
80 InventoryRoot.FolderName = "My Inventory";
81 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
82 InventoryRoot.OwnerID = AgentID;
83 }
84
85 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName)
86 {
87 InventoryFolder Folder = new InventoryFolder();
88 Folder.FolderID = folderID;
89 Folder.OwnerID = AgentID;
90 Folder.DefaultType = type;
91 Folder.FolderName = folderName;
92 InventoryFolders.Add(Folder.FolderID, Folder);
93 return (true);
94 }
95
96 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID)
97 {
98 if (!InventoryFolders.ContainsKey(folderID))
99 {
100 System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
101 InventoryFolder Folder = new InventoryFolder();
102 Folder.FolderID = folderID;
103 Folder.OwnerID = AgentID;
104 Folder.DefaultType = type;
105 Folder.FolderName = folderName;
106 Folder.ParentID = parentID;
107 InventoryFolders.Add(Folder.FolderID, Folder);
108 }
109 return (true);
110 }
111
112 public bool HasFolder(LLUUID folderID)
113 {
114 if (InventoryFolders.ContainsKey(folderID))
115 {
116 return true;
117 }
118 return false;
119 }
120
121 public LLUUID GetFolderID(string folderName)
122 {
123 foreach (InventoryFolder inv in InventoryFolders.Values)
124 {
125 if (inv.FolderName == folderName)
126 {
127 return inv.FolderID;
128 }
129 }
130 return LLUUID.Zero;
131 }
132
133 public bool UpdateItemAsset(LLUUID itemID, AssetBase asset)
134 {
135 if (InventoryItems.ContainsKey(itemID))
136 {
137 InventoryItem Item = InventoryItems[itemID];
138 Item.AssetID = asset.FullID;
139 System.Console.WriteLine("updated inventory item " + itemID.ToString() +
140 " so it now is set to asset " + asset.FullID.ToString());
141 //TODO need to update the rest of the info
142 }
143 return true;
144 }
145
146 public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
147 {
148 System.Console.WriteLine("updating inventory item details");
149 if (InventoryItems.ContainsKey(itemID))
150 {
151 System.Console.WriteLine("changing name to " + Util.FieldToString(packet.Name));
152 InventoryItem Item = InventoryItems[itemID];
153 Item.Name = Util.FieldToString(packet.Name);
154 System.Console.WriteLine("updated inventory item " + itemID.ToString());
155 //TODO need to update the rest of the info
156 }
157 return true;
158 }
159
160 // FIXME: Unused, pending possible cleanup for this whole class.
161// public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
162// {
163// if (InventoryFolders.ContainsKey(folderID))
164// {
165// LLUUID NewItemID = LLUUID.Random();
166//
167// InventoryItem Item = new InventoryItem();
168// Item.FolderID = folderID;
169// Item.OwnerID = AgentID;
170// Item.AssetID = asset.FullID;
171// Item.ItemID = NewItemID;
172// Item.Type = asset.Type;
173// Item.Name = asset.Name;
174// Item.Description = asset.Description;
175// Item.InvType = asset.InvType;
176// InventoryItems.Add(Item.ItemID, Item);
177// InventoryFolder Folder = InventoryFolders[Item.FolderID];
178// Folder.Items.Add(Item);
179// return (Item.ItemID);
180// }
181// else
182// {
183// return (null);
184// }
185// }
186
187 public bool DeleteFromInventory(LLUUID itemID)
188 {
189 bool res = false;
190 if (InventoryItems.ContainsKey(itemID))
191 {
192 InventoryItem item = InventoryItems[itemID];
193 InventoryItems.Remove(itemID);
194 foreach (InventoryFolder fold in InventoryFolders.Values)
195 {
196 if (fold.Items.Contains(item))
197 {
198 fold.Items.Remove(item);
199 break;
200 }
201 }
202 res = true;
203 }
204 return res;
205 }
206 }
207
208 public class InventoryFolder
209 {
210 //public List<InventoryFolder> Subfolders;
211 public ushort DefaultType;
212 public LLUUID FolderID;
213 public string FolderName;
214 public List<InventoryItem> Items;
215 public LLUUID OwnerID;
216 public LLUUID ParentID = LLUUID.Zero;
217 public ushort Version;
218
219 public InventoryFolder()
220 {
221 Items = new List<InventoryItem>();
222 //Subfolders = new List<InventoryFolder>();
223 }
224 }
225
226 public class InventoryItem
227 {
228 public LLUUID AssetID;
229 public LLUUID CreatorID;
230 public string Description;
231 public LLUUID FolderID;
232 public sbyte InvType;
233 public LLUUID ItemID;
234 public string Name = String.Empty;
235 public LLUUID OwnerID;
236 public sbyte Type;
237
238 public InventoryItem()
239 {
240 CreatorID = LLUUID.Zero;
241 }
242
243 public string ExportString()
244 {
245 string typ = "notecard";
246 string result = String.Empty;
247 result += "\tinv_object\t0\n\t{\n";
248 result += "\t\tobj_id\t%s\n";
249 result += "\t\tparent_id\t" + ItemID.ToString() + "\n";
250 result += "\t\ttype\t" + typ + "\n";
251 result += "\t\tname\t" + Name + "|\n";
252 result += "\t}\n";
253 return result;
254 }
255 }
256}
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index 5435a43..2b37daa 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -76,6 +76,9 @@ namespace OpenSim.Framework
76 set { _type = value; } 76 set { _type = value; }
77 } 77 }
78 78
79 /// <summary>
80 /// PLEASE DON'T USE ME. I'm probably going away soon.
81 /// </summary>
79 public virtual sbyte InvType 82 public virtual sbyte InvType
80 { 83 {
81 get { return _invtype; } 84 get { return _invtype; }