示例#1
0
 public void end(MapleClient c, short questid, int npc) {
   MapleQuest quest = MapleQuest.getInstance(questid);
   if (!c.getPlayer().getQuest(quest).getStatus().equals(MapleQuestStatus.Status.STARTED)
       || !c.getPlayer().getMap().containsNPC(npc)) {
     dispose(c);
     return;
   }
   try {
     QuestActionManager qm = new QuestActionManager(c, questid, npc, false);
     if (qms.containsKey(c)) {
       return;
     }
     if (c.canClickNPC()) {
       qms.put(c, qm);
       Invocable iv = getInvocable("quest/" + questid + ".js", c);
       if (iv == null) {
         qm.dispose();
         return;
       }
       engine.put("qm", qm);
       scripts.put(c, iv);
       c.setClickedNPC();
       iv.invokeFunction("end", (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
 public void start(MapleClient c, byte mode, byte type, int selection) {
   Invocable iv = scripts.get(c);
   if (iv != null) {
     try {
       c.setClickedNPC();
       iv.invokeFunction("start", mode, type, selection);
     } catch (final UndeclaredThrowableException ute) {
       FilePrinter.printError(FilePrinter.QUEST + getQM(c).getQuest() + ".txt", ute);
       dispose(c);
     } catch (final Throwable t) {
       FilePrinter.printError(FilePrinter.QUEST + getQM(c).getQuest() + ".txt", t);
       dispose(c);
     }
   }
 }