IEntityInventory.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. using System.Collections.Generic;
  28. using OpenMetaverse;
  29. using OpenSim.Framework;
  30. namespace OpenSim.Region.Framework.Interfaces
  31. {
  32. /// <summary>
  33. /// Interface to an entity's (SceneObjectPart's) inventory
  34. /// </summary>
  35. ///
  36. /// This is not a finished 1.0 candidate interface
  37. public interface IEntityInventory
  38. {
  39. /// <summary>
  40. /// Force the task inventory of this prim to persist at the next update sweep
  41. /// </summary>
  42. void ForceInventoryPersistence();
  43. /// <summary>
  44. /// Reset UUIDs for all the items in the prim's inventory.
  45. /// </summary>
  46. ///
  47. /// This involves either generating
  48. /// new ones or setting existing UUIDs to the correct parent UUIDs.
  49. ///
  50. /// If this method is called and there are inventory items, then we regard the inventory as having changed.
  51. ///
  52. /// <param name="linkNum">Link number for the part</param>
  53. void ResetInventoryIDs();
  54. /// <summary>
  55. /// Change every item in this inventory to a new owner.
  56. /// </summary>
  57. /// <param name="ownerId"></param>
  58. void ChangeInventoryOwner(UUID ownerId);
  59. /// <summary>
  60. /// Change every item in this inventory to a new group.
  61. /// </summary>
  62. /// <param name="groupID"></param>
  63. void ChangeInventoryGroup(UUID groupID);
  64. /// <summary>
  65. /// Start all the scripts contained in this entity's inventory
  66. /// </summary>
  67. void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
  68. /// <summary>
  69. /// Stop all the scripts in this entity.
  70. /// </summary>
  71. void RemoveScriptInstances();
  72. /// <summary>
  73. /// Start a script which is in this entity's inventory.
  74. /// </summary>
  75. /// <param name="item"></param>
  76. /// <param name="postOnRez"></param>
  77. /// <param name="engine"></param>
  78. /// <param name="stateSource"></param>
  79. void CreateScriptInstance(
  80. TaskInventoryItem item, int startParam, bool postOnRez, string engine, int stateSource);
  81. /// <summary>
  82. /// Start a script which is in this entity's inventory.
  83. /// </summary>
  84. /// <param name="itemId"></param>
  85. /// <param name="startParam"></param>
  86. /// <param name="postOnRez"></param>
  87. /// <param name="engine"></param>
  88. /// <param name="stateSource"></param>
  89. void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource);
  90. /// <summary>
  91. /// Stop a script which is in this prim's inventory.
  92. /// </summary>
  93. /// <param name="itemId"></param>
  94. void RemoveScriptInstance(UUID itemId);
  95. /// <summary>
  96. /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative
  97. /// name is chosen.
  98. /// </summary>
  99. /// <param name="item"></param>
  100. void AddInventoryItem(TaskInventoryItem item, bool allowedDrop);
  101. /// <summary>
  102. /// Add an item to this entity's inventory. If an item with the same name already exists, it is replaced.
  103. /// </summary>
  104. /// <param name="item"></param>
  105. void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop);
  106. /// <summary>
  107. /// Restore a whole collection of items to the entity's inventory at once.
  108. /// We assume that the items already have all their fields correctly filled out.
  109. /// The items are not flagged for persistence to the database, since they are being restored
  110. /// from persistence rather than being newly added.
  111. /// </summary>
  112. /// <param name="items"></param>
  113. void RestoreInventoryItems(ICollection<TaskInventoryItem> items);
  114. /// <summary>
  115. /// Returns an existing inventory item. Returns the original, so any changes will be live.
  116. /// </summary>
  117. /// <param name="itemID"></param>
  118. /// <returns>null if the item does not exist</returns>
  119. TaskInventoryItem GetInventoryItem(UUID itemId);
  120. /// <summary>
  121. /// Update an existing inventory item.
  122. /// </summary>
  123. /// <param name="item">The updated item. An item with the same id must already exist
  124. /// in this prim's inventory.</param>
  125. /// <returns>false if the item did not exist, true if the update occurred successfully</returns>
  126. bool UpdateInventoryItem(TaskInventoryItem item);
  127. /// <summary>
  128. /// Remove an item from this entity's inventory
  129. /// </summary>
  130. /// <param name="itemID"></param>
  131. /// <returns>Numeric asset type of the item removed. Returns -1 if the item did not exist
  132. /// in this prim's inventory.</returns>
  133. int RemoveInventoryItem(UUID itemID);
  134. /// <summary>
  135. /// Return the name with which a client can request a xfer of this prim's inventory metadata
  136. /// </summary>
  137. string GetInventoryFileName();
  138. bool GetInventoryFileName(IClientAPI client, uint localID);
  139. /// <summary>
  140. /// Serialize all the metadata for the items in this prim's inventory ready for sending to the client
  141. /// </summary>
  142. /// <param name="xferManager"></param>
  143. void RequestInventoryFile(IClientAPI client, IXfer xferManager);
  144. /// <summary>
  145. /// Backup the inventory to the given data store
  146. /// </summary>
  147. /// <param name="datastore"></param>
  148. void ProcessInventoryBackup(IRegionDataStore datastore);
  149. uint MaskEffectivePermissions();
  150. void ApplyNextOwnerPermissions();
  151. void ApplyGodPermissions(uint perms);
  152. /// <summary>
  153. /// Returns true if this inventory contains any scripts
  154. /// </summary></returns>
  155. bool ContainsScripts();
  156. /// <summary>
  157. /// Get the uuids of all items in this inventory
  158. /// </summary>
  159. /// <returns></returns>
  160. List<UUID> GetInventoryList();
  161. /// <summary>
  162. /// Get the names of the assemblies associated with scripts in this inventory.
  163. /// </summary>
  164. /// <returns></returns>
  165. string[] GetScriptAssemblies();
  166. /// <summary>
  167. /// Get the xml representing the saved states of scripts in this inventory.
  168. /// </summary>
  169. /// <returns>
  170. /// A <see cref="Dictionary`2"/>
  171. /// </returns>
  172. Dictionary<UUID, string> GetScriptStates();
  173. bool CanBeDeleted();
  174. }
  175. }