Package net.sf.l2j.gameserver.serverpackets

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


          } catch(NoSuchElementException e) {}
          if (amount > 0 && (long)getCastle().getTreasury() + amount < Integer.MAX_VALUE) {
            if (player.reduceAdena("Castle", amount, this, true)) {
              getCastle().addToTreasuryNoTax(amount);
            } else {
              sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
            }
          }
        } else if (val.equalsIgnoreCase("withdraw")) {
          try {
            amount = Integer.parseInt(st.nextToken());
          } catch(NoSuchElementException e) {}
          if (amount > 0) {
            if (getCastle().getTreasury() < amount) {
              filename = "data/html/chamberlain/chamberlain-vault-no.htm";
            } else {
              if (getCastle().addToTreasuryNoTax((-1)*amount))
                player.addAdena("Castle", amount, this, true);

            }
          }
        }

        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        html.setFile(filename);
        html.replace("%objectId%", String.valueOf(getObjectId()));
        html.replace("%npcname%", getName());
        html.replace("%tax_income%", Util.formatAdena(getCastle().getTreasury()));
        html.replace("%withdraw_amount%", Util.formatAdena(amount));
        player.sendPacket(html);

        return;
      }
          else if(actualCommand.equalsIgnoreCase("manor")) {
        String filename = "";
        if (CastleManorManager.getInstance().isDisabled()) {
          filename = "data/html/npcdefault.htm";
        } else {
          int cmd = Integer.parseInt(val);
                switch(cmd) {
                  case 0:
                    filename = "data/html/chamberlain/manor/manor.htm";
              break;
            // TODO: correct in html's to 1
                  case 4:
                    filename = "data/html/chamberlain/manor/manor_help00"+st.nextToken()+".htm";
                    break;
                    default:
                      filename = "data/html/chamberlain/chamberlain-no.htm";
              break;
                }
        }

        if (filename.length()!=0) {
                NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
          html.setFile(filename);
          html.replace("%objectId%", String.valueOf(getObjectId()));
          html.replace("%npcname%", getName());
          player.sendPacket(html);
        }
        return;
      }
      else if (command.startsWith("manor_menu_select"))
      {// input string format:
       // manor_menu_select?ask=X&state=Y&time=X
        if (CastleManorManager.getInstance().isUnderMaintenance())
        {
          player.sendPacket(new ActionFailed());
          player.sendPacket(new SystemMessage(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE));
          return;
        }

        String params = command.substring(command.indexOf("?")+1);
        StringTokenizer str = new StringTokenizer(params, "&");
        int ask   = Integer.parseInt(str.nextToken().split("=")[1]);
        int state = Integer.parseInt(str.nextToken().split("=")[1]);
        int time  = Integer.parseInt(str.nextToken().split("=")[1]);

        int castleId;
        if (state == -1) // info for current manor
          castleId = getCastle().getCastleId();
        else        // info for requested manor
          castleId = state;

        switch (ask) { // Main action
        case 3: // Current seeds (Manor info)
          if (time == 1 && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved())
            player.sendPacket(new ExShowSeedInfo(castleId, null));
          else
            player.sendPacket(new ExShowSeedInfo(castleId, CastleManager.getInstance().getCastleById(castleId).getSeedProduction(time)));
          break;
        case 4: // Current crops (Manor info)
          if (time == 1 && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved())
            player.sendPacket(new ExShowCropInfo(castleId, null));
          else
            player.sendPacket(new ExShowCropInfo(castleId, CastleManager.getInstance().getCastleById(castleId).getCropProcure(time)));
          break;
        case 5: // Basic info (Manor info)
          player.sendPacket(new ExShowManorDefaultInfo());
          break;
        case 7: // Edit seed setup
          if (getCastle().isNextPeriodApproved()) {
            player.sendPacket(new SystemMessage(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM));
          } else {
            player.sendPacket(new ExShowSeedSetting(getCastle().getCastleId()));
          }
          break;
        case 8: // Edit crop setup
          if (getCastle().isNextPeriodApproved()) {
            player.sendPacket(new SystemMessage(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM));
          } else {
            player.sendPacket(new ExShowCropSetting(getCastle().getCastleId()));
          }
          break;
        }
View Full Code Here


                {
                  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);
          }
                  else
                  {
                    // activate attacked effects, if any
                        target.stopSkillEffects(skill.getId());
                        if (f.calcSkillSuccess(activeChar, target, skill, false, false, false))
                        {
                            skill.getEffects(activeChar, target);

                            SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
                            sm.addSkillName(skill.getId());
                            target.sendPacket(sm);
                        }
                        else
                        {
                            SystemMessage sm = new SystemMessage(SystemMessageId.S1_WAS_UNAFFECTED_BY_S2);
                            sm.addString(target.getName());
                            sm.addSkillName(skill.getDisplayId());
                            activeChar.sendPacket(sm);
                        }
                  }
                }

                 // Success of lethal effect
                int chance = Rnd.get(100);
                if(!target.isRaid()
                    && chance < skill.getLethalChance1()
                    && !(target instanceof L2DoorInstance)
              && !(target instanceof L2NpcInstance && ((L2NpcInstance)target).getNpcId() == 35062))
          {
                  // 1st lethal effect activate (cp to 1 or if target is npc then hp to 50%)
                  if(skill.getLethalChance2() > 0 && chance >= skill.getLethalChance2())
                  {
                     if (target instanceof L2PcInstance)
                    {
                       L2PcInstance player = (L2PcInstance)target;
                    if (!player.isInvul())
                    {
                      player.setCurrentCp(1); // Set CP to 1
                               player.reduceCurrentHp(damage, activeChar);
                    }
                   }
                    else if (target instanceof L2MonsterInstance) // If is a monster remove first damage and after 50% of current hp
                    {
                     target.reduceCurrentHp(damage, activeChar);
                     target.reduceCurrentHp(target.getCurrentHp()/2, activeChar);
                    }
                  }
                  else //2nd lethal effect activate (cp,hp to 1 or if target is npc then hp to 1)
                  {
                         // If is a monster damage is (CurrentHp - 1) so HP = 1
                        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);
                    }
                  }
                  }
                    // Lethal Strike was succefful!
                    activeChar.sendPacket(new SystemMessage(SystemMessageId.LETHAL_STRIKE_SUCCESSFUL));
                }
                else
                {
                  // Make damage directly to HP
                  if(skill.getDmgDirectlyToHP())
                  {
                if(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(damage);
                      player.sendPacket(smsg);

                }
                else
                  target.reduceCurrentHp(damage, activeChar);
                  }
                  else
                  {
                    target.reduceCurrentHp(damage, activeChar);
                  }
                }
            }
            else // No - damage
            {
              activeChar.sendPacket(new SystemMessage(SystemMessageId.ATTACK_FAILED));
            }

            if (skill.getId() == 345 || skill.getId() == 346) // Sonic Rage or Raging Force
            {
                EffectCharge effect = (EffectCharge)activeChar.getFirstEffect(L2Effect.EffectType.CHARGE);
                if (effect != null)
                {
                    int effectcharge = effect.getLevel();
                    if (effectcharge < 7)
                    {
                        effectcharge++;
                        effect.addNumCharges(1);
                        if (activeChar instanceof L2PcInstance)
                        {
                          activeChar.sendPacket(new EtcStatusUpdate((L2PcInstance)activeChar));
                          SystemMessage sm = new SystemMessage(SystemMessageId.FORCE_INCREASED_TO_S1);
                          sm.addNumber(effectcharge);
                          activeChar.sendPacket(sm);
                        }
                    }
                    else
                    {
                        SystemMessage sm = new SystemMessage(SystemMessageId.FORCE_MAXLEVEL_REACHED);
                        activeChar.sendPacket(sm);
                    }
                }
                else
                {
View Full Code Here

        && target.getParty().isInCommandChannel()
        && activeChar.getParty().getCommandChannel().getChannelLeader().equals(activeChar))
    {
      target.getParty().getCommandChannel().removeParty(target.getParty());

      SystemMessage sm = SystemMessage.sendString("Your party was dismissed from the CommandChannel.");
      target.getParty().broadcastToPartyMembers(sm);

      sm = SystemMessage.sendString(target.getParty().getPartyMembers().get(0).getName()
          + "'s party was dismissed from the CommandChannel.");
    }
View Full Code Here

            int val = Integer.parseInt(command.substring(15));
            showChatWindow(player, val, null, true);
        }
        else if (command.startsWith("SevenSigns"))
        {
            SystemMessage sm;
            InventoryUpdate iu;
            StatusUpdate su;
            String path;
            int cabal = SevenSigns.CABAL_NULL;
            int stoneType = 0;
            L2ItemInstance ancientAdena = player.getInventory().getItemByItemId(
                                                                                SevenSigns.ANCIENT_ADENA_ID);
            int ancientAdenaAmount = ancientAdena == null ? 0 : ancientAdena.getCount();
            int val = Integer.parseInt(command.substring(11, 12).trim());

            if (command.length() > 12) // SevenSigns x[x] x [x..x]
                val = Integer.parseInt(command.substring(11, 13).trim());

            if (command.length() > 13)
            {
                try
                {
                    cabal = Integer.parseInt(command.substring(14, 15).trim());
                }
                catch (Exception e)
                {
                    try
                    {
                        cabal = Integer.parseInt(command.substring(13, 14).trim());
                    }
                    catch (Exception e2)
                    {
                      try
                      {
                        StringTokenizer st = new StringTokenizer(command.trim());
                        st.nextToken();
                        cabal = Integer.parseInt(st.nextToken());
                      }
                      catch (Exception e3)
                      {
                        _log.warning("Failed to retrieve cabal from bypass command. NpcId: " + getNpcId() + "; Command: " + command);
                      }
                    }
                }
            }

            switch (val)
            {
                case 2: // Purchase Record of the Seven Signs
                    if (!player.getInventory().validateCapacity(1))
                    {
                        player.sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL));
                        break;
                    }

                    L2ItemInstance adenaItem = player.getInventory().getAdenaInstance();
                    if (!player.reduceAdena("SevenSigns", SevenSigns.RECORD_SEVEN_SIGNS_COST, this, true))
                    {
                        player.sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
                        break;
                    }
                    L2ItemInstance recordSevenSigns = player.getInventory().addItem(
                                                                                    "SevenSigns",
                                                                                    SevenSigns.RECORD_SEVEN_SIGNS_ID,
                                                                                    1, player, this);

                    // Send inventory update packet
                    iu = new InventoryUpdate();
                    iu.addNewItem(recordSevenSigns);
                    iu.addItem(adenaItem);
                    sendPacket(iu);

                    // Update current load as well
                    su = new StatusUpdate(player.getObjectId());
                    su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
                    sendPacket(su);

                    sm = new SystemMessage(SystemMessageId.EARNED_ITEM);
                    sm.addItemName(SevenSigns.RECORD_SEVEN_SIGNS_ID);
                    player.sendPacket(sm);
                    break;
                case 3: // Join Cabal Intro 1
                case 8: // Festival of Darkness Intro - SevenSigns x [0]1
                case 10: // Teleport Locations List
                    showChatWindow(player, val, SevenSigns.getCabalShortName(cabal), false);
                    break;
                case 4: // Join a Cabal - SevenSigns 4 [0]1 x
                    int newSeal = Integer.parseInt(command.substring(15));
                    int oldCabal = SevenSigns.getInstance().getPlayerCabal(player);

                    if (oldCabal != SevenSigns.CABAL_NULL)
                    {
                        player.sendMessage("You are already a member of the "
                            + SevenSigns.getCabalName(cabal) + ".");
                        return;
                    }

                    if (player.getClassId().level() == 0)
                    {
                        player.sendMessage("You must have already completed your first class transfer.");
                        break;
                    }
                    else if (player.getClassId().level() >= 2)
                    {
                        if (Config.ALT_GAME_REQUIRE_CASTLE_DAWN)
                        {
                            if (getPlayerAllyHasCastle(player))
                            {
                                if (cabal == SevenSigns.CABAL_DUSK)
                                {
                                    player.sendMessage("You must not be a member of a castle-owning clan to join the Revolutionaries of Dusk.");
                                    return;
                                }
                            }
                            /*if (!getPlayerAllyHasCastle(player))
                            {
                              if (cabal == SevenSigns.CABAL_DAWN)
                              {
                                player.sendMessage("You must be a member of a castle-owning clan to join the Lords Of Dawn.");
                                return;
                              }
                            }
*/
                            else
                            {
                                /*
                                 * If the player is trying to join the Lords of Dawn, check if they are
                                 * carrying a Lord's certificate.
                                 *
                                 * If not then try to take the required amount of adena instead.
                                 */
                                if (cabal == SevenSigns.CABAL_DAWN)
                                {
                                    boolean allowJoinDawn = false;

                                    if (player.destroyItemByItemId(
                                                                   "SevenSigns",
                                                                   SevenSigns.CERTIFICATE_OF_APPROVAL_ID,
                                                                   1, this, false))
                                    {
                                        sm = new SystemMessage(SystemMessageId.DISSAPEARED_ITEM);
                                        sm.addNumber(1);
                                        sm.addItemName(SevenSigns.CERTIFICATE_OF_APPROVAL_ID);
                                        player.sendPacket(sm);
                                        allowJoinDawn = true;
                                    }
                                    else if (player.reduceAdena("SevenSigns",
                                                                SevenSigns.ADENA_JOIN_DAWN_COST, this,
                                                                false))
                                    {
                                        sm = new SystemMessage(SystemMessageId.DISSAPEARED_ADENA);
                                        sm.addNumber(SevenSigns.ADENA_JOIN_DAWN_COST);
                                        player.sendPacket(sm);
                                        allowJoinDawn = true;
                                    }

                                    if (!allowJoinDawn)
                                    {
                                        player.sendMessage("You must be a member of a castle-owning clan, have a Certificate of Lord's Approval, or pay 50000 adena to join the Lords of Dawn.");
                                        return;
                                    }
                                }
                            }
                        }
                    }

                    SevenSigns.getInstance().setPlayerInfo(player, cabal, newSeal);

                    if (cabal == SevenSigns.CABAL_DAWN) player.sendPacket(new SystemMessage(
                                                                                            SystemMessageId.SEVENSIGNS_PARTECIPATION_DAWN)); // Joined Dawn
                    else player.sendPacket(new SystemMessage(SystemMessageId.SEVENSIGNS_PARTECIPATION_DUSK)); // Joined Dusk

                    // Show a confirmation message to the user, indicating which seal they chose.
                    switch (newSeal)
                    {
                        case SevenSigns.SEAL_AVARICE:
                            player.sendPacket(new SystemMessage(SystemMessageId.FIGHT_FOR_AVARICE));
                            break;
                        case SevenSigns.SEAL_GNOSIS:
                            player.sendPacket(new SystemMessage(SystemMessageId.FIGHT_FOR_GNOSIS));
                            break;
                        case SevenSigns.SEAL_STRIFE:
                            player.sendPacket(new SystemMessage(SystemMessageId.FIGHT_FOR_STRIFE));
                            break;
                    }

                    showChatWindow(player, 4, SevenSigns.getCabalShortName(cabal), false);
                    break;
                case 6: // Contribute Seal Stones - SevenSigns 6 x
                    stoneType = Integer.parseInt(command.substring(13));
                    L2ItemInstance redStones = player.getInventory().getItemByItemId(
                                                                                     SevenSigns.SEAL_STONE_RED_ID);
                    int redStoneCount = redStones == null ? 0 : redStones.getCount();
                    L2ItemInstance greenStones = player.getInventory().getItemByItemId(
                                                                                       SevenSigns.SEAL_STONE_GREEN_ID);
                    int greenStoneCount = greenStones == null ? 0 : greenStones.getCount();
                    L2ItemInstance blueStones = player.getInventory().getItemByItemId(
                                                                                      SevenSigns.SEAL_STONE_BLUE_ID);
                    int blueStoneCount = blueStones == null ? 0 : blueStones.getCount();
                    int contribScore = SevenSigns.getInstance().getPlayerContribScore(player);
                    boolean stonesFound = false;

                    if (contribScore == Config.ALT_MAXIMUM_PLAYER_CONTRIB)
                    {
                        player.sendPacket(new SystemMessage(SystemMessageId.CONTRIB_SCORE_EXCEEDED));
                        break;
                  }
          int redContribCount = 0;
          int greenContribCount = 0;
          int blueContribCount = 0;
 
          switch (stoneType)
          {
              case 1:
                  blueContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - contribScore)
                      / SevenSigns.BLUE_CONTRIB_POINTS;
                  if (blueContribCount > blueStoneCount)
                      blueContribCount = blueStoneCount;
                  break;
              case 2:
                  greenContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - contribScore)
                      / SevenSigns.GREEN_CONTRIB_POINTS;
                  if (greenContribCount > greenStoneCount)
                      greenContribCount = greenStoneCount;
                  break;
              case 3:
                  redContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - contribScore)
                      / SevenSigns.RED_CONTRIB_POINTS;
                  if (redContribCount > redStoneCount) redContribCount = redStoneCount;
                  break;
              case 4:
                  int tempContribScore = contribScore;
                  redContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - tempContribScore)
                      / SevenSigns.RED_CONTRIB_POINTS;
                  if (redContribCount > redStoneCount) redContribCount = redStoneCount;
                  tempContribScore += redContribCount * SevenSigns.RED_CONTRIB_POINTS;
                  greenContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - tempContribScore)
                      / SevenSigns.GREEN_CONTRIB_POINTS;
                  if (greenContribCount > greenStoneCount)
                      greenContribCount = greenStoneCount;
                  tempContribScore += greenContribCount * SevenSigns.GREEN_CONTRIB_POINTS;
                  blueContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - tempContribScore)
                      / SevenSigns.BLUE_CONTRIB_POINTS;
                  if (blueContribCount > blueStoneCount)
                      blueContribCount = blueStoneCount;
                  break;
          }
          if (redContribCount > 0)
          {
              if (player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_RED_ID,
                                             redContribCount, this, false))
                  stonesFound = true;
          }
          if (greenContribCount > 0)
          {
              if (player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_GREEN_ID,
                                             greenContribCount, this, false))
                  stonesFound = true;
          }
          if (blueContribCount > 0)
          {
              if (player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_BLUE_ID,
                                             blueContribCount, this, false))
                  stonesFound = true;
          }
 
          if (!stonesFound)
          {
              player.sendMessage("You do not have any seal stones of that type.");
              break;
          }
         
          contribScore = SevenSigns.getInstance().addPlayerStoneContrib(
                                                                             player,
                                                                             blueContribCount,
                                                                             greenContribCount,
                                                                             redContribCount);
 
          sm = new SystemMessage(SystemMessageId.CONTRIB_SCORE_INCREASED);
          sm.addNumber(contribScore);
          player.sendPacket(sm);
 
          showChatWindow(player, 6, null, false);
                    break;
                case 7: // Exchange Ancient Adena for Adena - SevenSigns 7 xxxxxxx
                    int ancientAdenaConvert = 0;

                    try
                    {
                        ancientAdenaConvert = Integer.parseInt(command.substring(13).trim());
                    }
                    catch (NumberFormatException e)
                    {
                        player.sendMessage("You must enter an integer amount.");
                        break;
                    }
                    catch (StringIndexOutOfBoundsException e)
                    {
                        player.sendMessage("You must enter an amount.");
                        break;
                    }

                    if (ancientAdenaAmount < ancientAdenaConvert || ancientAdenaConvert < 1)
                    {
                        player.sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
                        break;
                    }

                    player.reduceAncientAdena("SevenSigns", ancientAdenaConvert, this, true);
                    player.addAdena("SevenSigns", ancientAdenaConvert, this, true);
View Full Code Here

  protected void runImpl()
  {
    if (getClient().getActiveChar() == null)
        return;
    getClient().getActiveChar().deleteMacro(_id);
      SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
      sm.addString("Delete macro id="+_id);
    sendPacket(sm);
    sm = null;
  }
View Full Code Here

    L2PcInstance activeChar = (L2PcInstance) playable;
    L2Object target = activeChar.getTarget();

    if (!(target instanceof L2DoorInstance))
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      activeChar.sendPacket(new ActionFailed());
      return;
    }
    L2DoorInstance door = (L2DoorInstance)target;
View Full Code Here

        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

        {
          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

        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

     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

TOP

Related Classes of net.sf.l2j.gameserver.serverpackets.SystemMessage

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.