}
ItemAttributes set = itemToUnnchant.getAttributes();
Element element = Element.getElementById(_attributeId);
if ((element == Element.NONE) || (set.getValue(element) <= 0))
{
activeChar.sendPacket(new ExBaseAttributeCancelResult(false, itemToUnnchant, element), ActionFail.STATIC);
return;
}
if (!activeChar.reduceAdena(ExShowBaseAttributeCancelWindow.getAttributeRemovePrice(itemToUnnchant), true))
{
activeChar.sendPacket(new ExBaseAttributeCancelResult(false, itemToUnnchant, element), SystemMsg.YOU_DO_NOT_HAVE_ENOUGH_ADENA, ActionFail.STATIC);
return;
}
boolean equipped = itemToUnnchant.isEquipped();
if (equipped)
{
activeChar.getInventory().unEquipItem(itemToUnnchant);
}
itemToUnnchant.setAttributeElement(element, 0);
itemToUnnchant.setJdbcState(JdbcEntityState.UPDATED);
itemToUnnchant.update();
if (equipped)
{
activeChar.getInventory().equipItem(itemToUnnchant);
}
activeChar.sendPacket(new InventoryUpdate().addModifiedItem(itemToUnnchant));
activeChar.sendPacket(new ExBaseAttributeCancelResult(true, itemToUnnchant, element));
activeChar.updateStats();
}