TradeItem.java 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. * Copyright (C) 2004-2013 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.model;
  20. import com.l2jserver.gameserver.model.items.L2Item;
  21. import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
  22. public class TradeItem
  23. {
  24. private int _objectId;
  25. private final L2Item _item;
  26. private final int _location;
  27. private int _enchant;
  28. private final int _type1;
  29. private final int _type2;
  30. private long _count;
  31. private long _storeCount;
  32. private long _price;
  33. private final byte _elemAtkType;
  34. private final int _elemAtkPower;
  35. private final int[] _elemDefAttr =
  36. {
  37. 0,
  38. 0,
  39. 0,
  40. 0,
  41. 0,
  42. 0
  43. };
  44. private final int[] _enchantOptions;
  45. public TradeItem(L2ItemInstance item, long count, long price)
  46. {
  47. _objectId = item.getObjectId();
  48. _item = item.getItem();
  49. _location = item.getLocationSlot();
  50. _enchant = item.getEnchantLevel();
  51. _type1 = item.getCustomType1();
  52. _type2 = item.getCustomType2();
  53. _count = count;
  54. _price = price;
  55. _elemAtkType = item.getAttackElementType();
  56. _elemAtkPower = item.getAttackElementPower();
  57. for (byte i = 0; i < 6; i++)
  58. {
  59. _elemDefAttr[i] = item.getElementDefAttr(i);
  60. }
  61. _enchantOptions = item.getEnchantOptions();
  62. }
  63. public TradeItem(L2Item item, long count, long price)
  64. {
  65. _objectId = 0;
  66. _item = item;
  67. _location = 0;
  68. _enchant = 0;
  69. _type1 = 0;
  70. _type2 = 0;
  71. _count = count;
  72. _storeCount = count;
  73. _price = price;
  74. _elemAtkType = Elementals.NONE;
  75. _elemAtkPower = 0;
  76. _enchantOptions = L2ItemInstance.DEFAULT_ENCHANT_OPTIONS;
  77. }
  78. public TradeItem(TradeItem item, long count, long price)
  79. {
  80. _objectId = item.getObjectId();
  81. _item = item.getItem();
  82. _location = item.getLocationSlot();
  83. _enchant = item.getEnchant();
  84. _type1 = item.getCustomType1();
  85. _type2 = item.getCustomType2();
  86. _count = count;
  87. _storeCount = count;
  88. _price = price;
  89. _elemAtkType = item.getAttackElementType();
  90. _elemAtkPower = item.getAttackElementPower();
  91. for (byte i = 0; i < 6; i++)
  92. {
  93. _elemDefAttr[i] = item.getElementDefAttr(i);
  94. }
  95. _enchantOptions = item.getEnchantOptions();
  96. }
  97. public void setObjectId(int objectId)
  98. {
  99. _objectId = objectId;
  100. }
  101. public int getObjectId()
  102. {
  103. return _objectId;
  104. }
  105. public L2Item getItem()
  106. {
  107. return _item;
  108. }
  109. public int getLocationSlot()
  110. {
  111. return _location;
  112. }
  113. public void setEnchant(int enchant)
  114. {
  115. _enchant = enchant;
  116. }
  117. public int getEnchant()
  118. {
  119. return _enchant;
  120. }
  121. public int getCustomType1()
  122. {
  123. return _type1;
  124. }
  125. public int getCustomType2()
  126. {
  127. return _type2;
  128. }
  129. public void setCount(long count)
  130. {
  131. _count = count;
  132. }
  133. public long getCount()
  134. {
  135. return _count;
  136. }
  137. public long getStoreCount()
  138. {
  139. return _storeCount;
  140. }
  141. public void setPrice(long price)
  142. {
  143. _price = price;
  144. }
  145. public long getPrice()
  146. {
  147. return _price;
  148. }
  149. public byte getAttackElementType()
  150. {
  151. return _elemAtkType;
  152. }
  153. public int getAttackElementPower()
  154. {
  155. return _elemAtkPower;
  156. }
  157. public int getElementDefAttr(byte i)
  158. {
  159. return _elemDefAttr[i];
  160. }
  161. public int[] getEnchantOptions()
  162. {
  163. return _enchantOptions;
  164. }
  165. }