CompBlessedSpiritShotPacks.java 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 net.sf.l2j.gameserver.handler.itemhandlers;
  16. import net.sf.l2j.gameserver.handler.IItemHandler;
  17. import net.sf.l2j.gameserver.model.L2ItemInstance;
  18. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  19. import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
  20. import net.sf.l2j.gameserver.network.SystemMessageId;
  21. import net.sf.l2j.gameserver.network.serverpackets.ItemList;
  22. import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  23. /**
  24. * This class ...
  25. *
  26. * @version $Revision: 1.1.2.1.2.3 $ $Date: 2005/03/27 15:30:07 $
  27. */
  28. public class CompBlessedSpiritShotPacks implements IItemHandler
  29. {
  30. private static final int[] ITEM_IDS =
  31. {
  32. 5146, 5147, 5148, 5149, 5150,
  33. 5151, 5262, 5263, 5264, 5265,
  34. 5266, 5267
  35. };
  36. /**
  37. *
  38. * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
  39. */
  40. public void useItem(L2PlayableInstance playable, L2ItemInstance item)
  41. {
  42. if (!(playable instanceof L2PcInstance))
  43. return;
  44. L2PcInstance activeChar = (L2PcInstance) playable;
  45. int itemId = item.getItemId();
  46. int itemToCreateId;
  47. int amount;
  48. if (itemId < 5200)
  49. { // Normal Compressed Package of SpiritShots
  50. itemToCreateId = itemId - 1199; // Gives id of matching item for this pack
  51. amount = 300;
  52. }
  53. else
  54. { // Greater Compressed Package of SpiritShots
  55. itemToCreateId = itemId - 1315; // Gives id of matching item for this pack
  56. amount = 1000;
  57. }
  58. activeChar.getInventory().destroyItem("Extract", item, activeChar, null);
  59. activeChar.getInventory().addItem("Extract", itemToCreateId, amount, activeChar, item);
  60. SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
  61. sm.addItemName(itemToCreateId);
  62. sm.addNumber(amount);
  63. activeChar.sendPacket(sm);
  64. ItemList playerUI = new ItemList(activeChar, false);
  65. activeChar.sendPacket(playerUI);
  66. }
  67. /**
  68. *
  69. * @see net.sf.l2j.gameserver.handler.IItemHandler#getItemIds()
  70. */
  71. public int[] getItemIds()
  72. {
  73. return ITEM_IDS;
  74. }
  75. }