L2WarehouseItem.java 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License as published by
  4. * the Free Software Foundation; either version 2, or (at your option)
  5. * any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, write to the Free Software
  14. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  15. * 02111-1307, USA.
  16. *
  17. * http://www.gnu.org/copyleft/gpl.html
  18. */
  19. package net.sf.l2j.gameserver.templates;
  20. import net.sf.l2j.gameserver.model.L2ItemInstance;
  21. /**
  22. * This class contains L2ItemInstance<BR>
  23. * Use to sort L2ItemInstance of :
  24. * <LI>L2Armor</LI>
  25. * <LI>L2EtcItem</LI>
  26. * <LI>L2Weapon</LI>
  27. * @version $Revision: 1.7.2.2.2.5 $ $Date: 2005/04/06 18:25:18 $
  28. */
  29. public class L2WarehouseItem
  30. {
  31. private L2Item _item;
  32. private int _object;
  33. private int _count;
  34. private int _owner;
  35. private int _enchant;
  36. private int _grade;
  37. private boolean _isAugmented;
  38. private int _augmentationId;
  39. private int _customType1;
  40. private int _customType2;
  41. private int _mana;
  42. private int _attackAttrElement;
  43. private int _attackAttrElementVal;
  44. private int _defAttrFire;
  45. private int _defAttrWater;
  46. private int _defAttrWind;
  47. private int _defAttrEarth;
  48. private int _defAttrHoly;
  49. private int _defAttrUnholy;
  50. public L2WarehouseItem(L2ItemInstance item)
  51. {
  52. _item = item.getItem();
  53. _object = item.getObjectId();
  54. _count = item.getCount();
  55. _owner = item.getOwnerId();
  56. _enchant = item.getEnchantLevel();
  57. _customType1 = item.getCustomType1();
  58. _customType2 = item.getCustomType2();
  59. _grade = item.getItem().getItemGrade();
  60. if (item.isAugmented())
  61. {
  62. _isAugmented = true;
  63. _augmentationId = item.getAugmentation().getAugmentationId();
  64. }
  65. else
  66. _isAugmented = false;
  67. _mana = item.getMana();
  68. _attackAttrElement = item.getAttackAttrElement();
  69. _attackAttrElementVal = item.getAttackAttrElementVal();
  70. _defAttrFire = item.getDefAttrFire();
  71. _defAttrWater = item.getDefAttrWater();
  72. _defAttrWind = item.getDefAttrWind();
  73. _defAttrEarth = item.getDefAttrEarth();
  74. _defAttrHoly = item.getDefAttrHoly();
  75. _defAttrUnholy = item.getDefAttrUnholy();
  76. }
  77. /**
  78. * Returns the item.
  79. * @return L2Item
  80. */
  81. public L2Item getItem()
  82. {
  83. return _item;
  84. }
  85. /**
  86. * Returns the unique objectId
  87. * @return int
  88. */
  89. public final int getObjectId()
  90. {
  91. return _object;
  92. }
  93. /**
  94. * Returns the owner
  95. * @return int
  96. */
  97. public final int getOwnerId()
  98. {
  99. return _owner;
  100. }
  101. /**
  102. * Returns the count
  103. * @return int
  104. */
  105. public final int getCount()
  106. {
  107. return _count;
  108. }
  109. /**
  110. * Returns the first type
  111. * @return int
  112. */
  113. public final int getType1()
  114. {
  115. return _item.getType1();
  116. }
  117. /**
  118. * Returns the second type
  119. * @return int
  120. */
  121. public final int getType2()
  122. {
  123. return _item.getType2();
  124. }
  125. /**
  126. * Returns the second type
  127. * @return int
  128. */
  129. @SuppressWarnings("unchecked")
  130. public final Enum getItemType()
  131. {
  132. return _item.getItemType();
  133. }
  134. /**
  135. * Returns the ItemId
  136. * @return int
  137. */
  138. public final int getItemId()
  139. {
  140. return _item.getItemId();
  141. }
  142. /**
  143. * Returns the part of body used with this item
  144. * @return int
  145. */
  146. public final int getBodyPart()
  147. {
  148. return _item.getBodyPart();
  149. }
  150. /**
  151. * Returns the enchant level
  152. * @return int
  153. */
  154. public final int getEnchantLevel()
  155. {
  156. return _enchant;
  157. }
  158. /**
  159. * Returns the item grade
  160. * @return int
  161. */
  162. public final int getItemGrade()
  163. {
  164. return _grade;
  165. }
  166. /**
  167. * Returns true if it is a weapon
  168. * @return boolean
  169. */
  170. public final boolean isWeapon()
  171. {
  172. return (_item instanceof L2Weapon);
  173. }
  174. /**
  175. * Returns true if it is an armor
  176. * @return boolean
  177. */
  178. public final boolean isArmor()
  179. {
  180. return (_item instanceof L2Armor);
  181. }
  182. /**
  183. * Returns true if it is an EtcItem
  184. * @return boolean
  185. */
  186. public final boolean isEtcItem()
  187. {
  188. return (_item instanceof L2EtcItem);
  189. }
  190. /**
  191. * Returns the name of the item
  192. * @return String
  193. */
  194. public String getItemName()
  195. {
  196. return _item.getName();
  197. }
  198. public boolean isAugmented()
  199. {
  200. return _isAugmented;
  201. }
  202. public int getAugmentationId()
  203. {
  204. return _augmentationId;
  205. }
  206. /**
  207. * Returns the name of the item
  208. * @return String
  209. * @deprecated beware to use getItemName() instead because getName() is final in L2Object and could not be overriden! Allover L2Object.getName() may return null!
  210. */
  211. public String getName()
  212. {
  213. return _item.getName();
  214. }
  215. public final int getCustomType1()
  216. {
  217. return _customType1;
  218. }
  219. public final int getCustomType2()
  220. {
  221. return _customType2;
  222. }
  223. public final int getMana()
  224. {
  225. return _mana;
  226. }
  227. public final int getAttackAttrElement()
  228. {
  229. return _attackAttrElement;
  230. }
  231. public final int getAttackAttrElementVal()
  232. {
  233. return _attackAttrElementVal;
  234. }
  235. public final int getDefAttrFire()
  236. {
  237. return _defAttrFire;
  238. }
  239. public final int getDefAttrWater()
  240. {
  241. return _defAttrWater;
  242. }
  243. public final int getDefAttrWind()
  244. {
  245. return _defAttrWind;
  246. }
  247. public final int getDefAttrEarth()
  248. {
  249. return _defAttrEarth;
  250. }
  251. public final int getDefAttrHoly()
  252. {
  253. return _defAttrHoly;
  254. }
  255. public final int getDefAttrUnholy()
  256. {
  257. return _defAttrUnholy;
  258. }
  259. /**
  260. * Returns the name of the item
  261. * @return String
  262. */
  263. public String toString()
  264. {
  265. return _item.toString();
  266. }
  267. }