@Override
protected void runImpl()
{
L2Player activeChar = getClient().getActiveChar();
L2ItemInstance targetItem = activeChar.getInventory().getItemByObjectId(_targetItemObjId);
// cannot remove augmentation from a not augmented item
if(targetItem == null || !targetItem.isAugmented())
{
activeChar.sendPacket(new ExVariationCancelResult(0), Msg.AUGMENTATION_REMOVAL_CAN_ONLY_BE_DONE_ON_AN_AUGMENTED_ITEM);
return;
}
// get the price
int price = getRemovalPrice(targetItem.getItem());
if(price < 0)
{
activeChar.sendPacket(new ExVariationCancelResult(0));
}
// try to reduce the players adena
if(activeChar.getAdena() < price)
{
activeChar.sendPacket(new ExVariationCancelResult(0), Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
return;
}
activeChar.reduceAdena(price, true);
// cancel boni
targetItem.getAugmentation().removeBoni(activeChar);
// remove the augmentation
targetItem.removeAugmentation();
// send inventory update
InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(targetItem);
// send system message
SystemMessage sm = new SystemMessage(SystemMessage.AUGMENTATION_HAS_BEEN_SUCCESSFULLY_REMOVED_FROM_YOUR_S1);
sm.addItemName(targetItem.getItemId());
activeChar.sendPacket(new ExVariationCancelResult(1), iu, sm);
activeChar.broadcastUserInfo(true);
}