Examples of SystemMessage


Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage

        return;

        // You cannot do anything else while fishing
        if (activeChar.isFishing())
        {
            SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_DO_WHILE_FISHING_3);
            activeChar.sendPacket(sm);
            sm = null;
            return;
        }
View Full Code Here

Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage

        {
          for (int i=0;i<reward[1];i++)
            inv.addItem("TvT Event", reward[0], 1, playerInstance, playerInstance);
        }

        SystemMessage systemMessage = null;

        if (reward[1] > 1)
        {
          systemMessage = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
          systemMessage.addItemName(reward[0]);
          systemMessage.addNumber(reward[1]);
        }
        else
        {
          systemMessage = new SystemMessage(SystemMessageId.EARNED_ITEM);
          systemMessage.addItemName(reward[0]);
        }

        playerInstance.sendPacket(systemMessage);
      }
View Full Code Here

Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage

        int minlevel = SkillTreeTable.getInstance().getMinLevelForNewSkill(player);

        if (minlevel > 0)
            {
                // No more skills to learn, come back when you level.
            SystemMessage sm = new SystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN);
            sm.addNumber(minlevel);
            player.sendPacket(sm);
        }
            else
            {
                TextBuilder sb = new TextBuilder();
View Full Code Here

Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage

     if (!(activeChar instanceof L2PcInstance)) return; // currently not implemented for others
     L2PcInstance activePlayer = (L2PcInstance)activeChar;

     if (activePlayer.isInOlympiadMode())
     {
       activePlayer.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT));
       return;
        }

     // Checks summoner not in arenas, siege zones, jail
         if (activePlayer.isInsideZone(L2Character.ZONE_PVP))
         {
           activePlayer.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_SUMMON_IN_COMBAT));
          return;
        }

        // check for summoner not in raid areas
         FastList<L2Object> objects = L2World.getInstance().getVisibleObjects(activeChar, 5000);

        if (objects != null)
        {
          for (L2Object object : objects)
          {
            if (object instanceof L2RaidBossInstance)
            {
              activePlayer.sendPacket(new SystemMessage(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION));
                    return;
            }
          }
        }

    try
        {
      for (int index = 0; index < targets.length; index++)
      {
        if (!(targets[index] instanceof L2Character))
          continue;

        L2Character target = (L2Character)targets[index];

        if (activeChar == target) continue;

                if (target instanceof L2PcInstance)
                {
                    L2PcInstance targetChar = (L2PcInstance)target;

                    // CHECK TARGET CONDITIONS

                    //This message naturally doesn't bring up a box...
                    //$s1 wishes to summon you from $s2. Do you accept?
            //SystemMessage sm2 = new SystemMessage(SystemMessageId.S1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT);
                  //sm2.addString(activeChar.getName());
                  //String nearestTown = MapRegionTable.getInstance().getClosestTownName(activeChar);
                  //sm2.addString(nearestTown);
                  //targetChar.sendPacket(sm2);

                    // is in same party (not necessary any more)
                    // if (!(targetChar.getParty() != null && targetChar.getParty().getPartyMembers().contains(activeChar)))
                    //  continue;

                    if (targetChar.isAlikeDead())
                    {
                      SystemMessage sm = new SystemMessage(SystemMessageId.S1_IS_DEAD_AT_THE_MOMENT_AND_CANNOT_BE_SUMMONED);
                      sm.addString(targetChar.getName());
                      activeChar.sendPacket(sm);
                      continue;
                    }

                    if (targetChar.isInStoreMode())
                    {
                      SystemMessage sm = new SystemMessage(SystemMessageId.S1_CURRENTLY_TRADING_OR_OPERATING_PRIVATE_STORE_AND_CANNOT_BE_SUMMONED);
                      sm.addString(targetChar.getName());
                      activeChar.sendPacket(sm);
                      continue;
                    }

                    // Target cannot be in combat (or dead, but that's checked by TARGET_PARTY)
                    if (targetChar.isRooted() || targetChar.isInCombat())
                    {
                      SystemMessage sm = new SystemMessage(SystemMessageId.S1_IS_ENGAGED_IN_COMBAT_AND_CANNOT_BE_SUMMONED);
                      sm.addString(targetChar.getName());
                      activeChar.sendPacket(sm);
                      continue;
                    }

                    // Check for the the target's festival status
                    if (targetChar.isInOlympiadMode()) {
                        activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_SUMMON_PLAYERS_WHO_ARE_IN_OLYMPIAD));
                        continue;
                    }

                    // Check for the the target's festival status
                    if (targetChar.isFestivalParticipant()) {
                      activeChar.sendPacket(new SystemMessage(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING));
                        continue;
                    }

                    // Check for the target's jail status, arenas and siege zones
                    if (targetChar.isInsideZone(L2Character.ZONE_PVP))
                    {
                      activeChar.sendPacket(new SystemMessage(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING));
                        continue;
                    }

                    // Requires a Summoning Crystal
                    if (targetChar.getInventory().getItemByItemId(8615) == null)
View Full Code Here

Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage

      int count  = _items[i * 2 + 1];
      int price = 0;
      if (count > Integer.MAX_VALUE)
      {
        Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" tried to purchase over "+Integer.MAX_VALUE+" items at the same time.",  Config.DEFAULT_PUNISH);
        SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
        sendPacket(sm);
        return;
      }

      L2Item template = ItemTable.getInstance().getTemplate(L2Manor.getInstance().getRewardItem(
          itemId,manor.getCastle().getCrop(itemId,CastleManorManager.PERIOD_CURRENT).getReward()));
          weight += count * template.getWeight();

      if (!template.isStackable()) slots += count;
      else if (player.getInventory().getItemByItemId(itemId) == null) slots++;
    }

    if (!player.getInventory().validateWeight(weight))
    {
      sendPacket(new SystemMessage(SystemMessageId.WEIGHT_LIMIT_EXCEEDED));
      return;
    }


    if (!player.getInventory().validateCapacity(slots))
    {
      sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL));
      return;
    }

    // Proceed the purchase
    InventoryUpdate playerIU = new InventoryUpdate();
    _procureList =  manor.getCastle().getCropProcure(CastleManorManager.PERIOD_CURRENT);

    for (int i=0; i < _count; i++)
    {
      int itemId = _items[i * 2 + 0];
      int count  = _items[i * 2 + 1];
      if (count < 0) count = 0;

      int rewradItemId=L2Manor.getInstance().getRewardItem(
          itemId,manor.getCastle().getCrop(itemId, CastleManorManager.PERIOD_CURRENT).getReward());

      int rewradItemCount = 1; //L2Manor.getInstance().getRewardAmount(itemId, manor.getCastle().getCropReward(itemId));

      rewradItemCount = count / rewradItemCount;

      // Add item to Inventory and adjust update packet
      L2ItemInstance item = player.getInventory().addItem("Manor",rewradItemId,rewradItemCount,player,manor);
      L2ItemInstance iteme = player.getInventory().destroyItemByItemId("Manor",itemId,count,player,manor);

      if (item == null || iteme == null)
        continue;

      playerIU.addRemovedItem(iteme);
      if (item.getCount() > rewradItemCount) playerIU.addModifiedItem(item);
      else playerIU.addNewItem(item);

      // Send Char Buy Messages
      SystemMessage sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
      sm.addItemName(rewradItemId);
      sm.addNumber(rewradItemCount);
      player.sendPacket(sm);
      sm = null;

      //manor.getCastle().setCropAmount(itemId, manor.getCastle().getCrop(itemId, CastleManorManager.PERIOD_CURRENT).getAmount() - count);
    }
