ItemInfo.java 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package net.sf.l2j.gameserver.model;
  16. import net.sf.l2j.gameserver.templates.L2Item;
  17. /**
  18. * Get all information from L2ItemInstance to generate ItemInfo.<BR><BR>
  19. *
  20. */
  21. public class ItemInfo
  22. {
  23. /** Identifier of the L2ItemInstance */
  24. private int _objectId;
  25. /** The L2Item template of the L2ItemInstance */
  26. private L2Item _item;
  27. /** The level of enchant on the L2ItemInstance */
  28. private int _enchant;
  29. /** The augmentation of the item */
  30. private int _augmentation;
  31. /** The quantity of L2ItemInstance */
  32. private int _count;
  33. /** The price of the L2ItemInstance */
  34. private int _price;
  35. /** The custom L2ItemInstance types (used loto, race tickets) */
  36. private int _type1;
  37. private int _type2;
  38. /** If True the L2ItemInstance is equipped */
  39. private int _equipped;
  40. /** The action to do clientside (1=ADD, 2=MODIFY, 3=REMOVE) */
  41. private int _change;
  42. /** The mana of this item */
  43. private int _mana;
  44. private int _location;
  45. private int _element;
  46. private int _val;
  47. private int _fire;
  48. private int _water;
  49. private int _earth;
  50. private int _wind;
  51. private int _holy;
  52. private int _unholy;
  53. /**
  54. * Get all information from L2ItemInstance to generate ItemInfo.<BR><BR>
  55. *
  56. */
  57. public ItemInfo(L2ItemInstance item)
  58. {
  59. if (item == null) return;
  60. // Get the Identifier of the L2ItemInstance
  61. _objectId = item.getObjectId();
  62. // Get the L2Item of the L2ItemInstance
  63. _item = item.getItem();
  64. // Get the enchant level of the L2ItemInstance
  65. _enchant = item.getEnchantLevel();
  66. // Get the augmentation boni
  67. if (item.isAugmented()) _augmentation = item.getAugmentation().getAugmentationId();
  68. else _augmentation = 0;
  69. // Get the quantity of the L2ItemInstance
  70. _count = item.getCount();
  71. // Get custom item types (used loto, race tickets)
  72. _type1 = item.getCustomType1();
  73. _type2 = item.getCustomType2();
  74. // Verify if the L2ItemInstance is equipped
  75. _equipped = item.isEquipped() ? 1 : 0;
  76. // Get the action to do clientside
  77. switch (item.getLastChange())
  78. {
  79. case (L2ItemInstance.ADDED): { _change = 1; break; }
  80. case (L2ItemInstance.MODIFIED): { _change = 2; break; }
  81. case (L2ItemInstance.REMOVED): { _change = 3; break;}
  82. }
  83. // Get shadow item mana
  84. _mana = item.getMana();
  85. _location = item.getLocationSlot();
  86. }
  87. public ItemInfo(L2ItemInstance item, int change)
  88. {
  89. if (item == null) return;
  90. // Get the Identifier of the L2ItemInstance
  91. _objectId = item.getObjectId();
  92. // Get the L2Item of the L2ItemInstance
  93. _item = item.getItem();
  94. // Get the enchant level of the L2ItemInstance
  95. _enchant = item.getEnchantLevel();
  96. // Get the augmentation boni
  97. if (item.isAugmented()) _augmentation = item.getAugmentation().getAugmentationId();
  98. else _augmentation = 0;
  99. // Get the quantity of the L2ItemInstance
  100. _count = item.getCount();
  101. // Get custom item types (used loto, race tickets)
  102. _type1 = item.getCustomType1();
  103. _type2 = item.getCustomType2();
  104. // Verify if the L2ItemInstance is equipped
  105. _equipped = item.isEquipped() ? 1 : 0;
  106. // Get the action to do clientside
  107. _change = change;
  108. // Get shadow item mana
  109. _mana = item.getMana();
  110. _location = item.getLocationSlot();
  111. _element = item.getAttackAttrElement();
  112. _val = item.getAttackAttrElementVal();
  113. _fire = item.getDefAttrFire();
  114. _water = item.getDefAttrWater();
  115. _wind = item.getDefAttrWind();
  116. _earth = item.getDefAttrEarth();
  117. _holy = item.getDefAttrHoly();
  118. _unholy = item.getDefAttrUnholy();
  119. }
  120. public int getObjectId(){return _objectId;}
  121. public L2Item getItem(){return _item;}
  122. public int getEnchant(){return _enchant;}
  123. public int getAugmentationBonus(){return _augmentation;}
  124. public int getCount(){return _count;}
  125. public int getPrice(){return _price;}
  126. public int getCustomType1(){return _type1;}
  127. public int getCustomType2(){return _type2;}
  128. public int getEquipped(){return _equipped;}
  129. public int getChange(){return _change;}
  130. public int getMana(){return _mana;}
  131. public int getLocation(){return _location;}
  132. public int getAttackAttrElement(){return _element;}
  133. public int getAttackAttrElementVal(){return _val;}
  134. public int getDefAttrFire(){return _fire;}
  135. public int getDefAttrWater(){return _water;}
  136. public int getDefAttrWind(){return _wind;}
  137. public int getDefAttrEarth(){return _earth;}
  138. public int getDefAttrHoly(){return _holy;}
  139. public int getDefAttrUnholy(){return _unholy;}
  140. }