InventoryItemBase.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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. 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 = UUID.Zero.ToString();
  81. /// <value>
  82. /// The creator of this item expressed as a UUID. Database plugins don't need to set this, it will be set by
  83. /// upstream code (or set by the get accessor if left unset).
  84. /// </value>
  85. public UUID CreatorIdAsUuid
  86. {
  87. get
  88. {
  89. UUID temp = UUID.Zero;
  90. UUID.TryParse(CreatorId, out temp);
  91. return temp;
  92. }
  93. set
  94. {
  95. CreatorId = value.ToString();
  96. }
  97. }
  98. /// <value>
  99. /// The description of the inventory item (must be less than 64 characters)
  100. /// </value>
  101. public string Description
  102. {
  103. get
  104. {
  105. return m_description;
  106. }
  107. set
  108. {
  109. m_description = value;
  110. }
  111. }
  112. protected string m_description = String.Empty;
  113. /// <value>
  114. ///
  115. /// </value>
  116. public uint NextPermissions
  117. {
  118. get
  119. {
  120. return m_nextPermissions;
  121. }
  122. set
  123. {
  124. m_nextPermissions = value;
  125. }
  126. }
  127. protected uint m_nextPermissions;
  128. /// <value>
  129. /// A mask containing permissions for the current owner (cannot be enforced)
  130. /// </value>
  131. public uint CurrentPermissions
  132. {
  133. get
  134. {
  135. return m_currentPermissions;
  136. }
  137. set
  138. {
  139. m_currentPermissions = value;
  140. }
  141. }
  142. protected uint m_currentPermissions;
  143. /// <value>
  144. ///
  145. /// </value>
  146. public uint BasePermissions
  147. {
  148. get
  149. {
  150. return m_basePermissions;
  151. }
  152. set
  153. {
  154. m_basePermissions = value;
  155. }
  156. }
  157. protected uint m_basePermissions;
  158. /// <value>
  159. ///
  160. /// </value>
  161. public uint EveryOnePermissions
  162. {
  163. get
  164. {
  165. return m_everyonePermissions;
  166. }
  167. set
  168. {
  169. m_everyonePermissions = value;
  170. }
  171. }
  172. protected uint m_everyonePermissions;
  173. /// <value>
  174. ///
  175. /// </value>
  176. public uint GroupPermissions
  177. {
  178. get
  179. {
  180. return m_groupPermissions;
  181. }
  182. set
  183. {
  184. m_groupPermissions = value;
  185. }
  186. }
  187. protected uint m_groupPermissions;
  188. /// <value>
  189. /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
  190. /// </value>
  191. public int AssetType
  192. {
  193. get
  194. {
  195. return m_assetType;
  196. }
  197. set
  198. {
  199. m_assetType = value;
  200. }
  201. }
  202. protected int m_assetType;
  203. /// <value>
  204. /// The UUID of the associated asset on the asset server
  205. /// </value>
  206. public UUID AssetID
  207. {
  208. get
  209. {
  210. return m_assetID;
  211. }
  212. set
  213. {
  214. m_assetID = value;
  215. }
  216. }
  217. protected UUID m_assetID;
  218. /// <value>
  219. ///
  220. /// </value>
  221. public UUID GroupID
  222. {
  223. get
  224. {
  225. return m_groupID;
  226. }
  227. set
  228. {
  229. m_groupID = value;
  230. }
  231. }
  232. protected UUID m_groupID;
  233. /// <value>
  234. ///
  235. /// </value>
  236. public bool GroupOwned
  237. {
  238. get
  239. {
  240. return m_groupOwned;
  241. }
  242. set
  243. {
  244. m_groupOwned = value;
  245. }
  246. }
  247. protected bool m_groupOwned;
  248. /// <value>
  249. ///
  250. /// </value>
  251. public int SalePrice
  252. {
  253. get
  254. {
  255. return m_salePrice;
  256. }
  257. set
  258. {
  259. m_salePrice = value;
  260. }
  261. }
  262. protected int m_salePrice;
  263. /// <value>
  264. ///
  265. /// </value>
  266. public byte SaleType
  267. {
  268. get
  269. {
  270. return m_saleType;
  271. }
  272. set
  273. {
  274. m_saleType = value;
  275. }
  276. }
  277. protected byte m_saleType;
  278. /// <value>
  279. ///
  280. /// </value>
  281. public uint Flags
  282. {
  283. get
  284. {
  285. return m_flags;
  286. }
  287. set
  288. {
  289. m_flags = value;
  290. }
  291. }
  292. protected uint m_flags;
  293. /// <value>
  294. ///
  295. /// </value>
  296. public int CreationDate
  297. {
  298. get
  299. {
  300. return m_creationDate;
  301. }
  302. set
  303. {
  304. m_creationDate = value;
  305. }
  306. }
  307. protected int m_creationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
  308. public object Clone()
  309. {
  310. return MemberwiseClone();
  311. }
  312. }
  313. }