예제 #1
0
 private static void showPage3(L2PcInstance activeChar, String format, String command) {
   NpcHtmlMessage adminReply = new NpcHtmlMessage(0);
   adminReply.setFile("data/html/admin/pforge3.htm");
   adminReply.replace("%format%", format);
   adminReply.replace("%command%", command);
   activeChar.sendPacket(adminReply);
 }
예제 #2
0
  private void listCharacters(L2PcInstance activeChar, int page) {
    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values();
    L2PcInstance[] players;
    // synchronized (L2World.getInstance().getAllPlayers())
    {
      players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);
    }

    int maxCharactersPerPage = 20;
    int maxPages = players.length / maxCharactersPerPage;

    if (players.length > maxCharactersPerPage * maxPages) maxPages++;

    // Check if number of users changed
    if (page > maxPages) page = maxPages;

    int charactersStart = maxCharactersPerPage * page;
    int charactersEnd = players.length;
    if (charactersEnd - charactersStart > maxCharactersPerPage)
      charactersEnd = charactersStart + maxCharactersPerPage;

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/charlist.htm");

    final StringBuilder replyMSG = new StringBuilder(1000);

    for (int x = 0; x < maxPages; x++) {
      int pagenr = x + 1;
      StringUtil.append(
          replyMSG,
          "<center><a action=\"bypass -h admin_show_characters "
              + x
              + "\">"
              + MessageTable.Messages[677].getMessage()
              + pagenr
              + MessageTable.Messages[215].getMessage()
              + "</a></center>");
    }

    adminReply.replace("%pages%", replyMSG.toString());
    replyMSG.setLength(0);

    for (int i = charactersStart; i < charactersEnd; i++) {
      // Add player info into new Table row
      StringUtil.append(
          replyMSG,
          "<tr><td width=80><a action=\"bypass -h admin_character_info ",
          players[i].getName(),
          "\">",
          players[i].getName(),
          "</a></td><td width=110>",
          players[i].getTemplate().className,
          "</td><td width=40>",
          String.valueOf(players[i].getLevel()),
          "</td></tr>");
    }

    adminReply.replace("%players%", replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }
예제 #3
0
  private void showFortSelectPage(L2PcInstance activeChar) {
    int i = 0;
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/forts.htm");

    final List<Fort> forts = FortManager.getInstance().getForts();
    final StringBuilder cList = new StringBuilder(forts.size() * 100);

    for (Fort fort : forts) {
      if (fort != null) {
        StringUtil.append(
            cList,
            "<td fixwidth=90><a action=\"bypass -h admin_fortsiege ",
            String.valueOf(fort.getFortId()),
            "\">",
            fort.getName(),
            " ID: ", // Update by rocknow
            String.valueOf(fort.getFortId()),
            "</a></td>");
        i++;
      }

      if (i > 0) { // Update by rocknow
        cList.append("</tr><tr>");
        i = 0;
      }
    }

    adminReply.replace("%forts%", cList.toString());
    activeChar.sendPacket(adminReply);
  }
예제 #4
0
 private void showFortSiegePage(L2PcInstance activeChar, Fort fort) {
   NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
   adminReply.setFile("data/html/admin/fort.htm");
   adminReply.replace("%fortName%", fort.getName());
   adminReply.replace("%fortId%", String.valueOf(fort.getFortId()));
   activeChar.sendPacket(adminReply);
 }
