@Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, false);
   String htmltext = getNoQuestMsg(player);
   if (st != null) {
     switch (st.getState()) {
       case State.CREATED:
         {
           htmltext = player.getLevel() >= MIN_LVL ? "30078-01.html" : "30078-02.htm";
           break;
         }
       case State.STARTED:
         {
           if (st.isCond(2) && (st.getQuestItemsCount(BEAR_SKIN) >= REQUIRED_COUNT)) {
             st.giveAdena(ADENA_COUNT, true);
             st.exitQuest(true, true);
             htmltext = "30078-05.html";
           } else {
             htmltext = "30078-06.html";
           }
           break;
         }
     }
   }
   return htmltext;
 }
 @Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   final QuestState st = player.getQuestState(getName());
   if (st == null) {
     return null;
   }
   String htmltext = event;
   switch (event) {
     case "31517-05.html":
       break;
     case "31517-02.htm":
       st.startQuest();
       break;
     case "Exp":
       if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) {
         return "31517-06.html";
       }
       st.addExpAndSp(XP_COUNT, SP_COUNT);
       st.exitQuest(true, true);
       htmltext = "31517-07.html";
       break;
     case "Adena":
       if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) {
         return "31517-06.html";
       }
       st.giveAdena(ADENA_COUNT, true);
       st.exitQuest(true, true);
       htmltext = "31517-07.html";
       break;
     default:
       htmltext = null;
       break;
   }
   return htmltext;
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);
    if (st == null) {
      return htmltext;
    }

    switch (st.getState()) {
      case State.CREATED:
        {
          htmltext =
              (player.getRace() == Race.DARK_ELF)
                  ? (player.getLevel() >= MIN_LEVEL) ? "30346-03.htm" : "30346-02.htm"
                  : "30346-01.htm";
          break;
        }
      case State.STARTED:
        {
          if (hasAtLeastOneQuestItem(player, getRegisteredItemIds())) {
            final long amulets = st.getQuestItemsCount(ORC_AMULET);
            final long necklaces = st.getQuestItemsCount(ORC_NECKLACE);
            st.giveAdena(
                ((amulets * 20) + (necklaces * 30) + ((amulets + necklaces) >= 10 ? 1100 : 0)),
                true);
            takeItems(player, -1, getRegisteredItemIds());
            htmltext = "30346-06.html";
          } else {
            htmltext = "30346-05.html";
          }
          break;
        }
    }
    return htmltext;
  }
 @Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   final QuestState st = player.getQuestState(getName());
   if (st == null) {
     return null;
   }
   String htmltext = null;
   switch (event) {
     case "30621-02.html":
     case "30512-02.html":
       {
         htmltext = event;
         break;
       }
     case "30673-03.htm":
       {
         if (st.isCreated()) {
           st.startQuest();
           st.takeItems(LORAINES_CERTIFICATE, -1);
           st.giveItems(METALLOGRAPH, 1);
           htmltext = event;
         }
         break;
       }
     case "30621-03.html":
       {
         if (st.isCond(1)) {
           st.setCond(2, true);
           htmltext = event;
         }
         break;
       }
     case "30512-03.html":
       {
         if (st.isCond(2)) {
           st.giveAdena(93383, true);
           if (player.getLevel() < MIN_LEVEL_FOR_EXP_SP) {
             st.addExpAndSp(285935, 18711);
           }
           st.exitQuest(false, true);
           htmltext = event;
         }
         break;
       }
   }
   return htmltext;
 }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return getNoQuestMsg(player);
    }

    switch (event) {
      case "31340-03.htm":
        st.startQuest();
        break;
      case "31335-03.htm":
        st.giveAdena(360000, true);
        st.exitQuest(false, true);
        break;
    }
    return event;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = event;
    final QuestState st = player.getQuestState(getName());
    if (st == null) {
      return htmltext;
    }

    if (npc.getId() == MOUEN) {
      if (event.equalsIgnoreCase("30196-03.htm")) {
        st.startQuest();
      }
    } else if ((npc.getId() == JOHNNY) && event.equalsIgnoreCase("32744-03.htm")) {
      st.giveAdena(83056, true);
      st.addExpAndSp(477496, 58743);
      st.exitQuest(false, true);
    }
    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    String htmltext = null;
    if (st == null) {
      return htmltext;
    }

    switch (event) {
      case "32133-03.htm":
        {
          st.startQuest();
          htmltext = event;
          break;
        }
      case "32133-06.html":
        {
          htmltext = event;
          break;
        }
      case "32133-08.html":
        {
          if (st.hasQuestItems(CRIMSON_SPIDER_CLAW)) {
            final long claws = st.getQuestItemsCount(CRIMSON_SPIDER_CLAW);
            st.giveAdena((claws * CLAW_PRICE) + ((claws >= 10) ? BONUS : 0), true);
            st.takeItems(CRIMSON_SPIDER_CLAW, -1);
            Q00261_CollectorsDream.giveNewbieReward(player);
            htmltext = event;
          } else {
            htmltext = "32133-07.html";
          }
          break;
        }
      case "32133-09.html":
        {
          st.exitQuest(true, true);
          htmltext = event;
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(getName());
    if (st == null) {
      return null;
    }

    String htmltext = event;
    switch (event) {
      case "30291-02a.html":
      case "30291-04.html":
      case "30291-05.html":
      case "30291-06.html":
      case "30068-08.html":
      case "30068-09.html":
      case "30068-10.html":
        break;
      case "30068-03.htm":
        st.startQuest();
        break;
      case "30068-04.html":
        st.setCond(2, true);
        break;
      case "30291-07.html":
        st.unset("talk");
        st.setCond(3, true);
        break;
      case "30068-11.html":
        st.giveItems(BADGE_TEMPLE_EXECUTOR, 1);
        st.giveAdena(16924, true);
        if (player.getLevel() < MAX_REWARD_LEVEL) {
          st.addExpAndSp(30000, 2000);
        }
        st.exitQuest(false, true);
        break;
      default:
        htmltext = null;
        break;
    }
    return htmltext;
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, true);
   String htmltext = null;
   if (st != null) {
     switch (st.getState()) {
       case State.CREATED:
         {
           htmltext =
               (player.getRace() == Race.ORC)
                   ? (player.getLevel() >= MIN_LVL) ? "30572-03.htm" : "30572-02.htm"
                   : "30572-01.htm";
           break;
         }
       case State.STARTED:
         {
           switch (st.getCond()) {
             case 1:
               {
                 htmltext = "30572-05.html";
                 break;
               }
             case 2:
               {
                 st.giveAdena(1500, true);
                 st.exitQuest(true, true);
                 htmltext = "30572-06.html";
                 break;
               }
           }
           break;
         }
     }
   }
   return htmltext;
 }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(getName());

    if (st == null) {
      return null;
    }
    String htmltext = null;
    switch (event) {
      case "30512-02.htm":
      case "30673-02.html":
      case "30673-03.html":
        {
          htmltext = event;
          break;
        }
      case "30512-03.htm":
        {
          st.startQuest();
          htmltext = event;
          break;
        }
      case "30673-04.html":
        {
          st.setCond(2, true);
          htmltext = event;
          break;
        }
      case "30621-02.html":
        {
          if (player.getLevel() < 43) {
            st.addExpAndSp(60000, 3000);
          }
          st.giveAdena(18100, true);
          st.exitQuest(false, true);
          htmltext = event;
          break;
        }
      case "Contract":
        {
          final Quest quest =
              QuestManager.getInstance().getQuest("184_Nikolas_Cooperation_Contract");
          st = player.getQuestState("184_Nikolas_Cooperation_Contract");
          if ((quest != null) && (st == null)) {
            st = quest.newQuestState(player);
            st.setState(State.STARTED);
            quest.notifyEvent("30621-01.htm", npc, player);
          }
          break;
        }
      case "Consideration":
        {
          final Quest quest =
              QuestManager.getInstance().getQuest("185_Nikolas_Cooperation_Consideration");
          st = player.getQuestState("185_Nikolas_Cooperation_Consideration");
          if ((quest != null) && (st == null)) {
            st = quest.newQuestState(player);
            st.setState(State.STARTED);
            quest.notifyEvent("30621-01.htm", npc, player);
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(getName());
    String htmltext = getNoQuestMsg(player);
    if (st == null) {
      return htmltext;
    }

    switch (st.getState()) {
      case State.COMPLETED:
        {
          if (!st.isNowAvailable()) {
            htmltext = "31340-02.htm";
            break;
          }
          st.setState(State.CREATED);
        }
      case State.CREATED:
        {
          htmltext = (player.getLevel() >= MIN_LVL) ? "31340-01.htm" : "31340-03.htm";
          break;
        }
      case State.STARTED:
        {
          switch (st.getCond()) {
            case 1:
              {
                htmltext = "31340-09.html";
                break;
              }
            case 2:
              {
                htmltext = "31340-11.html";
                break;
              }
            case 3:
              {
                htmltext = "31340-12.html";
                break;
              }
            case 4:
              {
                htmltext = "31340-13.html";
                break;
              }
            case 5:
              {
                if (st.hasQuestItems(SHATTERED_BONES)) {
                  st.giveItems(PROOF_OF_CHALLENGE, 1);
                  st.giveAdena(134038, true);
                } else if (st.hasQuestItems(CANNIBALISTIC_STAKATO_LDR_CLAW)) {
                  st.giveItems(PROOF_OF_CHALLENGE, 3);
                  st.giveAdena(210119, true);
                } else if (st.hasQuestItems(ANAIS_SCROLL)) {
                  st.giveItems(PROOF_OF_CHALLENGE, 3);
                  st.giveAdena(348155, true);
                }
                st.exitQuest(QuestType.DAILY, true);
                htmltext = "31340-14.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;
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState st = player.getQuestState(getName());
   String htmltext = getNoQuestMsg(player);
   if (st != null) {
     switch (npc.getId()) {
       case JENNA:
         {
           switch (st.getState()) {
             case State.CREATED:
               {
                 htmltext =
                     (player.getRace() == Race.DARK_ELF)
                         ? (player.getLevel() >= MIN_LVL) ? "30349-02.htm" : "30349-01.htm"
                         : "30349-00.htm";
                 break;
               }
             case State.STARTED:
               {
                 switch (st.getCond()) {
                   case 1:
                     {
                       if (st.hasQuestItems(JENNAS_LETTER)) {
                         htmltext = "30349-04.html";
                       }
                       break;
                     }
                   case 2:
                     {
                       if (st.hasQuestItems(SENTRY_BLADE1, SENTRY_BLADE2, SENTRY_BLADE3)) {
                         st.takeItems(SENTRY_BLADE1, -1);
                         st.setCond(3, true);
                         htmltext = "30349-05.html";
                       }
                       break;
                     }
                   case 3:
                     {
                       if (hasAtLeastOneQuestItem(player, SENTRY_BLADE2, SENTRY_BLADE3)) {
                         htmltext = "30349-07.html";
                       }
                       break;
                     }
                   case 4:
                     {
                       if (st.getQuestItemsCount(OLD_BRONZE_SWORD) >= 2) {
                         st.giveAdena(820, true);
                         st.exitQuest(false, true);
                         htmltext = "30349-07.html";
                       }
                       break;
                     }
                 }
                 break;
               }
             case State.COMPLETED:
               {
                 htmltext = getAlreadyCompletedMsg(player);
                 break;
               }
           }
           break;
         }
       case HARANT:
         {
           if (st.isCond(1) && st.hasQuestItems(JENNAS_LETTER)) {
             st.takeItems(JENNAS_LETTER, -1);
             st.giveItems(SENTRY_BLADE1, 1);
             st.giveItems(SENTRY_BLADE2, 1);
             st.giveItems(SENTRY_BLADE3, 1);
             st.setCond(2, true);
             htmltext = "30360-01.html";
           } else if (st.isCond(2)) {
             htmltext = "30360-02.html";
           }
           break;
         }
       case ROSELYN:
       case KRISTIN:
         {
           if (st.isCond(3) && st.hasQuestItems(SENTRIES.get(npc.getId()))) {
             st.takeItems(SENTRIES.get(npc.getId()), -1);
             st.giveItems(OLD_BRONZE_SWORD, 1);
             if (st.getQuestItemsCount(OLD_BRONZE_SWORD) >= 2) {
               st.setCond(4, true);
             }
             htmltext = npc.getId() + "-01.html";
           } else if (!st.hasQuestItems(SENTRIES.get(npc.getId()))
               && st.hasQuestItems(OLD_BRONZE_SWORD)) {
             htmltext = npc.getId() + "-02.html";
           }
           break;
         }
     }
   }
   return htmltext;
 }