ExShowBaseAttributeCancelWindow.java 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.network.serverpackets;
  16. import com.l2jserver.gameserver.model.L2ItemInstance;
  17. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  18. import com.l2jserver.gameserver.templates.item.L2Item;
  19. import com.l2jserver.gameserver.templates.item.L2Weapon;
  20. public class ExShowBaseAttributeCancelWindow extends L2GameServerPacket
  21. {
  22. private static final String _S__FE_74_EXCSHOWBASEATTRIBUTECANCELWINDOW = "[S] FE:74 ExShowBaseAttributeCancelWindow";
  23. private L2ItemInstance[] _items;
  24. private long _price;
  25. public ExShowBaseAttributeCancelWindow(L2PcInstance player)
  26. {
  27. _items = player.getInventory().getElementItems();
  28. }
  29. @Override
  30. protected void writeImpl()
  31. {
  32. writeC(0xfe);
  33. writeH(0x74);
  34. writeD(_items.length);
  35. for (L2ItemInstance item : _items)
  36. {
  37. writeD(item.getObjectId());
  38. writeQ(getPrice(item));
  39. }
  40. }
  41. private long getPrice(L2ItemInstance item)
  42. {
  43. switch(item.getItem().getCrystalType())
  44. {
  45. case L2Item.CRYSTAL_S:
  46. if (item.getItem() instanceof L2Weapon)
  47. _price = 50000;
  48. else
  49. _price = 40000;
  50. break;
  51. case L2Item.CRYSTAL_S80:
  52. if (item.getItem() instanceof L2Weapon)
  53. _price = 100000;
  54. else
  55. _price = 80000;
  56. break;
  57. case L2Item.CRYSTAL_S84:
  58. if (item.getItem() instanceof L2Weapon)
  59. _price = 200000;
  60. else
  61. _price = 160000;
  62. break;
  63. }
  64. return _price;
  65. }
  66. @Override
  67. public String getType()
  68. {
  69. return _S__FE_74_EXCSHOWBASEATTRIBUTECANCELWINDOW;
  70. }
  71. }