예제 #5
0
  /**
   * @param activeChar
   * @throws IllegalArgumentException
   */
  private void findDualbox(L2PcInstance activeChar, int multibox) throws IllegalArgumentException {
    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values();
    L2PcInstance[] players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);

    Map<String, List<L2PcInstance>> ipMap = new HashMap<String, List<L2PcInstance>>();

    String ip = "0.0.0.0";
    L2GameClient client;

    final Map<String, Integer> dualboxIPs = new HashMap<String, Integer>();

    for (L2PcInstance player : players) {
      client = player.getClient();
      if (client.isDetached()) continue;
      else {
        ip = client.getConnection().getInetAddress().getHostAddress();
        if (ipMap.get(ip) == null) ipMap.put(ip, new ArrayList<L2PcInstance>());
        ipMap.get(ip).add(player);

        if (ipMap.get(ip).size() >= multibox) {
          Integer count = dualboxIPs.get(ip);
          if (count == null) dualboxIPs.put(ip, multibox);
          else dualboxIPs.put(ip, count + 1);
        }
      }
    }

    List<String> keys = new ArrayList<String>(dualboxIPs.keySet());
    Collections.sort(
        keys,
        new Comparator<String>() {
          public int compare(String left, String right) {
            return dualboxIPs.get(left).compareTo(dualboxIPs.get(right));
          }
        });
    Collections.reverse(keys);

    final StringBuilder results = new StringBuilder();
    for (String dualboxIP : keys) {
      StringUtil.append(
          results,
          "<a action=\"bypass -h admin_find_ip "
              + dualboxIP
              + "\">"
              + dualboxIP
              + " ("
              + dualboxIPs.get(dualboxIP)
              + ")</a><br1>");
    }

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/dualbox.htm");
    adminReply.replace("%multibox%", String.valueOf(multibox));
    adminReply.replace("%results%", results.toString());
    activeChar.sendPacket(adminReply);
  }
예제 #6
0
  private static void showClanHallPage(L2PcInstance activeChar, ClanHall clanhall) {
    final L2Clan owner = ClanTable.getInstance().getClan(clanhall.getOwnerId());

    final NpcHtmlMessage html = new NpcHtmlMessage(0);
    html.setFile("data/html/admin/clanhall.htm");
    html.replace("%clanhallName%", clanhall.getName());
    html.replace("%clanhallId%", clanhall.getId());
    html.replace("%clanhallOwner%", (owner == null) ? "None" : owner.getName());
    activeChar.sendPacket(html);
  }
예제 #7
0
  private static void playerHelp(L2PcInstance activeChar, String path) {
    if (path.indexOf("..") != -1) return;

    final StringTokenizer st = new StringTokenizer(path);
    final String[] cmd = st.nextToken().split("#");

    final NpcHtmlMessage html = new NpcHtmlMessage(0);
    html.setFile("data/html/help/" + cmd[0]);
    if (cmd.length > 1) html.setItemId(Integer.parseInt(cmd[1]));
    html.disableValidation();
    activeChar.sendPacket(html);
  }
