diff options
3 files changed, 225 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IEntityInventory.cs b/OpenSim/Region/Environment/Interfaces/IEntityInventory.cs new file mode 100644 index 0000000..80a6a62 --- /dev/null +++ b/OpenSim/Region/Environment/Interfaces/IEntityInventory.cs | |||
@@ -0,0 +1,223 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using OpenMetaverse; | ||
32 | using log4net; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Region.Interfaces; | ||
36 | using OpenSim.Region.Environment.Interfaces; | ||
37 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
38 | |||
39 | namespace OpenSim.Region.Environment.Scenes | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Interface to an entity's (SceneObjectPart's) inventory | ||
43 | /// </summary> | ||
44 | /// | ||
45 | /// This is not a finished 1.0 candidate interface | ||
46 | public interface IEntityInventory | ||
47 | { | ||
48 | /// <value> | ||
49 | /// Inventory serial number | ||
50 | /// </value> | ||
51 | uint Serial | ||
52 | { | ||
53 | get; | ||
54 | set; | ||
55 | } | ||
56 | |||
57 | /// <value> | ||
58 | /// Raw inventory data | ||
59 | /// </value> | ||
60 | TaskInventoryDictionary Items | ||
61 | { | ||
62 | get; | ||
63 | set; | ||
64 | } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Force the task inventory of this prim to persist at the next update sweep | ||
68 | /// </summary> | ||
69 | void ForceInventoryPersistence(); | ||
70 | |||
71 | /// <summary> | ||
72 | /// Reset UUIDs for all the items in the prim's inventory. This involves either generating | ||
73 | /// new ones or setting existing UUIDs to the correct parent UUIDs. | ||
74 | /// | ||
75 | /// If this method is called and there are inventory items, then we regard the inventory as having changed. | ||
76 | /// </summary> | ||
77 | /// <param name="linkNum">Link number for the part</param> | ||
78 | void ResetInventoryIDs(); | ||
79 | |||
80 | /// <summary> | ||
81 | /// Change every item in this inventory to a new owner. | ||
82 | /// </summary> | ||
83 | /// <param name="ownerId"></param> | ||
84 | void ChangeInventoryOwner(UUID ownerId); | ||
85 | |||
86 | /// <summary> | ||
87 | /// Change every item in this inventory to a new group. | ||
88 | /// </summary> | ||
89 | /// <param name="groupID"></param> | ||
90 | void ChangeInventoryGroup(UUID groupID); | ||
91 | |||
92 | /// <summary> | ||
93 | /// Start all the scripts contained in this entity's inventory | ||
94 | /// </summary> | ||
95 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); | ||
96 | |||
97 | /// <summary> | ||
98 | /// Stop all the scripts in this entity. | ||
99 | /// </summary> | ||
100 | void RemoveScriptInstances(); | ||
101 | |||
102 | /// <summary> | ||
103 | /// Start a script which is in this entity's inventory. | ||
104 | /// </summary> | ||
105 | /// <param name="item"></param> | ||
106 | /// <param name="postOnRez"></param> | ||
107 | /// <param name="engine"></param> | ||
108 | /// <param name="stateSource"></param> | ||
109 | void CreateScriptInstance( | ||
110 | TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource); | ||
111 | |||
112 | /// <summary> | ||
113 | /// Start a script which is in this entity's inventory. | ||
114 | /// </summary> | ||
115 | /// <param name="itemId"></param> | ||
116 | /// <param name="startParam"></param> | ||
117 | /// <param name="postOnRez"></param> | ||
118 | /// <param name="engine"></param> | ||
119 | /// <param name="stateSource"></param> | ||
120 | void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource); | ||
121 | |||
122 | /// <summary> | ||
123 | /// Stop a script which is in this prim's inventory. | ||
124 | /// </summary> | ||
125 | /// <param name="itemId"></param> | ||
126 | void RemoveScriptInstance(UUID itemId); | ||
127 | |||
128 | /// <summary> | ||
129 | /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative | ||
130 | /// name is chosen. | ||
131 | /// </summary> | ||
132 | /// <param name="item"></param> | ||
133 | void AddInventoryItem(TaskInventoryItem item, bool allowedDrop); | ||
134 | |||
135 | /// <summary> | ||
136 | /// Add an item to this entity's inventory. If an item with the same name already exists, it is replaced. | ||
137 | /// </summary> | ||
138 | /// <param name="item"></param> | ||
139 | void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop); | ||
140 | |||
141 | /// <summary> | ||
142 | /// Restore a whole collection of items to the entity's inventory at once. | ||
143 | /// We assume that the items already have all their fields correctly filled out. | ||
144 | /// The items are not flagged for persistence to the database, since they are being restored | ||
145 | /// from persistence rather than being newly added. | ||
146 | /// </summary> | ||
147 | /// <param name="items"></param> | ||
148 | void RestoreInventoryItems(ICollection<TaskInventoryItem> items); | ||
149 | |||
150 | /// <summary> | ||
151 | /// Returns an existing inventory item. Returns the original, so any changes will be live. | ||
152 | /// </summary> | ||
153 | /// <param name="itemID"></param> | ||
154 | /// <returns>null if the item does not exist</returns> | ||
155 | TaskInventoryItem GetInventoryItem(UUID itemId); | ||
156 | |||
157 | /// <summary> | ||
158 | /// Update an existing inventory item. | ||
159 | /// </summary> | ||
160 | /// <param name="item">The updated item. An item with the same id must already exist | ||
161 | /// in this prim's inventory.</param> | ||
162 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | ||
163 | bool UpdateInventoryItem(TaskInventoryItem item); | ||
164 | |||
165 | /// <summary> | ||
166 | /// Remove an item from this entity's inventory | ||
167 | /// </summary> | ||
168 | /// <param name="itemID"></param> | ||
169 | /// <returns>Numeric asset type of the item removed. Returns -1 if the item did not exist | ||
170 | /// in this prim's inventory.</returns> | ||
171 | int RemoveInventoryItem(UUID itemID); | ||
172 | |||
173 | /// <summary> | ||
174 | /// Return the name with which a client can request a xfer of this prim's inventory metadata | ||
175 | /// </summary> | ||
176 | string GetInventoryFileName(); | ||
177 | |||
178 | bool GetInventoryFileName(IClientAPI client, uint localID); | ||
179 | |||
180 | /// <summary> | ||
181 | /// Serialize all the metadata for the items in this prim's inventory ready for sending to the client | ||
182 | /// </summary> | ||
183 | /// <param name="xferManager"></param> | ||
184 | void RequestInventoryFile(IClientAPI client, IXfer xferManager); | ||
185 | |||
186 | /// <summary> | ||
187 | /// Backup the inventory to the given data store | ||
188 | /// </summary> | ||
189 | /// <param name="datastore"></param> | ||
190 | void ProcessInventoryBackup(IRegionDataStore datastore); | ||
191 | |||
192 | uint MaskEffectivePermissions(); | ||
193 | |||
194 | void ApplyNextOwnerPermissions(); | ||
195 | |||
196 | void ApplyGodPermissions(uint perms); | ||
197 | |||
198 | /// <summary> | ||
199 | /// Returns true if this inventory contains any scripts | ||
200 | /// </summary></returns> | ||
201 | bool ContainsScripts(); | ||
202 | |||
203 | /// <summary> | ||
204 | /// Get the uuids of all items in this inventory | ||
205 | /// </summary> | ||
206 | /// <returns></returns> | ||
207 | List<UUID> GetInventoryList(); | ||
208 | |||
209 | /// <summary> | ||
210 | /// Get the names of the assemblies associated with scripts in this inventory. | ||
211 | /// </summary> | ||
212 | /// <returns></returns> | ||
213 | string[] GetScriptAssemblies(); | ||
214 | |||
215 | /// <summary> | ||
216 | /// Get the xml representing the saved states of scripts in this inventory. | ||
217 | /// </summary> | ||
218 | /// <returns> | ||
219 | /// A <see cref="Dictionary`2"/> | ||
220 | /// </returns> | ||
221 | Dictionary<UUID, string> GetScriptStates(); | ||
222 | } | ||
223 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 712cbac..bfb8b98 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
147 | /// This part's inventory | 147 | /// This part's inventory |
148 | /// </summary> | 148 | /// </summary> |
149 | [XmlIgnore] | 149 | [XmlIgnore] |
150 | public readonly SceneObjectPartInventory Inventory; | 150 | public readonly IEntityInventory Inventory; |
151 | 151 | ||
152 | [XmlIgnore] | 152 | [XmlIgnore] |
153 | public bool Undoing = false; | 153 | public bool Undoing = false; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs index aff1ef1..82a89df 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPartInventory.cs | |||
@@ -38,7 +38,7 @@ using OpenSim.Region.Environment.Scenes.Scripting; | |||
38 | 38 | ||
39 | namespace OpenSim.Region.Environment.Scenes | 39 | namespace OpenSim.Region.Environment.Scenes |
40 | { | 40 | { |
41 | public class SceneObjectPartInventory | 41 | public class SceneObjectPartInventory : IEntityInventory |
42 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||