コード例 #1
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204501) return defaultQuestEndDialog(env);
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 204020) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 0) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
        case 10000:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 204501) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 1) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
          else if (var == 2)
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
        case 33:
          if (QuestService.collectItemCheck(env, true)) {
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
          } else return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 10001);
        case 1353:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 191));
          break;
        case 10001:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    }
    return false;
  }
コード例 #2
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 799546) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1011);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      switch (targetId) {
        case 204108:
          {
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) {
                    return sendQuestDialog(env, 1352);
                  } else if (var == 1) {
                    return sendQuestDialog(env, 2375);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1);
                }
              case CHECK_USER_HAS_QUEST_ITEM_SIMPLE:
                {
                  if (QuestService.collectItemCheck(env, true)) {
                    changeQuestStep(env, 1, 1, true);
                    return sendQuestDialog(env, 5);
                  } else {
                    return closeDialogWindow(env);
                  }
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204108) {
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();

    QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) {
      targetId = ((Npc) env.getVisibleObject()).getNpcId();
    }

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 798452) { // Darfen
        if (env.getDialog() == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1011);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    }

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798452:
          { // Darfen
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  return sendQuestDialog(env, 2375);
                }
              case CHECK_USER_HAS_QUEST_ITEM:
                {
                  if (QuestService.collectItemCheck(env, true)) {
                    changeQuestStep(env, 0, 0, true);
                    return sendQuestDialog(env, 5);
                  } else {
                    return sendQuestDialog(env, 2716);
                  }
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798452) { // Darfen
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
コード例 #4
0
 @Override
 public boolean onKillEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   int targetId = env.getTargetId();
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
       case 286904:
       case 281419:
       case 215795:
         {
           if (QuestService.collectItemCheck(env, true)) {
             return giveQuestItem(env, 182213290, 1);
           }
         }
     }
   }
   return false;
 }
コード例 #5
0
 @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);
 }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    if (sendQuestNoneDialog(env, 798959, 4762)) {
      return true;
    }

    final Player player = env.getPlayer();

    QuestState qs = env.getPlayer().getQuestStateList().getQuestState(questId);
    if (qs == null) {
      return false;
    }
    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (env.getTargetId() == 798959) {
        if (env.getDialog() == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) {
          return sendQuestDialog(env, 5);
        } else {
          return sendQuestEndDialog(env);
        }
      }
      return false;
    }
    if (qs.getStatus() == QuestStatus.START) {
      switch (env.getTargetId()) {
        case 798959:
          switch (env.getDialog()) {
            case QUEST_SELECT:
              if (var == 0) {
                return sendQuestDialog(env, 1011);
              } else if (var == 1) {
                return sendQuestDialog(env, 1352);
              }
            case CHECK_USER_HAS_QUEST_ITEM:
              if (var == 0) {
                if (QuestService.collectItemCheck(env, true)) {
                  qs.setQuestVarById(0, var + 1);
                  updateQuestStatus(env);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                  return true;
                } else {
                  return sendQuestDialog(env, 10001);
                }
              }
            case SETPRO2:
              if (var == 1) {
                if (!giveQuestItem(env, 182206726, 1)) {
                  return true;
                }
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
              }
              return true;
          }
      }
    }
    return false;
  }
コード例 #7
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) {
      return false;
    }

    int var = qs.getQuestVarById(0);
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) {
      targetId = ((Npc) env.getVisibleObject()).getNpcId();
    }

    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204715) {
        if (env.getDialog() == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) {
          return sendQuestDialog(env, 5);
        } else {
          return sendQuestEndDialog(env);
        }
      }
      return false;
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 204715) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 0) {
            return sendQuestDialog(env, 1011);
          }
        case SETPRO1:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        default:
          break;
      }
    } else if (targetId == 204801) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 1) {
            return sendQuestDialog(env, 1352);
          } else if (var == 7) {
            return sendQuestDialog(env, 1693);
          }
        case SETPRO2:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case SETPRO3:
          if (var == 7) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        default:
          break;
      }
    } else if (targetId == 204805) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 8) {
            return sendQuestDialog(env, 2034);
          }
          if (var == 9) {
            return sendQuestDialog(env, 2375);
          }
        case CHECK_USER_HAS_QUEST_ITEM:
          if (QuestService.collectItemCheck(env, true)) {
            if (!giveQuestItem(env, 182204304, 1)) {
              return true;
            }
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            return sendQuestDialog(env, 10000);
          } else {
            return sendQuestDialog(env, 10001);
          }
        case SETPRO4:
          if (var == 8) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        default:
          break;
      }
    }
    return false;
  }
コード例 #8
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204501) return defaultQuestEndDialog(env);
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 204501) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 0) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
          else if (var == 4)
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
          return false;
        case 10000:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10004:
          if (var == 4) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 204582) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 1) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
          else if (var == 3)
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2034);
          return false;
        case 10001:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10003:
          if (var == 3) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            ItemService.decreaseItemCountByItemId(player, 182201601, 1);
            return true;
          }
          return false;
      }
    } else if (targetId == 203882) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 5) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2716);
        case 10005:
          if (var == 5) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 278503) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 6) return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3057);
          else if (var == 7)
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3398);
        case 33:
          if (QuestService.collectItemCheck(env, true)) {
            qs.setQuestVarById(0, var + 1);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 10000);
          } else return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 10001);
        case 10006:
          if (var == 6) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10007:
          if (var == 7) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 700217 && qs.getQuestVarById(0) == 2) {
      if (env.getDialogId() == -1) {
        final int targetObjectId = env.getVisibleObject().getObjectId();
        PacketSendUtility.sendPacket(
            player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 1));
        PacketSendUtility.broadcastPacket(
            player, new SM_EMOTION(player, EmotionType.NEUTRALMODE2, 0, targetObjectId), true);
        ThreadPoolManager.getInstance()
            .schedule(
                new Runnable() {
                  @Override
                  public void run() {
                    PacketSendUtility.sendPacket(
                        player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                    PacketSendUtility.broadcastPacket(
                        player,
                        new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                        true);
                    sendQuestDialog(player, targetObjectId, 1693);
                  }
                },
                3000);
      } else if (qs.getQuestVarById(0) == 2 && env.getDialogId() == 10002) {
        PacketSendUtility.sendPacket(
            player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
        ItemService.addItems(player, Collections.singletonList(new QuestItems(182201601, 1)));
        qs.setQuestVarById(0, 3);
        updateQuestStatus(player, qs);
        return true;
      }
    } else if (targetId == 700303 && qs.getQuestVarById(0) == 7) {
      if (env.getDialogId() == -1) {
        final int targetObjectId = env.getVisibleObject().getObjectId();
        PacketSendUtility.sendPacket(
            player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 1));
        PacketSendUtility.broadcastPacket(
            player, new SM_EMOTION(player, EmotionType.NEUTRALMODE2, 0, targetObjectId), true);
        ThreadPoolManager.getInstance()
            .schedule(
                new Runnable() {
                  @Override
                  public void run() {
                    PacketSendUtility.sendPacket(
                        player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                    PacketSendUtility.broadcastPacket(
                        player,
                        new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                        true);
                    ItemService.addItems(
                        player, Collections.singletonList(new QuestItems(182201602, 1)));
                  }
                },
                3000);
      }
    }
    return false;
  }