2
0

TradeItem.java 3.4 KB

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