Пример #1
0
  @Override
  public void setLevel(byte value) {
    getActiveChar()
        .setPetData(
            PetDataTable.getInstance()
                .getPetLevelData(getActiveChar().getTemplate().getNpcId(), value));

    getActiveChar().stopFeed();
    super.setLevel(value); // Set level.
    getActiveChar().startFeed();

    // If a control item exists and its level is different of the new level.
    final L2ItemInstance controlItem = getActiveChar().getControlItem();
    if (controlItem != null && controlItem.getEnchantLevel() != getLevel()) {
      getActiveChar().sendPetInfosToOwner();

      controlItem.setEnchantLevel(getLevel());

      // Update item
      InventoryUpdate iu = new InventoryUpdate();
      iu.addModifiedItem(controlItem);
      getActiveChar().getOwner().sendPacket(iu);
    }
  }
Пример #2
0
 @Override
 public final long getExpForLevel(int level) {
   return PetDataTable.getInstance()
       .getPetLevelData(getActiveChar().getNpcId(), level)
       .getPetMaxExp();
 }