{
SystemMessage sm = new SystemMessage(
SystemMessageId.CRYSTALLIZE_LEVEL_TOO_LOW);
activeChar.sendPacket(sm);
sm = null;
ActionFailed af = new ActionFailed();
activeChar.sendPacket(af);
return;
}
PcInventory inventory = activeChar.getInventory();
if (inventory != null)
{
L2ItemInstance item = inventory.getItemByObjectId(_objectId);
if (item == null || item.isWear())
{
ActionFailed af = new ActionFailed();
activeChar.sendPacket(af);
return;
}
int itemId = item.getItemId();
if ((itemId >= 6611 && itemId <= 6621) || itemId == 6842)
return;
if (_count > item.getCount())
{
_count = activeChar.getInventory().getItemByObjectId(_objectId)
.getCount();
}
}
L2ItemInstance itemToRemove = activeChar.getInventory()
.getItemByObjectId(_objectId);
if (itemToRemove == null || itemToRemove.isWear())
{
return;
}
if (!itemToRemove.getItem().isCrystallizable()
|| (itemToRemove.getItem().getCrystalCount() <= 0)
|| (itemToRemove.getItem().getCrystalType() == L2Item.CRYSTAL_NONE))
{
_log.warning("" + activeChar.getObjectId()
+ " tried to crystallize "
+ itemToRemove.getItem().getItemId());
return;
}
// Check if the char can crystallize C items and return if false;
if (itemToRemove.getItem().getCrystalType() == L2Item.CRYSTAL_C
&& skillLevel <= 1)
{
SystemMessage sm = new SystemMessage(
SystemMessageId.CRYSTALLIZE_LEVEL_TOO_LOW);
activeChar.sendPacket(sm);
sm = null;
ActionFailed af = new ActionFailed();
activeChar.sendPacket(af);
return;
}
// Check if the user can crystallize B items and return if false;
if (itemToRemove.getItem().getCrystalType() == L2Item.CRYSTAL_B
&& skillLevel <= 2)
{
SystemMessage sm = new SystemMessage(
SystemMessageId.CRYSTALLIZE_LEVEL_TOO_LOW);
activeChar.sendPacket(sm);
sm = null;
ActionFailed af = new ActionFailed();
activeChar.sendPacket(af);
return;
}
// Check if the user can crystallize A items and return if false;
if (itemToRemove.getItem().getCrystalType() == L2Item.CRYSTAL_A
&& skillLevel <= 3)
{
SystemMessage sm = new SystemMessage(
SystemMessageId.CRYSTALLIZE_LEVEL_TOO_LOW);
activeChar.sendPacket(sm);
sm = null;
ActionFailed af = new ActionFailed();
activeChar.sendPacket(af);
return;
}
// Check if the user can crystallize S items and return if false;
if (itemToRemove.getItem().getCrystalType() == L2Item.CRYSTAL_S
&& skillLevel <= 4)
{
SystemMessage sm = new SystemMessage(
SystemMessageId.CRYSTALLIZE_LEVEL_TOO_LOW);
activeChar.sendPacket(sm);
sm = null;
ActionFailed af = new ActionFailed();
activeChar.sendPacket(af);
return;
}
activeChar.setInCrystallize(true);