Package net.sf.l2j.gameserver.model.actor.instance

Examples of net.sf.l2j.gameserver.model.actor.instance.L2SummonInstance


   * @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)
        {
          if (((L2PetInstance)member).getPetData().getOwnerExpTaken() > 0)
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.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() >= Experience.LEVEL.length)
        {
            summon.getStat().setExp(Experience.LEVEL[Experience.LEVEL.length - 1]);
            _log.warning("Summon ("+summon.getName()+") NpcID: "+summon.getNpcId()+" has a level above 75. Please rectify.");
        }
        else
        {
            summon.getStat().setExp(Experience.LEVEL[(summon.getLevel() % Experience.LEVEL.length)]);
        }
    summon.setCurrentHp(summon.getMaxHp());
    summon.setCurrentMp(summon.getMaxMp());
    summon.setHeading(activeChar.getHeading());
      summon.setRunning();
    activeChar.setPet(summon);

      L2World.getInstance().storeObject(summon);
        summon.spawnMe(activeChar.getX()+50, activeChar.getY()+100, 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

TOP

Related Classes of net.sf.l2j.gameserver.model.actor.instance.L2SummonInstance

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.