Guys, i made an itemhandler (credits to me so don't start saying c/p and and and), that when you double click on gold dragon(3481), cancel augment window pops up, and the item GETS consumed(not 100%). <<I have tested it so give me feedback. I won't explain how to register an itemhandler or how to register it with configs... there are plenty of guides... (MADE IN L2J INTERLUDE)
Here you go: Create a file CancelAugPortable.java in java/net/sf/l2j/gameserver/handler/itemhandlers and paste:
/*
* This program 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 2, or (at your option)
* any later version.
*
* This program 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package net.sf.l2j.gameserver.handler.itemhandlers;
import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.ExShowVariationMakeWindow;
public class CancelAugPortable implements IItemHandler
{
private static final int ITEM_IDS[] =
{
3481
};
public void useItem(L2PlayableInstance playable, L2ItemInstance item)
{
if (!(playable instanceof L2PcInstance))
return;
L2PcInstance activeChar = (L2PcInstance)playable;
if (activeChar.isInCombat())
{
activeChar.sendMessage("You cant cancel Augment while you are attacking");
return;
}
else if (activeChar.isInJail())
{
activeChar.sendMessage("You cant cancel Augment while you are in jail");
return;
}
else if (activeChar.isInOlympiadMode())
{
activeChar.sendMessage("You cant cancel Augment while you are on olympiad game");
return;
}
else
activeChar.sendPacket(new ExShowVariationCancelWindow());
}
public int[] getItemIds()
{
return ITEM_IDS;
}
}
Idea was taken from TheEnd's share with portable augment.