TradeItem.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 com.l2jserver.gameserver.model;
  16. import com.l2jserver.gameserver.model.items.L2Item;
  17. import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
  18. public class TradeItem
  19. {
  20. private int _objectId;
  21. private final L2Item _item;
  22. private final int _location;
  23. private int _enchant;
  24. private final int _type1;
  25. private final int _type2;
  26. private long _count;
  27. private long _storeCount;
  28. private long _price;
  29. private final byte _elemAtkType;
  30. private final int _elemAtkPower;
  31. private final int[] _elemDefAttr =
  32. {
  33. 0,
  34. 0,
  35. 0,
  36. 0,
  37. 0,
  38. 0
  39. };
  40. private final int[] _enchantOptions;
  41. public TradeItem(L2ItemInstance item, long count, long price)
  42. {
  43. _objectId = item.getObjectId();
  44. _item = item.getItem();
  45. _location = item.getLocationSlot();
  46. _enchant = item.getEnchantLevel();
  47. _type1 = item.getCustomType1();
  48. _type2 = item.getCustomType2();
  49. _count = count;
  50. _price = price;
  51. _elemAtkType = item.getAttackElementType();
  52. _elemAtkPower = item.getAttackElementPower();
  53. for (byte i = 0; i < 6; i++)
  54. {
  55. _elemDefAttr[i] = item.getElementDefAttr(i);
  56. }
  57. _enchantOptions = item.getEnchantOptions();
  58. }
  59. public TradeItem(L2Item item, long count, long price)
  60. {
  61. _objectId = 0;
  62. _item = item;
  63. _location = 0;
  64. _enchant = 0;
  65. _type1 = 0;
  66. _type2 = 0;
  67. _count = count;
  68. _storeCount = count;
  69. _price = price;
  70. _elemAtkType = Elementals.NONE;
  71. _elemAtkPower = 0;
  72. _enchantOptions = L2ItemInstance.DEFAULT_ENCHANT_OPTIONS;
  73. }
  74. public TradeItem(TradeItem item, long count, long price)
  75. {
  76. _objectId = item.getObjectId();
  77. _item = item.getItem();
  78. _location = item.getLocationSlot();
  79. _enchant = item.getEnchant();
  80. _type1 = item.getCustomType1();
  81. _type2 = item.getCustomType2();
  82. _count = count;
  83. _storeCount = count;
  84. _price = price;
  85. _elemAtkType = item.getAttackElementType();
  86. _elemAtkPower = item.getAttackElementPower();
  87. for (byte i = 0; i < 6; i++)
  88. {
  89. _elemDefAttr[i] = item.getElementDefAttr(i);
  90. }
  91. _enchantOptions = item.getEnchantOptions();
  92. }
  93. public void setObjectId(int objectId)
  94. {
  95. _objectId = objectId;
  96. }
  97. public int getObjectId()
  98. {
  99. return _objectId;
  100. }
  101. public L2Item getItem()
  102. {
  103. return _item;
  104. }
  105. public int getLocationSlot()
  106. {
  107. return _location;
  108. }
  109. public void setEnchant(int enchant)
  110. {
  111. _enchant = enchant;
  112. }
  113. public int getEnchant()
  114. {
  115. return _enchant;
  116. }
  117. public int getCustomType1()
  118. {
  119. return _type1;
  120. }
  121. public int getCustomType2()
  122. {
  123. return _type2;
  124. }
  125. public void setCount(long count)
  126. {
  127. _count = count;
  128. }
  129. public long getCount()
  130. {
  131. return _count;
  132. }
  133. public long getStoreCount()
  134. {
  135. return _storeCount;
  136. }
  137. public void setPrice(long price)
  138. {
  139. _price = price;
  140. }
  141. public long getPrice()
  142. {
  143. return _price;
  144. }
  145. public byte getAttackElementType()
  146. {
  147. return _elemAtkType;
  148. }
  149. public int getAttackElementPower()
  150. {
  151. return _elemAtkPower;
  152. }
  153. public int getElementDefAttr(byte i)
  154. {
  155. return _elemDefAttr[i];
  156. }
  157. public int[] getEnchantOptions()
  158. {
  159. return _enchantOptions;
  160. }
  161. }