Ejemplo n.º 1
0
 /**
  * Add player to get notification of characters death
  *
  * @param player : L2Character of the character to get notification of death
  */
 public void addNotifyOfDeath(Player player, boolean withPet) {
   OnDeathListenerImpl listener = new OnDeathListenerImpl();
   player.addListener(listener);
   if (withPet) {
     for (Summon summon : player.getSummonList()) {
       summon.addListener(listener);
     }
   }
 }
 private static boolean HatchlingSummoned(QuestState st, boolean CheckObjID) {
   Summon _pet = st.getPlayer().getSummonList().getPet();
   if (_pet == null) return false;
   if (CheckObjID) {
     int dragonflute_id = st.getInt("dragonflute");
     if (dragonflute_id == 0) return false;
     if (_pet.getControlItemObjId() != dragonflute_id) return false;
   }
   ItemInstance dragonflute = GetDragonflute(st);
   if (dragonflute == null) return false;
   if (PetDataTable.getControlItemId(_pet.getNpcId()) != dragonflute.getItemId()) return false;
   return true;
 }
Ejemplo n.º 3
0
  public void evolve() {
    Player player = getSelf();
    NpcInstance npc = getNpc();
    if (player == null || npc == null) {
      return;
    }
    Summon pl_pet = player.getPet();
    if (player.getInventory().getItemByItemId(BABY_COUGAR_CHIME) == null) {
      show("scripts/services/petevolve/no_item.htm", player, npc);
      return;
    }
    if (pl_pet == null || pl_pet.isDead()) {
      show("scripts/services/petevolve/evolve_no.htm", player, npc);
      return;
    }
    if (pl_pet.getNpcId() != BABY_COUGAR) {
      show("scripts/services/petevolve/no_pet.htm", player, npc);
      return;
    }
    if (pl_pet.getLevel() < 55) {
      show("scripts/services/petevolve/no_level.htm", player, npc);
      return;
    }

    int controlItemId = player.getPet().getControlItemObjId();
    player.getPet().unSummon();

    ItemInstance control = player.getInventory().getItemByObjectId(controlItemId);
    control.setItemId(IN_COUGAR_CHIME);
    control.setEnchantLevel(L2Pet.IMPROVED_BABY_COUGAR.getMinLevel());
    control.setJdbcState(JdbcEntityState.UPDATED);
    control.update();
    player.sendItemList(false);

    show("scripts/services/petevolve/yes_pet.htm", player, npc);
  }