View Full Code Here

Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage

        int val = Integer.parseInt(st.nextToken());
        boolean sendMessage = activeChar.getFirstEffect(7029) != null;
        activeChar.stopSkillEffects(7029);
        if (val == 0 && sendMessage)
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.EFFECT_S1_DISAPPEARED).addSkillName(7029));
        }
        else if ((val >= 1) && (val <= 4))
        {
          L2Skill gmSpeedSkill = SkillTable.getInstance().getInfo(7029, val);
          activeChar.doCast(gmSpeedSkill);
        }
      }
      catch (Exception e)
      {
        activeChar.sendMessage("Use //gmspeed value (0=off...4=max).");
      }
      finally
      {
        activeChar.updateEffectIcons();
      }
    }
    else if (command.startsWith("admin_polyself"))
    {
      try
      {
        String id = st.nextToken();
        activeChar.getPoly().setPolyInfo("npc", id);
        activeChar.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), false);
        CharInfo info1 = new CharInfo(activeChar);
        activeChar.broadcastPacket(info1);
        UserInfo info2 = new UserInfo(activeChar);
        activeChar.sendPacket(info2);
      }
      catch(Exception e)
      {
      }
    }
    else if (command.startsWith("admin_unpolyself"))
    {
      activeChar.getPoly().setPolyInfo(null, "1");
      activeChar.decayMe();
      activeChar.spawnMe(activeChar.getX(),activeChar.getY(),activeChar.getZ());
      CharInfo info1 = new CharInfo(activeChar);
      activeChar.broadcastPacket(info1);
      UserInfo info2 = new UserInfo(activeChar);
      activeChar.sendPacket(info2);
    }
    else if (command.startsWith("admin_changename"))
    {
      try
      {
        String name = st.nextToken();
        String oldName = "null";
        try
        {
          L2Object target = activeChar.getTarget();
          L2Character player = null;
          if (target instanceof L2Character)
          {
            player = (L2Character)target;
            oldName = player.getName();
          }
          else if (target == null)
          {
            player = activeChar;
            oldName = activeChar.getName();
          }
          if (player instanceof L2PcInstance)
            L2World.getInstance().removeFromAllPlayers((L2PcInstance)player);
          player.setName(name);
          if (player instanceof L2PcInstance)
            L2World.getInstance().addVisibleObject(player, null, null);
          if (player instanceof L2PcInstance)
          {
            CharInfo info1 = new CharInfo((L2PcInstance)player);
            player.broadcastPacket(info1);
            UserInfo info2 = new UserInfo((L2PcInstance)player);
            player.sendPacket(info2);
          }
          else if(player instanceof L2NpcInstance)
          {
            NpcInfo info1 = new NpcInfo((L2NpcInstance)player, null);
            player.broadcastPacket(info1);
          }
          activeChar.sendMessage("Changed name from "+ oldName +" to "+ name +".");
        }
        catch (Exception e){}
      }
      catch (StringIndexOutOfBoundsException e){}
    }
    else if (command.equals("admin_clear_teams"))
    {
      try
      {
        for (L2PcInstance player : activeChar.getKnownList().getKnownPlayers().values())
        {
          player.setTeam(0);
          player.broadcastUserInfo();
        }
      }
      catch (Exception e){}
    }
    else if (command.startsWith("admin_setteam_close"))
    {
      try
      {
        String val = st.nextToken();
        int teamVal = Integer.parseInt(val);
        for (L2PcInstance player : activeChar.getKnownList().getKnownPlayers().values())
        {
          if (activeChar.isInsideRadius(player, 400, false, true))
          {
            player.setTeam(0);
            if (teamVal != 0)
            {
              SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
              sm.addString("You have joined team " + teamVal);
              player.sendPacket(sm);
            }
            player.broadcastUserInfo();
          }
        }
      }
      catch (Exception e)
      {
      }
    }
    else if (command.startsWith("admin_setteam"))
    {
      String val = command.substring(14);
      int teamVal = Integer.parseInt(val);
      L2Object target = activeChar.getTarget();
      L2PcInstance player = null;
      if (target instanceof L2PcInstance)
        player = (L2PcInstance)target;
      else
        return false;
      player.setTeam(teamVal);
      if (teamVal != 0)
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
        sm.addString("You have joined team " + teamVal);
        player.sendPacket(sm);
      }
      player.broadcastUserInfo();
    }
    else if (command.startsWith("admin_social"))
    {
      try
      {
        String target=null;
        L2Object obj = activeChar.getTarget();
        if (st.countTokens() == 2)
        {
          int social = Integer.parseInt(st.nextToken());
          target = st.nextToken();
          if (target != null)
          {
            L2PcInstance player = L2World.getInstance().getPlayer(target);
            if (player != null)
            {
              if (performSocial(social,player,activeChar))
                activeChar.sendMessage(player.getName()+" was affected by your request.");
            }
            else
            {
              try
              {
                int radius = Integer.parseInt(target);
                for (L2Object object : activeChar.getKnownList().getKnownObjects().values())
                  if (activeChar.isInsideRadius(object, radius, false, false))
                    performSocial(social,object,activeChar);
                activeChar.sendMessage(radius+ " units radius affected by your request.");
              }
              catch (NumberFormatException nbe)
              {
                activeChar.sendMessage("Incorrect parameter");
              }
            }
          }
        }
        else if (st.countTokens() == 1)
        {
          int social = Integer.parseInt(st.nextToken());
          if (obj == null)
            obj = activeChar;
         
          if (performSocial(social,obj,activeChar))
            activeChar.sendMessage(obj.getName()+ " was affected by your request.");
          else
            activeChar.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED));
        }
        else if (!command.contains("menu"))
          activeChar.sendMessage("Usage: //social <social_id> [player_name|radius]");
      }
      catch (Exception e)
      {
        if (Config.DEBUG)
          e.printStackTrace();
      }
    }
    else if (command.startsWith("admin_abnormal"))
    {
      try
      {
        String target=null;
        L2Object obj = activeChar.getTarget();
        if (st.countTokens() == 2)
        {
          String parm = st.nextToken();
          int abnormal = Integer.decode("0x"+parm);
          target = st.nextToken();
          if (target != null)
          {
            L2PcInstance player = L2World.getInstance().getPlayer(target);
            if (player != null)
            {
              if (performAbnormal(abnormal,player))
                activeChar.sendMessage(player.getName()+"'s abnormal status was affected by your request.");
              else
                activeChar.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED));
            }
            else
            {
              try
              {
                int radius = Integer.parseInt(target);
                for (L2Object object : activeChar.getKnownList().getKnownObjects().values())
                  if (activeChar.isInsideRadius(object, radius, false, false))
                    performAbnormal(abnormal,object);
                activeChar.sendMessage(radius+ " units radius affected by your request.");
              }
              catch (NumberFormatException nbe)
              {
                activeChar.sendMessage("Usage: //abnormal <hex_abnormal_mask> [player|radius]");
              }
            }
          }
        }
        else if (st.countTokens() == 1)
        {
          int abnormal = Integer.decode("0x"+st.nextToken());
          if (obj == null)
            obj = activeChar;
          if (performAbnormal(abnormal,obj))
            activeChar.sendMessage(obj.getName()+ "'s abnormal status was affected by your request.");
          else
            activeChar.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED));
        }
        else if (!command.contains("menu"))
          activeChar.sendMessage("Usage: //abnormal <abnormal_mask> [player_name|radius]");
      }
      catch (Exception e)
      {
        if (Config.DEBUG)
          e.printStackTrace();
      }
    }
    else if (command.startsWith("admin_effect"))
    {
      try
      {
        L2Object obj = activeChar.getTarget();
        int level = 1,hittime = 1;
        int skill = Integer.parseInt(st.nextToken());
        if (st.hasMoreTokens())
          level = Integer.parseInt(st.nextToken());
        if (st.hasMoreTokens())
          hittime = Integer.parseInt(st.nextToken());
        if (obj == null)
          obj = activeChar;
        if (!(obj instanceof L2Character))
          activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
        else
        {
          L2Character target = (L2Character)obj;
          target.broadcastPacket(new MagicSkillUser(target,activeChar,skill,level,hittime,0));
          activeChar.sendMessage(obj.getName()+" performs MSU "+skill+"/"+level+" by your request.");
View Full Code Here

Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage

    {
      if (target instanceof L2Character)
      {
        if ((target instanceof L2Summon) || (target instanceof L2ChestInstance))
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED));
          return false;
        }
        if((target instanceof L2NpcInstance) && (action < 1 || action > 3))
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED));
          return false;
        }
        if((target instanceof L2PcInstance) && (action < 2 || action > 16))
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED));
          return false;
        }
        L2Character character = (L2Character)target;
        character.broadcastPacket(new SocialAction(target.getObjectId(),action));
      }
