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

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    if (targetId != 204301) return false;
    if (qs.getStatus() == QuestStatus.START) {
      if (env.getDialogId() == 25) {
        qs.setQuestVar(1);
        qs.setStatus(QuestStatus.REWARD);
        updateQuestStatus(player, qs);
        return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
      } else return defaultQuestStartDialog(env);
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (env.getDialogId() == 17) {
        int[] ids = {2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042};
        for (int id : ids) {
          QuestService.startQuest(
              new QuestEnv(env.getVisibleObject(), env.getPlayer(), id, env.getDialogId()),
              QuestStatus.LOCKED);
        }
      }
      return defaultQuestEndDialog(env);
    }
    return false;
  }
示例#2
0
 @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 == 203607) {
     if (qs == null) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011);
       else return sendQuestStartDialog(env);
     }
   } else if (targetId == 203609) {
     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) {
         return defaultCloseDialog(env, 0, 1); // 1
       } else return sendQuestStartDialog(env);
     }
   } else if (targetId == 203631) {
     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) {
         qs.setQuestVar(2);
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         return sendQuestEndDialog(env);
       } else return sendQuestEndDialog(env);
     }
   }
   return false;
 }
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     int var = qs.getQuestVars().getQuestVars();
     if (player.getWorldId() != 320070000) {
       if (var >= 95 && var <= 99) {
         removeStigma(env);
         qs.setQuestVar(4);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player,
             new SM_SYSTEM_MESSAGE(
                 SystemMessageId.QUEST_FAILED_$1,
                 DataManager.QUEST_DATA.getQuestById(questId).getName()));
         return true;
       } else if (var == 9) {
         removeStigma(env);
         return true;
       }
     }
   }
   return false;
 }
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     int var = qs.getQuestVars().getQuestVars();
     if (var == 12) {
       if (player.getWorldId() == 300160000) {
         qs.setQuestVar(13);
         updateQuestStatus(env);
         return true;
       } else {
         if (player.getInventory().getItemCountByItemId(182206613) == 0) {
           return giveQuestItem(env, 182206613, 1);
         }
       }
     } else if (var >= 13 && var < 16) {
       if (player.getWorldId() != 300160000) {
         changeQuestStep(env, var, 12, false);
         if (player.getInventory().getItemCountByItemId(182206613) == 0) {
           giveQuestItem(env, 182206613, 1);
         }
         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 (targetId == 0) {
      if (env.getDialogId() == 1002) {
        QuestService.startQuest(env, QuestStatus.START);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 203075) {
      if (qs != null) {
        if (env.getDialogId() == 25 && qs.getStatus() == QuestStatus.START) {
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        } else if (env.getDialogId() == 1009) {
          player.getInventory().removeFromBagByItemId(182200501, 1);
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(player, qs);
          return defaultQuestEndDialog(env);
        } else return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    int targetId = 0;

    QuestState qs2 = player.getQuestStateList().getQuestState(3968);
    if (qs2 == null || qs2.getStatus() != QuestStatus.COMPLETE) return false;

    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (targetId == 798390) // Palentine
    {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == -1)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
        else if (env.getDialogId() == 1002) {
          if (ItemService.addItems(
              player, Collections.singletonList(new QuestItems(182206126, 1)))) {
            return defaultQuestStartDialog(env);
          }
          return true;
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    int var = qs.getQuestVarById(0);

    if (targetId == 798391) // Andu
    {
      if (qs.getStatus() == QuestStatus.START && var == 0) {
        if (env.getDialogId() == -1)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
        else if (env.getDialogId() == 10000) {
          if (ItemService.removeItemFromInventoryByItemId(player, 182206126)) {
            qs.setQuestVar(1);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(player, qs);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          }
          return true;
        } else return defaultQuestStartDialog(env);
      }
    } else if (targetId == 798390) // Palentine
    {
      if (qs.getStatus() == QuestStatus.REWARD) {
        if (env.getDialogId() == -1)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
示例#7
0
  @Override
  public boolean onKillEvent(QuestEnv env) {
    Player player = env.getPlayer();
    int instanceId = player.getInstanceId();
    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();

    if (targetId == 211042) {
      if (var >= 51 && var <= 53) {
        qs.setQuestVar(qs.getQuestVars().getQuestVars() + 1);
        updateQuestStatus(player, qs);
        return true;
      } else if (var == 54) {
        qs.setQuestVar(4);
        updateQuestStatus(player, qs);
        Npc mob =
            (Npc)
                questService.addNewSpawn(
                    310010000,
                    instanceId,
                    211043,
                    (float) 226.7,
                    (float) 251.5,
                    (float) 205.5,
                    (byte) 0,
                    true);
        // TODO: Tempt decrease P attack.
        mob.getGameStats()
            .setStat(
                StatEnum.MAIN_HAND_POWER,
                mob.getGameStats().getCurrentStat(StatEnum.MAIN_HAND_POWER) / 3);
        mob.getAggroList().addDamage(player, 1000);
        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 (targetId == 0) {
      if (env.getDialogId() == 1002) {
        QuestService.startQuest(env, QuestStatus.START);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 278039) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
        if (env.getDialogId() == 25)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
        else if (env.getDialogId() == 10000) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(player, qs);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return defaultQuestStartDialog(env);
      }
    } else if (targetId == 279027) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
        if (env.getDialogId() == 25)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
        else if (env.getDialogId() == 10001) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(player, qs);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return defaultQuestStartDialog(env);
      }
    } else if (targetId == 798317) {
      if (qs != null) {
        if (env.getDialogId() == 25 && qs.getStatus() == QuestStatus.START) {
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        } else if (env.getDialogId() == 1009) {
          ItemService.removeItemFromInventoryByItemId(player, 182207048);
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(player, qs);
          return defaultQuestEndDialog(env);
        } else return defaultQuestEndDialog(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 == 798103) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 25)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
        else return defaultQuestStartDialog(env);
      } else if (qs.getStatus() == QuestStatus.START) {
        if (env.getDialogId() == 25)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
        else if (env.getDialogId() == 1009) {
          qs.setQuestVar(3);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(player, qs);
          return defaultQuestEndDialog(env);
        } else return defaultQuestEndDialog(env);
      } else if (qs.getStatus() == QuestStatus.REWARD) {
        return defaultQuestEndDialog(env);
      }
    } else if (targetId == 798026) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
        if (env.getDialogId() == 25)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
        else if (env.getDialogId() == 10000) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(player, qs);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return defaultQuestStartDialog(env);
      }
    } else if (targetId == 798357) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
        if (env.getDialogId() == 25)
          return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
        else if (env.getDialogId() == 10000) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(player, qs);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return defaultQuestStartDialog(env);
      }
    }

    return false;
  }
示例#10
0
 @Override
 public boolean onMovieEndEvent(QuestEnv env, int movieId) {
   if (movieId != 151) return false;
   Player player = env.getPlayer();
   int instanceId = player.getInstanceId();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() != QuestStatus.START || qs.getQuestVars().getQuestVars() != 4)
     return false;
   questService.addNewSpawn(
       310010000, instanceId, 790001, (float) 220.6, (float) 247.8, (float) 206.0, (byte) 0, true);
   qs.setQuestVar(5);
   updateQuestStatus(player, qs);
   return true;
 }
示例#11
0
 @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 == 204754) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011);
       else return sendQuestStartDialog(env);
     } else 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.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return sendQuestEndDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       return sendQuestEndDialog(env);
     }
   } else if (targetId == 204701) {
     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 == 204768) {
     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) {
         qs.setQuestVar(3);
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         return sendQuestEndDialog(env);
       } else return sendQuestEndDialog(env);
     }
   }
   return false;
 }
示例#12
0
  @Override
  public boolean onDieEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;
    int var = qs.getQuestVars().getQuestVars();
    if (var == 4 || (var >= 50 && var <= 55)) {
      qs.setQuestVar(3);
      updateQuestStatus(player, qs);
      PacketSendUtility.sendPacket(
          player,
          new SM_SYSTEM_MESSAGE(
              SystemMessageId.QUEST_FAILED_$1, questsData.getQuestById(questId).getName()));
    }

    return false;
  }
示例#13
0
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     int var = qs.getQuestVars().getQuestVars();
     if (var == 4 || (var >= 50 && var <= 55) || var == 99) {
       if (player.getWorldId() != 310010000) {
         qs.setQuestVar(3);
         updateQuestStatus(player, qs);
         PacketSendUtility.sendPacket(
             player,
             new SM_SYSTEM_MESSAGE(
                 SystemMessageId.QUEST_FAILED_$1, questsData.getQuestById(questId).getName()));
       } else {
         PacketSendUtility.sendPacket(player, new SM_ASCENSION_MORPH(1));
         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) {
      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;
  }
  @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 == 0) {
        if (dialog == DialogAction.QUEST_ACCEPT_1) {
          QuestService.startQuest(env);
          return closeDialogWindow(env);
        }
      } else if (targetId == 700616) {
        return giveQuestItem(env, 182206798, 1);
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 798991) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1352);
        } else if (dialog == DialogAction.SETPRO1) {
          qs.setQuestVar(1);
          return defaultCloseDialog(env, 1, 1, true, true);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798947) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 2375);
        }
        removeQuestItem(env, 182206798, 1);
        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 (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;
  }