예제 #8
0
  private static void showPage2(L2PcInstance activeChar, String format) {
    NpcHtmlMessage adminReply = new NpcHtmlMessage(0);
    adminReply.setFile("data/html/admin/pforge2.htm");
    adminReply.replace("%format%", format);

    StringBuilder replyMSG = new StringBuilder();
    for (int i = 0; i < format.length(); i++)
      replyMSG.append(format.charAt(i) + " : <edit var=\"v" + i + "\" width=100><br1>");
    adminReply.replace("%valueditors%", replyMSG.toString());
    replyMSG.setLength(0);

    for (int i = 0; i < format.length(); i++) replyMSG.append(" \\$v" + i);
    adminReply.replace("%send%", replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }
예제 #9
0
  public void giveBlessingSupport(L2PcInstance player) {
    if (player == null) return;

    // Select the player
    setTarget(player);

    // If the player is too high level, display a message and return
    if (player.getLevel() > 39 || player.getClassId().level() >= 2) {
      NpcHtmlMessage npcReply = new NpcHtmlMessage(getObjectId());
      npcReply.setHtml(
          "<html><body>Newbie Guide:<br>I'm sorry, but you are not eligible to receive the protection blessing.<br1>It can only be bestowed on <font color=\"LEVEL\">characters below level 39 who have not made a seccond transfer.</font></body></html>");
      npcReply.replace("%objectId%", getObjectId());
      player.sendPacket(npcReply);
      return;
    }
    doCast(FrequentSkill.BLESSING_OF_PROTECTION.getSkill());
  }
예제 #10
0
  /**
   * This method displays SkillList to the player.
   *
   * @param player The player who requested the method.
   * @param npc The L2Npc linked to the request.
   * @param classId The classId asked. Used to sort available skill list.
   */
  public static void showSkillList(L2PcInstance player, L2Npc npc, ClassId classId) {
    if (((L2NpcInstance) npc).getClassesToTeach() == null) {
      NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
      final String sb =
          StringUtil.concat(
              "<html><body>I cannot teach you. My class list is empty.<br>Your admin needs to add me teachTo informations.<br>NpcId:",
              String.valueOf(npc.getTemplate().getNpcId()),
              ", your classId:",
              String.valueOf(player.getClassId().getId()),
              "</body></html>");
      html.setHtml(sb);
      player.sendPacket(html);
      return;
    }

    if (!npc.getTemplate().canTeach(classId)) {
      NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
      html.setFile("data/html/trainer/" + npc.getTemplate().getNpcId() + "-noskills.htm");
      player.sendPacket(html);
      return;
    }

    AcquireSkillList asl = new AcquireSkillList(AcquireSkillList.SkillType.Usual);
    boolean empty = true;

    for (L2SkillLearn sl : SkillTreeTable.getInstance().getAvailableSkills(player, classId)) {
      L2Skill sk = SkillTable.getInstance().getInfo(sl.getId(), sl.getLevel());
      if (sk == null) continue;

      asl.addSkill(sl.getId(), sl.getLevel(), sl.getLevel(), sl.getSpCost(), 0);
      empty = false;
    }

    if (empty) {
      int minlevel = SkillTreeTable.getInstance().getMinLevelForNewSkill(player, classId);

      if (minlevel > 0)
        player.sendPacket(
            SystemMessage.getSystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN_S1)
                .addNumber(minlevel));
      else player.sendPacket(SystemMessageId.NO_MORE_SKILLS_TO_LEARN);
    } else player.sendPacket(asl);

    player.sendPacket(ActionFailed.STATIC_PACKET);
  }
예제 #11
0
  /**
   * @param activeChar
   * @param characterName
   * @throws IllegalArgumentException
   */
  private void findCharactersPerAccount(L2PcInstance activeChar, String characterName)
      throws IllegalArgumentException {
    if (characterName.matches(Config.CNAME_TEMPLATE)) {
      String account = null;
      Map<Integer, String> chars;
      L2PcInstance player = L2World.getInstance().getPlayer(characterName);
      if (player == null) throw new IllegalArgumentException("Player doesn't exist");
      chars = player.getAccountChars();
      account = player.getAccountName();
      final StringBuilder replyMSG = new StringBuilder(chars.size() * 20);
      NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
      adminReply.setFile("data/html/admin/accountinfo.htm");
      for (String charname : chars.values()) {
        StringUtil.append(replyMSG, charname, "<br1>");
      }

      adminReply.replace("%characters%", replyMSG.toString());
      adminReply.replace("%account%", account);
      adminReply.replace("%player%", characterName);
      activeChar.sendPacket(adminReply);
    } else throw new IllegalArgumentException("Malformed character name");
  }
