Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. package net.sf.l2j.gameserver.handler.itemhandlers;
  2.  
  3. import net.sf.l2j.gameserver.handler.IItemHandler;
  4. import net.sf.l2j.gameserver.model.L2ItemInstance;
  5. import net.sf.l2j.gameserver.model.actor.L2Playable;
  6. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  7.  
  8. public class CustomCoins implements IItemHandler
  9. {
  10.     private static final int[] ITEM_IDS = { id1, id2 };
  11.  
  12.     @Override
  13. public void useItem(L2Playable playable, L2ItemInstance item)
  14. {
  15.         L2PcInstance activeChar = (L2PcInstance) playable;
  16.        
  17.         int itemId = item.getItemId();
  18.                 if (itemId == ITEM_IDS[0]) {
  19.                 if (activeChar.isHero()) {
  20.                  activeChar.sendMessage("You are already a hero!");
  21.                  return;
  22.                 }
  23.                
  24.                 activeChar.setHero(true);
  25.                  activeChar.sendMessage("You have hero status, util you log out!");
  26.                 activeChar.destroyItem("Consume", 3487, 1, activeChar, true);
  27.                 }
  28.                 else if (itemId == ITEM_IDS[1]) {
  29.                     if (activeChar.isNoble()) {
  30.                      activeChar.sendMessage("You are already noble!");
  31.                      return;
  32.                     }
  33.  
  34.                 activeChar.setNoble(true);
  35.                  activeChar.sendMessage("You have noble status!");
  36.                     activeChar.destroyItem("Consume", 3496, 1, activeChar, true);
  37.                 }
  38.         }
  39.  
  40.  
  41. public int[] getItemIds()
  42. {
  43.     return ITEM_IDS;
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement