// L2J-Dot Custom Item
// This Item Grants You Noblesse Status When Press It 
// Source File Name:   NobleCustomItem.java

package com.l2dot.gameserver.handler.itemhandlers;

import com.l2dot.Config;
import com.l2dot.gameserver.handler.IItemHandler;
import com.l2dot.gameserver.model.L2ItemInstance;
import com.l2dot.gameserver.model.actor.instance.L2PcInstance;
import com.l2dot.gameserver.model.actor.instance.L2PlayableInstance;
import com.l2dot.gameserver.network.serverpackets.SocialAction;

public class NobleCustomItem
    implements IItemHandler
{

    public NobleCustomItem()
    {
    }

    public void useItem(L2PlayableInstance playable, L2ItemInstance item)
    {
        if(Config.NOBLE_CUSTOM_ITEMS)
        {
            if(!(playable instanceof L2PcInstance))
                return;
            L2PcInstance activeChar = (L2PcInstance)playable;
            if(activeChar.isNoble())
            {
                activeChar.sendMessage("You Are Already A Noblesse!.");
            } else
            {
                activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));
                activeChar.setNoble(true);
                activeChar.sendMessage("You Are Now a Noble,You Are Granted With Noblesse Status , And Noblesse Skills.");
                activeChar.broadcastUserInfo();
                playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
                activeChar.getInventory().addItem("Tiara", 7694, 1, activeChar, null);
            }
        }
    }

    public int[] getItemIds()
    {
        return ITEM_IDS;
    }

    private static final int ITEM_IDS[] = {
    	Config.NOBLE_ITEM_ID
    };

}