aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs107
1 files changed, 89 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 9e2c256..5d197e3 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -144,7 +144,26 @@ namespace OpenSim.Region.Environment.Scenes
144 itemId, Name, UUID); 144 itemId, Name, UUID);
145 } 145 }
146 146
147 } 147 }
148
149 /// <summary>
150 /// Stop a script which is in this prim's inventory.
151 /// </summary>
152 /// <param name="itemId"></param>
153 public void StopScript(LLUUID itemId)
154 {
155 if (m_taskInventory.ContainsKey(itemId))
156 {
157 m_parentGroup.Scene.EventManager.TriggerRemoveScript(LocalID, itemId);
158 }
159 else
160 {
161 MainLog.Instance.Error(
162 "PRIMINVENTORY",
163 "Couldn't stop script with ID {0} since it couldn't be found for prim {1}, {2}",
164 itemId, Name, UUID);
165 }
166 }
148 167
149 /// <summary> 168 /// <summary>
150 /// Add an item to this prim's inventory. 169 /// Add an item to this prim's inventory.
@@ -173,33 +192,85 @@ namespace OpenSim.Region.Environment.Scenes
173 192
174 m_inventorySerial++; 193 m_inventorySerial++;
175 } 194 }
195
196 /// <summary>
197 /// Returns an existing inventory item. Returns the original, so any changes will be live.
198 /// </summary>
199 /// <param name="itemID"></param>
200 /// <returns>null if the item does not exist</returns>
201 public TaskInventoryItem GetInventoryItem(LLUUID itemID)
202 {
203 if (m_taskInventory.ContainsKey(itemID))
204 {
205 return m_taskInventory[itemID];
206 }
207 else
208 {
209 MainLog.Instance.Error(
210 "PRIMINVENTORY",
211 "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
212 itemID, Name, UUID);
213 }
214
215 return null;
216 }
217
218 /// <summary>
219 /// Update an existing inventory item.
220 /// </summary>
221 /// <param name="item">The updated item. An item with the same id must already exist
222 /// in this prim's inventory.</param>
223 /// <returns>false if the item did not exist, true if the update occurred succesfully</returns>
224 public bool UpdateInventoryItem(TaskInventoryItem item)
225 {
226 if (m_taskInventory.ContainsKey(item.item_id))
227 {
228 m_taskInventory[item.item_id] = item;
229 m_inventorySerial++;
230
231 return true;
232 }
233 else
234 {
235 MainLog.Instance.Error(
236 "PRIMINVENTORY",
237 "Tried to retrieve item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
238 item.item_id, Name, UUID);
239 }
240
241 return false;
242 }
176 243
177 /// <summary> 244 /// <summary>
178 /// Remove an item from this prim's inventory 245 /// Remove an item from this prim's inventory
179 /// </summary> 246 /// </summary>
180 /// <param name="remoteClient"></param>
181 /// <param name="localID"></param>
182 /// <param name="itemID"></param> 247 /// <param name="itemID"></param>
183 /// <returns>Numeric asset type of the item removed.</returns> 248 /// <returns>Numeric asset type of the item removed. Returns -1 if the item did not exist
184 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) 249 /// in this prim's inventory.</returns>
250 public int RemoveInventoryItem(LLUUID itemID)
185 { 251 {
186 if (localID == LocalID) 252 if (m_taskInventory.ContainsKey(itemID))
187 { 253 {
188 if (m_taskInventory.ContainsKey(itemID)) 254 string type = m_taskInventory[itemID].inv_type;
255 m_taskInventory.Remove(itemID);
256 m_inventorySerial++;
257 if (type == "lsltext")
258 {
259 return 10;
260 }
261 else
189 { 262 {
190 string type = m_taskInventory[itemID].inv_type; 263 return 0;
191 m_taskInventory.Remove(itemID);
192 m_inventorySerial++;
193 if (type == "lsltext")
194 {
195 return 10;
196 }
197 else
198 {
199 return 0;
200 }
201 } 264 }
202 } 265 }
266 else
267 {
268 MainLog.Instance.Error(
269 "PRIMINVENTORY",
270 "Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
271 itemID, Name, UUID);
272 }
273
203 return -1; 274 return -1;
204 } 275 }
205 276