@Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = player.getQuestState(getName());
    if (st == null) {
      return htmltext;
    }

    switch (npc.getId()) {
      case SHEGFIELD:
        switch (st.getState()) {
          case State.CREATED:
            htmltext = (player.getLevel() >= MIN_LEVEL) ? "30068-01.htm" : "30068-02.htm";
            break;
          case State.STARTED:
            switch (st.getCond()) {
              case 1: // 1
                st.setCond(2, true);
                htmltext = "30068-04.html";
                break;
              case 2: // 2, 3
              case 3: // 4
                htmltext = "30068-05.html";
                break;
              case 4: // 5
                htmltext = "30068-06.html";
                break;
              case 5:
                if (st.isSet("talk")) {
                  htmltext = "30068-08.html";
                } else if (st.hasQuestItems(
                    PANOS_CREDENTIALS, SONINS_CREDENTIALS, ALEXS_CREDENTIALS)) {
                  st.takeItems(SONINS_CREDENTIALS, -1);
                  st.takeItems(PANOS_CREDENTIALS, -1);
                  st.takeItems(ALEXS_CREDENTIALS, -1);
                  st.set("talk", "1");
                  htmltext = "30068-07.html";
                } else {
                  htmltext = "30068-06.html";
                }
                break;
            }
            break;
          case State.COMPLETED:
            htmltext = getAlreadyCompletedMsg(player);
            break;
        }
        break;
      case ALEX:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
              htmltext = "30291-01.html";
              break;
            case 2:
              if (st.isSet("talk")) {
                htmltext = "30291-03.html";
              } else {
                st.set("talk", "1");
                htmltext = "30291-02.html";
              }
              break;
            case 3:
              htmltext = "30291-08.html"; // 4
              break;
            case 4:
              if (st.hasQuestItems(PANOS_CREDENTIALS, SONINS_CREDENTIALS)) {
                if (st.getQuestItemsCount(OLD_TREASURE_MAP) < ITEM_COUNT) {
                  return htmltext;
                }
                st.setCond(5, true);
                st.takeItems(OLD_TREASURE_MAP, -1);
                st.giveItems(ALEXS_CREDENTIALS, 1);
                htmltext = "30291-10.html";
              } else {
                htmltext = "30291-09.html";
              }
              break;
            case 5:
              htmltext = "30291-11.html";
              break;
          }
        }
        break;
      case PANO:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
              htmltext = "30078-01.html";
              break;
            case 2:
              htmltext = "30078-02.html";
              break;
            case 3:
              htmltext = "30078-03.html";
              break;
            case 4:
              if (!st.isSet("Pano")) {
                if (st.getQuestItemsCount(HATE_CRYSTAL) < ITEM_COUNT) {
                  return htmltext;
                }
                st.takeItems(HATE_CRYSTAL, -1);
                st.giveItems(PANOS_CREDENTIALS, 1);
                st.set("Pano", "1");
                htmltext = "30078-04.html";
                break;
              }
            case 5:
              htmltext = "30078-05.html";
              break;
          }
        }
        break;
      case SONIN:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
              htmltext = "31773-01.html";
              break;
            case 2:
              htmltext = "31773-02.html";
              break;
            case 3:
              htmltext = "31773-03.html";
              break;
            case 4:
              if (!st.isSet("Sonin")) {
                if (st.getQuestItemsCount(STOLEN_CARGO) < ITEM_COUNT) {
                  return htmltext;
                }
                st.takeItems(STOLEN_CARGO, -1);
                st.giveItems(SONINS_CREDENTIALS, 1);
                st.set("Sonin", "1");
                htmltext = "31773-04.html";
                break;
              }
            case 5:
              htmltext = "31773-05.html";
              break;
          }
        }
        break;
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = player.getQuestState(getName());
    if (st == null) {
      return htmltext;
    }

    switch (npc.getId()) {
      case NATOOLS:
        switch (st.getState()) {
          case State.STARTED:
            switch (st.getCond()) {
              case 1:
                htmltext = "30894-01.html";
                break;
              default:
                htmltext = "30894-04.html";
                break;
            }
            break;
          case State.COMPLETED:
            htmltext = getAlreadyCompletedMsg(player);
            break;
        }
        break;
      case RAYMOND:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
              htmltext = "30289-01.html";
              break;
            case 2:
              if (st.isSet("talk")) {
                htmltext = "30289-03.html";
              } else {
                st.takeItems(CRYPTOGRAM_OF_THE_ANGEL_SEARCH, -1);
                st.set("talk", "1");
                htmltext = "30289-02.html";
              }
              break;
            case 3:
            case 4:
            case 5:
              htmltext = "30289-06.html";
              break;
            case 6:
              st.giveAdena(92676, true);
              if (player.getLevel() <= MAX_REWARD_LEVEL) {
                st.addExpAndSp(223036, 13091);
              }
              st.exitQuest(false, true);
              htmltext = "30289-07.html";
              break;
          }
        }
        break;
      case CASIAN:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
            case 2:
              htmltext = "30612-01.html";
              break;
            case 3:
              if (st.getInt("talk") == 1) {
                htmltext = "30612-03.html";
              } else if (st.getInt("talk") == 2) {
                htmltext = "30612-06.html";
              } else {
                htmltext = "30612-02.html";
                st.set("talk", "1");
              }
              break;
            case 4:
            case 5:
            case 6:
              htmltext = "30612-09.html";
              break;
          }
        }
        break;
      case ROCK:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 5:
              htmltext = "32368-02.html";
              break;
            case 6:
              htmltext = "32368-05.html";
              break;
            default:
              htmltext = "32368-01.html";
              break;
          }
        }
        break;
    }
    return htmltext;
  }