L2ItemInstance newItem = getInventory().transferItem(process, objectId, count, target, actor, reference);
if (newItem == null) return null;
// Send inventory update packet
PetInventoryUpdate petIU = new PetInventoryUpdate();
if (oldItem.getCount() > 0 && oldItem != newItem) petIU.addModifiedItem(oldItem);
else petIU.addRemovedItem(oldItem);
getOwner().sendPacket(petIU);
// Send target update packet
if (target instanceof PcInventory)
{
L2PcInstance targetPlayer = ((PcInventory)target).getOwner();
InventoryUpdate playerUI = new InventoryUpdate();
if (newItem.getCount() > count) playerUI.addModifiedItem(newItem);
else playerUI.addNewItem(newItem);
targetPlayer.sendPacket(playerUI);
// Update current load as well
StatusUpdate playerSU = new StatusUpdate(targetPlayer.getObjectId());
playerSU.addAttribute(StatusUpdate.CUR_LOAD, targetPlayer.getCurrentLoad());
targetPlayer.sendPacket(playerSU);
}
else if (target instanceof PetInventory)
{
petIU = new PetInventoryUpdate();
if (newItem.getCount() > count) petIU.addRemovedItem(newItem);
else petIU.addNewItem(newItem);
((PetInventory)target).getOwner().getOwner().sendPacket(petIU);
}
return newItem;
}