示例#17
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final int instanceId = player.getInstanceId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

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

    if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 790001) {
        switch (env.getDialogId()) {
          case 25:
            if (var == 0)
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
            else if (var == 3)
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
            else if (var == 5)
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2034);
          case 10000:
            if (var == 0) {
              if (player.getInventory().getItemCountByItemId(182200007) == 0)
                if (!itemService.addItems(
                    player, Collections.singletonList(new QuestItems(182200007, 1)))) return true;
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
          case 10002:
            if (var == 3) {
              player.getInventory().removeFromBagByItemId(182200009, 1);
              qs.setQuestVar(99);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
              WorldMapInstance newInstance = instanceService.getNextAvailableInstance(310010000);
              instanceService.registerPlayerWithInstance(newInstance, player);
              teleportService.teleportTo(
                  player, 310010000, newInstance.getInstanceId(), 52, 174, 229, 0);
              return true;
            }
          case 10003:
            if (var == 5) {
              PlayerClass playerClass = player.getCommonData().getPlayerClass();
              if (playerClass == PlayerClass.WARRIOR)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
              else if (playerClass == PlayerClass.SCOUT)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2716);
              else if (playerClass == PlayerClass.MAGE)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3057);
              else if (playerClass == PlayerClass.PRIEST)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3398);
            }
          case 10004:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.GLADIATOR);
          case 10005:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.TEMPLAR);
          case 10006:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.ASSASSIN);
          case 10007:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.RANGER);
          case 10008:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.SORCERER);
          case 10009:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.SPIRIT_MASTER);
          case 10010:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.CLERIC);
          case 10011:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.CHANTER);
        }
      } else if (targetId == 730008) {
        switch (env.getDialogId()) {
          case 25:
            if (var == 2) {
              if (player.getInventory().getItemCountByItemId(182200008) != 0)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
              else return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1354);
            }
          case 1353:
            if (var == 2) {
              PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 14));
              player.getInventory().removeFromBagByItemId(182200008, 1);
              itemService.addItems(player, Collections.singletonList(new QuestItems(182200009, 1)));
            }
            return false;
          case 10001:
            if (var == 2) {
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
        }
      } else if (targetId == 205000) {
        switch (env.getDialogId()) {
          case 25:
            if (var == 99) {
              PacketSendUtility.sendPacket(player, new SM_EMOTION(player, 6, 1001, 0));
              qs.setQuestVar(50);
              updateQuestStatus(player, qs);
              ThreadPoolManager.getInstance()
                  .schedule(
                      new Runnable() {
                        @Override
                        public void run() {
                          qs.setQuestVar(51);
                          updateQuestStatus(player, qs);
                          List<Npc> mobs = new ArrayList<Npc>();
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 224.073,
                                      (float) 239.1,
                                      (float) 206.7,
                                      (byte) 0,
                                      true));
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 233.5,
                                      (float) 241.04,
                                      (float) 206.365,
                                      (byte) 0,
                                      true));
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 229.6,
                                      (float) 265.7,
                                      (float) 205.7,
                                      (byte) 0,
                                      true));
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 222.8,
                                      (float) 262.5,
                                      (float) 205.7,
                                      (byte) 0,
                                      true));
                          for (Npc mob : mobs) {
                            // TODO: Tempt decrease P attack.
                            mob.getGameStats()
                                .setStat(
                                    StatEnum.MAIN_HAND_POWER,
                                    mob.getGameStats().getCurrentStat(StatEnum.MAIN_HAND_POWER)
                                        / 3);
                            mob.getGameStats().setStat(StatEnum.PHYSICAL_DEFENSE, 0);
                            mob.getAggroList().addDamage(player, 1000);
                          }
                        }
                      },
                      43000);
              return true;
            }
            return false;
          default:
            return false;
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 790001) {
        return defaultQuestEndDialog(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 == 800529) { // Vard.
       if (env.getDialog() == DialogAction.QUEST_SELECT) {
         return sendQuestDialog(env, 1011);
       } else {
         return sendQuestStartDialog(env);
       }
     }
   }
   if (qs == null) {
     return false;
   }
   if (qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
       case 800531:
         { // Bilveo.
           switch (env.getDialog()) {
             case QUEST_SELECT:
               {
                 return sendQuestDialog(env, 1352);
               }
             case SETPRO1:
               {
                 qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                 updateQuestStatus(env);
                 PacketSendUtility.sendPacket(
                     player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                 return true;
               }
             default:
               break;
           }
         }
       case 800529:
         { // Vard.
           switch (env.getDialog()) {
             case QUEST_SELECT:
               {
                 return sendQuestDialog(env, 2375);
               }
             case SELECT_QUEST_REWARD:
               {
                 qs.setQuestVar(3);
                 qs.setStatus(QuestStatus.REWARD);
                 updateQuestStatus(env);
                 return sendQuestEndDialog(env);
               }
             default:
               return sendQuestEndDialog(env);
           }
         }
     }
   } else if (qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 800529) { // Tirins.
       switch (env.getDialog()) {
         case SELECT_QUEST_REWARD:
           {
             return sendQuestDialog(env, 5);
           }
         default:
           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 == 203919) {
        if (env.getDialog() == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 4762);
        } else return sendQuestStartDialog(env);
      }
    }
    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 203337:
          {
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  switch (qs.getQuestVarById(0)) {
                    case 0:
                      {
                        return sendQuestDialog(env, 1011);
                      }
                    case 1:
                      {
                        long itemCount1 = player.getInventory().getItemCountByItemId(182201399);
                        if (itemCount1 >= 3) {
                          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                          updateQuestStatus(env);
                          return sendQuestDialog(env, 1352);
                        } else return sendQuestDialog(env, 10001);
                      }
                    case 2:
                      {
                        return sendQuestDialog(env, 1693);
                      }
                    case 3:
                      {
                        return sendQuestDialog(env, 10002);
                      }
                  }
                }
              case SETPRO1:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  updateQuestStatus(env);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                  return true;
                }
              case SETPRO3:
                {
                  qs.setQuestVar(3);
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(env);
                  TeleportService2.teleportTo(player, 220020000, 1, 638, 2337, 425, (byte) 20);
                  return true;
                }
              default:
                return sendQuestStartDialog(env);
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203337) {
        if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id())
          return sendQuestDialog(env, 5);
        else return sendQuestEndDialog(env);
      }
    }
    return false;
  }