diff options
Diffstat (limited to 'OpenSim/Region/Framework/Interfaces/IEntityInventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | 322 |
1 files changed, 322 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs new file mode 100644 index 0000000..9ffda51 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -0,0 +1,322 @@ | |||
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 OpenSimulator 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 | |||
28 | using System.Collections.Generic; | ||
29 | using System.Collections; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | |||
34 | namespace OpenSim.Region.Framework.Interfaces | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// Interface to an entity's (SceneObjectPart's) inventory | ||
38 | /// </summary> | ||
39 | /// | ||
40 | /// This is not a finished 1.0 candidate interface | ||
41 | public interface IEntityInventory | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// Force the task inventory of this prim to persist at the next update sweep | ||
45 | /// </summary> | ||
46 | void ForceInventoryPersistence(); | ||
47 | |||
48 | /// <summary> | ||
49 | /// Reset UUIDs for all the items in the prim's inventory. | ||
50 | /// </summary> | ||
51 | /// | ||
52 | /// This involves either generating | ||
53 | /// new ones or setting existing UUIDs to the correct parent UUIDs. | ||
54 | /// | ||
55 | /// If this method is called and there are inventory items, then we regard the inventory as having changed. | ||
56 | /// | ||
57 | /// <param name="linkNum">Link number for the part</param> | ||
58 | void ResetInventoryIDs(); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Reset parent object UUID for all the items in the prim's inventory. | ||
62 | /// </summary> | ||
63 | /// | ||
64 | /// If this method is called and there are inventory items, then we regard the inventory as having changed. | ||
65 | /// | ||
66 | /// <param name="linkNum">Link number for the part</param> | ||
67 | void ResetObjectID(); | ||
68 | |||
69 | /// <summary> | ||
70 | /// Change every item in this inventory to a new owner. | ||
71 | /// </summary> | ||
72 | /// <param name="ownerId"></param> | ||
73 | void ChangeInventoryOwner(UUID ownerId); | ||
74 | |||
75 | /// <summary> | ||
76 | /// Change every item in this inventory to a new group. | ||
77 | /// </summary> | ||
78 | /// <param name="groupID"></param> | ||
79 | void ChangeInventoryGroup(UUID groupID); | ||
80 | |||
81 | /// <summary> | ||
82 | /// Start all the scripts contained in this entity's inventory | ||
83 | /// </summary> | ||
84 | /// <param name="startParam"></param> | ||
85 | /// <param name="postOnRez"></param> | ||
86 | /// <param name="engine"></param> | ||
87 | /// <param name="stateSource"></param> | ||
88 | /// <returns>Number of scripts started.</returns> | ||
89 | int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); | ||
90 | |||
91 | ArrayList GetScriptErrors(UUID itemID); | ||
92 | void ResumeScripts(); | ||
93 | |||
94 | /// <summary> | ||
95 | /// Stop and remove all the scripts in this entity from the scene. | ||
96 | /// </summary> | ||
97 | /// <param name="sceneObjectBeingDeleted"> | ||
98 | /// Should be true if these scripts are being removed because the scene | ||
99 | /// object is being deleted. This will prevent spurious updates to the client. | ||
100 | /// </param> | ||
101 | void RemoveScriptInstances(bool sceneObjectBeingDeleted); | ||
102 | |||
103 | /// <summary> | ||
104 | /// Stop all the scripts in this entity. | ||
105 | /// </summary> | ||
106 | void StopScriptInstances(); | ||
107 | |||
108 | /// <summary> | ||
109 | /// Start a script which is in this entity's inventory. | ||
110 | /// </summary> | ||
111 | /// <param name="item"></param> | ||
112 | /// <param name="postOnRez"></param> | ||
113 | /// <param name="engine"></param> | ||
114 | /// <param name="stateSource"></param> | ||
115 | /// <returns> | ||
116 | /// true if the script instance was valid for starting, false otherwise. This does not guarantee | ||
117 | /// that the script was actually started, just that the script was valid (i.e. its asset data could be found, etc.) | ||
118 | /// </returns> | ||
119 | bool CreateScriptInstance( | ||
120 | TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource); | ||
121 | |||
122 | /// <summary> | ||
123 | /// Start a script which is in this entity's inventory. | ||
124 | /// </summary> | ||
125 | /// <param name="itemId"></param> | ||
126 | /// <param name="startParam"></param> | ||
127 | /// <param name="postOnRez"></param> | ||
128 | /// <param name="engine"></param> | ||
129 | /// <param name="stateSource"></param> | ||
130 | /// <returns> | ||
131 | /// true if the script instance was valid for starting, false otherwise. This does not guarantee | ||
132 | /// that the script was actually started, just that the script was valid (i.e. its asset data could be found, etc.) | ||
133 | /// </returns> | ||
134 | bool CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource); | ||
135 | |||
136 | /// <summary> | ||
137 | /// Stop and remove a script which is in this prim's inventory from the scene. | ||
138 | /// </summary> | ||
139 | /// <param name="itemId"></param> | ||
140 | /// <param name="sceneObjectBeingDeleted"> | ||
141 | /// Should be true if these scripts are being removed because the scene | ||
142 | /// object is being deleted. This will prevent spurious updates to the client. | ||
143 | /// </param> | ||
144 | void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted); | ||
145 | |||
146 | /// <summary> | ||
147 | /// Stop a script which is in this prim's inventory. | ||
148 | /// </summary> | ||
149 | /// <param name="itemId"></param> | ||
150 | void StopScriptInstance(UUID itemId); | ||
151 | |||
152 | /// <summary> | ||
153 | /// Try to get the script running status. | ||
154 | /// </summary> | ||
155 | /// <returns> | ||
156 | /// Returns true if a script for the item was found in one of the simulator's script engines. In this case, | ||
157 | /// the running parameter will reflect the running status. | ||
158 | /// Returns false if the item could not be found, if the item is not a script or if a script instance for the | ||
159 | /// item was not found in any of the script engines. In this case, running status is irrelevant. | ||
160 | /// </returns> | ||
161 | /// <param name='itemId'></param> | ||
162 | /// <param name='running'></param> | ||
163 | bool TryGetScriptInstanceRunning(UUID itemId, out bool running); | ||
164 | |||
165 | /// <summary> | ||
166 | /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative | ||
167 | /// name is chosen. | ||
168 | /// </summary> | ||
169 | /// <param name="item"></param> | ||
170 | void AddInventoryItem(TaskInventoryItem item, bool allowedDrop); | ||
171 | |||
172 | /// <summary> | ||
173 | /// Add an item to this entity's inventory. If an item with the same name already exists, it is replaced. | ||
174 | /// </summary> | ||
175 | /// <param name="item"></param> | ||
176 | void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop); | ||
177 | |||
178 | /// <summary> | ||
179 | /// Restore a whole collection of items to the entity's inventory at once. | ||
180 | /// We assume that the items already have all their fields correctly filled out. | ||
181 | /// The items are not flagged for persistence to the database, since they are being restored | ||
182 | /// from persistence rather than being newly added. | ||
183 | /// </summary> | ||
184 | /// <param name="items"></param> | ||
185 | void RestoreInventoryItems(ICollection<TaskInventoryItem> items); | ||
186 | |||
187 | /// <summary> | ||
188 | /// Returns an existing inventory item. Returns the original, so any changes will be live. | ||
189 | /// </summary> | ||
190 | /// <param name="itemID"></param> | ||
191 | /// <returns>null if the item does not exist</returns> | ||
192 | TaskInventoryItem GetInventoryItem(UUID itemId); | ||
193 | |||
194 | /// <summary> | ||
195 | /// Get all inventory items. | ||
196 | /// </summary> | ||
197 | /// <param name="name"></param> | ||
198 | /// <returns> | ||
199 | /// If there are no inventory items then an empty list is returned. | ||
200 | /// </returns> | ||
201 | List<TaskInventoryItem> GetInventoryItems(); | ||
202 | |||
203 | /// <summary> | ||
204 | /// Gets an inventory item by name | ||
205 | /// </summary> | ||
206 | /// <remarks> | ||
207 | /// This method returns the first inventory item that matches the given name. In SL this is all you need | ||
208 | /// since each item in a prim inventory must have a unique name. | ||
209 | /// </remarks> | ||
210 | /// <param name='name'></param> | ||
211 | /// <returns> | ||
212 | /// The inventory item. Null if no such item was found. | ||
213 | /// </returns> | ||
214 | TaskInventoryItem GetInventoryItem(string name); | ||
215 | |||
216 | /// <summary> | ||
217 | /// Get inventory items by name. | ||
218 | /// </summary> | ||
219 | /// <param name="name"></param> | ||
220 | /// <returns> | ||
221 | /// A list of inventory items with that name. | ||
222 | /// If no inventory item has that name then an empty list is returned. | ||
223 | /// </returns> | ||
224 | List<TaskInventoryItem> GetInventoryItems(string name); | ||
225 | |||
226 | /// <summary> | ||
227 | /// Get inventory items by type. | ||
228 | /// </summary> | ||
229 | /// <param type="name"></param> | ||
230 | /// <returns> | ||
231 | /// A list of inventory items of that type. | ||
232 | /// If no inventory items of that type then an empty list is returned. | ||
233 | /// </returns> | ||
234 | List<TaskInventoryItem> GetInventoryItems(InventoryType type); | ||
235 | |||
236 | /// <summary> | ||
237 | /// Get the scene object(s) referenced by an inventory item. | ||
238 | /// </summary> | ||
239 | /// | ||
240 | /// This is returned in a 'rez ready' state. That is, name, description, permissions and other details have | ||
241 | /// been adjusted to reflect the part and item from which it originates. | ||
242 | /// | ||
243 | /// <param name="item">Inventory item</param> | ||
244 | /// <param name="objlist">The scene objects</param> | ||
245 | /// <param name="veclist">Relative offsets for each object</param> | ||
246 | /// <returns>true = success, false = the scene object asset couldn't be found</returns> | ||
247 | bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist); | ||
248 | |||
249 | /// <summary> | ||
250 | /// Update an existing inventory item. | ||
251 | /// </summary> | ||
252 | /// <param name="item">The updated item. An item with the same id must already exist | ||
253 | /// in this prim's inventory.</param> | ||
254 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | ||
255 | bool UpdateInventoryItem(TaskInventoryItem item); | ||
256 | bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents); | ||
257 | bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged); | ||
258 | |||
259 | /// <summary> | ||
260 | /// Remove an item from this entity's inventory | ||
261 | /// </summary> | ||
262 | /// <param name="itemID"></param> | ||
263 | /// <returns>Numeric asset type of the item removed. Returns -1 if the item did not exist | ||
264 | /// in this prim's inventory.</returns> | ||
265 | int RemoveInventoryItem(UUID itemID); | ||
266 | |||
267 | /// <summary> | ||
268 | /// Serialize all the metadata for the items in this prim's inventory ready for sending to the client | ||
269 | /// </summary> | ||
270 | /// <param name="xferManager"></param> | ||
271 | void RequestInventoryFile(IClientAPI client, IXfer xferManager); | ||
272 | |||
273 | /// <summary> | ||
274 | /// Backup the inventory to the given data store | ||
275 | /// </summary> | ||
276 | /// <param name="datastore"></param> | ||
277 | void ProcessInventoryBackup(ISimulationDataService datastore); | ||
278 | |||
279 | uint MaskEffectivePermissions(); | ||
280 | |||
281 | void ApplyNextOwnerPermissions(); | ||
282 | |||
283 | void ApplyGodPermissions(uint perms); | ||
284 | |||
285 | /// <summary> | ||
286 | /// Number of items in this inventory. | ||
287 | /// </summary> | ||
288 | int Count { get; } | ||
289 | |||
290 | /// <summary> | ||
291 | /// Returns true if this inventory contains any scripts | ||
292 | /// </summary></returns> | ||
293 | bool ContainsScripts(); | ||
294 | |||
295 | /// <summary> | ||
296 | /// Number of scripts in this inventory. | ||
297 | /// </summary> | ||
298 | /// <remarks> | ||
299 | /// Includes both running and non running scripts. | ||
300 | /// </remarks> | ||
301 | int ScriptCount(); | ||
302 | |||
303 | /// <summary> | ||
304 | /// Number of running scripts in this inventory. | ||
305 | /// </summary></returns> | ||
306 | int RunningScriptCount(); | ||
307 | |||
308 | /// <summary> | ||
309 | /// Get the uuids of all items in this inventory | ||
310 | /// </summary> | ||
311 | /// <returns></returns> | ||
312 | List<UUID> GetInventoryList(); | ||
313 | |||
314 | /// <summary> | ||
315 | /// Get the xml representing the saved states of scripts in this inventory. | ||
316 | /// </summary> | ||
317 | /// <returns> | ||
318 | /// A <see cref="Dictionary`2"/> | ||
319 | /// </returns> | ||
320 | Dictionary<UUID, string> GetScriptStates(); | ||
321 | } | ||
322 | } | ||