Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2004-2013 L2J DataPack
- *
- * This file is part of L2J DataPack.
- *
- * L2J DataPack is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * L2J DataPack is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package handlers.itemhandlers;
- import java.util.concurrent.TimeUnit;
- import l2r.gameserver.model.actor.L2Playable;
- import l2r.gameserver.model.actor.instance.L2PcInstance;
- import l2r.gameserver.model.items.instance.L2ItemInstance;
- import l2r.gameserver.network.SystemMessageId;
- import l2r.gameserver.util.Util;
- public class HeroCoin extends ItemSkills
- {
- @Override
- public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
- {
- if (!playable.isPlayer())
- {
- playable.sendPacket(SystemMessageId.ITEM_NOT_FOR_PETS);
- return false;
- }
- final L2PcInstance activeChar = playable.getActingPlayer();
- if (activeChar.isHero())
- {
- activeChar.sendMessage("You cannot use this coin while hero.");
- return false;
- }
- activeChar.setHero(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(30));
- activeChar.sendMessage("You received hero for 30 days. Expire at " + Util.convertMillisecondToDate(activeChar.getHeroExpire()));
- activeChar.destroyItemByItemId("", 9143, 1, activeChar, true);
- return super.useItem(playable, item, forceUse);
- }
- }
Add Comment
Please, Sign In to add comment