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)); }
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); }