예제 #12
0
  /**
   * This method displays EnchantSkillList to the player.
   *
   * @param player The player who requested the method.
   * @param npc The L2Npc linked to the request.
   * @param classId The classId asked. Used to sort available enchant skill list.
   */
  public static void showEnchantSkillList(L2PcInstance player, L2Npc npc, ClassId classId) {
    if (((L2NpcInstance) npc).getClassesToTeach() == null) {
      NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
      final String sb =
          StringUtil.concat(
              "<html><body>I cannot teach you. My class list is empty.<br>Your admin needs to add me teachTo informations.<br>NpcId:",
              String.valueOf(npc.getTemplate().getNpcId()),
              ", your classId:",
              String.valueOf(player.getClassId().getId()),
              "</body></html>");
      html.setHtml(sb);
      player.sendPacket(html);
      return;
    }

    if (!npc.getTemplate().canTeach(classId)) {
      NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
      html.setFile("data/html/trainer/" + npc.getTemplate().getNpcId() + "-noskills.htm");
      player.sendPacket(html);
      return;
    }

    if (player.getClassId().level() < 3) {
      NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
      html.setHtml("<html><body> You must have 3rd class change quest completed.</body></html>");
      player.sendPacket(html);
      return;
    }

    ExEnchantSkillList esl = new ExEnchantSkillList();
    boolean empty = true;

    List<L2EnchantSkillLearn> esll = SkillTreeTable.getInstance().getAvailableEnchantSkills(player);
    for (L2EnchantSkillLearn skill : esll) {
      L2Skill sk = SkillTable.getInstance().getInfo(skill.getId(), skill.getLevel());
      if (sk == null) continue;

      L2EnchantSkillData data =
          SkillTreeTable.getInstance().getEnchantSkillData(skill.getEnchant());
      if (data == null) continue;

      esl.addSkill(skill.getId(), skill.getLevel(), data.getCostSp(), data.getCostExp());
      empty = false;
    }

    if (empty) {
      player.sendPacket(SystemMessageId.THERE_IS_NO_SKILL_THAT_ENABLES_ENCHANT);

      if (player.getLevel() < 74)
        player.sendPacket(
            SystemMessage.getSystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN_S1)
                .addNumber(74));
      else player.sendPacket(SystemMessageId.NO_MORE_SKILLS_TO_LEARN);
    } else player.sendPacket(esl);

    player.sendPacket(ActionFailed.STATIC_PACKET);
  }
예제 #13
0
  /**
   * @param activeChar
   * @param CharacterToFind
   */
  private void findCharacter(L2PcInstance activeChar, String CharacterToFind) {
    int CharactersFound = 0;
    String name;
    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values();
    L2PcInstance[] players;
    // synchronized (L2World.getInstance().getAllPlayers())
    {
      players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);
    }
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/charfind.htm");

    final StringBuilder replyMSG = new StringBuilder(1000);

    for (L2PcInstance player : players) { // Add player info into new Table row
      name = player.getName();
      if (name.toLowerCase().contains(CharacterToFind.toLowerCase())) {
        CharactersFound = CharactersFound + 1;
        StringUtil.append(
            replyMSG,
            "<tr><td width=80><a action=\"bypass -h admin_character_list ",
            name,
            "\">",
            name,
            "</a></td><td width=110>",
            player.getTemplate().className,
            "</td><td width=40>",
            String.valueOf(player.getLevel()),
            "</td></tr>");
      }
      if (CharactersFound > 20) break;
    }
    adminReply.replace("%results%", replyMSG.toString());

    final String replyMSG2;

    if (CharactersFound == 0) {
      replyMSG2 = MessageTable.Messages[678].getMessage();
    } else if (CharactersFound > 20) {
      adminReply.replace("%number%", MessageTable.Messages[679].getMessage());
      replyMSG2 = MessageTable.Messages[680].getMessage();
    } else if (CharactersFound == 1) {
      replyMSG2 = MessageTable.Messages[1196].getMessage();
    } else {
      replyMSG2 = MessageTable.Messages[1197].getMessage();
    }

    adminReply.replace("%number%", String.valueOf(CharactersFound));
    adminReply.replace("%end%", replyMSG2);
    activeChar.sendPacket(adminReply);
  }
