package com.l2dot.gameserver.handler.voicedcommandhandlers;

import com.l2dot.gameserver.handler.IVoicedCommandHandler;
import com.l2dot.gameserver.model.actor.instance.L2PcInstance;


/**
 *
 *
 */
public class Res implements IVoicedCommandHandler
{
    private static final String[] VOICED_COMMANDS = { "res" };

    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {   
        if (command.equalsIgnoreCase("res"))
        {
              if (!activeChar.isAlikeDead())
              {
                 activeChar.sendMessage("You cannot be ressurected while alive.");
                 return false;
              }
           if(activeChar.isInOlympiadMode())
           {
              activeChar.sendMessage("You cannot use this feature during olympiad.");
             return false;
           }
           if(activeChar.getInventory().getItemByItemId(3470) == null)
           {
              activeChar.sendMessage("You need 1 or more Gold Bars to use the ressurection system.");
             return false;
           }
           
           
           
              activeChar.sendMessage("You have been ressurected!");
            activeChar.getInventory().destroyItemByItemId("RessSystem", 3470, 1, activeChar, activeChar.getTarget());
              activeChar.doRevive();
              activeChar.broadcastUserInfo();
              activeChar.sendMessage("One GoldBar has dissapeared! Thank you!");
        }
       return true;
    }
    public String[] getVoicedCommandList()
    {
        return VOICED_COMMANDS;
    }

}

       