@Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 801547) {
        switch (env.getDialog()) {
          case QUEST_SELECT:
            return sendQuestDialog(env, 4762);
          case QUEST_ACCEPT_SIMPLE:
            return sendQuestStartDialog(env);
          case QUEST_REFUSE_SIMPLE:
            return sendQuestEndDialog(env);
        }
      }
    } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
      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;
  }
  @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 == 203782) {
        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 203783:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                return sendQuestDialog(env, 1011);
              case SETPRO1:
                if (!giveQuestItem(env, 122001251, 1)) return true;
                qs.setQuestVarById(0, 1);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
        case 203782:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  long itemCount1 = player.getInventory().getItemCountByItemId(152003007);
                  long itemCount2 = player.getInventory().getItemCountByItemId(152003008);
                  if (itemCount1 > 0 && itemCount2 > 0) {
                    removeQuestItem(env, 152003007, 1);
                    removeQuestItem(env, 152003008, 1);
                    qs.setStatus(QuestStatus.REWARD);
                    updateQuestStatus(env);
                    return sendQuestDialog(env, 1352);
                  } else return sendQuestDialog(env, 10001);
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203782) {
        if (env.getDialogId() == DialogAction.CHECK_USER_HAS_QUEST_ITEM.id())
          return sendQuestDialog(env, 5);
        else return sendQuestEndDialog(env);
      }
    }
    return false;
  }
  @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 (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (env.getDialogId() == DialogAction.QUEST_ACCEPT_1.id()) {
        QuestService.startQuest(env);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      } else PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
    } else if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 278592) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1352);
        else if (env.getDialog() == DialogAction.SETPRO1) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        }
      } else if (targetId == 203933) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1693);
        else if (env.getDialog() == DialogAction.SETPRO2) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        }
      } else if (targetId == 203991) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 2375);
        else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return sendQuestEndDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD && targetId == 203991) {
      return sendQuestEndDialog(env);
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = env.getTargetId();

    if (!butlers.contains(targetId)) return false;

    House house = player.getActiveHouse();
    if (house == null || house.getButler() == null || house.getButler().getNpcId() != targetId)
      return false;

    DialogAction dialog = env.getDialog();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      switch (dialog) {
        case QUEST_SELECT:
          return sendQuestDialog(env, 1011);
        case QUEST_ACCEPT_1:
        case QUEST_ACCEPT_SIMPLE:
          return sendQuestStartDialog(env, 182213191, 1);
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      switch (dialog) {
        case USE_OBJECT:
          return sendQuestDialog(env, 2375);
        case SELECT_QUEST_REWARD:
          removeQuestItem(env, 182213191, 1);
        case SELECTED_QUEST_NOREWARD:
          sendQuestEndDialog(env);
          return true;
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    DialogAction dialog = env.getDialog();
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 204006) { // Demokritos
        if (dialog == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011);
        else return sendQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      if (targetId == 203765) { // Kreon
        switch (dialog) {
          case QUEST_SELECT:
            if (var == 0) return sendQuestDialog(env, 1352);
          case SETPRO1:
            if (var == 0) return defaultCloseDialog(env, 0, 1);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204006) return sendQuestEndDialog(env);
    }
    return false;
  }
  @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 == 798225) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1011);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 798226) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 2375);
        } else if (dialog == DialogAction.SELECT_QUEST_REWARD) {
          return defaultCloseDialog(env, 0, 1, true, true);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798226) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 5);
        }
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (targetId == 204720) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011);
        else if (env.getDialogId() == DialogAction.QUEST_ACCEPT_1.id()) {
          if (giveQuestItem(env, 182204404, 1)) return sendQuestStartDialog(env);
          else return true;
        } else return sendQuestStartDialog(env);
      }
    }
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204720) {
        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 == 204731) {
      switch (env.getDialog()) {
        case QUEST_SELECT:
          if (var == 0) return sendQuestDialog(env, 1352);
        case SETPRO1:
          if (var == 0) {
            removeQuestItem(env, 182204404, 1);
            if (!giveQuestItem(env, 182204405, 1)) {}
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    }
    return false;
  }
  @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.START) {
      switch (targetId) {
        case 204191:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                if (var == 0) return sendQuestDialog(env, 1352);
                break;
              case SETPRO1:
                if (var == 0) {
                  qs.setQuestVarById(0, var + 1);
                  updateQuestStatus(env);
                  TeleportService2.teleportTo(
                      player, 220030000, player.getInstanceId(), 1748f, 1807f, 255f);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                  return true;
                }
            }
          }
        case 203559:
          switch (env.getDialog()) {
            case QUEST_SELECT:
              if (var == 1) {
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                return sendQuestDialog(env, 2375);
              }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203559) {
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
  @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 == 204339) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 4762);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 204339) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1003);
        } else if (dialog == DialogAction.SELECT_ACTION_1012) {
          giveQuestItem(env, 182204147, 1);
          return sendQuestDialog(env, 1012);
        } else if (dialog == DialogAction.SELECT_ACTION_1097) {
          giveQuestItem(env, 182204147, 1);
          return sendQuestDialog(env, 1097);
        } else if (dialog == DialogAction.SETPRO10) {
          changeQuestStep(env, 0, 10, false);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return closeDialogWindow(env);
        } else if (dialog == DialogAction.SETPRO20) {
          rewardIndex = 1;
          changeQuestStep(env, 0, 20, false);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return closeDialogWindow(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798079) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 1352);
        }
      } else if (targetId == 798080) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 1693);
        }
      }
      return sendQuestEndDialog(env, rewardIndex);
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = env.getTargetId();
    DialogAction dialog = env.getDialog();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 830211) {
        switch (dialog) {
          case QUEST_SELECT:
            return sendQuestDialog(env, 1011);
          case QUEST_ACCEPT_1:
          case QUEST_ACCEPT_SIMPLE:
            return sendQuestStartDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 730524:
          {
            switch (dialog) {
              case QUEST_SELECT:
                return sendQuestDialog(env, 1352);
              case SELECT_ACTION_1353:
                return sendQuestDialog(env, 1353);
              case SETPRO1:
                return defaultCloseDialog(env, 0, 1);
            }
            break;
          }
        case 830211:
          {
            switch (dialog) {
              case QUEST_SELECT:
                {
                  return sendQuestDialog(env, 2375);
                }
              case SELECT_QUEST_REWARD:
                changeQuestStep(env, 1, 1, true);
                return sendQuestDialog(env, 5);
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 830211) {
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
  @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 == 204261) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 4762);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 204261) {
        if (dialog == DialogAction.QUEST_SELECT) {
          if (qs.getQuestVarById(0) == 0) return sendQuestDialog(env, 1003);
        } else if (dialog == DialogAction.SELECT_ACTION_1012) {
          return sendQuestDialog(env, 1012);
        } else if (dialog == DialogAction.SELECT_ACTION_1097) {
          return sendQuestDialog(env, 1097);
        } else if (dialog == DialogAction.SETPRO10) {
          qs.setQuestVar(10);
          return defaultCloseDialog(env, 10, 10, true, false);
        } else if (dialog == DialogAction.SETPRO20) {
          qs.setQuestVar(20);
          return defaultCloseDialog(env, 20, 20, true, false);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798058 && qs.getQuestVarById(0) == 10) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 1352);
        }
        return sendQuestEndDialog(env);
      } else if (targetId == 204108 && qs.getQuestVarById(0) == 20) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 1693);
        }
        return sendQuestEndDialog(env, 1);
      }
    }
    return false;
  }
 @Override
 public boolean onDialogEvent(QuestEnv env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (targetId == 278003) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011);
       else return sendQuestStartDialog(env);
     }
   } else if (targetId == 278000) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1352);
       else if (env.getDialog() == DialogAction.SETPRO1) {
         qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return sendQuestStartDialog(env);
     }
   } else if (targetId == 278013) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1352);
       else if (env.getDialog() == DialogAction.SETPRO1) {
         qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return sendQuestStartDialog(env);
     }
   } else if (targetId == 278102) {
     if (qs != null) {
       if (env.getDialog() == DialogAction.QUEST_SELECT && qs.getStatus() == QuestStatus.START)
         return sendQuestDialog(env, 2375);
       else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()
           && qs.getStatus() == QuestStatus.START) {
         qs.setQuestVar(2);
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         return sendQuestEndDialog(env);
       } else return sendQuestEndDialog(env);
     }
   }
   return false;
 }
  @Override
  public boolean onDialogEvent(final QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 204787) { // Chieftain Akagitan
        if (dialog == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 4762);
        else if (dialog == DialogAction.QUEST_ACCEPT_1) {
          if (!giveQuestItem(env, 182204498, 1)) return true;
          return sendQuestStartDialog(env);
        } else return sendQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      if (targetId == 204824) {
        switch (dialog) {
          case QUEST_SELECT:
            if (var == 0) return sendQuestDialog(env, 1011);
          case SETPRO1:
            if (var == 0) {
              qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
              updateQuestStatus(env);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              final Npc npc = (Npc) env.getVisibleObject();
              ThreadPoolManager.getInstance()
                  .schedule(
                      new Runnable() {
                        @Override
                        public void run() {
                          npc.getController().onDelete();
                        }
                      },
                      40000);
              return true;
            }
        }
      }
      if (targetId == 700323) { // Hugh mamut skull
        switch (dialog) {
          case USE_OBJECT:
            if (var == 0) {
              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() {
                          @SuppressWarnings("unused")
                          final QuestState qs = player.getQuestStateList().getQuestState(questId);
                          removeQuestItem(env, 182204498, 1);
                          if (player.getTarget() == null
                              || player.getTarget().getObjectId() != targetObjectId) return;
                          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);
                          QuestService.addNewSpawn(
                              220040000,
                              1,
                              204824,
                              (float) 2851.698,
                              (float) 160.88698,
                              (float) 301.78537,
                              (byte) 93);
                        }
                      },
                      3000);
            }
        }
      }
      if (targetId == 204787) { // Chieftain Akagitan
        switch (dialog) {
          case USE_OBJECT:
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 10002);
          case SELECT_QUEST_REWARD:
            return sendQuestDialog(env, 5);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204787) return sendQuestEndDialog(env);
    }
    return false;
  }
 @Override
 public boolean onDialogEvent(QuestEnv env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() == QuestStatus.NONE) {
     if (targetId == 204326) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 4762);
       else return sendQuestStartDialog(env);
     }
   } else if (qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
       case 204375:
         {
           switch (env.getDialog()) {
             case QUEST_SELECT:
               {
                 if (qs.getQuestVarById(0) == 0) return sendQuestDialog(env, 1011);
                 else if (qs.getQuestVarById(0) == 1) return sendQuestDialog(env, 1352);
                 else if (qs.getQuestVarById(0) == 2) return sendQuestDialog(env, 1693);
               }
             case CHECK_USER_HAS_QUEST_ITEM:
               {
                 return checkQuestItems(env, 1, 2, false, 10000, 10001);
               }
             case SETPRO3:
               {
                 TeleportService2.teleportTo(
                     player,
                     210020000,
                     1,
                     370.13f,
                     2682.59f,
                     171,
                     (byte) 30,
                     TeleportAnimation.BEAM_ANIMATION);
                 qs.setQuestVar(3);
                 return defaultCloseDialog(env, 3, 3, true, false);
               }
             case SELECT_ACTION_1779:
               {
                 return sendQuestDialog(env, 1779);
               }
             case SETPRO1:
               {
                 TeleportService2.teleportTo(
                     player,
                     210020000,
                     1,
                     370.13f,
                     2682.59f,
                     171,
                     (byte) 30,
                     TeleportAnimation.BEAM_ANIMATION);
                 return defaultCloseDialog(env, 0, 1);
               }
           }
         }
     }
   } else if (qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 204375) {
       if (env.getDialog() == DialogAction.USE_OBJECT) {
         return sendQuestDialog(env, 10002);
       } else {
         return sendQuestEndDialog(env);
       }
     }
   }
   return false;
 }
  @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 == 205492) {
        if (dialog == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 4762);
        else return sendQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      switch (targetId) {
        case 282203:
          {
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) return sendQuestDialog(env, 1011);
                }
              case SETPRO1:
                {
                  final Npc npc = (Npc) env.getVisibleObject();
                  npc.getController().scheduleRespawn();
                  npc.getController().onDelete();
                  QuestService.addNewSpawn(
                      player.getWorldId(),
                      player.getInstanceId(),
                      217249,
                      npc.getX(),
                      npc.getY(),
                      npc.getZ(),
                      npc.getHeading());
                  return defaultCloseDialog(env, 0, 1);
                }
            }
          }

        case 282204:
          {
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 2) return sendQuestDialog(env, 1693);
                }
              case SET_SUCCEED:
                {
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(env);
                  return closeDialogWindow(env);
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 205492)
        switch (dialog) {
          case USE_OBJECT:
            {
              return sendQuestDialog(env, 10002);
            }
          default:
            {
              return sendQuestEndDialog(env);
            }
        }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 204817) {
        if (dialog == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011);
        else return sendQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      if (targetId == 204817) {
        switch (dialog) {
          case QUEST_SELECT:
            if (var == 3) {
              qs.setStatus(QuestStatus.REWARD);
              updateQuestStatus(env);
              return sendQuestDialog(env, 2375);
            }
          case SELECT_QUEST_REWARD:
            if (var == 3) return sendQuestDialog(env, 5);
        }
      }
      if (targetId == 204777) {
        switch (dialog) {
          case QUEST_SELECT:
            if (var == 0) return sendQuestDialog(env, 1352);
          case SETPRO1:
            if (var == 0) {
              if (!giveQuestItem(env, 182204515, 1)) return true;
              if (!giveQuestItem(env, 182204516, 1)) return true;
              qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
              updateQuestStatus(env);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
        }
      }
      if (targetId == 204700) {
        switch (dialog) {
          case QUEST_SELECT:
            if (var == 1) return sendQuestDialog(env, 1693);
          case SETPRO2:
            if (var == 1) {
              removeQuestItem(env, 182204515, 1);
              qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
              updateQuestStatus(env);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
        }
      }
      if (targetId == 204702) {
        switch (dialog) {
          case QUEST_SELECT:
            if (var == 2) return sendQuestDialog(env, 2034);
          case SETPRO3:
            if (var == 2) {
              removeQuestItem(env, 182204516, 1);
              qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
              updateQuestStatus(env);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204817) {
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
  @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 (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 203711) // Miriya
      {
        if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 4762);
        else return sendQuestStartDialog(env);
      }
      return false;
    }

    int var = qs.getQuestVarById(0);

    if (qs.getStatus() == QuestStatus.REWARD) {

      if (targetId == 203711
          && player.getInventory().getItemCountByItemId(182206081) == 1) // Miriya
      {
        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) {
      if (targetId == 798321) // Koruchinerk
      {
        switch (env.getDialog()) {
          case QUEST_SELECT:
            if (var == 0) return sendQuestDialog(env, 1011);
            if (var == 1) return sendQuestDialog(env, 1352);
          case CHECK_USER_HAS_QUEST_ITEM:
            if (var == 1) {
              if (QuestService.collectItemCheck(env, true)) {
                if (!giveQuestItem(env, 182206080, 1)) return true;
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
                return sendQuestDialog(env, 10000);
              } else return sendQuestDialog(env, 10001);
            }
          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 == 279005
          && player.getInventory().getItemCountByItemId(182206080) == 1) // Kohrunerk
      {
        switch (env.getDialog()) {
          case QUEST_SELECT:
            if (var == 2) return sendQuestDialog(env, 1693);
          case SET_SUCCEED:
            if (var == 2) removeQuestItem(env, 182206080, 1);
            if (!giveQuestItem(env, 182206081, 1)) return true;
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return true;
        }
      }
      return false;
    }
    return false;
  }
Example #18
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(env.getQuestId());
    if (qs == null) return false;
    Npc target = (Npc) env.getVisibleObject();
    int targetId = target.getNpcId();
    int var = qs.getQuestVarById(0);
    DialogAction dialog = env.getDialog();

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798300:
          { // Phyper
            if (dialog == DialogAction.QUEST_SELECT && var == 0) {
              return sendQuestDialog(env, 1011);
            }
            if (dialog == DialogAction.SETPRO1) {
              return defaultCloseDialog(env, 0, 1); // 1
            }
            break;
          }
        case 204253:
          { // Khrudgelmir
            if (dialog == DialogAction.QUEST_SELECT && var == 2) {
              return sendQuestDialog(env, 1693);
            }
            if (dialog == DialogAction.QUEST_SELECT && var == 6) {
              return sendQuestDialog(env, 3057);
            }
            if (dialog == DialogAction.SETPRO3) {
              removeQuestItem(env, 182205502, 1);
              return defaultCloseDialog(env, 2, 3); // 3
            }
            if (dialog == DialogAction.SET_SUCCEED) {
              return defaultCloseDialog(env, 6, 6, true, false); // reward
            }
            break;
          }
        case 700369:
          { // Underground Arena Exit
            if (dialog == DialogAction.USE_OBJECT && var == 5) {
              TeleportService2.teleportTo(player, 120010000, 981.6009f, 1552.97f, 210.46f);
              changeQuestStep(env, 5, 6, false); // 6
              return true;
            }
            break;
          }
        case 204089:
          { // Garm
            if (dialog == DialogAction.QUEST_SELECT && var == 3) {
              return sendQuestDialog(env, 2034);
            }
            if (dialog == DialogAction.SETPRO4) {
              WorldMapInstance newInstance = InstanceService.getNextAvailableInstance(320120000);
              InstanceService.registerPlayerWithInstance(newInstance, player);
              TeleportService2.teleportTo(
                  player,
                  320120000,
                  newInstance.getInstanceId(),
                  591.47894f,
                  420.20865f,
                  202.97754f);
              playQuestMovie(env, 423);
              changeQuestStep(env, 3, 5, false); // 5
              return closeDialogWindow(env);
            }
            break;
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203550) { // Munin
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else {
          int[] questItems = {182205502};
          return sendQuestEndDialog(env, questItems);
        }
      }
    }
    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 (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 == 798190) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1352);
        else if (env.getDialog() == DialogAction.SETPRO1) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return sendQuestStartDialog(env);
      }
    } else if (targetId == 798191) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1693);
        else if (env.getDialog() == DialogAction.SETPRO2) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return sendQuestStartDialog(env);
      }
    } else if (targetId == 798192) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 2) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 2034);
        else if (env.getDialog() == DialogAction.SETPRO3) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return sendQuestStartDialog(env);
      }
    } else if (targetId == 798193) {
      if (qs != null) {
        if (env.getDialog() == DialogAction.QUEST_SELECT && qs.getStatus() == QuestStatus.START) {
          return sendQuestDialog(env, 2375);
        } else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()
            && qs.getStatus() != QuestStatus.COMPLETE
            && qs.getStatus() != QuestStatus.NONE) {
          removeQuestItem(env, 182208043, 1);
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return sendQuestEndDialog(env);
        } else return sendQuestEndDialog(env);
      }
    }
    return false;
  }
  @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 == 205579) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 4762);
        } else if (dialog == DialogAction.QUEST_ACCEPT_SIMPLE) {
          QuestService.questTimerStart(env, 780);
          return sendQuestStartDialog(env);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    } else if (qs != null && qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      if (targetId == 205798) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1011);
        } else if (dialog == DialogAction.SETPRO1) {
          return defaultCloseDialog(env, 0, 1);
        }
      }
      if (targetId == 205799 && var == 1) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1352);
        } else if (dialog == DialogAction.SETPRO2) {
          return defaultCloseDialog(env, 1, 2);
        }
      }
      if (targetId == 205800 && var == 2) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1693);
        } else if (dialog == DialogAction.SETPRO3) {
          return defaultCloseDialog(env, 2, 3);
        }
      }
      if (targetId == 205801 && var == 3) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 2034);
        } else if (dialog == DialogAction.SETPRO4) {
          return defaultCloseDialog(env, 3, 4);
        }
      }
      if (targetId == 205579 && var == 4) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 2375);
        } else if (dialog == DialogAction.SETPRO5) {
          return defaultCloseDialog(env, 4, 5);
        }
      }
      if (targetId == 205579 && var == 5) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 2716);
        } else if (dialog == DialogAction.CHECK_USER_HAS_QUEST_ITEM_SIMPLE) {
          return checkQuestItems(env, 5, 6, true, 10002, 10001);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 205579) {
        if (dialog == DialogAction.SELECT_QUEST_REWARD) {
          QuestService.questTimerEnd(env);
          return sendQuestDialog(env, 5);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }