@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { final Properties helpFile = CMLib.help().getHelpFile(); if (helpFile.size() == 0) { if (mob != null) mob.tell(L("No help is available.")); return false; } doTopics(mob, helpFile, "HELP", "PLAYER TOPICS"); return false; }
@Override public boolean execute(MOB mob, Vector<String> commands, int metaFlags) { String helpStr = CMParms.combine(commands, 1); if (CMLib.help().getArcHelpFile().size() == 0) { mob.tell("No archon help is available."); return false; } String thisTag = null; if (helpStr.length() == 0) { StringBuffer thisBuf = Resources.getFileResource("help/arc_help.txt", true); if (thisBuf != null) thisTag = thisBuf.toString(); } else thisTag = CMLib.help().getHelpText(helpStr, CMLib.help().getArcHelpFile(), mob); if (thisTag == null) { mob.tell( "No archon help is available on " + helpStr + " .\r\nEnter 'COMMANDS' for a command list, or 'TOPICS' for a complete list."); Log.errOut("Help: " + mob.name() + " wanted archon help on " + helpStr); } else if (!mob.isMonster()) mob.session().wraplessPrintln(thisTag); return false; }
@SuppressWarnings({"unchecked", "rawtypes"}) public String runMacro(HTTPRequest httpReq, String parm) { java.util.Map<String, String> parms = parseParms(parm); String last = httpReq.getUrlParameter("HELPTOPIC"); if (parms.containsKey("RESET")) { if (last != null) httpReq.removeUrlParameter("HELPTOPIC"); httpReq.removeUrlParameter("HELPFIRSTLETTER"); return ""; } else if (parms.containsKey("DATA")) { int limit = 78; if (parms.containsKey("LIMIT")) limit = CMath.s_int(parms.get("LIMIT")); if ((last != null) && (last.length() > 0)) { StringBuilder s = CMLib.help().getHelpText(last, null, parms.containsKey("AHELP")); if (s != null) return clearWebMacros(helpHelp(s, limit).toString()); } return ""; } else if (parms.containsKey("NEXTLETTER")) { String fletter = httpReq.getUrlParameter("HELPFIRSTLETTER"); if ((fletter == null) || (fletter.length() == 0)) fletter = "A"; else if (fletter.charAt(0) >= 'Z') { httpReq.addFakeUrlParameter("HELPFIRSTLETTER", ""); return " @break@"; } else fletter = Character.toString((char) (fletter.charAt(0) + 1)); httpReq.addFakeUrlParameter("HELPFIRSTLETTER", fletter); } else if (parms.containsKey("NEXT")) { List<String> topics = null; if (parms.containsKey("ARCHON")) { topics = (List) httpReq.getRequestObjects().get("HELP_ARCHONTOPICS"); if (topics == null) { topics = CMLib.help().getTopics(true, false); httpReq.getRequestObjects().put("HELP_ARCHONTOPICS", topics); } } else if (parms.containsKey("BOTH")) { topics = (List) httpReq.getRequestObjects().get("HELP_BOTHTOPICS"); if (topics == null) { topics = CMLib.help().getTopics(true, true); httpReq.getRequestObjects().put("HELP_BOTHTOPICS", topics); } } else { topics = (List) httpReq.getRequestObjects().get("HELP_HELPTOPICS"); if (topics == null) { topics = CMLib.help().getTopics(false, true); httpReq.getRequestObjects().put("HELP_HELPTOPICS", topics); } } boolean noables = parms.containsKey("SHORT"); String fletter = parms.get("FIRSTLETTER"); if (fletter == null) fletter = httpReq.getUrlParameter("FIRSTLETTER"); if (fletter == null) fletter = ""; String lastID = ""; for (int h = 0; h < topics.size(); h++) { String topic = topics.get(h); if (noables && CMLib.help().isPlayerSkill(topic)) continue; if (topic.startsWith(fletter) || (fletter.length() == 0)) if ((last == null) || ((last.length() > 0) && (last.equals(lastID)) && (!topic.equals(lastID)))) { httpReq.addFakeUrlParameter("HELPTOPIC", topic); return ""; } lastID = topic; } httpReq.addFakeUrlParameter("HELPTOPIC", ""); if (parms.containsKey("EMPTYOK")) return "<!--EMPTY-->"; return " @break@"; } else if (last != null) return last; return "<!--EMPTY-->"; }