Как партизан на допросе.
Вот тебе для л2ж ит.
Код:
package ru.it.l2js.gameserver.handler.itemhandlers;
import ru.it.l2js.Config;
import ru.it.l2js.gameserver.handler.IItemHandler;
import ru.it.l2js.gameserver.model.L2ItemInstance;
import ru.it.l2js.gameserver.model.actor.instance.L2PcInstance;
import ru.it.l2js.gameserver.model.actor.instance.L2PlayableInstance;
import ru.it.l2js.gameserver.network.serverpackets.ActionFailed;
import ru.it.l2js.gameserver.network.serverpackets.SocialAction;
/**
* @author Stefoulis15
**/
public class HeroCustomItem implements IItemHandler
{
private static final int ITEM_IDS[] =
{
3481
};
public void useItem(L2PlayableInstance playable, L2ItemInstance item)
{
if(Config.ALLOW_HERO_CUSTOM_ITEM)
{
if(!(playable instanceof L2PcInstance))
return;
L2PcInstance activeChar = (L2PcInstance)playable;
if(activeChar.isHero())
{
activeChar.sendMessage("You Are Already A Hero!");
activeChar.sendPacket(new ActionFailed());
return;
}
if (activeChar.isInOlympiadMode())
{
activeChar.sendMessage("This Item Cannot Be Used On Olympiad Games.");
activeChar.sendPacket(new ActionFailed());
return;
}
if (!activeChar.isNoble() && Config.NOBLE_STATUS_NEEDED_TO_USE_HERO_ITEM)
{
activeChar.sendMessage("You Must be a Noblesse In Order To Use the Hero Item!");
activeChar.sendPacket(new ActionFailed());
return;
}
activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 16));
activeChar.setHero(true);
activeChar.sendMessage("You Are Now a Hero,You Are Granted With Hero Status , Skills ,Aura. This Effect Will Stop When You Restart.");
activeChar.broadcastUserInfo();
playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
activeChar.getInventory().addItem("Wings", 6842, 1, activeChar, null);
}
}
public int[] getItemIds()
{
return ITEM_IDS;
}
}