@Override
  public boolean onKillEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

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

    switch (targetId) {
      case 217249:
        if (qs.getQuestVarById(0) == 1) {
          Npc npc = (Npc) env.getVisibleObject();
          qs.setQuestVarById(0, var + 1);
          updateQuestStatus(env);
          QuestService.addNewSpawn(
              player.getWorldId(),
              player.getInstanceId(),
              282204,
              npc.getX(),
              npc.getY(),
              npc.getZ(),
              npc.getHeading());
        }
    }
    return false;
  }
  @Override
  public boolean onKillEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

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

    switch (targetId) {
      case 213109:
        if (qs.getQuestVarById(1) < 5 && qs.getQuestVarById(0) == 1) {
          qs.setQuestVarById(1, qs.getQuestVarById(1) + 1);
          updateQuestStatus(env);
          return true;
        }
        break;

      case 213111:
        if (qs.getQuestVarById(2) < 5 && qs.getQuestVarById(0) == 1) {
          qs.setQuestVarById(2, qs.getQuestVarById(2) + 1);
          updateQuestStatus(env);
          return true;
        }
    }

    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;
    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) {
    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 = 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(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();
    int targetId = env.getTargetId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (targetId == 799584) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == DialogAction.QUEST_SELECT.id()) return sendQuestDialog(env, 4762);
        else return sendQuestStartDialog(env);
      }
    } else if (targetId == 799563) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
        if (env.getDialogId() == DialogAction.QUEST_SELECT.id()) return sendQuestDialog(env, 1011);
        else if (env.getDialogId() == DialogAction.SETPRO1.id()) {
          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 (qs != null && qs.getStatus() == QuestStatus.REWARD) {
        if (env.getDialogId() == DialogAction.USE_OBJECT.id()) return sendQuestDialog(env, 10002);
        else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id())
          return sendQuestDialog(env, 5);
        else return sendQuestEndDialog(env);
      }
    } else if (targetId == 799553) {
      if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
        if (env.getDialogId() == DialogAction.USE_OBJECT.id()) 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(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;
  }
Example #14
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) {
    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;
  }