Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 KB | None | 0 0
  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.  
  21. import net.sf.l2j.gameserver.model.L2ItemInstance;
  22.  
  23. /**
  24. * This class contains L2ItemInstance<BR>
  25. * Use to sort L2ItemInstance of :
  26. * <LI>L2Armor</LI>
  27. * <LI>L2EtcItem</LI>
  28. * <LI>L2Weapon</LI>
  29. * @version $Revision: 1.7.2.2.2.5 $ $Date: 2005/04/06 18:25:18 $
  30. */
  31. public class L2WarehouseItem
  32. {
  33. private L2Item _item;
  34. private int _object;
  35. private int _count;
  36. private int _owner;
  37. private int _enchant;
  38. private int _grade;
  39. private int _augmentationId;
  40. private int _customType1;
  41. private int _customType2;
  42.  
  43. public L2WarehouseItem(L2ItemInstance item)
  44. {
  45. _item = item.getItem();
  46. _object = item.getObjectId();
  47. _count = item.getCount();
  48. _owner = item.getOwnerId();
  49. _enchant = item.getEnchantLevel();
  50. _customType1 = item.getCustomType1();
  51. _customType2 = item.getCustomType2();
  52. _grade = item.getItem().getItemGrade();
  53. }
  54.  
  55. /**
  56. * Returns the item.
  57. * @return L2Item
  58. */
  59. public L2Item getItem()
  60. {
  61. return _item;
  62. }
  63.  
  64. /**
  65. * Returns the unique objectId
  66. * @return int
  67. */
  68. public final int getObjectId()
  69. {
  70. return _object;
  71. }
  72.  
  73. /**
  74. * Returns the owner
  75. * @return int
  76. */
  77. public final int getOwnerId()
  78. {
  79. return _owner;
  80. }
  81.  
  82. /**
  83. * Returns the count
  84. * @return int
  85. */
  86. public final int getCount()
  87. {
  88. return _count;
  89. }
  90.  
  91. /**
  92. * Returns the first type
  93. * @return int
  94. */
  95. public final int getType1()
  96. {
  97. return _item.getType1();
  98. }
  99.  
  100. /**
  101. * Returns the second type
  102. * @return int
  103. */
  104. public final int getType2()
  105. {
  106. return _item.getType2();
  107. }
  108.  
  109. /**
  110. * Returns the second type
  111. * @return int
  112. */
  113. @SuppressWarnings("unchecked")
  114. public final Enum getItemType()
  115. {
  116. return _item.getItemType();
  117. }
  118.  
  119. /**
  120. * Returns the ItemId
  121. * @return int
  122. */
  123. public final int getItemId()
  124. {
  125. return _item.getItemId();
  126. }
  127.  
  128. /**
  129. * Returns the part of body used with this item
  130. * @return int
  131. */
  132. public final int getBodyPart()
  133. {
  134. return _item.getBodyPart();
  135. }
  136.  
  137. /**
  138. * Returns the enchant level
  139. * @return int
  140. */
  141. public final int getEnchantLevel()
  142. {
  143. return _enchant;
  144. }
  145.  
  146. /**
  147. * Returns the item grade
  148. * @return int
  149. */
  150. public final int getItemGrade()
  151. {
  152. return _grade;
  153. }
  154.  
  155. /**
  156. * Returns true if it is a weapon
  157. * @return boolean
  158. */
  159. public final boolean isWeapon()
  160. {
  161. return (_item instanceof L2Weapon);
  162. }
  163.  
  164. /**
  165. * Returns true if it is an armor
  166. * @return boolean
  167. */
  168. public final boolean isArmor()
  169. {
  170. return (_item instanceof L2Armor);
  171. }
  172.  
  173. /**
  174. * Returns true if it is an EtcItem
  175. * @return boolean
  176. */
  177. public final boolean isEtcItem()
  178. {
  179. return (_item instanceof L2EtcItem);
  180. }
  181.  
  182. /**
  183. * Returns the name of the item
  184. * @return String
  185. */
  186. public String getItemName()
  187. {
  188. return _item.getName();
  189. }
  190.  
  191. /**
  192. * Returns the name of the item
  193. * @return String
  194. * @deprecated beware to use getItemName() instead because getName() is final in L2Object and could not be overridden! Allover L2Object.getName() may return null!
  195. */
  196. public String getName()
  197. {
  198. return _item.getName();
  199. }
  200.  
  201. public final int getCustomType1()
  202. {
  203. return _customType1;
  204. }
  205. public final int getCustomType2()
  206. {
  207. return _customType2;
  208. }
  209.  
  210. /**
  211. * Returns the name of the item
  212. * @return String
  213. */
  214. public String toString()
  215. {
  216. return _item.toString();
  217. }
  218. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement