Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2Summon


              _log.log(Level.WARNING, "Attention: playable " + playable.getName() + " has not potions " + potion + "!");
          }
        }
        else if (playable instanceof L2Summon)
        {
          L2Summon activeChar = (L2Summon) playable;
         
          if (activeChar.getInventory().getInventoryItemCount(potion, 0) > 0)
          {
            L2ItemInstance item = activeChar.getInventory().getItemByItemId(potion);
            activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
          }
          else
          {
            if (Config.DEBUG)
              _log.log(Level.WARNING, "Attention: playable " + playable.getName() + " has not potions " + potion + "!");
View Full Code Here


            L2PcInstance player = (L2PcInstance) targ;
            // L2PcInstance player = (L2PcInstance)target;
            if (!player.isInvul())
            {
              // Check and calculate transfered damage
              L2Summon summon = player.getPet();
              if (summon instanceof L2SummonInstance && Util.checkIfInRange(900, player, summon, true))
              {
                int tDmg = (int) damage * (int) player.getStat().calcStat(Stats.TRANSFER_DAMAGE_PERCENT, 0, null, null) / 100;
               
                // Only transfer dmg up to current HP, it should
                // not be killed
                if (summon.getCurrentHp() < tDmg)
                  tDmg = (int) summon.getCurrentHp() - 1;
                if (tDmg > 0)
                {
                  summon.reduceCurrentHp(tDmg, activeChar);
                  damage -= tDmg;
                }
              }
              if (damage >= player.getCurrentHp())
              {
View Full Code Here

    }

    if(activeOwner == null)
      return;

    L2Summon activePet = activeOwner.getPet();

    if(activePet == null)
    {
      activeOwner.sendPacket(new SystemMessage(SystemMessageId.PETS_ARE_NOT_AVAILABLE_AT_THIS_TIME));
      return;
    }

    if(activePet.isDead())
    {
      activeOwner.sendPacket(new SystemMessage(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET));
      return;
    }

    int itemId = 6645;
    int shotConsumption = 1;

    L2ItemInstance weaponInst = null;
    L2Weapon weaponItem = null;

    if(activePet instanceof L2PetInstance && !(activePet instanceof L2BabyPetInstance))
    {
      weaponInst = ((L2PetInstance) activePet).getActiveWeaponInstance();
      weaponItem = ((L2PetInstance) activePet).getActiveWeaponItem();

      if(weaponInst == null)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SOULSHOTS));
        return;
      }

      if(weaponInst.getChargedSoulshot() != L2ItemInstance.CHARGED_NONE)
        // SoulShots are already active.
        return;

      int shotCount = item.getCount();
      shotConsumption = weaponItem.getSoulShotCount();
      weaponItem = null;

      if(shotConsumption == 0)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SOULSHOTS));
        return;
      }

      if(!(shotCount > shotConsumption))
      {
        // Not enough Soulshots to use.
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SOULSHOTS_FOR_PET));
        return;
      }

      shotCount = 0;
      weaponInst.setChargedSoulshot(L2ItemInstance.CHARGED_SOULSHOT);
    }
    else
    {
      if(activePet.getChargedSoulShot() != L2ItemInstance.CHARGED_NONE)
        return;

      activePet.setChargedSoulShot(L2ItemInstance.CHARGED_SOULSHOT);
    }

    // If the player doesn't have enough beast soulshot remaining, remove any auto soulshot task.
    // TODO: test ss
    if(!Config.DONT_DESTROY_SS)
View Full Code Here

    }

    if(activeOwner == null)
      return;

    L2Summon activePet = activeOwner.getPet();
    if(activePet == null)
    {
      activeOwner.sendPacket(new SystemMessage(SystemMessageId.PETS_ARE_NOT_AVAILABLE_AT_THIS_TIME));
      return;
    }

    if(activePet.isDead())
    {
      activeOwner.sendPacket(new SystemMessage(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET));
      return;
    }

    int itemId = item.getItemId();
    boolean isBlessed = itemId == 6647;
    int shotConsumption = 1;

    L2ItemInstance weaponInst = null;
    L2Weapon weaponItem = null;

    if(activePet instanceof L2PetInstance && !(activePet instanceof L2BabyPetInstance))
    {
      weaponInst = ((L2PetInstance) activePet).getActiveWeaponInstance();
      weaponItem = ((L2PetInstance) activePet).getActiveWeaponItem();

      if(weaponInst == null)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SPIRITSHOTS));
        return;
      }

      if(weaponInst.getChargedSpiritshot() != L2ItemInstance.CHARGED_NONE)
        // SpiritShots are already active.
        return;

      int shotCount = item.getCount();
      shotConsumption = weaponItem.getSpiritShotCount();

      weaponItem = null;

      if(shotConsumption == 0)
      {
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.CANNOT_USE_SPIRITSHOTS));
        return;
      }

      if(!(shotCount > shotConsumption))
      {
        // Not enough SpiritShots to use.
        activeOwner.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITHOTS_FOR_PET));
        return;
      }

      if(isBlessed)
      {
        weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT);
      }
      else
      {
        weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_SPIRITSHOT);
      }
    }
    else
    {
      if(activePet.getChargedSpiritShot() != L2ItemInstance.CHARGED_NONE)
        return;

      if(isBlessed)
      {
        activePet.setChargedSpiritShot(L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT);
      }
      else
      {
        activePet.setChargedSpiritShot(L2ItemInstance.CHARGED_SPIRITSHOT);
      }
    }

    // TODO: test ss
    if(!Config.DONT_DESTROY_SS)
View Full Code Here

        active_char.sendPacket(new NpcInfo((L2NpcInstance) object, active_char));
      }
      else if(object instanceof L2Summon)
      {
        L2Summon summon = (L2Summon) object;

        // Check if the L2PcInstance is the owner of the Pet
        if(active_char.equals(summon.getOwner()))
        {
          active_char.sendPacket(new PetInfo(summon));
          // The PetInfo packet wipes the PartySpelled (list of active  spells' icons).  Re-add them
          summon.updateEffectIcons(true);

          if(summon instanceof L2PetInstance)
          {
            active_char.sendPacket(new PetItemList((L2PetInstance) summon));
          }
View Full Code Here

    int fullValue = (int) value;

    if(attacker != null && attacker != getActiveChar())
    {
      // Check and calculate transfered damage
      L2Summon summon = getActiveChar().getPet();

      //TODO correct range
      if(summon != null && summon instanceof L2SummonInstance && Util.checkIfInRange(900, getActiveChar(), summon, true))
      {
        int tDmg = (int) value * (int) getActiveChar().getStat().calcStat(Stats.TRANSFER_DAMAGE_PERCENT, 0, null, null) / 100;

        // Only transfer dmg up to current HP, it should not be killed
        if(summon.getCurrentHp() < tDmg)
        {
          tDmg = (int) summon.getCurrentHp() - 1;
        }

        if(tDmg > 0)
        {
          summon.reduceCurrentHp(tDmg, attacker);
          value -= tDmg;
          fullValue = (int) value; // reduce the annouced value here as player will get a message about summon dammage
        }
      }

View Full Code Here

 
  public void addAttackStanceTask(L2Character actor)
  {
    if (actor instanceof L2Summon)
    {
      L2Summon summon = (L2Summon) actor;
      actor = summon.getOwner();
    }
    if (actor instanceof L2PcInstance)
    {
      L2PcInstance player = (L2PcInstance) actor;
      for (L2CubicInstance cubic : player.getCubics().values())
View Full Code Here

 
  public void removeAttackStanceTask(L2Character actor)
  {
    if (actor instanceof L2Summon)
    {
      L2Summon summon = (L2Summon) actor;
      actor = summon.getOwner();
    }
    _attackStanceTasks.remove(actor);
  }
View Full Code Here

 
  public boolean getAttackStanceTask(L2Character actor)
  {
    if (actor instanceof L2Summon)
    {
      L2Summon summon = (L2Summon) actor;
      actor = summon.getOwner();
    }
    return _attackStanceTasks.containsKey(actor);
  }
View Full Code Here

  public synchronized boolean useUserCommand(int id, L2PcInstance activeChar)
  {
    if(id != COMMAND_IDS[0])
      return false;

    L2Summon pet = activeChar.getPet();

    if(pet != null && pet.isMountable() && !activeChar.isMounted())
    {
      if(activeChar.isDead())
      {
        // A strider cannot be ridden when player is dead.
        SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_DEAD);
        activeChar.sendPacket(msg);
        msg = null;
      }
      else if(pet.isDead())
      {
        // A dead strider cannot be ridden.
        SystemMessage msg = new SystemMessage(SystemMessageId.DEAD_STRIDER_CANT_BE_RIDDEN);
        activeChar.sendPacket(msg);
        msg = null;
      }
      else if(pet.isInCombat())
      {
        // A strider in battle cannot be ridden.
        SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_IN_BATLLE_CANT_BE_RIDDEN);
        activeChar.sendPacket(msg);
        msg = null;
      }
      else if(activeChar.isInCombat())
      {
        // A pet cannot be ridden while player is in battle.
        SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE);
        activeChar.sendPacket(msg);
        msg = null;
      }
      else if(!activeChar.isInsideRadius(pet, 60, true, false))
      {
        activeChar.sendMessage("Too far away from strider to mount.");
        return false;
      }
      else if(!GeoData.getInstance().canSeeTarget(activeChar, pet))
      {
        SystemMessage msg = new SystemMessage(SystemMessageId.CANT_SEE_TARGET);
        activeChar.sendPacket(msg);
        return false;
      }
      else if(activeChar.isSitting() || activeChar.isMoving())
      {
        // A strider can be ridden only when player is standing.
        SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CAN_BE_RIDDEN_ONLY_WHILE_STANDING);
        activeChar.sendPacket(msg);
        msg = null;
      }
      else if(!pet.isDead() && !activeChar.isMounted())
      {
        if(!activeChar.disarmWeapons())
          return false;

        Ride mount = new Ride(activeChar.getObjectId(), Ride.ACTION_MOUNT, pet.getTemplate().npcId);
        Broadcast.toSelfAndKnownPlayersInRadius(activeChar, mount, 810000/*900*/);
        activeChar.setMountType(mount.getMountType());
        activeChar.setMountObjectID(pet.getControlItemId());
        pet.unSummon(activeChar);
        mount = null;

        if(activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null || activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND) != null)
        {
          if(activeChar.setMountType(0))
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.L2Summon

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.