TradeItem.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 int[] _enchantOptions = L2ItemInstance.DEFAULT_ENCHANT_OPTIONS;
  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. }
  73. public TradeItem(TradeItem item, long count, long price)
  74. {
  75. _objectId = item.getObjectId();
  76. _item = item.getItem();
  77. _location = item.getLocationSlot();
  78. _enchant = item.getEnchant();
  79. _type1 = item.getCustomType1();
  80. _type2 = item.getCustomType2();
  81. _count = count;
  82. _storeCount = count;
  83. _price = price;
  84. _elemAtkType = item.getAttackElementType();
  85. _elemAtkPower = item.getAttackElementPower();
  86. for (byte i = 0; i < 6; i++)
  87. {
  88. _elemDefAttr[i] = item.getElementDefAttr(i);
  89. }
  90. }
  91. public void setObjectId(int objectId)
  92. {
  93. _objectId = objectId;
  94. }
  95. public int getObjectId()
  96. {
  97. return _objectId;
  98. }
  99. public L2Item getItem()
  100. {
  101. return _item;
  102. }
  103. public int getLocationSlot()
  104. {
  105. return _location;
  106. }
  107. public void setEnchant(int enchant)
  108. {
  109. _enchant = enchant;
  110. }
  111. public int getEnchant()
  112. {
  113. return _enchant;
  114. }
  115. public int getCustomType1()
  116. {
  117. return _type1;
  118. }
  119. public int getCustomType2()
  120. {
  121. return _type2;
  122. }
  123. public void setCount(long count)
  124. {
  125. _count = count;
  126. }
  127. public long getCount()
  128. {
  129. return _count;
  130. }
  131. public long getStoreCount()
  132. {
  133. return _storeCount;
  134. }
  135. public void setPrice(long price)
  136. {
  137. _price = price;
  138. }
  139. public long getPrice()
  140. {
  141. return _price;
  142. }
  143. public byte getAttackElementType()
  144. {
  145. return _elemAtkType;
  146. }
  147. public int getAttackElementPower()
  148. {
  149. return _elemAtkPower;
  150. }
  151. public int getElementDefAttr(byte i)
  152. {
  153. return _elemDefAttr[i];
  154. }
  155. public int[] getEnchantOptions()
  156. {
  157. return _enchantOptions;
  158. }
  159. }