1
0

InventoryItemBase.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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;
  28. using OpenMetaverse;
  29. namespace OpenSim.Framework
  30. {
  31. /// <summary>
  32. /// Inventory Item - contains all the properties associated with an individual inventory piece.
  33. /// </summary>
  34. public class InventoryItemBase : InventoryNodeBase, ICloneable
  35. {
  36. /// <value>
  37. /// The inventory type of the item. This is slightly different from the asset type in some situations.
  38. /// </value>
  39. public int InvType
  40. {
  41. get
  42. {
  43. return m_invType;
  44. }
  45. set
  46. {
  47. m_invType = value;
  48. }
  49. }
  50. protected int m_invType;
  51. /// <value>
  52. /// The folder this item is contained in
  53. /// </value>
  54. public UUID Folder
  55. {
  56. get
  57. {
  58. return m_folder;
  59. }
  60. set
  61. {
  62. m_folder = value;
  63. }
  64. }
  65. protected UUID m_folder;
  66. /// <value>
  67. /// The creator of this item
  68. /// </value>
  69. public string CreatorId
  70. {
  71. get
  72. {
  73. return m_creatorId;
  74. }
  75. set
  76. {
  77. m_creatorId = value;
  78. }
  79. }
  80. protected string m_creatorId;
  81. /// <value>
  82. /// The UUID for the creator. This may be different from the canonical CreatorId. This property is used
  83. /// for communication with the client over the Second Life protocol, since that protocol can only understand
  84. /// UUIDs. As this is a basic framework class, this means that both the string creator id and the uuid
  85. /// reference have to be settable separately
  86. ///
  87. /// Database plugins don't need to set this, it will be set by
  88. /// upstream code (or set by the get accessor if left unset).
  89. ///
  90. /// XXX: An alternative to having a separate uuid property would be to hash the CreatorId appropriately
  91. /// every time there was communication with a UUID-only client. This may be much more expensive.
  92. /// </value>
  93. public UUID CreatorIdAsUuid
  94. {
  95. get
  96. {
  97. if (UUID.Zero == m_creatorIdAsUuid)
  98. {
  99. UUID.TryParse(CreatorId, out m_creatorIdAsUuid);
  100. }
  101. return m_creatorIdAsUuid;
  102. }
  103. set
  104. {
  105. m_creatorIdAsUuid = value;
  106. }
  107. }
  108. protected UUID m_creatorIdAsUuid = UUID.Zero;
  109. /// <value>
  110. /// The description of the inventory item (must be less than 64 characters)
  111. /// </value>
  112. public string Description
  113. {
  114. get
  115. {
  116. return m_description;
  117. }
  118. set
  119. {
  120. m_description = value;
  121. }
  122. }
  123. protected string m_description = String.Empty;
  124. /// <value>
  125. ///
  126. /// </value>
  127. public uint NextPermissions
  128. {
  129. get
  130. {
  131. return m_nextPermissions;
  132. }
  133. set
  134. {
  135. m_nextPermissions = value;
  136. }
  137. }
  138. protected uint m_nextPermissions;
  139. /// <value>
  140. /// A mask containing permissions for the current owner (cannot be enforced)
  141. /// </value>
  142. public uint CurrentPermissions
  143. {
  144. get
  145. {
  146. return m_currentPermissions;
  147. }
  148. set
  149. {
  150. m_currentPermissions = value;
  151. }
  152. }
  153. protected uint m_currentPermissions;
  154. /// <value>
  155. ///
  156. /// </value>
  157. public uint BasePermissions
  158. {
  159. get
  160. {
  161. return m_basePermissions;
  162. }
  163. set
  164. {
  165. m_basePermissions = value;
  166. }
  167. }
  168. protected uint m_basePermissions;
  169. /// <value>
  170. ///
  171. /// </value>
  172. public uint EveryOnePermissions
  173. {
  174. get
  175. {
  176. return m_everyonePermissions;
  177. }
  178. set
  179. {
  180. m_everyonePermissions = value;
  181. }
  182. }
  183. protected uint m_everyonePermissions;
  184. /// <value>
  185. ///
  186. /// </value>
  187. public uint GroupPermissions
  188. {
  189. get
  190. {
  191. return m_groupPermissions;
  192. }
  193. set
  194. {
  195. m_groupPermissions = value;
  196. }
  197. }
  198. protected uint m_groupPermissions;
  199. /// <value>
  200. /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
  201. /// </value>
  202. public int AssetType
  203. {
  204. get
  205. {
  206. return m_assetType;
  207. }
  208. set
  209. {
  210. m_assetType = value;
  211. }
  212. }
  213. protected int m_assetType;
  214. /// <value>
  215. /// The UUID of the associated asset on the asset server
  216. /// </value>
  217. public UUID AssetID
  218. {
  219. get
  220. {
  221. return m_assetID;
  222. }
  223. set
  224. {
  225. m_assetID = value;
  226. }
  227. }
  228. protected UUID m_assetID;
  229. /// <value>
  230. ///
  231. /// </value>
  232. public UUID GroupID
  233. {
  234. get
  235. {
  236. return m_groupID;
  237. }
  238. set
  239. {
  240. m_groupID = value;
  241. }
  242. }
  243. protected UUID m_groupID;
  244. /// <value>
  245. ///
  246. /// </value>
  247. public bool GroupOwned
  248. {
  249. get
  250. {
  251. return m_groupOwned;
  252. }
  253. set
  254. {
  255. m_groupOwned = value;
  256. }
  257. }
  258. protected bool m_groupOwned;
  259. /// <value>
  260. ///
  261. /// </value>
  262. public int SalePrice
  263. {
  264. get
  265. {
  266. return m_salePrice;
  267. }
  268. set
  269. {
  270. m_salePrice = value;
  271. }
  272. }
  273. protected int m_salePrice;
  274. /// <value>
  275. ///
  276. /// </value>
  277. public byte SaleType
  278. {
  279. get
  280. {
  281. return m_saleType;
  282. }
  283. set
  284. {
  285. m_saleType = value;
  286. }
  287. }
  288. protected byte m_saleType;
  289. /// <value>
  290. ///
  291. /// </value>
  292. public uint Flags
  293. {
  294. get
  295. {
  296. return m_flags;
  297. }
  298. set
  299. {
  300. m_flags = value;
  301. }
  302. }
  303. protected uint m_flags;
  304. /// <value>
  305. ///
  306. /// </value>
  307. public int CreationDate
  308. {
  309. get
  310. {
  311. return m_creationDate;
  312. }
  313. set
  314. {
  315. m_creationDate = value;
  316. }
  317. }
  318. protected int m_creationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
  319. public InventoryItemBase()
  320. {
  321. }
  322. public InventoryItemBase(UUID id)
  323. {
  324. ID = id;
  325. }
  326. public InventoryItemBase(UUID id, UUID owner)
  327. {
  328. ID = id;
  329. Owner = owner;
  330. }
  331. public object Clone()
  332. {
  333. return MemberwiseClone();
  334. }
  335. }
  336. }