{
if(!(playable instanceof L2PcInstance))
return;
L2PcInstance activeChar = (L2PcInstance) playable;
L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
L2Weapon weaponItem = activeChar.getActiveWeaponItem();
int itemId = item.getItemId();
if(activeChar.isParalyzed())
{
activeChar.sendMessage("You Cannot Use This While You Are Paralyzed");
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
if(activeChar.isInOlympiadMode())
{
SystemMessage sm = new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
sm.addString(item.getItemName());
activeChar.sendPacket(sm);
sm = null;
return;
}
// Check if Blessed Spiritshot can be used
if(weaponInst == null || weaponItem.getSpiritShotCount() == 0)
{
if(!activeChar.getAutoSoulShot().containsKey(itemId))
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SPIRITSHOTS));
}
return;
}
// Check if Blessed Spiritshot is already active (it can be charged over Spiritshot)
if(weaponInst.getChargedSpiritshot() != L2ItemInstance.CHARGED_NONE)
return;
// Check for correct grade
int weaponGrade = weaponItem.getCrystalType();
if(weaponGrade == L2Item.CRYSTAL_NONE && itemId != 3947 || weaponGrade == L2Item.CRYSTAL_D && itemId != 3948 || weaponGrade == L2Item.CRYSTAL_C && itemId != 3949 || weaponGrade == L2Item.CRYSTAL_B && itemId != 3950 || weaponGrade == L2Item.CRYSTAL_A && itemId != 3951 || weaponGrade == L2Item.CRYSTAL_S && itemId != 3952)
{
if(!activeChar.getAutoSoulShot().containsKey(itemId))
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH));
}
return;
}
// Consume Blessed Spiritshot if player has enough of them
// TODO: test ss
if(!Config.DONT_DESTROY_SS)
{
if(!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false))
{
if(activeChar.getAutoSoulShot().containsKey(itemId))
{
activeChar.removeAutoSoulShot(itemId);
activeChar.sendPacket(new ExAutoSoulShot(itemId, 0));
SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
sm.addString(item.getItem().getName());
activeChar.sendPacket(sm);
sm = null;
return;
}
activeChar.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS));
return;
}
}
// Charge Blessed Spiritshot
weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT);
// Send message to client
activeChar.sendPacket(new SystemMessage(SystemMessageId.ENABLED_SPIRITSHOT));
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);