Пример #1
0
 public void start(MapleClient c, short questid, int npc) {
   MapleQuest quest = MapleQuest.getInstance(questid);
   if (!c.getPlayer().getQuest(quest).getStatus().equals(MapleQuestStatus.Status.NOT_STARTED)) {
     dispose(c);
     return;
   }
   try {
     QuestActionManager qm = new QuestActionManager(c, questid, npc, true);
     if (qms.containsKey(c)) {
       return;
     }
     if (c.canClickNPC()) {
       qms.put(c, qm);
       Invocable iv = getInvocable("quest/" + questid + ".js", c);
       if (iv == null) {
         FilePrinter.printError(
             FilePrinter.QUEST_UNCODED, "Quest " + questid + " is uncoded.\r\n");
       }
       if (iv == null || QuestScriptManager.getInstance() == null) {
         qm.dispose();
         return;
       }
       engine.put("qm", qm);
       scripts.put(c, iv);
       c.setClickedNPC();
       iv.invokeFunction("start", (byte) 1, (byte) 0, 0);
     }
   } catch (final UndeclaredThrowableException ute) {
     FilePrinter.printError(FilePrinter.QUEST + questid + ".txt", ute);
     dispose(c);
   } catch (final Throwable t) {
     FilePrinter.printError(FilePrinter.QUEST + getQM(c).getQuest() + ".txt", t);
     dispose(c);
   }
 }
Пример #2
0
 @Override
 public int execute(MapleClient c, String[] splitted) {
   c.removeClickedNPC();
   NPCScriptManager.getInstance().dispose(c);
   ItemScriptManager.getInstance().dispose(c);
   QuestScriptManager.getInstance().dispose(c);
   c.getSession().write(MaplePacketCreator.enableActions());
   c.getPlayer().dropMessage(6, "解卡成功。");
   return 1;
 }
Пример #3
0
 public QuestActionManager getQM() {
   return QuestScriptManager.getInstance().getQM(this);
 }