예제 #14
0
  /**
   * @param activeChar
   * @param IpAdress
   * @throws IllegalArgumentException
   */
  private void findCharactersPerIp(L2PcInstance activeChar, String IpAdress)
      throws IllegalArgumentException {
    boolean findDisconnected = false;

    if (IpAdress.equals("disconnected")) {
      findDisconnected = true;
    } else {
      if (!IpAdress.matches(
          "^(?:(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))$"))
        throw new IllegalArgumentException("Malformed IPv4 number");
    }
    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values();
    L2PcInstance[] players;
    // synchronized (L2World.getInstance().getAllPlayers())
    {
      players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);
    }
    int CharactersFound = 0;
    L2GameClient client;
    String name, ip = "0.0.0.0";
    final StringBuilder replyMSG = new StringBuilder(1000);
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/ipfind.htm");
    for (L2PcInstance player : players) {
      client = player.getClient();
      if (client.isDetached()) {
        if (!findDisconnected) {
          continue;
        }
      } else {
        if (findDisconnected) {
          continue;
        } else {
          ip = client.getConnection().getInetAddress().getHostAddress();
          if (!ip.equals(IpAdress)) continue;
        }
      }

      name = player.getName();
      CharactersFound = CharactersFound + 1;
      StringUtil.append(
          replyMSG,
          "<tr><td width=80><a action=\"bypass -h admin_character_list ",
          name,
          "\">",
          name,
          "</a></td><td width=110>",
          player.getTemplate().className,
          "</td><td width=40>",
          String.valueOf(player.getLevel()),
          "</td></tr>");

      if (CharactersFound > 20) break;
    }
    adminReply.replace("%results%", replyMSG.toString());

    final String replyMSG2;

    if (CharactersFound == 0) {
      replyMSG2 = MessageTable.Messages[681].getMessage();
    } else if (CharactersFound > 20) {
      adminReply.replace(
          "%number%", MessageTable.Messages[1213].getMessage() + String.valueOf(CharactersFound));
      replyMSG2 = MessageTable.Messages[682].getMessage();
    } else if (CharactersFound == 1) {
      replyMSG2 = MessageTable.Messages[1196].getMessage();
    } else {
      replyMSG2 = MessageTable.Messages[1197].getMessage();
    }
    adminReply.replace("%ip%", ip);
    adminReply.replace("%number%", String.valueOf(CharactersFound));
    adminReply.replace("%end%", replyMSG2);
    activeChar.sendPacket(adminReply);
  }
