Beispiel #1
0
  @Override
  public HandlerResult onItemUseEvent(final QuestEnv env, Item item) {

    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs != null && qs.getStatus() == QuestStatus.START) {
      if (player.isInsideZone(ZoneName.get("BERITRAS_WEAPON_220040000"))) {
        QuestService.questTimerStart(env, 300);
        return HandlerResult.fromBoolean(useQuestItem(env, item, 0, 1, false, 182204426, 1, 0));
      }
    }
    return HandlerResult.SUCCESS; // ??
  }
 @Override
 public boolean onDialogEvent(QuestEnv env) {
   QuestState qs = env.getPlayer().getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() == QuestStatus.NONE) {
     if (env.getTargetId() == 203621) {
       switch (env.getDialog()) {
         case QUEST_SELECT:
           return sendQuestDialog(env, 1011);
         case ASK_QUEST_ACCEPT:
           return sendQuestDialog(env, 4);
         case QUEST_ACCEPT_1:
           return sendQuestDialog(env, 1003);
         case QUEST_REFUSE_1:
           return sendQuestDialog(env, 1004);
         case SETPRO1:
           if (QuestService.startQuest(env)) {
             QuestService.questTimerStart(env, 1800);
             return true;
           } else return false;
       }
     }
   }
   if (qs == null) return false;
   int var = qs.getQuestVarById(0);
   if (qs.getStatus() == QuestStatus.START) {
     if (env.getTargetId() == 203621) {
       switch (env.getDialog()) {
         case QUEST_SELECT:
           if (var == 0) return sendQuestDialog(env, 2375);
         case CHECK_USER_HAS_QUEST_ITEM:
           if (var == 0) {
             if (QuestService.collectItemCheck(env, true)) {
               qs.setStatus(QuestStatus.REWARD);
               updateQuestStatus(env);
               QuestService.questTimerEnd(env);
               return sendQuestDialog(env, 5);
             } else return sendQuestDialog(env, 2716);
           }
       }
     }
   }
   return sendQuestRewardDialog(env, 203621, 0);
 }
Beispiel #3
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) {
      return false;
    }
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      switch (targetId) {
        case 205987:
          { // Garnon
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) {
                    return sendQuestDialog(env, 1011);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1); // 1
                }
            }
            break;
          }
        case 730493:
          { // Protector's Seal
            switch (dialog) {
              case USE_OBJECT:
                {
                  if (var == 2) {
                    changeQuestStep(env, 2, 3, false); // 3
                    QuestService.questTimerStart(env, 180); // 3 minutes
                    QuestService.invisibleTimerStart(
                        env, 170); // 2:50 minutes invisible timer for dragon spawn
                    // doesent work. maybe should be 2:40?
                    spawn(player);
                    return true;
                  }
                }
            }
            break;
          }
        case 205795:
          { // Oriata should be spawned after timer ends?
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 4) {
                    return sendQuestDialog(env, 2375);
                  } else if (var == 5) {
                    playQuestMovie(env, 709);
                    return sendQuestDialog(env, 2716);
                  }
                }
              case CHECK_USER_HAS_QUEST_ITEM:
                {
                  return checkQuestItems(env, 5, 5, true, 10000, 10001); // reward
                }
              case SETPRO5:
                {
                  return defaultCloseDialog(env, 4, 5); // 5
                }
              case FINISH_DIALOG:
                {
                  return closeDialogWindow(env);
                }
            }
            break;
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 205535) { // Killios
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }