TradeItem.java 3.5 KB

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