예제 #15
0
 /**
  * @param activeChar
  * @param player
  */
 private void gatherCharacterInfo(L2PcInstance activeChar, L2PcInstance player, String filename) {
   String ip = "N/A";
   String account = "N/A";
   try {
     String clientInfo = player.getClient().toString();
     account =
         clientInfo.substring(clientInfo.indexOf("Account: ") + 9, clientInfo.indexOf(" - IP: "));
     ip = clientInfo.substring(clientInfo.indexOf(" - IP: ") + 7, clientInfo.lastIndexOf("]"));
   } catch (Exception e) {
   }
   NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
   adminReply.setFile("data/html/admin/" + filename);
   adminReply.replace("%name%", player.getName());
   adminReply.replace("%level%", String.valueOf(player.getLevel()));
   adminReply.replace(
       "%clan%", String.valueOf(ClanTable.getInstance().getClan(player.getClanId())));
   adminReply.replace("%xp%", String.valueOf(player.getExp()));
   adminReply.replace("%sp%", String.valueOf(player.getSp()));
   adminReply.replace("%class%", player.getTemplate().className);
   adminReply.replace("%ordinal%", String.valueOf(player.getClassId().ordinal()));
   adminReply.replace("%classid%", String.valueOf(player.getClassId()));
   adminReply.replace("%x%", String.valueOf(player.getX()));
   adminReply.replace("%y%", String.valueOf(player.getY()));
   adminReply.replace("%z%", String.valueOf(player.getZ()));
   adminReply.replace("%currenthp%", String.valueOf((int) player.getCurrentHp()));
   adminReply.replace("%maxhp%", String.valueOf(player.getMaxHp()));
   adminReply.replace("%karma%", String.valueOf(player.getKarma()));
   adminReply.replace("%currentmp%", String.valueOf((int) player.getCurrentMp()));
   adminReply.replace("%maxmp%", String.valueOf(player.getMaxMp()));
   adminReply.replace("%pvpflag%", String.valueOf(player.getPvpFlag()));
   adminReply.replace("%currentcp%", String.valueOf((int) player.getCurrentCp()));
   adminReply.replace("%maxcp%", String.valueOf(player.getMaxCp()));
   adminReply.replace("%pvpkills%", String.valueOf(player.getPvpKills()));
   adminReply.replace("%pkkills%", String.valueOf(player.getPkKills()));
   adminReply.replace("%currentload%", String.valueOf(player.getCurrentLoad()));
   adminReply.replace("%maxload%", String.valueOf(player.getMaxLoad()));
   adminReply.replace(
       "%percent%",
       String.valueOf(
           Util.roundTo(
               ((float) player.getCurrentLoad() / (float) player.getMaxLoad()) * 100, 2)));
   adminReply.replace("%patk%", String.valueOf(player.getPAtk(null)));
   adminReply.replace("%matk%", String.valueOf(player.getMAtk(null, null)));
   adminReply.replace("%pdef%", String.valueOf(player.getPDef(null)));
   adminReply.replace("%mdef%", String.valueOf(player.getMDef(null, null)));
   adminReply.replace("%accuracy%", String.valueOf(player.getAccuracy()));
   adminReply.replace("%evasion%", String.valueOf(player.getEvasionRate(null)));
   adminReply.replace("%critical%", String.valueOf(player.getCriticalHit(null, null)));
   adminReply.replace("%runspeed%", String.valueOf(player.getRunSpeed()));
   adminReply.replace("%patkspd%", String.valueOf(player.getPAtkSpd()));
   adminReply.replace("%matkspd%", String.valueOf(player.getMAtkSpd()));
   adminReply.replace("%access%", String.valueOf(player.getAccessLevel().getLevel()));
   adminReply.replace("%account%", account);
   adminReply.replace("%ip%", ip);
   activeChar.sendPacket(adminReply);
 }
예제 #16
0
  @Override
  public void onBypassFeedback(L2PcInstance player, String command) {
    player.sendPacket(ActionFailed.STATIC_PACKET);

    StringTokenizer st = new StringTokenizer(command, " ");
    String actualCommand = st.nextToken(); // Get actual command

    String filename = SevenSigns.SEVEN_SIGNS_HTML_PATH;
    int sealAvariceOwner = SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_AVARICE);
    int sealGnosisOwner = SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_GNOSIS);
    int playerCabal = SevenSigns.getInstance().getPlayerCabal(player.getObjectId());
    boolean isSealValidationPeriod = SevenSigns.getInstance().isSealValidationPeriod();
    int compWinner = SevenSigns.getInstance().getCabalHighestScore();

    if (actualCommand.startsWith("necro")) {
      boolean canPort = true;
      if (isSealValidationPeriod) {
        if (compWinner == SevenSigns.CABAL_DAWN
            && (playerCabal != SevenSigns.CABAL_DAWN
                || sealAvariceOwner != SevenSigns.CABAL_DAWN)) {
          player.sendPacket(SystemMessageId.CAN_BE_USED_BY_DAWN);
          canPort = false;
        } else if (compWinner == SevenSigns.CABAL_DUSK
            && (playerCabal != SevenSigns.CABAL_DUSK
                || sealAvariceOwner != SevenSigns.CABAL_DUSK)) {
          player.sendPacket(SystemMessageId.CAN_BE_USED_BY_DUSK);
          canPort = false;
        } else if (compWinner == SevenSigns.CABAL_NULL && playerCabal != SevenSigns.CABAL_NULL)
          canPort = true;
        else if (playerCabal == SevenSigns.CABAL_NULL) canPort = false;
      } else {
        if (playerCabal == SevenSigns.CABAL_NULL) canPort = false;
      }

      if (!canPort) {
        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        filename += "necro_no.htm";
        html.setFile(filename);
        player.sendPacket(html);
      } else {
        doTeleport(player, Integer.parseInt(st.nextToken()));
        player.setIsIn7sDungeon(true);
      }
    } else if (actualCommand.startsWith("cata")) {
      boolean canPort = true;
      if (isSealValidationPeriod) {
        if (compWinner == SevenSigns.CABAL_DAWN
            && (playerCabal != SevenSigns.CABAL_DAWN || sealGnosisOwner != SevenSigns.CABAL_DAWN)) {
          player.sendPacket(SystemMessageId.CAN_BE_USED_BY_DAWN);
          canPort = false;
        } else if (compWinner == SevenSigns.CABAL_DUSK
            && (playerCabal != SevenSigns.CABAL_DUSK || sealGnosisOwner != SevenSigns.CABAL_DUSK)) {
          player.sendPacket(SystemMessageId.CAN_BE_USED_BY_DUSK);
          canPort = false;
        } else if (compWinner == SevenSigns.CABAL_NULL && playerCabal != SevenSigns.CABAL_NULL)
          canPort = true;
        else if (playerCabal == SevenSigns.CABAL_NULL) canPort = false;
      } else {
        if (playerCabal == SevenSigns.CABAL_NULL) canPort = false;
      }

      if (!canPort) {
        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        filename += "cata_no.htm";
        html.setFile(filename);
        player.sendPacket(html);
      } else {
        doTeleport(player, Integer.parseInt(st.nextToken()));
        player.setIsIn7sDungeon(true);
      }
    } else if (actualCommand.startsWith("exit")) {
      doTeleport(player, Integer.parseInt(st.nextToken()));
      player.setIsIn7sDungeon(false);
    } else if (actualCommand.startsWith("goto")) {
      doTeleport(player, Integer.parseInt(st.nextToken()));
    } else super.onBypassFeedback(player, command);
  }
예제 #17
0
 private static void showSiegePage(L2PcInstance activeChar, String castleName) {
   final NpcHtmlMessage html = new NpcHtmlMessage(0);
   html.setFile("data/html/admin/castle.htm");
   html.replace("%castleName%", castleName);
   activeChar.sendPacket(html);
 }