View Full Code Here

Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage

        {
          if (target.reflectSkill(skill))
          {
            activeChar.stopSkillEffects(skill.getId());
            skill.getEffects(null, activeChar);
            SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
            sm.addSkillName(skill.getId());
            activeChar.sendPacket(sm);
          }
        }
              L2ItemInstance weapon = activeChar.getActiveWeaponInstance();
              boolean soul = (weapon != null && weapon.getChargedSoulshot() == L2ItemInstance.CHARGED_SOULSHOT && weapon.getItemType() == L2WeaponType.DAGGER);
              boolean shld = Formulas.getInstance().calcShldUse(activeChar, target);

              // Crit rate base crit rate for skill, modified with STR bonus
              boolean crit = false;
        if(Formulas.getInstance().calcCrit(skill.getBaseCritRate()*10*Formulas.getInstance().getSTRBonus(activeChar)))
          crit = true;
        double damage = (int)Formulas.getInstance().calcBlowDamage(activeChar, target, skill, shld, soul);
        if (crit)
        {
          damage *= 2;
          // Vicious Stance is special after C5, and only for BLOW skills
          // Adds directly to damage
          L2Effect vicious = activeChar.getFirstEffect(312);
          if(vicious != null && damage > 1)
          {
            for(Func func: vicious.getStatFuncs())
            {
              Env env = new Env();
              env.player = activeChar;
              env.target = target;
              env.skill = skill;
              env.value = damage;
              func.calc(env);
              damage = (int)env.value;
            }
          }
        }

        if (soul && weapon != null)
                weapon.setChargedSoulshot(L2ItemInstance.CHARGED_NONE);
        if(skill.getDmgDirectlyToHP() && target instanceof L2PcInstance)
            {
          L2PcInstance player = (L2PcInstance)target;
              if (!player.isInvul())
          {
                   if (damage >= player.getCurrentHp())
                   {
                     if(player.isInDuel()) player.setCurrentHp(1);
                     else
                     {
                       player.setCurrentHp(0);
                       if (player.isInOlympiadMode())
                       {
                         player.abortAttack();
                         player.abortCast();
                         player.getStatus().stopHpMpRegeneration();
                       }
                       else
                         player.doDie(activeChar);
                     }
                   }
                   else
                    player.setCurrentHp(player.getCurrentHp() - damage);
          }
              SystemMessage smsg = new SystemMessage(SystemMessageId.S1_GAVE_YOU_S2_DMG);
              smsg.addString(activeChar.getName());
              smsg.addNumber((int)damage);
              player.sendPacket(smsg);
            }
            else
              target.reduceCurrentHp(damage, activeChar);
        if(activeChar instanceof L2PcInstance)
          activeChar.sendPacket(new SystemMessage(SystemMessageId.CRITICAL_HIT));
        SystemMessage sm = new SystemMessage(SystemMessageId.YOU_DID_S1_DMG);
              sm.addNumber((int)damage);
              activeChar.sendPacket(sm);
      }
      //Possibility of a lethal strike
      if(!target.isRaid()
          && !(target instanceof L2DoorInstance)
          && !(target instanceof L2NpcInstance && ((L2NpcInstance)target).getNpcId() == 35062))
      {
        int chance = Rnd.get(100);
        //2nd lethal effect activate (cp,hp to 1 or if target is npc then hp to 1)
        if(skill.getLethalChance2() > 0 && chance < Formulas.getInstance().calcLethal(activeChar, target, skill.getLethalChance2()))
              {
                if (target instanceof L2NpcInstance)
                        target.reduceCurrentHp(target.getCurrentHp()-1, activeChar);
              else if (target instanceof L2PcInstance) // If is a active player set his HP and CP to 1
              {
                L2PcInstance player = (L2PcInstance)target;
                if (!player.isInvul()){
                  player.setCurrentHp(1);
                player.setCurrentCp(1);
                }
              }
                activeChar.sendPacket(new SystemMessage(SystemMessageId.LETHAL_STRIKE));
              }
              else if(skill.getLethalChance1() > 0 && chance < Formulas.getInstance().calcLethal(activeChar, target, skill.getLethalChance1())){
                if (target instanceof L2PcInstance)
                  {
                  L2PcInstance player = (L2PcInstance)target;
                if (!player.isInvul())
                  player.setCurrentCp(1); // Set CP to 1
                  }
                else if (target instanceof L2NpcInstance) // If is a monster remove first damage and after 50% of current hp
                  target.reduceCurrentHp(target.getCurrentHp()/2, activeChar);
                activeChar.sendPacket(new SystemMessage(SystemMessageId.LETHAL_STRIKE));
        }
      }
            L2Effect effect = activeChar.getFirstEffect(skill.getId());
            //Self Effect
            if (effect != null && effect.isSelfEffect())
