@Override
 public boolean onDialogEvent(QuestEnv env) {
   final Player player = env.getPlayer();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) {
     targetId = ((Npc) env.getVisibleObject()).getNpcId();
   }
   if (targetId == 798926) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) {
         return sendQuestDialog(env, 1011);
       } else {
         return sendQuestStartDialog(env);
       }
     } else if (qs.getStatus() == QuestStatus.START) {
       long itemCount;
       if (env.getDialog() == DialogAction.QUEST_SELECT && qs.getQuestVarById(0) == 0) {
         return sendQuestDialog(env, 2375);
       } else if (env.getDialogId() == DialogAction.CHECK_USER_HAS_QUEST_ITEM.id()
           && qs.getQuestVarById(0) == 0) {
         itemCount = player.getInventory().getItemCountByItemId(182209601);
         if (itemCount > 0) {
           removeQuestItem(env, 182209601, 1);
           qs.setStatus(QuestStatus.REWARD);
           updateQuestStatus(env);
           return sendQuestDialog(env, 5);
         } else {
           return sendQuestDialog(env, 2716);
         }
       } else {
         return sendQuestEndDialog(env);
       }
     } else {
       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 == 203792) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 4762);
        else return sendQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs != null && qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798013:
          switch (env.getDialog()) {
            case QUEST_SELECT:
              return sendQuestDialog(env, 1011);
            case SETPRO10:
              if (!giveQuestItem(env, 152202049, 1)) return true;
              if (!giveQuestItem(env, 152020249, 1)) return true;
              qs.setQuestVarById(0, 1);
              updateQuestStatus(env);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            case SETPRO20:
              if (!giveQuestItem(env, 152202050, 1)) return true;
              if (!giveQuestItem(env, 152020249, 1)) return true;
              qs.setQuestVarById(0, 1);
              updateQuestStatus(env);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
          }
        case 203792:
          switch (env.getDialog()) {
            case QUEST_SELECT:
              long itemCount1 = player.getInventory().getItemCountByItemId(182206767);
              if (itemCount1 > 0) {
                removeQuestItem(env, 182206767, 1);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                return sendQuestDialog(env, 1352);
              } else return sendQuestDialog(env, 10001);
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203792) {
        if (env.getDialogId() == DialogAction.CHECK_USER_HAS_QUEST_ITEM.id())
          return sendQuestDialog(env, 5);
        else return sendQuestEndDialog(env);
      }
    }
    return false;
  }