/*
* This file is part of the L2J Mobius project.
*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
package handlers.itemhandlers;
import org.l2jmobius.gameserver.handler.IItemHandler;
import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ExShowVariationMakeWindow;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/**
* @author proGenitor
*/
public class LifeStone implements IItemHandler
{
@Override
public boolean useItem(Playable playable, ItemInstance item, boolean forceUse)
{
if (playable.isDead()) {
final SystemMessage msg = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
msg.addItemName(item);
playable.sendPacket(msg);
return false;
}
final PlayerInstance player = playable.getActingPlayer();
final int itemId = item.getId();
switch (itemId)
{
case 90012:
case 90013:
case 90014: {
player.sendPacket(ExShowVariationMakeWindow.STATIC_PACKET);
return true;
}
default: {
LOGGER.warning("LifeStone Augment: Item with id: " + itemId + " is not handled");
}
}
return false;
}
}
It's for Mobius.. Adapt for your project!