Package l2p.gameserver.model.instances

Examples of l2p.gameserver.model.instances.L2PetInstance$FeedTask


    public boolean OnActionShift_L2PetInstance(L2Player player, L2Object object) {
        if (player == null || object == null || !player.getPlayerAccess().CanViewChar) {
            return false;
        }
        if (object.isPet()) {
            L2PetInstance pet = (L2PetInstance) object;

            String dialog;

            dialog = Files.read("data/scripts/actions/admin.L2PetInstance.onActionShift.htm");
            dialog = dialog.replaceFirst("%name%", String.valueOf(pet.getName()));
            dialog = dialog.replaceFirst("%level%", String.valueOf(pet.getLevel()));
            dialog = dialog.replaceFirst("%class%", String.valueOf(pet.getClass().getSimpleName().replaceFirst("L2", "").replaceFirst("Instance", "")));
            dialog = dialog.replaceFirst("%xyz%", pet.getLoc().x + " " + pet.getLoc().y + " " + pet.getLoc().z);
            dialog = dialog.replaceFirst("%heading%", String.valueOf(pet.getLoc().h));

            dialog = dialog.replaceFirst("%owner%", String.valueOf(pet.getPlayer().getName()));
            dialog = dialog.replaceFirst("%ownerId%", String.valueOf(pet.getPlayer().getObjectId()));
            dialog = dialog.replaceFirst("%npcId%", String.valueOf(pet.getNpcId()));
            dialog = dialog.replaceFirst("%controlItemId%", String.valueOf(pet.getControlItem().getItemId()));

            dialog = dialog.replaceFirst("%exp%", String.valueOf(pet.getExp()));
            dialog = dialog.replaceFirst("%sp%", String.valueOf(pet.getSp()));

            dialog = dialog.replaceFirst("%maxHp%", String.valueOf(pet.getMaxHp()));
            dialog = dialog.replaceFirst("%maxMp%", String.valueOf(pet.getMaxMp()));
            dialog = dialog.replaceFirst("%currHp%", String.valueOf((int) pet.getCurrentHp()));
            dialog = dialog.replaceFirst("%currMp%", String.valueOf((int) pet.getCurrentMp()));

            dialog = dialog.replaceFirst("%pDef%", String.valueOf(pet.getPDef(null)));
            dialog = dialog.replaceFirst("%mDef%", String.valueOf(pet.getMDef(null, null)));
            dialog = dialog.replaceFirst("%pAtk%", String.valueOf(pet.getPAtk(null)));
            dialog = dialog.replaceFirst("%mAtk%", String.valueOf(pet.getMAtk(null, null)));
            dialog = dialog.replaceFirst("%accuracy%", String.valueOf(pet.getAccuracy()));
            dialog = dialog.replaceFirst("%evasionRate%", String.valueOf(pet.getEvasionRate(null)));
            dialog = dialog.replaceFirst("%crt%", String.valueOf(pet.getCriticalHit(null, null)));
            dialog = dialog.replaceFirst("%runSpeed%", String.valueOf(pet.getRunSpeed()));
            dialog = dialog.replaceFirst("%walkSpeed%", String.valueOf(pet.getWalkSpeed()));
            dialog = dialog.replaceFirst("%pAtkSpd%", String.valueOf(pet.getPAtkSpd()));
            dialog = dialog.replaceFirst("%mAtkSpd%", String.valueOf(pet.getMAtkSpd()));
            dialog = dialog.replaceFirst("%dist%", String.valueOf((int) pet.getRealDistance(player)));

            dialog = dialog.replaceFirst("%STR%", String.valueOf(pet.getSTR()));
            dialog = dialog.replaceFirst("%DEX%", String.valueOf(pet.getDEX()));
            dialog = dialog.replaceFirst("%CON%", String.valueOf(pet.getCON()));
            dialog = dialog.replaceFirst("%INT%", String.valueOf(pet.getINT()));
            dialog = dialog.replaceFirst("%WIT%", String.valueOf(pet.getWIT()));
            dialog = dialog.replaceFirst("%MEN%", String.valueOf(pet.getMEN()));

            show(dialog, player);
        }
        return true;
    }