View Full Code Here

Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage

                  if (attacker instanceof L2PcInstance)
                  {
                    L2PcInstance player = (L2PcInstance)attacker;
                    if (isOverhit() && attacker == getOverhitAttacker())
                    {
                      player.sendPacket(new SystemMessage(SystemMessageId.OVER_HIT));
                      exp += calculateOverhitExp(exp);
                    }
                  }

                  // Distribute the Exp and SP between the L2PcInstance and its L2Summon
                  if (!attacker.isDead())
                    attacker.addExpAndSp(Math.round(attacker.calcStat(Stats.EXPSP_RATE, exp, null, null)),
                        (int)attacker.calcStat(Stats.EXPSP_RATE, sp, null, null));
                }
              }
              else
              {
                //share with party members
                partyDmg = 0;
                partyMul = 1.f;
                partyLvl = 0;

                // Get all L2Character that can be rewarded in the party
                List<L2PlayableInstance> rewardedMembers = new FastList<L2PlayableInstance>();

                // Go through all L2PcInstance in the party
                List<L2PcInstance> groupMembers;
                if (attackerParty.isInCommandChannel())
                  groupMembers = attackerParty.getCommandChannel().getMembers();
                else
                  groupMembers = attackerParty.getPartyMembers();

                for (L2PcInstance pl : groupMembers)
                {
                  if (pl == null || pl.isDead()) continue;

                  // Get the RewardInfo of this L2PcInstance from L2Attackable rewards
                  reward2 = rewards.get(pl);

                  // If the L2PcInstance is in the L2Attackable rewards add its damages to party damages
                  if (reward2 != null)
                  {
                    if (Util.checkIfInRange(Config.ALT_PARTY_RANGE, this, pl, true))
                    {
                      partyDmg += reward2._dmg; // Add L2PcInstance damages to party damages
                      rewardedMembers.add(pl);
                      if (pl.getLevel() > partyLvl)
                      {
                        if(attackerParty.isInCommandChannel())
                          partyLvl = attackerParty.getCommandChannel().getLevel();
                        else
                          partyLvl = pl.getLevel();
                      }
                    }
                    rewards.remove(pl); // Remove the L2PcInstance from the L2Attackable rewards
                  }
                  else
                  {
                    // Add L2PcInstance of the party (that have attacked or not) to members that can be rewarded
                    // and in range of the monster.
                    if (Util.checkIfInRange(Config.ALT_PARTY_RANGE, this, pl, true))
                    {
                      rewardedMembers.add(pl);
                      if (pl.getLevel() > partyLvl)
                      {
                        if(attackerParty.isInCommandChannel())
                          partyLvl = attackerParty.getCommandChannel().getLevel();
                        else
                          partyLvl = pl.getLevel();
                      }
                    }
                  }
                  L2PlayableInstance summon = pl.getPet();
                  if (summon != null && summon instanceof L2PetInstance)
                  {
                    reward2 = rewards.get(summon);
                    if (reward2 != null) // Pets are only added if they have done damage
                    {
                      if (Util.checkIfInRange(Config.ALT_PARTY_RANGE, this, summon, true))
                      {
                        partyDmg += reward2._dmg; // Add summon damages to party damages
                        rewardedMembers.add(summon);
                        if (summon.getLevel() > partyLvl)
                          partyLvl = summon.getLevel();
                      }
                      rewards.remove(summon); // Remove the summon from the L2Attackable rewards
                    }
                  }
                }

                // If the party didn't killed this L2Attackable alone
                if (partyDmg < getMaxHp()) partyMul = ((float)partyDmg / (float)getMaxHp());

                // Avoid "over damage"
                if (partyDmg > getMaxHp()) partyDmg = getMaxHp();

                // Calculate the level difference between Party and L2Attackable
                levelDiff = partyLvl - getLevel();

                // Calculate Exp and SP rewards
                tmp = calculateExpAndSp(levelDiff, partyDmg);
                exp = tmp[0];
                sp = tmp[1];

                if (Config.L2JMOD_CHAMPION_ENABLE && isChampion())
                {
                  exp *= Config.L2JMOD_CHAMPION_REWARDS;
                  sp *= Config.L2JMOD_CHAMPION_REWARDS;
                }

                exp *= partyMul;
                sp *= partyMul;

                // Check for an over-hit enabled strike
                // (When in party, the over-hit exp bonus is given to the whole party and splitted proportionally through the party members)
                if (attacker instanceof L2PcInstance)
                {
                  L2PcInstance player = (L2PcInstance)attacker;
                  if (isOverhit() && attacker == getOverhitAttacker())
                  {
                    player.sendPacket(new SystemMessage(SystemMessageId.OVER_HIT));
                    exp += calculateOverhitExp(exp);
                  }
                }

                // Distribute Experience and SP rewards to L2PcInstance Party members in the known area of the last attacker
View Full Code Here

Examples of net.sf.l2j.gameserver.serverpackets.SystemMessage

           else DropItem(player, item); // drop the item on the ground

           // Broadcast message if RaidBoss was defeated
                 if(this instanceof L2RaidBossInstance)
                 {
                     SystemMessage sm;
                     sm = new SystemMessage(SystemMessageId.S1_DIED_DROPPED_S3_S2);
                     sm.addString(getName());
                     sm.addItemName(item.getItemId());
                     sm.addNumber(item.getCount());
                     broadcastPacket(sm);
                 }
           }
         }
       }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.