Package l2p.gameserver.model.items

Examples of l2p.gameserver.model.items.PetInventory


    {
      _level = minLevel;
    }
    _exp = getExpForThisLevel();
    _data = PetDataTable.getInstance().getInfo(template.npcId, _level);
    _inventory = new PetInventory(this);
    //transferPetItems();
    startFeed(false);
  }
View Full Code Here


    {
      _level = minLevel;
      _exp = getExpForThisLevel();
    }
    _data = PetDataTable.getInstance().getInfo(template.npcId, _level);
    _inventory = new PetInventory(this);
    _inventory.restore();
    transferPetItems();
    startFeed(false);
  }
View Full Code Here

    if(pet == null)
    {
      activeChar.sendActionFailed();
      return;
    }
    PetInventory petInventory = pet.getInventory();
    PcInventory playerInventory = activeChar.getInventory();
    L2ItemInstance petItem = petInventory.getItemByObjectId(_objectId);
    if(petItem == null)
    {
      _log.warning(activeChar.getName() + " requested item obj_id: " + _objectId + " from pet, but its not there.");
      return;
    }
    if(petItem.isEquipped())
    {
      activeChar.sendActionFailed();
      return;
    }
    long finalLoad = petItem.getItem().getWeight() * _amount;
    if(!activeChar.getInventory().validateWeight(finalLoad))
    {
      sendPacket(Msg.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
      return;
    }
    L2ItemInstance item = petInventory.dropItem(_objectId, _amount, false);
    item.setCustomFlags(item.getCustomFlags() & ~L2ItemInstance.FLAG_PET_EQUIPPED, true);
    playerInventory.addItem(item);
    pet.sendItemList();
    pet.broadcastPetInfo();
    Log.LogItem(activeChar, activeChar.getPet(), Log.GetItemFromPet, petItem);
View Full Code Here

    if(_objectId == pet.getControlItemObjId())
    {
      activeChar.sendActionFailed();
      return;
    }
    PetInventory petInventory = pet.getInventory();
    PcInventory playerInventory = activeChar.getInventory();
    L2ItemInstance playerItem = playerInventory.getItemByObjectId(_objectId);
    if(playerItem == null || playerItem.getObjectId() == pet.getControlItemObjId() || PetDataTable.isPetControlItem(playerItem))
    {
      activeChar.sendActionFailed();
      return;
    }
    if(pet.getInventory().getTotalWeight() + playerItem.getItem().getWeight() * _amount >= pet.getMaxLoad())
    {
      activeChar.sendPacket(Msg.EXCEEDED_PET_INVENTORYS_WEIGHT_LIMIT);
      return;
    }
    if(!playerItem.canBeDropped(activeChar, false))
    {
      activeChar.sendActionFailed();
      return;
    }
    if(_amount >= playerItem.getCount())
    {
      playerInventory.dropItem(_objectId, playerItem.getCount(), false);
      playerItem.setCustomFlags(playerItem.getCustomFlags() | L2ItemInstance.FLAG_PET_EQUIPPED, true);
      petInventory.addItem(playerItem);
    }
    else
    {
      L2ItemInstance newPetItem = playerInventory.dropItem(_objectId, _amount, false);
      petInventory.addItem(newPetItem);
    }
    pet.sendItemList();
    pet.broadcastPetInfo();
    Log.LogItem(activeChar, pet, Log.GiveItemToPet, playerItem);
  }
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.items.PetInventory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.