View Full Code Here


    if(pay != null && pay.getCount() >= Config.SERVICES_CHANGE_PET_NAME_PRICE)
    {
      player.getInventory().destroyItem(pay, Config.SERVICES_CHANGE_PET_NAME_PRICE, true);
      pl_pet.setName(pl_pet.getTemplate().name);
      pl_pet.broadcastPetInfo();
      L2PetInstance _pet = (L2PetInstance) pl_pet;
      L2ItemInstance controlItem = _pet.getControlItem();
      if(controlItem != null)
      {
        controlItem.setCustomType2(1);
        controlItem.setPriceToSell(0);
        controlItem.updateDatabase();
        _pet.updateControlItem();
      }
      show("Имя стерто.", player);
    }
    else if(Config.SERVICES_CHANGE_PET_NAME_ITEM == 57)
    {
View Full Code Here

        playersDie++;
        if(killer != null && killer.getReflectionId() == r.getId())
        {
          if(killer.isPet())
          {
            L2PetInstance pet = (L2PetInstance) killer;
            mOption.addItem(pet.getPlayer(), Config.eventLastHeroRewardId, Config.eventLastHeroRewardCount);
          }
          else if(killer.isPlayer())
          {
            L2Player playerKiller = (L2Player) killer;
            mOption.addItem(playerKiller, Config.eventLastHeroRewardId, Config.eventLastHeroRewardCount);
View Full Code Here

            break;
        }
        int killerTeam = 0;
        if(killer.isPet())
        {
          L2PetInstance pet = (L2PetInstance) killer;
          killerTeam = pet.getPlayer().getTeam();
        }
        else if(killer.isPlayer())
        {
          L2Player playerKiller = (L2Player) killer;
          killerTeam = playerKiller.getTeam();
View Full Code Here

            break;
        }
        int killerTeam = 0;
        if(killer.isPet())
        {
          L2PetInstance pet = (L2PetInstance) killer;
          killerTeam = pet.getPlayer().getTeam();
        }
        else if(killer.isPlayer())
        {
          L2Player playerKiller = (L2Player) killer;
          killerTeam = playerKiller.getTeam();
View Full Code Here

      L2Player pk = null;
      if(killer != null)
      {
        if(killer.isPet())
        {
          L2PetInstance pet = (L2PetInstance) killer;
          pk = pet.getPlayer();
        }
        else if(killer.isPlayer())
        {
          pk = (L2Player) killer;
        }
View Full Code Here

    L2Player activeChar = getClient().getActiveChar();
    if(activeChar == null)
    {
      return;
    }
    L2PetInstance pet = (L2PetInstance) activeChar.getPet();
    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

      }
      pet.setName(_name);
      pet.broadcastPetInfo();
      if(pet.isPet())
      {
        L2PetInstance _pet = (L2PetInstance) pet;
        L2ItemInstance controlItem = _pet.getControlItem();
        if(controlItem != null)
        {
          controlItem.setCustomType2(1);
          controlItem.setPriceToSell(0); // Костыль, иначе CustomType2 = 1 не пишется в базу
          controlItem.updateDatabase();
          _pet.updateControlItem();
        }
      }
    }
  }
View Full Code Here

        if (!check(_player, _item))
          return;
       
        int npcId = PetDataTable.getSummonId(_item);
        L2NpcTemplate petTemplate = NpcTable.getTemplate(npcId);
        L2PetInstance pet = L2PetInstance.spawnPet(petTemplate, _player, _item);
        if (pet == null)
          return;
       
        _player.setPet(pet);
        pet.setTitle(_player.getName());
        if (!pet.isRespawned())
        {
          try
          {
            pet.setCurrentHp(pet.getMaxHp(), false);
            pet.setCurrentMp(pet.getMaxMp());
            pet.setExp(pet.getExpForThisLevel());
            pet.setCurrentFed(pet.getMaxFed());
            pet.store();
          }
          catch (NullPointerException e)
          {
            _log.warning("PetSummon: failed set stats for summon " + npcId + ".");
            return;
          }
        }
        _player.sendPacket(new MagicSkillLaunched(_player.getObjectId(), 2046, 1, pet, true));
        pet.spawnMe(GeoEngine.findPointToStay(_player.getX(), _player.getY(), _player.getZ(), MIN_RADIUS, MAX_RADIUS, _player.getReflection().getGeoIndex()));
        pet.setRunning();
        pet.setFollowStatus(true, true);
        if (pet instanceof L2PetBabyInstance)
        {
          ((L2PetBabyInstance) pet).startBuffTask();
        }
      }
View Full Code Here

        }
        sendPacket(sm);
        activeChar.sendActionFailed();
        return;
      }
      L2PetInstance pet = (L2PetInstance) activeChar.getPet();
      if(pet == null || pet.isDead() || pet.isOutOfControl())
      {
        activeChar.sendActionFailed();
        return;
      }
      pet.getAI().setIntention(CtrlIntention.AI_INTENTION_PICK_UP, item, null);
    }
    else
    {
      activeChar.sendActionFailed();
      return;
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.instances.L2PetInstance$FeedTask

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.