if(!object.isItem())
{
owner.sendActionFailed();
return;
}
L2ItemInstance target = (L2ItemInstance) object;
if(target.isCursed())
{
owner.sendPacket(new SystemMessage(SystemMessage.YOU_HAVE_FAILED_TO_PICK_UP_S1).addItemName(target.getItemId()));
return;
}
synchronized(target)
{
if(!target.isVisible())
{
owner.sendActionFailed();
return;
}
if(getInventory().getTotalWeight() + target.getItem().getWeight() * target.getCount() > getMaxLoad())
{
owner.sendPacket(Msg.EXCEEDED_PET_INVENTORYS_WEIGHT_LIMIT);
return;
}
if(target.isHerb())
{
L2Skill[] skills = target.getItem().getAttachedSkills();
if(skills != null && skills.length > 0)
{
for(L2Skill skill : skills)
{
altUseSkill(skill, this);
}
}
target.deleteMe();
return;
}
if(!target.pickupMe(this))
{
owner.sendActionFailed();
return;
}
}
if(owner.getParty() == null || owner.getParty().getLootDistribution() == L2Party.ITEM_LOOTER)
{
owner.sendPacket(SystemMessage.obtainItemsBy(target, "Your pet"));
target.setCustomFlags(target.getCustomFlags() | L2ItemInstance.FLAG_PET_EQUIPPED, true);
synchronized(_inventory)
{
_inventory.addItem(target);
}
sendItemList();