ExShowBaseAttributeCancelWindow.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (C) 2004-2015 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.network.serverpackets;
  20. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  21. import com.l2jserver.gameserver.model.items.L2Weapon;
  22. import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
  23. public class ExShowBaseAttributeCancelWindow extends L2GameServerPacket
  24. {
  25. private final L2ItemInstance[] _items;
  26. private long _price;
  27. public ExShowBaseAttributeCancelWindow(L2PcInstance player)
  28. {
  29. _items = player.getInventory().getElementItems();
  30. }
  31. @Override
  32. protected void writeImpl()
  33. {
  34. writeC(0xFE);
  35. writeH(0x74);
  36. writeD(_items.length);
  37. for (L2ItemInstance item : _items)
  38. {
  39. writeD(item.getObjectId());
  40. writeQ(getPrice(item));
  41. }
  42. }
  43. /**
  44. * TODO: Update prices for Top/Mid/Low S80/S84
  45. * @param item
  46. * @return
  47. */
  48. private long getPrice(L2ItemInstance item)
  49. {
  50. switch (item.getItem().getCrystalType())
  51. {
  52. case S:
  53. if (item.getItem() instanceof L2Weapon)
  54. {
  55. _price = 50000;
  56. }
  57. else
  58. {
  59. _price = 40000;
  60. }
  61. break;
  62. case S80:
  63. if (item.getItem() instanceof L2Weapon)
  64. {
  65. _price = 100000;
  66. }
  67. else
  68. {
  69. _price = 80000;
  70. }
  71. break;
  72. case S84:
  73. if (item.getItem() instanceof L2Weapon)
  74. {
  75. _price = 200000;
  76. }
  77. else
  78. {
  79. _price = 160000;
  80. }
  81. break;
  82. }
  83. return _price;
  84. }
  85. }