public String getGeneralStats() { TextBuilder tb = new TextBuilder(); ThreadFactory tf = _generalThreadPool.getThreadFactory(); if (tf instanceof PriorityThreadFactory) { tb.append("General Thread Pool:\r\n"); tb.append("Tasks in the queue: " + _generalThreadPool.getQueue().size() + "\r\n"); tb.append("Showing threads stack trace:\r\n"); PriorityThreadFactory ptf = (PriorityThreadFactory) tf; int count = ptf.getGroup().activeCount(); Thread[] threads = new Thread[count + 2]; ptf.getGroup().enumerate(threads); tb.append("There should be " + count + " Threads\r\n"); for (Thread t : threads) { if (t == null) { continue; } tb.append(t.getName() + "\r\n"); for (StackTraceElement ste : t.getStackTrace()) { tb.append(ste.toString()); tb.append("\r\n"); } } } tb.append("Packet Tp stack traces printed.\r\n"); return tb.toString(); }
/** * This function has only debug purposes and is used to print the contents of a buffer to the * output log. This is used for the debug output when debugging the protocol. The bytes that are * written are all remaining bytes of the buffer. Also the position of the buffer with point at * the end after this function was called. * * @param prefix The prefix that shall be written first to the log * @param buffer The buffer that contains the values that shall be written */ static void dump(final String prefix, @Nonnull final ByteBuffer buffer) { final TextBuilder builder = TextBuilder.newInstance(); final TextBuilder builderText = TextBuilder.newInstance(); builder.append(prefix); builder.append(' '); int bytes = 0; while (buffer.hasRemaining()) { final byte bufferValue = buffer.get(); builder.append(String.format(DUMP_FORMAT_BYTES, bufferValue)); final char c = (char) ((bufferValue + CHAR_MOD) % CHAR_MOD); if (c >= FIRST_PRINT_CHAR) { builderText.append(c); } else { builderText.append('.'); } ++bytes; } builder.append(' '); builder.append(String.format(DUMP_FORMAT_TOTAL, bytes)); builder.append(' '); builder.append('<'); builder.append(builderText); builder.append('>'); LOGGER.debug(builder.toString()); TextBuilder.recycle(builder); TextBuilder.recycle(builderText); }
@Override protected String getScorebar(int instance) { int countAlive = this.getEventData(instance)._alivePlayers - 1; String time = ((Deathmatch.DMEventInstance) this._matches.get((Object) instance)).getClock().getTime(); String rounds = "" + this.getEventData(instance)._round + "/" + this._maxRounds; int top = 0; for (PlayerEventInfo player : this.getPlayers(instance)) { if (this.getPlayerData(player).getScore() <= top) continue; top = this.getPlayerData(player).getScore(); } TextBuilder tb = new TextBuilder(); String[] types = this._scorebarFormat; for (int i = 0; i < types.length; ++i) { String type = types[i]; if (type.equals("Alive")) { tb.append(LanguageEngine.getMsg("lms_scorebar_alive") + " " + countAlive); } else if (type.equals("Time")) { tb.append(LanguageEngine.getMsg("event_scorebar_time", time)); } else if (type.equals("Rounds")) { tb.append(LanguageEngine.getMsg("lms_scorebar_rounds") + " " + rounds); } else if (type.equals("Top")) { tb.append(LanguageEngine.getMsg("lms_scorebar_top") + " " + top); } if (i + 1 >= types.length) continue; tb.append(" "); } return tb.toString(); }
public String toString() { TextBuilder os = new TextBuilder(); os.append('{'); if (DO_PRONOUN) os.append("DO_PRONOUN"); if (USE_iwithini) os.append(", USE_iwithini"); if (USE_APPOSITION) os.append(", USE_APPOSITION"); if (USE_PREDICATENOMINATIVES) os.append(", USE_PREDICATENOMINATIVES"); if (USE_ACRONYM) os.append(", USE_ACRONYM"); if (USE_RELATIVEPRONOUN) os.append(", USE_RELATIVEPRONOUN"); if (USE_ROLEAPPOSITION) os.append(", USE_ROLEAPPOSITION"); if (USE_EXACTSTRINGMATCH) os.append(", USE_EXACTSTRINGMATCH"); if (USE_INCLUSION_HEADMATCH) os.append(", USE_INCLUSION_HEADMATCH"); if (USE_RELAXED_HEADMATCH) os.append(", USE_RELAXED_HEADMATCH"); if (USE_INCOMPATIBLE_MODIFIER) os.append(", USE_INCOMPATIBLE_MODIFIER"); if (USE_DEMONYM) os.append(", USE_DEMONYM"); if (USE_WORDS_INCLUSION) os.append(", USE_WORDS_INCLUSION"); if (USE_ROLE_SKIP) os.append(", USE_ROLE_SKIP"); if (USE_RELAXED_EXACTSTRINGMATCH) os.append(", USE_RELAXED_EXACTSTRINGMATCH"); if (USE_ATTRIBUTES_AGREE) os.append(", USE_ATTRIBUTES_AGREE"); if (USE_WN_HYPERNYM) os.append(", USE_WN_HYPERNYM"); if (USE_WN_SYNONYM) os.append(", USE_WN_SYNONYM"); if (USE_DIFFERENT_LOCATION) os.append(", USE_DIFFERENT_LOCATION"); if (USE_NUMBER_IN_MENTION) os.append(", USE_NUMBER_IN_MENTION"); if (USE_PROPERHEAD_AT_LAST) os.append(", USE_PROPERHEAD_AT_LAST"); if (USE_ALIAS) os.append(", USE_ALIAS"); if (USE_SLOT_MATCH) os.append(", USE_SLOT_MATCH"); if (USE_DISCOURSEMATCH) os.append(", USE_DISCOURSEMATCH"); if (USE_DISTANCE) os.append(", USE_DISTANCE"); if (USE_NUMBER_ANIMACY_NE_AGREE) os.append(", USE_NUMBER_ANIMACY_NE_AGREE"); if (USE_COREF_DICT) os.append(", USE_COREF_DICT"); os.append('}'); return os.toString(); }
/** * Get the simple name of this class along with the parameters of the command. * * @param param the parameters of the command that shall be displayed along with the class name of * the command * @return the string that contains the simple class name and the parameters */ protected final String toString(final String param) { final TextBuilder builder = TextBuilder.newInstance(); builder.append(getClass().getSimpleName()); builder.append('('); builder.append(param); builder.append(')'); final String retString = builder.toString(); TextBuilder.recycle(builder); return retString; }
/** * (Based on implode() in PHP) * * @param strArray - an array of strings to concatenate * @param strDelim - the delimiter to put between the strings * @return a delimited string for a given array of string elements. */ public static String implodeString(Iterable<String> strArray, String strDelim) { final TextBuilder sbString = TextBuilder.newInstance(); for (String strValue : strArray) { sbString.append(strValue); sbString.append(strDelim); } String result = sbString.toString(); TextBuilder.recycle(sbString); return result; }
public void viewPetition(L2PcInstance activeChar, int petitionId) { if (!activeChar.isGM()) return; if (!isValidPetition(petitionId)) return; Petition currPetition = getPendingPetitions().get(petitionId); TextBuilder htmlContent = new TextBuilder("<html><body>"); SimpleDateFormat dateFormat = new SimpleDateFormat("EEE dd MMM HH:mm z"); htmlContent .append("<center><br><font color=\"LEVEL\">Petition #") .append(currPetition.getId()) .append("</font><br1>"); htmlContent.append("<img src=\"L2UI.SquareGray\" width=\"200\" height=\"1\"></center><br>"); htmlContent .append("Submit Time: ") .append(dateFormat.format(new Date(currPetition.getSubmitTime()))) .append("<br1>"); htmlContent .append("Petitioner: ") .append(currPetition.getPetitioner().getName()) .append("<br1>"); htmlContent .append("Petition Type: ") .append(currPetition.getTypeAsString()) .append("<br>") .append(currPetition.getContent()) .append("<br>"); htmlContent .append("<center><button value=\"Accept\" action=\"bypass -h admin_accept_petition ") .append(currPetition.getId()) .append("\"") .append("width=\"50\" height=\"15\" back=\"sek.cbui94\" fore=\"sek.cbui92\"><br1>"); htmlContent .append("<button value=\"Reject\" action=\"bypass -h admin_reject_petition ") .append(currPetition.getId()) .append("\" ") .append("width=\"50\" height=\"15\" back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"); htmlContent.append( "<button value=\"Back\" action=\"bypass -h admin_view_petitions\" width=\"40\" height=\"15\" back=\"sek.cbui94\" " + "fore=\"sek.cbui92\"></center>"); htmlContent.append("</body></html>"); NpcHtmlMessage htmlMsg = new NpcHtmlMessage(0); htmlMsg.setHtml(htmlContent.toString()); activeChar.sendPacket(htmlMsg); }
public void sendPendingPetitionList(L2PcInstance activeChar) { TextBuilder htmlContent = new TextBuilder( "<html><body>" + "<center><font color=\"LEVEL\">Current Petitions</font><br><table width=\"300\">"); SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM HH:mm z"); if (getPendingPetitionCount() == 0) htmlContent.append( "<tr><td colspan=\"4\">There are no currently pending petitions.</td></tr>"); else htmlContent.append( "<tr><td></td><td><font color=\"999999\">Petitioner</font></td>" + "<td><font color=\"999999\">Petition Type</font></td><td><font color=\"999999\">Submitted</font></td></tr>"); for (Petition currPetition : getPendingPetitions().values()) { if (currPetition == null) continue; htmlContent.append("<tr><td>"); if (currPetition.getState() != PetitionState.In_Process) htmlContent .append("<button value=\"View\" action=\"bypass -h admin_view_petition ") .append(currPetition.getId()) .append("\" ") .append("width=\"40\" height=\"15\" back=\"sek.cbui94\" fore=\"sek.cbui92\">"); else htmlContent.append("<font color=\"999999\">In Process</font>"); htmlContent .append("</td><td>") .append(currPetition.getPetitioner().getName()) .append("</td><td>") .append(currPetition.getTypeAsString()) .append("</td><td>") .append(dateFormat.format(new Date(currPetition.getSubmitTime()))) .append("</td></tr>"); } htmlContent.append( "</table><br><button value=\"Refresh\" action=\"bypass -h admin_view_petitions\" width=\"50\" " + "height=\"15\" back=\"sek.cbui94\" fore=\"sek.cbui92\"><br><button value=\"Back\" action=\"bypass -h admin_admin\" " + "width=\"40\" height=\"15\" back=\"sek.cbui94\" fore=\"sek.cbui92\"></center></body></html>"); NpcHtmlMessage htmlMsg = new NpcHtmlMessage(0); htmlMsg.setHtml(htmlContent.toString()); activeChar.sendPacket(htmlMsg); }
private void showTeleportCharWindow(L2PcInstance activeChar) { L2Object target = activeChar.getTarget(); L2PcInstance player = null; if (target.isPlayer) { player = (L2PcInstance) target; } else { activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET)); return; } NpcHtmlMessage adminReply = new NpcHtmlMessage(5); TextBuilder replyMSG = new TextBuilder("<html><title>Teleport Character</title>"); replyMSG.append("<body>"); replyMSG.append("The character you will teleport is " + player.getName() + "."); replyMSG.append("<br>"); replyMSG.append("Co-ordinate x"); replyMSG.append("<edit var=\"char_cord_x\" width=110>"); replyMSG.append("Co-ordinate y"); replyMSG.append("<edit var=\"char_cord_y\" width=110>"); replyMSG.append("Co-ordinate z"); replyMSG.append("<edit var=\"char_cord_z\" width=110>"); replyMSG.append( "<button value=\"Teleport\" action=\"bypass -h admin_teleport_character $char_cord_x $char_cord_y $char_cord_z\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"); replyMSG.append( "<button value=\"Teleport near you\" action=\"bypass -h admin_teleport_character " + activeChar.getX() + " " + activeChar.getY() + " " + activeChar.getZ() + "\" width=115 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">"); replyMSG.append( "<center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>"); replyMSG.append("</body></html>"); adminReply.setHtml(replyMSG.toString()); activeChar.sendPacket(adminReply); adminReply = null; replyMSG = null; player = null; target = null; }
/** * this displays PledgeSkillList to the player. * * @param player */ public void showPledgeSkillList(L2PcInstance player) { if (Config.DEBUG) { _log.info("PledgeSkillList activated on: " + getObjectId()); } if (player.getClan() == null) return; L2PledgeSkillLearn[] skills = SkillTreeTable.getInstance().getAvailablePledgeSkills(player); AquireSkillList asl = new AquireSkillList(AquireSkillList.skillType.Clan); int counts = 0; for (L2PledgeSkillLearn s : skills) { int cost = s.getRepCost(); counts++; asl.addSkill(s.getId(), s.getLevel(), s.getLevel(), cost, 0); } skills = null; if (counts == 0) { NpcHtmlMessage html = new NpcHtmlMessage(1); if (player.getClan().getLevel() < 8) { SystemMessage sm = new SystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN); sm.addNumber(player.getClan().getLevel() + 1); player.sendPacket(sm); sm = null; } else { TextBuilder sb = new TextBuilder(); sb.append("<html><body>"); sb.append("You've learned all skills available for your Clan.<br>"); sb.append("</body></html>"); html.setHtml(sb.toString()); player.sendPacket(html); html = null; sb = null; } } else { player.sendPacket(asl); } asl = null; player.sendPacket(ActionFailed.STATIC_PACKET); }
/** * Get the name of the character. Returns the last known name or someone along with the ID of the * character, in case its set that the IDs shall be shown. * * @param id ID of the character who's name is wanted * @return the name of the character or null */ @SuppressWarnings("nls") private String getName(final CharacterId id) { String name = null; if (names != null) { name = names.getName(id); } if (name == null) { if (showIDs) { final TextBuilder buildName = TextBuilder.newInstance(); buildName.setLength(0); buildName.append(Lang.getMsg("someone")); buildName.append(' '); buildName.append('('); buildName.append(id); buildName.append(')'); name = buildName.toString(); TextBuilder.recycle(buildName); } } return name; }
@Override public void onBypassFeedback(L2PcInstance player, String command) { String[] commandStr = command.split(" "); String actualCommand = commandStr[0]; // Get actual command String cmdParams = ""; String cmdParams2 = ""; if (commandStr.length >= 2) { cmdParams = commandStr[1]; } if (commandStr.length >= 3) { cmdParams2 = commandStr[2]; } commandStr = null; if (actualCommand.equalsIgnoreCase("create_clan")) { if (cmdParams.equals("")) return; ClanTable.getInstance().createClan(player, cmdParams); } else if (actualCommand.equalsIgnoreCase("create_academy")) { if (cmdParams.equals("")) return; createSubPledge(player, cmdParams, null, L2Clan.SUBUNIT_ACADEMY, 5); } else if (actualCommand.equalsIgnoreCase("create_royal")) { if (cmdParams.equals("")) return; createSubPledge(player, cmdParams, cmdParams2, L2Clan.SUBUNIT_ROYAL1, 6); } else if (actualCommand.equalsIgnoreCase("create_knight")) { if (cmdParams.equals("")) return; createSubPledge(player, cmdParams, cmdParams2, L2Clan.SUBUNIT_KNIGHT1, 7); } else if (actualCommand.equalsIgnoreCase("assign_subpl_leader")) { if (cmdParams.equals("")) return; assignSubPledgeLeader(player, cmdParams, cmdParams2); } else if (actualCommand.equalsIgnoreCase("create_ally")) { if (cmdParams.equals("")) return; if (!player.isClanLeader()) { player.sendPacket(new SystemMessage(SystemMessageId.ONLY_CLAN_LEADER_CREATE_ALLIANCE)); return; } player.getClan().createAlly(player, cmdParams); } else if (actualCommand.equalsIgnoreCase("dissolve_ally")) { if (!player.isClanLeader()) { player.sendPacket(new SystemMessage(SystemMessageId.FEATURE_ONLY_FOR_ALLIANCE_LEADER)); return; } player.getClan().dissolveAlly(player); } else if (actualCommand.equalsIgnoreCase("dissolve_clan")) { dissolveClan(player, player.getClanId()); } else if (actualCommand.equalsIgnoreCase("change_clan_leader")) { if (cmdParams.equals("")) return; changeClanLeader(player, cmdParams); } else if (actualCommand.equalsIgnoreCase("recover_clan")) { recoverClan(player, player.getClanId()); } else if (actualCommand.equalsIgnoreCase("increase_clan_level")) { if (!player.isClanLeader()) { player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT)); return; } player.getClan().levelUpClan(player); } else if (actualCommand.equalsIgnoreCase("learn_clan_skills")) { showPledgeSkillList(player); } else if (command.startsWith("Subclass")) { int cmdChoice = Integer.parseInt(command.substring(9, 10).trim()); // Subclasses may not be changed while a skill is in use. if (player.isCastingNow() || player.isAllSkillsDisabled()) { player.sendPacket( new SystemMessage(SystemMessageId.SUBCLASS_NO_CHANGE_OR_CREATE_WHILE_SKILL_IN_USE)); return; } if (player.getPet() != null && player.getPet().isSummonInstance) { if (player.getPet().isCastingNow() || player.getPet().isAllSkillsDisabled()) { player.sendPacket( new SystemMessage(SystemMessageId.SUBCLASS_NO_CHANGE_OR_CREATE_WHILE_SKILL_IN_USE)); return; } } if (player.isCursedWeaponEquiped()) { player.sendMessage("You can`t change Subclass while Cursed weapon equiped!"); return; } TextBuilder content = new TextBuilder("<html><body>"); NpcHtmlMessage html = new NpcHtmlMessage(getObjectId()); Set<PlayerClass> subsAvailable; int paramOne = 0; int paramTwo = 0; try { int endIndex = command.length(); if (command.length() > 13) { endIndex = 13; paramTwo = Integer.parseInt(command.substring(13).trim()); } paramOne = Integer.parseInt(command.substring(11, endIndex).trim()); } catch (Exception NumberFormatException) { } switch (cmdChoice) { case 1: // Add Subclass - Initial // Avoid giving player an option to add a new sub class, if they have three already. if (player.getTotalSubClasses() == Config.ALT_MAX_SUBCLASS_COUNT) { player.sendMessage("You can now only change one of your current sub classes."); return; } subsAvailable = getAvailableSubClasses(player); if (subsAvailable != null && !subsAvailable.isEmpty()) { content.append("Add Subclass:<br>Which sub class do you wish to add?<br>"); for (PlayerClass subClass : subsAvailable) { content.append( "<a action=\"bypass -h npc_" + getObjectId() + "_Subclass 4 " + subClass.ordinal() + "\" msg=\"1268;" + formatClassForDisplay(subClass) + "\">" + formatClassForDisplay(subClass) + "</a><br>"); } } else { player.sendMessage("There are no sub classes available at this time."); return; } break; case 2: // Change Class - Initial content.append("Change Subclass:<br>"); final int baseClassId = player.getBaseClass(); if (player.getSubClasses().isEmpty()) { content.append( "You can't change sub classes when you don't have a sub class to begin with.<br>" + "<a action=\"bypass -h npc_" + getObjectId() + "_Subclass 1\">Add subclass.</a>"); } else { content.append("Which class would you like to switch to?<br>"); if (baseClassId == player.getActiveClass()) { content.append( CharTemplateTable.getClassNameById(baseClassId) + " <font color=\"LEVEL\">(Base Class)</font><br><br>"); } else { content.append( "<a action=\"bypass -h npc_" + getObjectId() + "_Subclass 5 0\">" + CharTemplateTable.getClassNameById(baseClassId) + "</a> " + "<font color=\"LEVEL\">(Base Class)</font><br><br>"); } for (Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext(); ) { SubClass subClass = subList.next(); int subClassId = subClass.getClassId(); if (subClassId == player.getActiveClass()) { content.append(CharTemplateTable.getClassNameById(subClassId) + "<br>"); } else { content.append( "<a action=\"bypass -h npc_" + getObjectId() + "_Subclass 5 " + subClass.getClassIndex() + "\">" + CharTemplateTable.getClassNameById(subClassId) + "</a><br>"); } } } break; case 3: // Change/Cancel Subclass - Initial content.append( "Change Subclass:<br>Which of the following sub classes would you like to change?<br>"); int classIndex = 1; for (Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext(); ) { SubClass subClass = subList.next(); content.append("Sub-class " + classIndex + "<br1>"); content.append( "<a action=\"bypass -h npc_" + getObjectId() + "_Subclass 6 " + subClass.getClassIndex() + "\">" + CharTemplateTable.getClassNameById(subClass.getClassId()) + "</a><br>"); classIndex++; } content.append( "<br>If you change a sub class, you'll start at level 40 after the 2nd class transfer."); break; case 4: // Add Subclass - Action (Subclass 4 x[x]) boolean allowAddition = true; /* * If the character is less than level 75 on any of their previously chosen * classes then disallow them to change to their most recently added sub-class choice. */ if (player.getLevel() < 75) { player.sendMessage( "You may not add a new sub class before you are level 75 on your previous class."); allowAddition = false; } if (player._event != null) { player.sendMessage("Недоступно в данный момент."); return; } if (Olympiad.getInstance().isRegisteredInComp(player) || player.getOlympiadGameId() > 0) { player.sendPacket( new SystemMessage( SystemMessageId .YOU_HAVE_ALREADY_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_AN_EVENT)); return; } if (allowAddition) { if (!player.getSubClasses().isEmpty()) { for (Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext(); ) { SubClass subClass = subList.next(); if (subClass.getLevel() < 75) { player.sendMessage( "You may not add a new sub class before you are level 75 on your previous sub class."); allowAddition = false; break; } } } } /* * If quest checking is enabled, verify if the character has completed the Mimir's Elixir (Path to Subclass) * and Fate's Whisper (A Grade Weapon) quests by checking for instances of their unique reward items. * * If they both exist, remove both unique items and continue with adding the sub-class. */ if (!Config.ALT_GAME_SUBCLASS_WITHOUT_QUESTS) { QuestState qs = player.getQuestState("235_MimirsElixir"); if (qs == null || !qs.getState().getName().equalsIgnoreCase("Completed")) { player.sendMessage( "You must have completed the Mimir's Elixir quest to continue adding your sub class."); return; } /*qs = player.getQuestState("234_FatesWhisper"); if(qs == null || qs.getState().getName() != "Completed") { player.sendMessage("You must have completed the Fate's Whisper quest to continue adding your sub class."); return; }*/ } ////////////////// \\\\\\\\\\\\\\\\\\ if (allowAddition) { String className = CharTemplateTable.getClassNameById(paramOne); if (!player.addSubClass(paramOne, player.getTotalSubClasses() + 1)) { player.sendMessage("The sub class could not be added."); return; } player.setActiveClass(player.getTotalSubClasses()); content.append( "Add Subclass:<br>The sub class of <font color=\"LEVEL\">" + className + "</font> has been added."); player.sendPacket( new SystemMessage(SystemMessageId.CLASS_TRANSFER)); // Transfer to new class. className = null; } else { html.setFile("data/html/villagemaster/SubClass_Fail.htm"); } break; case 5: // Change Class - Action /* * If the character is less than level 75 on any of their previously chosen * classes then disallow them to change to their most recently added sub-class choice. * fix: in waiting for battle in oly can change sublcass * Note: paramOne = classIndex */ if (Olympiad.getInstance().isRegisteredInComp(player) || player.getOlympiadGameId() > 0 || Olympiad.getInstance().isRegistered(player)) { player.sendPacket( new SystemMessage( SystemMessageId .YOU_HAVE_ALREADY_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_AN_EVENT)); return; } // sub class exploit fix if (!FloodProtector.getInstance() .tryPerformAction(player.getObjectId(), FloodProtector.PROTECTED_SUBCLASS)) { player.sendMessage( "You can change Subclass only every " + Config.PROTECTED_SUBCLASS_C + " Millisecond(s)"); return; } player.setActiveClass(paramOne); content.append( "Change Subclass:<br>Your active sub class is now a <font color=\"LEVEL\">" + CharTemplateTable.getClassNameById(player.getActiveClass()) + "</font>."); player.sendPacket( new SystemMessage( SystemMessageId.SUBCLASS_TRANSFER_COMPLETED)); // Transfer completed. break; case 6: // Change/Cancel Subclass - Choice content.append( "Please choose a sub class to change to. If the one you are looking for is not here, " + "please seek out the appropriate master for that class.<br>" + "<font color=\"LEVEL\">Warning!</font> All classes and skills for this class will be removed.<br><br>"); subsAvailable = getAvailableSubClasses(player); if (subsAvailable != null && !subsAvailable.isEmpty()) { for (PlayerClass subClass : subsAvailable) { content.append( "<a action=\"bypass -h npc_" + getObjectId() + "_Subclass 7 " + paramOne + " " + subClass.ordinal() + "\">" + formatClassForDisplay(subClass) + "</a><br>"); } } else { player.sendMessage("There are no sub classes available at this time."); return; } break; case 7: // Change Subclass - Action // check player skills if (Config.CHECK_SKILLS_ON_ENTER && !Config.ALT_GAME_SKILL_LEARN) { player.checkAllowedSkills(); } /* * Warning: the information about this subclass will be removed from the * subclass list even if false! */ if (!FloodProtector.getInstance() .tryPerformAction(player.getObjectId(), FloodProtector.PROTECTED_SUBCLASS)) { _log.warn("Player " + player.getName() + " has performed a subclass change too fast"); player.sendMessage( "You can change Subclass only every " + Config.PROTECTED_SUBCLASS_C + " Millisecond(s)"); return; } if (player.modifySubClass(paramOne, paramTwo)) { player.setActiveClass(paramOne); content.append( "Change Subclass:<br>Your sub class has been changed to <font color=\"LEVEL\">" + CharTemplateTable.getClassNameById(paramTwo) + "</font>."); player.sendPacket( new SystemMessage(SystemMessageId.ADD_NEW_SUBCLASS)); // Subclass added. // check player skills if (Config.CHECK_SKILLS_ON_ENTER && !Config.ALT_GAME_SKILL_LEARN) { player.checkAllowedSkills(); } } else { /* * This isn't good! modifySubClass() removed subclass from memory * we must update _classIndex! Else IndexOutOfBoundsException can turn * up some place down the line along with other seemingly unrelated * problems. */ player.setActiveClass( 0); // Also updates _classIndex plus switching _classid to baseclass. player.sendMessage( "The sub class could not be added, you have been reverted to your base class."); return; } break; } content.append("</body></html>"); // If the content is greater than for a basic blank page, // then assume no external HTML file was assigned. if (content.length() > 26) { html.setHtml(content.toString()); } player.sendPacket(html); content = null; html = null; subsAvailable = null; } else { // this class dont know any other commands, let forward // the command to the parent class super.onBypassFeedback(player, command); } actualCommand = null; cmdParams = null; cmdParams2 = null; }