コード例 #1
0
  private static final void showTutorialHtml(L2PcInstance player) {
    final ClassId currentClassId = player.getClassId();
    if (getMinLevel(currentClassId.level()) > player.getLevel() && !Config.ALLOW_ENTIRE_TREE)
      return;

    String msg =
        HtmCache.getInstance()
            .getHtm(player.getHtmlPrefix(), "data/html/classmaster/tutorialtemplate.htm");

    msg =
        msg.replaceAll(
            "%name%", CharTemplateTable.getInstance().getClassNameById(currentClassId.getId()));

    final StringBuilder menu = new StringBuilder(100);
    for (ClassId cid : ClassId.values()) {
      if (cid == ClassId.inspector && player.getTotalSubClasses() < 2) continue;
      if (validateClassId(currentClassId, cid)) {
        StringUtil.append(
            menu,
            "<a action=\"link CO",
            String.valueOf(cid.getId()),
            "\">",
            CharTemplateTable.getInstance().getClassNameById(cid.getId()),
            "</a><br>");
      }
    }

    msg = msg.replaceAll("%menu%", menu.toString());
    msg = msg.replace("%req_items%", getRequiredItems(currentClassId.level() + 1));
    player.sendPacket(new TutorialShowHtml(msg));
  }
コード例 #2
0
  @Override
  public void onBypassFeedback(L2PcInstance player, String command) {
    if (command.startsWith("1stClass")) {
      showHtmlMenu(player, getObjectId(), 1);
    } else if (command.startsWith("2ndClass")) {
      showHtmlMenu(player, getObjectId(), 2);
    } else if (command.startsWith("3rdClass")) {
      showHtmlMenu(player, getObjectId(), 3);
    } else if (command.startsWith("change_class")) {
      int val = Integer.parseInt(command.substring(13));

      if (checkAndChangeClass(player, val)) {
        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        html.setFile(player.getHtmlPrefix(), "data/html/classmaster/ok.htm");
        html.replace("%name%", CharTemplateTable.getInstance().getClassNameById(val));
        player.sendPacket(html);
      }
    } else if (command.startsWith("become_noble")) {
      if (!player.isNoble()) {
        player.setNoble(true);
        player.sendPacket(new UserInfo(player));
        player.sendPacket(new ExBrExtraUserInfo(player));
        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        html.setFile(player.getHtmlPrefix(), "data/html/classmaster/nobleok.htm");
        player.sendPacket(html);
      }
    } else if (command.startsWith("learn_skills")) {
      player.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true);
    } else if (command.startsWith("increase_clan_level")) {
      if (!player.isClanLeader()) {
        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        html.setFile(player.getHtmlPrefix(), "data/html/classmaster/noclanleader.htm");
        player.sendPacket(html);
      } else if (player.getClan().getLevel() >= 5) {
        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        html.setFile(player.getHtmlPrefix(), "data/html/classmaster/noclanlevel.htm");
        player.sendPacket(html);
      } else {
        player.getClan().changeLevel(5);
      }
    } else {
      super.onBypassFeedback(player, command);
    }
  }
コード例 #3
0
  private static final void showHtmlMenu(L2PcInstance player, int objectId, int level) {
    NpcHtmlMessage html = new NpcHtmlMessage(objectId);

    if (!Config.ALLOW_CLASS_MASTERS) {
      html.setFile(player.getHtmlPrefix(), "data/html/classmaster/disabled.htm");
    } else if (!Config.CLASS_MASTER_SETTINGS.isAllowed(level)) {
      int jobLevel = player.getClassId().level();
      final StringBuilder sb = new StringBuilder(100);
      sb.append("<html><body>");
      switch (jobLevel) {
        case 0:
          if (Config.CLASS_MASTER_SETTINGS.isAllowed(1))
            sb.append("Come back here when you reached level 20 to change your class.<br>");
          else if (Config.CLASS_MASTER_SETTINGS.isAllowed(2))
            sb.append("Come back after your first occupation change.<br>");
          else if (Config.CLASS_MASTER_SETTINGS.isAllowed(3))
            sb.append("Come back after your second occupation change.<br>");
          else sb.append("I can't change your occupation.<br>");
          break;
        case 1:
          if (Config.CLASS_MASTER_SETTINGS.isAllowed(2))
            sb.append("Come back here when you reached level 40 to change your class.<br>");
          else if (Config.CLASS_MASTER_SETTINGS.isAllowed(3))
            sb.append("Come back after your second occupation change.<br>");
          else sb.append("I can't change your occupation.<br>");
          break;
        case 2:
          if (Config.CLASS_MASTER_SETTINGS.isAllowed(3))
            sb.append("Come back here when you reached level 76 to change your class.<br>");
          else sb.append("I can't change your occupation.<br>");
          break;
        case 3:
          sb.append("There is no class change available for you anymore.<br>");
          break;
      }
      sb.append("</body></html>");
      html.setHtml(sb.toString());
    } else {
      final ClassId currentClassId = player.getClassId();
      if (currentClassId.level() >= level) {
        html.setFile(player.getHtmlPrefix(), "data/html/classmaster/nomore.htm");
      } else {
        final int minLevel = getMinLevel(currentClassId.level());
        if (player.getLevel() >= minLevel || Config.ALLOW_ENTIRE_TREE) {
          final StringBuilder menu = new StringBuilder(100);
          for (ClassId cid : ClassId.values()) {
            if (cid == ClassId.inspector && player.getTotalSubClasses() < 2) continue;
            if (validateClassId(currentClassId, cid) && cid.level() == level) {
              StringUtil.append(
                  menu,
                  "<a action=\"bypass -h npc_%objectId%_change_class ",
                  String.valueOf(cid.getId()),
                  "\">",
                  CharTemplateTable.getInstance().getClassNameById(cid.getId()),
                  "</a><br>");
            }
          }

          if (menu.length() > 0) {
            html.setFile(player.getHtmlPrefix(), "data/html/classmaster/template.htm");
            html.replace(
                "%name%", CharTemplateTable.getInstance().getClassNameById(currentClassId.getId()));
            html.replace("%menu%", menu.toString());
          } else {
            html.setFile(player.getHtmlPrefix(), "data/html/classmaster/comebacklater.htm");
            html.replace("%level%", String.valueOf(getMinLevel(level - 1)));
          }
        } else {
          if (minLevel < Integer.MAX_VALUE) {
            html.setFile(player.getHtmlPrefix(), "data/html/classmaster/comebacklater.htm");
            html.replace("%level%", String.valueOf(minLevel));
          } else html.setFile(player.getHtmlPrefix(), "data/html/classmaster/nomore.htm");
        }
      }
    }

    html.replace("%objectId%", String.valueOf(objectId));
    html.replace("%req_items%", getRequiredItems(level));
    player.sendPacket(html);
  }