예제 #18
0
  private static void showHtml(L2PcInstance activeChar) {
    int worldX = activeChar.getX();
    int worldY = activeChar.getY();
    int geoX = ((((worldX - (-327680)) >> 4) >> 11) + 10);
    int geoY = ((((worldY - (-262144)) >> 4) >> 11) + 10);

    NpcHtmlMessage adminReply = new NpcHtmlMessage(0);
    adminReply.setFile("data/html/admin/zone.htm");

    adminReply.replace(
        "%MAPREGION%",
        "[x:"
            + MapRegionTable.getMapRegionX(activeChar.getX())
            + " y:"
            + MapRegionTable.getMapRegionX(activeChar.getY())
            + "]");
    adminReply.replace("%GEOREGION%", "" + geoX + "_" + geoY);
    adminReply.replace(
        "%CLOSESTTOWN%", MapRegionTable.getInstance().getClosestTownName(activeChar));
    adminReply.replace(
        "%CURRENTLOC%",
        "" + activeChar.getX() + ", " + activeChar.getY() + ", " + activeChar.getZ());

    adminReply.replace(
        "%PVP%", (activeChar.isInsideZone(ZoneId.PVP) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%PEACE%",
        (activeChar.isInsideZone(ZoneId.PEACE) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%SIEGE%",
        (activeChar.isInsideZone(ZoneId.SIEGE) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%MOTHERTREE%",
        (activeChar.isInsideZone(ZoneId.MOTHER_TREE) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%CLANHALL%",
        (activeChar.isInsideZone(ZoneId.CLAN_HALL) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%NOLANDING%",
        (activeChar.isInsideZone(ZoneId.NO_LANDING) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%WATER%",
        (activeChar.isInsideZone(ZoneId.WATER) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%JAIL%",
        (activeChar.isInsideZone(ZoneId.JAIL) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%MONSTERTRACK%",
        (activeChar.isInsideZone(ZoneId.MONSTER_TRACK)
            ? "<font color=\"LEVEL\">YES</font>"
            : "NO"));
    adminReply.replace(
        "%CASTLE%",
        (activeChar.isInsideZone(ZoneId.CASTLE) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%SWAMP%",
        (activeChar.isInsideZone(ZoneId.SWAMP) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%NOSUMMONFRIEND%",
        (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND)
            ? "<font color=\"LEVEL\">YES</font>"
            : "NO"));
    adminReply.replace(
        "%NOSTORE%",
        (activeChar.isInsideZone(ZoneId.NO_STORE) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%TOWN%",
        (activeChar.isInsideZone(ZoneId.TOWN) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%HQ%", (activeChar.isInsideZone(ZoneId.HQ) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%DANGERAREA%",
        (activeChar.isInsideZone(ZoneId.DANGER_AREA) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%CASTONARTIFACT%",
        (activeChar.isInsideZone(ZoneId.CAST_ON_ARTIFACT)
            ? "<font color=\"LEVEL\">YES</font>"
            : "NO"));
    adminReply.replace(
        "%NORESTART%",
        (activeChar.isInsideZone(ZoneId.NO_RESTART) ? "<font color=\"LEVEL\">YES</font>" : "NO"));

    StringBuilder zones = new StringBuilder(100);
    L2WorldRegion region = L2World.getInstance().getRegion(activeChar.getX(), activeChar.getY());
    for (L2ZoneType zone : region.getZones()) {
      if (zone.isCharacterInZone(activeChar)) {
        StringUtil.append(zones, String.valueOf(zone.getId()));
        StringUtil.append(zones, " ");
      }
    }
    adminReply.replace("%ZLIST%", zones.toString());
    activeChar.sendPacket(adminReply);
  }
예제 #19
0
  private static void showCastleSelectPage(L2PcInstance activeChar) {
    int i = 0;

    final NpcHtmlMessage html = new NpcHtmlMessage(0);
    html.setFile("data/html/admin/castles.htm");

    final StringBuilder sb = new StringBuilder();
    for (Castle castle : CastleManager.getInstance().getCastles()) {
      if (castle != null) {
        StringUtil.append(
            sb,
            "<td fixwidth=90><a action=\"bypass -h admin_siege ",
            castle.getName(),
            "\">",
            castle.getName(),
            "</a></td>");
        i++;
      }

      if (i > 2) {
        sb.append("</tr><tr>");
        i = 0;
      }
    }
    html.replace("%castles%", sb.toString());

    // Cleanup sb.
    sb.setLength(0);
    i = 0;

    for (ClanHall clanhall : ClanHallManager.getInstance().getClanHalls().values()) {
      if (clanhall != null) {
        StringUtil.append(
            sb,
            "<td fixwidth=134><a action=\"bypass -h admin_clanhall ",
            clanhall.getId(),
            "\">",
            clanhall.getName(),
            "</a></td>");
        i++;
      }

      if (i > 1) {
        sb.append("</tr><tr>");
        i = 0;
      }
    }
    html.replace("%clanhalls%", sb.toString());

    // Cleanup sb.
    sb.setLength(0);
    i = 0;

    for (ClanHall clanhall : ClanHallManager.getInstance().getFreeClanHalls().values()) {
      if (clanhall != null) {
        StringUtil.append(
            sb,
            "<td fixwidth=134><a action=\"bypass -h admin_clanhall ",
            clanhall.getId(),
            "\">",
            clanhall.getName(),
            "</a></td>");
        i++;
      }

      if (i > 1) {
        sb.append("</tr><tr>");
        i = 0;
      }
    }
    html.replace("%freeclanhalls%", sb.toString());
    activeChar.sendPacket(html);
  }