boolean isAutoSoulShot = false;
if(player.getAutoSoulShot().contains(item.getItemId()))
{
isAutoSoulShot = true;
}
L2Summon pet = player.getPet();
if(pet == null)
{
if(!isAutoSoulShot)
{
player.sendPacket(Msg.PETS_AND_SERVITORS_ARE_NOT_AVAILABLE_AT_THIS_TIME);
}
return;
}
if(pet.isDead())
{
if(!isAutoSoulShot)
{
player.sendPacket(Msg.WHEN_PET_OR_SERVITOR_IS_DEAD_SOULSHOTS_OR_SPIRITSHOTS_FOR_PET_OR_SERVITOR_ARE_NOT_AVAILABLE);
}
return;
}
int consumption = 0;
int skillid = 0;
switch(item.getItemId())
{
case 6645:
case 20332:
if(pet.getChargedSoulShot())
{
return;
}
consumption = pet.getSoulshotConsumeCount();
if(item.getCount() < consumption)
{
player.sendPacket(Msg.YOU_DONT_HAVE_ENOUGH_SOULSHOTS_NEEDED_FOR_A_PET_SERVITOR);
return;
}
pet.chargeSoulShot();
skillid = 2033;
break;
case 6646:
case 20333:
if(pet.getChargedSpiritShot() > 0)
{
return;
}
consumption = pet.getSpiritshotConsumeCount();
if(item.getCount() < consumption)
{
player.sendPacket(Msg.YOU_DONT_HAVE_ENOUGH_SPIRITSHOTS_NEEDED_FOR_A_PET_SERVITOR);
return;
}
pet.chargeSpiritShot(L2ItemInstance.CHARGED_SPIRITSHOT);
skillid = 2008;
break;
case 6647:
case 20334:
if(pet.getChargedSpiritShot() > 1)
{
return;
}
consumption = pet.getSpiritshotConsumeCount();
if(item.getCount() < consumption)
{
player.sendPacket(Msg.YOU_DONT_HAVE_ENOUGH_SPIRITSHOTS_NEEDED_FOR_A_PET_SERVITOR);
return;
}
pet.chargeSpiritShot(L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT);
skillid = 2009;
break;
}
pet.broadcastPacket(new MagicSkillUse(pet, pet, skillid, 1, 0, 0));
player.getInventory().destroyItem(item, consumption, false);
}