@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 "30070-02.htm":
       st.startQuest();
       st.giveItems(TEMPLE_MANIFESTO, 1);
       break;
     case "30070-05.html":
       st.giveAdena(84593, true);
       if ((player.getLevel() < 42)) {
         st.addExpAndSp(187062, 11307);
       }
       st.exitQuest(false, true);
       break;
     case "30070-03.html":
       st.setCond(2, true);
       break;
     case "30118-06.html":
       st.setCond(3, true);
       break;
     case "30118-09.html":
       st.setCond(6, true);
       st.giveItems(PUPINAS_RECOMMENDATION, 1);
       break;
     case "30474-02.html":
       st.setCond(4, true);
       break;
     case "30666-02.html":
       if (st.hasQuestItems(PUPINAS_RECOMMENDATION)) {
         st.set("talk", "1");
         st.takeItems(PUPINAS_RECOMMENDATION, -1);
       }
       break;
     case "30666-03.html":
       if (st.hasQuestItems(TEMPLE_MANIFESTO)) {
         st.set("talk", "2");
         st.takeItems(TEMPLE_MANIFESTO, -1);
       }
       break;
     case "30666-08.html":
       st.setCond(7, true);
       st.unset("talk");
       break;
   }
   return event;
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (st == null) {
      return htmltext;
    }

    switch (st.getState()) {
      case State.COMPLETED:
        {
          if (npc.getId() == NAMELESS_SPIRIT) {
            htmltext = "31453-06.html";
          }
          break;
        }
      case State.CREATED:
        {
          htmltext =
              ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(ANTIQUE_BROOCH))
                  ? "31453-01.htm"
                  : "31453-05.html";
          break;
        }
      case State.STARTED:
        {
          if (npc.getId() == NAMELESS_SPIRIT) {
            if (st.isCond(1)) {
              if (st.hasQuestItems(ANTIQUE_BROOCH)) {
                htmltext = "31453-07.html";
              } else {
                htmltext = "31453-08.html";
                st.exitQuest(true);
              }
            } else if (st.isCond(2)) {
              htmltext = "31453-09.html";
            }
          } else if (npc.getId() == DEVORIN) {
            if (st.isCond(1)) {
              htmltext = "32009-01.html";
            } else if (st.isCond(2)) {
              htmltext = "32009-05.html";
            }
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "31453-02.htm":
      case "31453-03.htm":
      case "31453-10.html":
        {
          htmltext = event;
          break;
        }
      case "31453-04.html":
        {
          st.startQuest();
          htmltext = event;
          break;
        }
      case "31453-11.html":
        {
          if (st.isCond(2)) {
            st.giveAdena(150292, true);
            st.addExpAndSp(902439, 90067);
            st.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
      case "brooch":
        {
          htmltext = (st.hasQuestItems(ANTIQUE_BROOCH)) ? "32009-02.html" : "32009-03.html";
          break;
        }
      case "32009-04.html":
        {
          if (st.isCond(1) && st.hasQuestItems(ANTIQUE_BROOCH)) {
            st.setCond(2, true);
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    if (qs == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "32975-03.htm":
        {
          qs.startQuest();
          qs.setCond(2); // show arrow hack
          qs.setCond(1);
          player.sendPacket(
              new TutorialShowHtml(
                  npc.getObjectId(),
                  "..\\L2Text\\QT_027_Quest_01.htm",
                  TutorialShowHtml.LARGE_WINDOW));
          htmltext = event;
          break;
        }
      case "32975-02.htm":
        {
          htmltext = event;
          break;
        }
      case "32974-02.html":
        {
          giveAdena(player, 50, true);
          addExpAndSp(player, 40, 5);
          qs.exitQuest(false, true);
          Broadcast.toKnownPlayers(
              npc,
              new NpcSay(
                  npc.getObjectId(),
                  ChatType.NPC_GENERAL,
                  npc.getTemplate().getDisplayId(),
                  NpcStringId.HM_DON_T_JUST_GO_I_STILL_HAVE_TONS_TO_TEACH_YOU));
          htmltext = event;
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    if (qs == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "33864-03.html":
        {
          qs.startQuest();
          giveItems(player, SCROLL_OF_ESCAPE_FIELDS_OF_MASSACRE);
          htmltext = event;
          break;
        }
      case "33867-02.html":
        {
          if (qs.isCond(1)) {
            giveItems(player, STEEL_DOOR_GUILD);
            giveItems(player, ENCHANT_WEAPON_A);
            addExpAndSp(player, 807240, 193);
            showOnScreenMsg(
                player,
                NpcStringId
                    .GROW_STRONGER_HERE_UNTIL_YOU_RECEIVE_THE_NEXT_LETTER_FROM_KEKROPUS_AT_LV_65,
                ExShowScreenMessage.TOP_CENTER,
                4500);
            qs.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
      case "33864-02.htm":
        {
          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 "31338-1.html":
        st.giveItems(ANCIENT_BOOK, 1);
        st.startQuest();
        break;
      case "32113-2.html":
      case "32113-2a.html":
        st.giveAdena(191678, true);
        st.addExpAndSp(251602, 25245);
        st.exitQuest(false, true);
        break;
    }
    return event;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    if (qs == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "33952-02.htm":
      case "33953-02.html":
        {
          htmltext = event;
          break;
        }
      case "33952-03.html":
        {
          qs.startQuest();
          htmltext = event;
          break;
        }
      case "33953-03.html":
        {
          if (qs.isCond(2)) {
            giveAdena(player, 62000, true);
            addExpAndSp(player, 62876, 0);
            giveItems(player, LEATHER_SHOES);
            showOnScreenMsg(
                player,
                NpcStringId.CHECK_YOUR_EQUIPMENT_IN_YOUR_INVENTORY,
                ExShowScreenMessage.TOP_CENTER,
                4500);
            qs.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, true);
   String htmltext = getNoQuestMsg(player);
   switch (st.getState()) {
     case State.CREATED:
       {
         htmltext = (player.getLevel() < MIN_LEVEL) ? "32612-02.html" : "32612-01.htm";
         break;
       }
     case State.STARTED:
       {
         switch (st.getCond()) {
           case 1:
             {
               htmltext = "32612-05.html";
               break;
             }
           case 2:
             {
               if (getQuestItemsCount(player, ZAKENS_SOUL_FRAGMENT) >= FRAGMENT_COUNT) {
                 giveItems(player, SOUL_CLOAK_OF_ZAKEN, 1);
                 playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
                 st.exitQuest(false, true);
                 htmltext = "32612-06.html";
               }
               break;
             }
         }
         break;
       }
     case State.COMPLETED:
       {
         htmltext = "32612-03.html";
         break;
       }
   }
   return htmltext;
 }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    if (qs == null) {
      return null;
    }

    String texthtml = null;
    switch (event) {
      case "33509-02.htm":
        {
          texthtml = event;
          break;
        }
      case "33509-03.htm": // start the quest
        {
          qs.startQuest();
          texthtml = event;
          break;
        }
      case "31795-02.html":
        {
          texthtml = event;
          break;
        }
      case "31795-03.html": // end quest, take sketch, give rewards
        {
          giveAdena(player, ADENA_REWARD, true);
          addExpAndSp(player, EXP_REWARD, SP_REWARD);
          rewardItems(player, SCROLL_EW_D);
          qs.exitQuest(false, true);
          texthtml = event;
          break;
        }
    }
    return texthtml;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance talker) {
    final QuestState qs = getQuestState(talker, true);
    String htmltext = getNoQuestMsg(talker);

    switch (npc.getId()) {
      case CRONOS:
        {
          switch (qs.getState()) {
            case State.CREATED:
              {
                final long fluteCount =
                    getQuestItemsCount(
                        talker, DRAGONFLUTE_OF_WIND, DRAGONFLUTE_OF_STAR, DRAGONFLUTE_OF_TWILIGHT);
                if (fluteCount == 0) {
                  break; // this quest does not show up if no flute in inventory
                }

                if (talker.getLevel() < MIN_PLAYER_LVL) {
                  htmltext = "30610-01.htm";
                } else if (fluteCount > 1) {
                  htmltext = "30610-02.htm";
                } else if (getFlute(talker).getEnchantLevel() < MIN_HACHLING_LVL) {
                  htmltext = "30610-03.html";
                } else {
                  htmltext = "30610-04.htm";
                }
                break;
              }
            case State.STARTED:
              {
                htmltext = "30610-07.html";
                break;
              }
            case State.COMPLETED:
              {
                htmltext = getAlreadyCompletedMsg(talker);
                break;
              }
          }
          break;
        }
      case MIMYU:
        {
          switch (qs.getMemoState()) {
            case 100:
              {
                qs.setMemoState(200);
                htmltext = "30747-01.html";
                break;
              }
            case 200:
              {
                final L2Summon summon = talker.getPet();

                if (summon == null) {
                  htmltext = "30747-02.html";
                } else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) {
                  htmltext = "30747-03.html";
                } else {
                  htmltext = "30747-04.html";
                }
                break;
              }
            case 0:
              {
                htmltext = "30747-07.html";
                break;
              }
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
            case 14:
              {
                if (hasQuestItems(talker, FAIRY_LEAF)) {
                  htmltext = "30747-11.html";
                }
                break;
              }
            case 15:
              {
                if (!hasQuestItems(talker, FAIRY_LEAF)) {
                  final L2Summon summon = talker.getPet();

                  if (summon == null) {
                    htmltext = "30747-12.html";
                  } else if (summon.getControlObjectId() == qs.getInt("fluteObjectId")) {
                    qs.setMemoState(16);
                    htmltext = "30747-13.html";
                  } else {
                    htmltext = "30747-14.html";
                  }
                }
                break;
              }
            case 16:
              {
                if (!hasQuestItems(talker, FAIRY_LEAF)) {
                  if (talker.hasSummon()) {
                    htmltext = "30747-15.html";
                  } else {
                    final long fluteCount =
                        getQuestItemsCount(
                            talker,
                            DRAGONFLUTE_OF_WIND,
                            DRAGONFLUTE_OF_STAR,
                            DRAGONFLUTE_OF_TWILIGHT);

                    if (fluteCount > 1) {
                      htmltext = "30747-17.html";
                    } else if (fluteCount == 1) {
                      final L2ItemInstance flute = getFlute(talker);

                      if (flute.getObjectId() == qs.getInt("fluteObjectId")) {
                        // TODO what if the hatchling has items in his inventory?
                        // Should they be transfered to the strider or given to the player?
                        switch (flute.getId()) {
                          case DRAGONFLUTE_OF_WIND:
                            takeItems(talker, DRAGONFLUTE_OF_WIND, -1);
                            giveItems(talker, DRAGON_BUGLE_OF_WIND, 1);
                            break;
                          case DRAGONFLUTE_OF_STAR:
                            takeItems(talker, DRAGONFLUTE_OF_STAR, -1);
                            giveItems(talker, DRAGON_BUGLE_OF_STAR, 1);
                            break;
                          case DRAGONFLUTE_OF_TWILIGHT:
                            takeItems(talker, DRAGONFLUTE_OF_TWILIGHT, -1);
                            giveItems(talker, DRAGON_BUGLE_OF_TWILIGHT, 1);
                            break;
                        }

                        qs.exitQuest(true, true);
                        htmltext = "30747-16.html";
                      } else {
                        npc.setTarget(talker);
                        npc.doCast(CURSE_OF_MIMYU.getSkill());
                        htmltext = "30747-18.html";
                      }
                    }
                  }
                }
                break;
              }
          }
          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;
    }

    if (npc.getId() == KANEMIKA) {
      switch (st.getState()) {
        case State.COMPLETED:
          if (!st.isNowAvailable()) {
            htmltext = "32650-03.html";
            break;
          }
          st.setState(State.CREATED);
        case State.CREATED:
          htmltext = (player.getLevel() >= MIN_LEVEL) ? "32650-01.htm" : "32650-02.htm";
          break;
        case State.STARTED:
          if (st.isCond(1)) {
            htmltext =
                (!st.hasQuestItems(EVIDENCE_OF_MIGRATION)) ? "32650-08.html" : "32650-09.html";
          } else {
            st.giveAdena(
                65000, true); // Glory days reward: 6 886 980 exp, 8 116 410 sp, 371 400 Adena
            st.exitQuest(QuestType.DAILY, true);
            htmltext = "32650-10.html";
          }
          break;
      }
    } else if (st.isCond(1)) {
      if (npc.isBusy()) {
        return null;
      }

      if (getRandom(100) < 66) {
        st.giveItems(EVIDENCE_OF_MIGRATION, 1);
        st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
        npc.getAI()
            .setIntention(
                CtrlIntention.AI_INTENTION_MOVE_TO,
                new Location(npc.getX() + 100, npc.getY() + 100, npc.getZ(), 0));
        npc.setBusy(true);

        startQuestTimer("despawn", 3000, npc, player);

        if (st.getQuestItemsCount(EVIDENCE_OF_MIGRATION) == 10) {
          st.setCond(2, true);
        }
        htmltext = "32651-01.html";
      } else {
        if (getRandom(100) < 50) {
          npc.broadcastPacket(
              new NpcSay(
                  npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GRUNT_OH));
        } else {
          npc.broadcastPacket(
              new NpcSay(
                  npc.getObjectId(),
                  ChatType.NPC_GENERAL,
                  npc.getId(),
                  NpcStringId.GRUNT_WHAT_S_WRONG_WITH_ME));
        }
        npc.deleteMe();
        htmltext = null;

        final L2Attackable monster =
            (L2Attackable)
                addSpawn(
                    WARRIOR_MON,
                    npc.getX(),
                    npc.getY(),
                    npc.getZ(),
                    npc.getHeading(),
                    true,
                    600000);
        monster.setRunning();
        monster.addDamageHate(player, 0, 999);
        monster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
        showOnScreenMsg(
            player,
            NpcStringId
                .THE_GRAVE_ROBBER_WARRIOR_HAS_BEEN_FILLED_WITH_DARK_ENERGY_AND_IS_ATTACKING_YOU,
            5,
            5000);
      }
    }

    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    final QuestState q115 = player.getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName());
    if (st == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "ACCEPT":
        {
          st.startQuest();
          if ((q115 != null) && (q115.isCompleted())) {
            htmltext = "32020-04.htm";
          } else {
            st.setCond(2);
            htmltext = "32020-05.htm";
          }
          break;
        }
      case "ASK":
        {
          if (st.getCond() >= 1) {
            htmltext = ((q115 != null) && !q115.isCompleted()) ? "32020-14.html" : "32020-15.html";
          }
          break;
        }
      case "LATER":
        {
          if (st.getCond() >= 1) {
            htmltext = ((q115 != null) && !q115.isCompleted()) ? "32020-19.html" : "32020-20.html";
          }
          break;
        }
      case "REWARD":
        {
          if (st.getCond() >= 1) {
            final long silverCryCount = getQuestItemsCount(player, SILVER_ICE_CRYSTAL);
            final long blackCryCount = getQuestItemsCount(player, BLACK_ICE_CRYSTAL);
            if ((silverCryCount + blackCryCount) > 0) {
              giveAdena(player, (silverCryCount * 300) + (blackCryCount * 1200), true);
              takeItems(player, -1, SILVER_ICE_CRYSTAL, BLACK_ICE_CRYSTAL);
              htmltext =
                  ((q115 != null) && !q115.isCompleted()) ? "32020-16.html" : "32020-17.html";
            } else {
              htmltext = "32020-18.html";
            }
          }
          break;
        }
      case "QUIT":
        {
          if (st.getCond() >= 1) {
            if ((q115 != null) && !q115.isCompleted()) {
              htmltext = "32020-21.html";
              st.exitQuest(true, true);
            } else {
              htmltext = "32020-22.html";
            }
          }
          break;
        }
      case "32020-06.html":
      case "32020-07.html":
      case "32020-08.html":
      case "32020-09.html":
        {
          if (st.getCond() >= 1) {
            htmltext = event;
          }
          break;
        }
      case "32020-23.html":
        {
          if (st.getCond() >= 1) {
            st.exitQuest(true, true);
            htmltext = event;
          }
          break;
        }
      case "32023-04.html":
        {
          if ((st.getCond() >= 1)
              && hasQuestItems(player, SILVER_ICE_CRYSTAL)
              && (st.getInt("ex") == 0)) {
            st.set("ex", ((getRandom(4) + 1) * 10));
            htmltext = event;
          }
          break;
        }
      case "32023-05.html":
        {
          if ((st.getCond() >= 1)
              && hasQuestItems(player, SILVER_ICE_CRYSTAL)
              && (st.getInt("ex") > 0)) {
            takeItems(player, SILVER_ICE_CRYSTAL, 1);
            final int val = (st.getInt("ex") + 1);
            st.set("ex", val);
            playSound(player, QuestSound.ITEMSOUND_BROKEN_KEY);
            htmltext = event;
          }
          break;
        }
      case "32023-06.html":
        {
          if ((st.getCond() >= 1)
              && hasQuestItems(player, SILVER_ICE_CRYSTAL)
              && (st.getInt("ex") > 0)) {
            takeItems(player, SILVER_ICE_CRYSTAL, 1);
            final int val = (st.getInt("ex") + 2);
            st.set("ex", val);
            playSound(player, QuestSound.ITEMSOUND_BROKEN_KEY);
            htmltext = event;
          }
          break;
        }
      case "REPLY4":
        {
          if ((st.getCond() >= 1) && (st.getInt("ex") > 0)) {
            final int ex = st.getInt("ex");
            final int val1 = ex / 10;
            final int val2 = ex - (val1 * 10);
            if (val1 == val2) {
              htmltext = "32023-07.html";
              giveItems(player, BLACK_ICE_CRYSTAL, 1);
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_SUCCESS);
            } else {
              htmltext = "32023-08.html";
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_FAILED);
            }
            st.set("ex", 0);
          }
          break;
        }
      case "REPLY5":
        {
          if ((st.getCond() >= 1) && (st.getInt("ex") > 0)) {
            final int ex = st.getInt("ex");
            final int val1 = ex / 10;
            final int val2 = ((ex - (val1 * 10)) + 2);
            if (val1 == val2) {
              htmltext = "32023-07.html";
              giveItems(player, BLACK_ICE_CRYSTAL, 1);
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_SUCCESS);
            } else {
              htmltext = "32023-08.html";
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_FAILED);
            }
            st.set("ex", 0);
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    if (event.startsWith("DESPAWN")) {
      npc.deleteMe();
      return super.onAdvEvent(event, npc, player);
    }

    final QuestState qs = getQuestState(player, false);
    if (qs == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "30760-08.html":
        {
          if (qs.isCreated()) {
            giveItems(player, GUSTAVS_1ST_LETTER, 1);
            qs.startQuest();
            qs.setMemoState(1000);
            htmltext = event;
          }
          break;
        }
      case "30760-12.html":
        {
          giveItems(player, GUSTAVS_2ND_LETTER, 1);
          qs.setMemoState(4000);
          qs.setCond(4);
          htmltext = event;
          break;
        }
      case "30760-16.html":
        {
          giveItems(player, GUSTAVS_3RD_LETTER, 1);
          qs.setMemoState(7000);
          qs.setCond(7);
          htmltext = event;
          break;
        }
      case "30760-20.html":
        {
          if (hasQuestItems(player, SCEPTER_OF_JUDGMENT)) {
            giveItems(player, SEAL_OF_ASPIRATION, 1);
            addExpAndSp(player, 0, 250000);
            qs.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
      case "30760-22.html":
        {
          qs.setMemoState(10000);
          qs.setCond(12);
          htmltext = event;
          break;
        }
      case "30760-23.html":
        {
          if (hasQuestItems(player, SCEPTER_OF_JUDGMENT)) {
            giveItems(player, SEAL_OF_ASPIRATION, 1);
            addExpAndSp(player, 0, 250000);
            qs.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
      case "30512-03.html":
        {
          if (hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) {
            takeItems(player, BROOCH_OF_THE_MAGPIE, -1);
            giveItems(player, BLACK_ANVIL_COIN, 1);
          }
          htmltext = event;
          break;
        }
      case "30645-03.html":
        {
          takeItems(player, GUSTAVS_1ST_LETTER, -1);
          qs.setMemoState(2000);
          qs.setCond(2, true);
          htmltext = event;
          break;
        }
      case "30761-02.html":
        {
          if (qs.isMemoState(2000)
              || qs.isMemoState(2011)
              || qs.isMemoState(2010)
              || qs.isMemoState(2001)) {
            giveItems(player, BLITZ_WYRM_EGG, 3);
            qs.setMemoState(qs.getMemoState() + 100);
            addAttackPlayerDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player);
            addAttackPlayerDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player);
            startQuestTimer("DESPAWN", 10000, npc, player);
            htmltext = event;
          } else if (qs.isMemoState(2100)
              || qs.isMemoState(2111)
              || qs.isMemoState(2110)
              || qs.isMemoState(2101)) {
            addAttackPlayerDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player);
            addAttackPlayerDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player);
            startQuestTimer("DESPAWN", 10000, npc, player);
            htmltext = "30761-03.html";
          }
          break;
        }
      case "30762-02.html":
        {
          if (qs.isMemoState(2000)
              || qs.isMemoState(2101)
              || qs.isMemoState(2001)
              || qs.isMemoState(2100)) {
            giveItems(player, BLITZ_WYRM_EGG, 3);
            giveItems(player, MIST_DRAKES_EGG, 4);
            qs.setMemoState(qs.getMemoState() + 10);
            addAttackPlayerDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player);
            addAttackPlayerDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player);
            startQuestTimer("DESPAWN", 10000, npc, player);
            htmltext = event;
          } else if (qs.isMemoState(2100)
              || qs.isMemoState(2111)
              || qs.isMemoState(2011)
              || qs.isMemoState(2110)) {
            addAttackPlayerDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player);
            addAttackPlayerDesire(addSpawn(BLITZ_WYRM, npc, true, 0, false), player);
            startQuestTimer("DESPAWN", 10000, npc, player);
            htmltext = "30762-03.html";
          }
          break;
        }
      case "30763-02.html":
        {
          if (qs.isMemoState(2000)
              || qs.isMemoState(2110)
              || qs.isMemoState(2010)
              || qs.isMemoState(2100)) {
            giveItems(player, BROOCH_OF_THE_MAGPIE, 1);
            giveItems(player, MIST_DRAKES_EGG, 6);
            qs.setMemoState(qs.getMemoState() + 1);
            npc.deleteMe();
            htmltext = event;
          }
          break;
        }
      case "30764-03.html":
        {
          takeItems(player, GUSTAVS_2ND_LETTER, -1);
          qs.setMemoState(5000);
          qs.setCond(5, true);
          htmltext = event;
          break;
        }
      case "30764-06.html":
        {
          takeItems(player, GUSTAVS_2ND_LETTER, -1);
          takeItems(player, BLACK_ANVIL_COIN, -1);
          giveItems(player, RECIPE_SPITEFUL_SOUL_ENERGY, 1);
          qs.setMemoState(5000);
          qs.setCond(5, true);
          htmltext = event;
          break;
        }
      case "30765-04.html":
        {
          takeItems(player, IMPERIAL_KEY, -1);
          giveItems(player, SCEPTER_OF_JUDGMENT, 1);
          qs.setMemoState(8700);
          htmltext = event;
          break;
        }
      case "30766-04.html":
        {
          qs.setMemoState(8100);
          qs.setCond(9, true);
          npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.BLOOD_AND_HONOR));
          startQuestTimer("SPAWN_WITCH", 5000, npc, player);
          htmltext = event;
          break;
        }
      case "30766-08.html":
        {
          if (hasQuestItems(player, SCEPTER_OF_JUDGMENT)) {
            giveItems(player, SEAL_OF_ASPIRATION, 1);
            addExpAndSp(player, 0, 250000);
            qs.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
      case "30868-04.html":
        {
          takeItems(player, GUSTAVS_3RD_LETTER, -1);
          qs.setMemoState(8000);
          qs.setCond(8, true);
          htmltext = event;
          break;
        }
      case "30868-10.html":
        {
          qs.setMemoState(9000);
          qs.setCond(11, true);
          htmltext = event;
          break;
        }
      case "30645-06.html":
      case "30760-05.html":
      case "30760-06.html":
      case "30760-07.html":
      case "30760-21.html":
      case "30764-05.html":
      case "30765-02.html":
      case "30765-05a.html":
      case "30766-03.html":
      case "30868-03.html":
      case "30868-06a.html":
        {
          htmltext = event;
          break;
        }
      case "SPAWN_WITCH":
        {
          final L2Npc athrea = addSpawn(WITCH_ATHREA, 160688, 21296, -3714, 0, false, 0);
          athrea.setScriptValue(50301);
          final L2Npc kalis = addSpawn(WITCH_KALIS, 160690, 21176, -3712, 0, false, 0);
          kalis.setScriptValue(50302);
          break;
        }
    }
    return htmltext;
  }
Exemple #14
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    String htmltext = null;
    if (qs == null) {
      return htmltext;
    }
    switch (event) {
      case "30386-03.htm":
        {
          if (qs.isCreated()) {
            qs.startQuest();
            htmltext = event;
          }
          break;
        }
      case "30386-06.html":
        {
          if (qs.isCond(2)) {
            if (hasItem(player, FEATHER)) {
              qs.setCond(3, true);
              takeItem(player, FEATHER);
              giveItems(player, TOTEM_TOOTH_1ST, 1);
              htmltext = event;
            } else {
              htmltext = "30386-07.html";
            }
          }

          break;
        }
      case "30034-02.html":
        {
          if (qs.isCond(3)) {
            if (hasQuestItems(player, TOTEM_TOOTH_1ST)) {
              qs.setCond(4, true);
              takeItems(player, TOTEM_TOOTH_1ST, 1);
              giveItems(player, LETTER_1ST, 1);
              htmltext = event;
            } else {
              htmltext = "30034-03.html";
            }
          }
          break;
        }
      case "30034-06.html":
        {
          if (qs.isCond(5)) {
            if (hasQuestItems(player, LETTER_2ND)) {
              qs.setCond(6, true);
              takeItems(player, LETTER_2ND, 1);
              htmltext = event;
            } else {
              htmltext = "30034-07.html";
            }
          }
          break;
        }
      case "30034-10.html":
        {
          if (qs.isCond(7)) {
            if (hasItem(player, TOTEM_TOOTH_2ND)) {
              addExpAndSp(player, 435117, 23977);
              final int chance = getRandom(1000);
              if (chance < 250) {
                rewardItems(player, BONE_HELMET, 1);
                giveAdena(player, 5200, true);
              } else if (chance < 500) {
                rewardItems(player, ASPIS, 1);
                giveAdena(player, 1500, true);
              } else if (chance < 750) {
                rewardItems(player, BLUE_BUCKSKIN_BOOTS, 1);
                giveAdena(player, 3200, true);
              } else if (chance < 1000) {
                rewardItems(player, LEATHER_GAUNTLET, 1);
                giveAdena(player, 3200, true);
              }
              qs.exitQuest(false, true);
              htmltext = event;
            } else {
              htmltext = "30034-11.html";
            }
          }
          break;
        }
      case "30344-02.html":
        {
          if (qs.isCond(4)) {
            if (hasQuestItems(player, LETTER_1ST)) {
              qs.setCond(5, true);
              takeItems(player, LETTER_1ST, 1);
              giveItems(player, LETTER_2ND, 1);
              htmltext = event;
            } else {
              htmltext = "30344-03.html";
            }
          }
          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 (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 TOBIAS:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
              htmltext = "30297-01.html";
              break;
            case 2:
              htmltext = (st.isSet("talk")) ? "30297-04.html" : "30297-02.html";
              break;
            case 3:
            case 4:
              htmltext = "30297-06.html";
              break;
            case 5:
              st.giveAdena(89046, true);
              if (player.getLevel() <= MAX_REWARD_LEVEL) {
                st.addExpAndSp(223036, 13901);
              }
              st.exitQuest(false, true);
              htmltext = "30297-07.html";
              break;
          }
        }
        break;
      case CASIAN:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
            case 2:
              htmltext = "30612-01.html";
              break;
            case 3:
              htmltext = (st.isSet("talk")) ? "30612-04.html" : "30612-02.html";
              break;
            default:
              htmltext = "30612-10.html";
              break;
          }
        }
        break;
      case ROCK:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
            case 2:
            case 3:
              htmltext = "32368-01.html";
              break;
            case 4:
              htmltext = "32368-02.html";
              break;
            case 5:
              htmltext = "32368-05.html";
              break;
          }
        }
        break;
      case ANGEL:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
            case 2:
            case 3:
              htmltext = "32369-01.html";
              break;
            case 4:
              if (st.getInt("talk") == 1) {
                htmltext = "32369-04.html";
              } else if (st.getInt("talk") == 2) {
                htmltext = "32369-07.html";
              } else {
                htmltext = "32369-02.html";
              }
              break;
          }
        }
        break;
    }
    return htmltext;
  }