コード例 #1
0
  @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) {
      return false;
    }

    if (targetId == 0) {
      if (env.getDialogId() == DialogAction.QUEST_ACCEPT_1.id()) {
        qs.setStatus(QuestStatus.START);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 204373) {
      if (qs != null && qs.getStatus() == QuestStatus.START) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 2375);
        } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()
            && qs.getStatus() != QuestStatus.COMPLETE
            && qs.getStatus() != QuestStatus.NONE) {
          removeQuestItem(env, 182204123, 1);
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return sendQuestEndDialog(env);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
コード例 #2
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (env.getVisibleObject() instanceof Npc) {
      targetId = ((Npc) env.getVisibleObject()).getNpcId();
    }
    if (targetId == 0) {
      if (env.getDialogId() == DialogAction.QUEST_ACCEPT_1.id()) {
        QuestService.startQuest(env);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 700513) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        switch (env.getDialog()) {
          case USE_OBJECT:
            {
              if (player.getInventory().getItemCountByItemId(182201823) == 0) {
                return giveQuestItem(env, 182201823, 1);
              }
            }
        }
      }
    }
    if (qs == null) {
      return false;
    }

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798072) {
        if (env.getDialog() == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 2375);
        } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) {
          return sendQuestDialog(env, 5);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 798072) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 0) {
            return sendQuestDialog(env, 1352);
          }
        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;
          }
          return false;
      }
    } else if (targetId == 204571) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 1) {
            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;
          }
          return false;
      }
    } else if (targetId == 798013) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 2) {
            return sendQuestDialog(env, 2034);
          }
        case SETPRO3:
          if (var == 2) {
            {
              qs.setQuestVarById(0, var + 1);
              qs.setStatus(QuestStatus.REWARD);
              updateQuestStatus(env);
              if (giveQuestItem(env, 182201824, 1)) ;
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
          }
          return false;
      }
    }
    return false;
  }
コード例 #3
0
  @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 (targetId == 0) {
      if (env.getDialogId() == DialogAction.QUEST_ACCEPT_1.id()) {
        QuestService.startQuest(env);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    }

    if (qs != null && qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 204545:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  if (qs.getQuestVarById(0) == 0) {
                    return sendQuestDialog(env, 1352);
                  } else if (qs.getQuestVarById(0) == 2) {
                    return sendQuestDialog(env, 2034);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1);
                }
              case SETPRO3:
                {
                  qs.setQuestVar(3);
                  return defaultCloseDialog(env, 3, 3, true, false);
                }
            }
          }
        case 204537:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  return sendQuestDialog(env, 1693);
                }
              case SETPRO2:
                {
                  return defaultCloseDialog(env, 1, 2, 0, 0, 182201765, 1);
                }
            }
          }
      }
    } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204546) {
        switch (env.getDialog()) {
          case QUEST_SELECT:
            {
              return sendQuestDialog(env, 2375);
            }
          default:
            {
              return sendQuestEndDialog(env);
            }
        }
      }
    }
    return false;
  }