Package com.l2jfrozen.gameserver.model.actor.instance

Examples of com.l2jfrozen.gameserver.model.actor.instance.L2SummonInstance$SummonLifetime


   * @param rewardedMembers The list of L2PcInstance to reward
   * @param topLvl
   */
  public void distributeXpAndSp(long xpReward, int spReward, List<L2PlayableInstance> rewardedMembers, int topLvl)
  {
    L2SummonInstance summon = null;
    List<L2PlayableInstance> validMembers = getValidMembers(rewardedMembers, topLvl);

    float penalty;
    double sqLevel;
    double preCalculation;

    xpReward *= getExpBonus(validMembers.size());
    spReward *= getSpBonus(validMembers.size());

    double sqLevelSum = 0;

    for(L2PlayableInstance character : validMembers)
    {
      sqLevelSum += character.getLevel() * character.getLevel();
    }

    // Go through the L2PcInstances and L2PetInstances (not L2SummonInstances) that must be rewarded
    synchronized (rewardedMembers)
    {
      for(L2Character member : rewardedMembers)
      {
        if(member.isDead())
        {
          continue;
        }

        penalty = 0;

        // The L2SummonInstance penalty
        if(member.getPet() instanceof L2SummonInstance)
        {
          summon = (L2SummonInstance) member.getPet();
          penalty = summon.getExpPenalty();
        }

        // Pets that leech xp from the owner (like babypets) do not get rewarded directly
        if(member instanceof L2PetInstance)
        {
View Full Code Here


      _curFed = pet.getCurrentFed(); // how fed it is
      _maxFed = pet.getMaxFed(); //max fed it can be
    }
    else if (_summon instanceof L2SummonInstance)
    {
      L2SummonInstance sum = (L2SummonInstance)_summon;
      _curFed = sum.getTimeRemaining();
      _maxFed = sum.getTotalLifeTime();
    }
  }
View Full Code Here

      if (Config.DEBUG)
        _log.fine("player has a pet already. ignore summon skill");
      return;
    }
   
    L2SummonInstance summon;
    L2NpcTemplate summonTemplate = NpcTable.getInstance().getTemplate(_npcId);
    if (summonTemplate == null)
    {
      _log.warning("Summon attempt for nonexisting NPC ID:"+_npcId+", skill ID:"+this.getId());
      return; // npcID doesn't exist
    }
    if (summonTemplate.type.equalsIgnoreCase("L2SiegeSummon"))
      summon = new L2SiegeSummonInstance(IdFactory.getInstance().getNextId(), summonTemplate, activeChar, this);
    else
      summon = new L2SummonInstance(IdFactory.getInstance().getNextId(), summonTemplate, activeChar, this);
   
    summon.setName(summonTemplate.name);
    summon.setTitle(activeChar.getName());
    summon.setExpPenalty(_expPenalty);
    if (summon.getLevel() >= ExperienceData.getInstance().getMaxLevel())
    {
      summon.getStat().setExp(ExperienceData.getInstance().getExpForLevel(ExperienceData.getInstance().getMaxPetLevel() - 1));
      _log.warning("Summon ("+summon.getName()+") NpcID: "+summon.getNpcId()+" has a level above 75. Please rectify.");
    }
    else
    {
      summon.getStat().setExp(ExperienceData.getInstance().getExpForLevel(summon.getLevel() % ExperienceData.getInstance().getMaxPetLevel()));
    }
    summon.setCurrentHp(summon.getMaxHp());
    summon.setCurrentMp(summon.getMaxMp());
    summon.setHeading(activeChar.getHeading());
    summon.setRunning();
    activeChar.setPet(summon);

    L2World.getInstance().storeObject(summon);

    //Check to see if we should do the decay right after the cast
    if(getTargetType() == SkillTargetType.TARGET_CORPSE_MOB)
    {
      L2Character target = (L2Character) targets[0];
      if(target.isDead() && target instanceof L2NpcInstance)
      {
        summon.spawnMe(target.getX(), target.getY(), target.getZ() + 5);
        ((L2NpcInstance) target).endDecayTask();
      }
    }
    else
    {
      summon.spawnMe(activeChar.getX() + Rnd.get(40)-20, activeChar.getY() + Rnd.get(40)-20, activeChar.getZ());
    }

    summon.setFollowStatus(true);
    summon.setShowSummonAnimation(false); // addVisibleObject created the info packets with summon animation
    // if someone comes into range now, the animation shouldnt show any more
    activeChar.sendPacket(new PetInfo(summon));
  }
View Full Code Here

      _curFed = pet.getCurrentFed(); // how fed it is
      _maxFed = pet.getMaxFed(); //max fed it can be
    }
    else if (_summon instanceof L2SummonInstance)
    {
      L2SummonInstance sum = (L2SummonInstance)_summon;
      _curFed = sum.getTimeRemaining();
      _maxFed = sum.getTotalLifeTime();
    }
  }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.actor.instance.L2SummonInstance$SummonLifetime

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.