@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 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.getLevel() >= MIN_LEVEL) ? "30847-01.htm" : "30847-02.html";
        break;
      case State.STARTED:
        switch (st.getCond()) {
          case 1:
            htmltext = "30847-04.html";
            break;
          case 2:
            htmltext = "30847-05.html";
            break;
          case 3:
            htmltext =
                ((st.getQuestItemsCount(ARTISANS_FRAME) >= COUNT)
                        && (st.getQuestItemsCount(ORIHARUKON) >= COUNT))
                    ? "30847-07.html"
                    : "30847-08.html";
            break;
        }
        break;
      case State.COMPLETED:
        htmltext = getAlreadyCompletedMsg(player);
        break;
    }
    return htmltext;
  }
 @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 onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState st = player.getQuestState(getName());
   String htmltext = getNoQuestMsg(player);
   if (st != null) {
     switch (st.getState()) {
       case State.CREATED:
         {
           htmltext =
               (player.getRace() == Race.DARK_ELF)
                   ? (player.getLevel() >= MIN_LVL) ? "30348-02.htm" : "30348-01.htm"
                   : "30348-00.htm";
           break;
         }
       case State.STARTED:
         {
           if (st.isCond(2) && (st.getQuestItemsCount(DARK_BEZOAR) >= REQUIRED_COUNT)) {
             st.giveItems(LESSER_HEALING_POTION, 5);
             st.addExpAndSp(1000, 0);
             st.exitQuest(false, true);
             htmltext = "30348-05.html";
           } else {
             htmltext = "30348-04.html";
           }
           break;
         }
       case State.COMPLETED:
         {
           htmltext = getAlreadyCompletedMsg(player);
           break;
         }
     }
   }
   return htmltext;
 }
 @Override
 public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) {
   final QuestState st;
   if ((npc.getId() == FALLEN_ANGEL)) {
     st = player.getQuestState(getName());
     if (st.isCond(5)) {
       st.giveItems(FALLEN_ANGEL_BLOOD, 1);
       st.setCond(6, true);
       isAngelSpawned = false;
     }
   } else {
     final L2PcInstance member = getRandomPartyMember(player, 4);
     if (member != null) {
       st = member.getQuestState(getName());
       if (getRandom(1000) < MOBS.get(npc.getId())) {
         st.giveItems(PROPHECY_FRAGMENT, 1);
         if (st.getQuestItemsCount(PROPHECY_FRAGMENT) >= FRAGMENT_COUNT) {
           st.takeItems(PROPHECY_FRAGMENT, -1);
           st.setCond(5, true);
         } else {
           st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
         }
       }
     }
   }
   return super.onKill(npc, player, isSummon);
 }
  @Override
  public final String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    final QuestState st = player.getQuestState(qn);
    if ((st != null) && (st.getState() == State.STARTED)) {
      final long count = st.getQuestItemsCount(NECRO_HEART);
      if (count < 10) {
        int chance = (int) (Config.RATE_QUEST_DROP * DROP_CHANCE);
        int numItems = chance / 100;
        chance = chance % 100;
        if (getRandom(100) < chance) {
          numItems++;
        }
        if (numItems > 0) {
          if ((count + numItems) >= 10) {
            numItems = 10 - (int) count;
            st.playSound("ItemSound.quest_middle");
            st.set("cond", "2");
          } else {
            st.playSound("ItemSound.quest_itemget");
          }

          st.giveItems(NECRO_HEART, numItems);
        }
      }
    }
    return null;
  }
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final QuestState st = killer.getQuestState(getName());
   if ((st != null) && st.isCond(1) && (getRandom(3) < MONSTERS.get(npc.getId()))) {
     st.giveItems(DARK_BEZOAR, 1);
     if (st.getQuestItemsCount(DARK_BEZOAR) < REQUIRED_COUNT) {
       st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
     } else {
       st.setCond(2, true);
     }
   }
   return super.onKill(npc, killer, isSummon);
 }
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final QuestState st = getQuestState(killer, false);
   if ((st != null) && st.isCond(1)) {
     st.giveItems(GRAVE_ROBBERS_HEAD, 1);
     if (st.getQuestItemsCount(GRAVE_ROBBERS_HEAD) >= 50) {
       st.setCond(2, true);
     } else {
       st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
     }
   }
   return super.onKill(npc, killer, isSummon);
 }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(getName());
    if (st == null) {
      return getNoQuestMsg(player);
    }

    String htmltext = event;
    int level = checkLevel(st);

    if (event.equalsIgnoreCase("game")) {
      htmltext =
          st.getQuestItemsCount(GLITTERING_MEDAL) < MEDALS[level]
              ? "31229-no.htm"
              : "31229-game.htm";
    } else if (event.equalsIgnoreCase("heads") || event.equalsIgnoreCase("tails")) {
      if (st.getQuestItemsCount(GLITTERING_MEDAL) < MEDALS[level]) {
        htmltext = "31229-" + event.toLowerCase() + "-10.htm";
      } else {
        st.takeItems(GLITTERING_MEDAL, MEDALS[level]);

        if (getRandom(100) > WIN_CHANCE) {
          level = 0;
        } else {
          if (level > 0) {
            st.takeItems(BADGES[level - 1], -1);
          }
          st.giveItems(BADGES[level], 1);
          st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
          level++;
        }
        htmltext = "31229-" + event.toLowerCase() + "-" + String.valueOf(level) + ".htm";
      }
    } else if (event.equalsIgnoreCase("talk")) {
      htmltext = String.valueOf(npc.getId()) + "-lvl-" + String.valueOf(level) + ".htm";
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (st == null) {
      return htmltext;
    }

    if (st.isCreated()) {
      htmltext = "31537-01.htm";
    } else if (st.isStarted()) {
      if (st.isCond(1)) {
        if (st.getQuestItemsCount(PRIME_MEAT) < PRIME_MEAT_COUNT) {
          htmltext = "31537-04.html";
        }
      } else if (st.isCond(2)) {
        if (st.getQuestItemsCount(PRIME_MEAT) >= PRIME_MEAT_COUNT) {
          htmltext = "31537-05.html";
        }
      }
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    QuestState st = getQuestState(player, true);
    if (st == null) {
      return htmltext;
    }

    switch (st.getState()) {
      case State.COMPLETED:
        htmltext = "32557-0a.html";
        break;
      case State.CREATED:
        st = player.getQuestState(Q10273_GoodDayToFly.class.getSimpleName());
        if (st == null) {
          htmltext = "32557-00.html";
        } else {
          htmltext =
              ((player.getLevel() >= 75) && st.isCompleted()) ? "32557-01.htm" : "32557-00.html";
        }
        break;
      case State.STARTED:
        if ((st.getQuestItemsCount(RED)
                + st.getQuestItemsCount(BLUE)
                + st.getQuestItemsCount(GREEN))
            >= 8) {
          htmltext = "32557-05.html";
          st.giveItems(13728, 1);
          st.addExpAndSp(25160, 2525);
          st.exitQuest(false, true);
        } else {
          htmltext = "32557-04.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 "30847-03.htm":
        st.startQuest();
        break;
      case "30847-06.html":
        if (st.getQuestItemsCount(ENCHANTED_IRON) < IRON_COUNT) {
          return getNoQuestMsg(player);
        }
        st.takeItems(ENCHANTED_IRON, -1);
        st.setCond(3, true);
        break;
      case "30847-09.html":
        if ((st.getQuestItemsCount(ARTISANS_FRAME) >= COUNT)
            && (st.getQuestItemsCount(ORIHARUKON) >= COUNT)) {
          st.takeItems(ARTISANS_FRAME, 10);
          st.takeItems(ORIHARUKON, 10);
          st.giveItems(SEWING_KIT, 1);
          st.exitQuest(false, true);
        } else {
          htmltext = "30847-10.html";
        }
        break;
      default:
        htmltext = null;
        break;
    }
    return htmltext;
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) {
    final L2PcInstance member = getRandomPartyMember(player, 3);
    if (member == null) {
      return super.onKill(npc, player, isSummon);
    }
    final QuestState st = member.getQuestState(getName());
    if ((getRandom(1000) < MOBS.get(npc.getId()))) {
      if (st.getQuestItemsCount(STOLEN_CARGO) < ITEM_COUNT) {
        st.giveItems(STOLEN_CARGO, 1);
      } else if (st.getQuestItemsCount(HATE_CRYSTAL) < ITEM_COUNT) {
        st.giveItems(HATE_CRYSTAL, 1);
      } else {
        st.giveItems(OLD_TREASURE_MAP, 1);
      }

      if ((st.getQuestItemsCount(STOLEN_CARGO) >= ITEM_COUNT)
          && (st.getQuestItemsCount(HATE_CRYSTAL) >= ITEM_COUNT)
          && (st.getQuestItemsCount(OLD_TREASURE_MAP) >= ITEM_COUNT)) {
        st.setCond(4, true);
      }
    }
    return super.onKill(npc, player, isSummon);
  }
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final QuestState st = getQuestState(killer, false);
   if ((st != null) && st.isCond(1)) {
     final long count = st.getQuestItemsCount(KASHA_WOLF_FANG);
     int amount = ((getRandom(100) < 25) && (count < 49)) ? 2 : 1;
     st.giveItems(KASHA_WOLF_FANG, amount);
     if ((count + amount) >= 50) {
       st.setCond(2, true);
     } else {
       st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
     }
   }
   return super.onKill(npc, killer, isSummon);
 }
 @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)
                       ? (hasAtLeastOneQuestItem(player, NECKLACE_OF_VALOR, NECKLACE_OF_COURAGE))
                           ? "30577-07.htm"
                           : "30577-03.htm"
                       : "30577-02.htm"
                   : "30577-01.htm";
           break;
         }
       case State.STARTED:
         {
           switch (st.getCond()) {
             case 1:
               {
                 htmltext = "30577-05.html";
                 break;
               }
             case 2:
               {
                 if (st.getQuestItemsCount(KASHA_WOLF_FANG) >= 50) {
                   if (getRandom(100) <= 13) {
                     st.rewardItems(NECKLACE_OF_VALOR, 1);
                     st.rewardItems(HEALING_POTION, 10);
                   } else {
                     st.rewardItems(NECKLACE_OF_COURAGE, 1);
                   }
                   st.takeItems(KASHA_WOLF_FANG, -1);
                   st.exitQuest(true, true);
                   htmltext = "30577-06.html";
                 }
                 break;
               }
           }
           break;
         }
     }
   }
   return htmltext;
 }
 @Override
 public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) {
   final L2PcInstance member = getRandomPartyMember(player, 1);
   if (member != null) {
     final QuestState st = member.getQuestState(getName());
     if (getRandomBoolean()) {
       st.giveItems(ENCHANTED_IRON, 1);
       if (st.getQuestItemsCount(ENCHANTED_IRON) >= IRON_COUNT) {
         st.setCond(2, true);
       } else {
         st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
       }
     }
   }
   return super.onKill(npc, player, isSummon);
 }
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final L2PcInstance partyMember = getRandomPartyMember(killer, 1);
   if (partyMember != null) {
     final QuestState st = partyMember.getQuestState(getName());
     final float chance = (MONSTERS.get(npc.getId()) * Config.RATE_QUEST_DROP);
     if (getRandom(1000) < chance) {
       st.giveItems(BLOOD_OF_SAINT, 1);
       if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) {
         st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
       } else {
         st.setCond(2, true);
       }
     }
   }
   return super.onKill(npc, killer, isSummon);
 }
  @Override
  public final String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(qn);
    final QuestState contractOfMammon = player.getQuestState("194_SevenSignContractOfMammon");

    if (st == null) return "<html><body>目前沒有執行任務,或條件不符。</body></html>";

    final int cond = st.getInt("cond");
    switch (npc.getNpcId()) {
      case CLAUDIA:
        switch (st.getState()) {
          case State.CREATED:
            if (cond == 0
                && player.getLevel() >= 79
                && contractOfMammon.getState() == State.COMPLETED) return "31001-01.htm";
            else st.exitQuest(true);
            return "31001-00.htm";
          case State.STARTED:
            if (cond == 1) return "31001-06.htm";
          case State.COMPLETED:
            return "<html><body>這是已經完成的任務。</body></html>";
        }
      case JOHN:
        switch (st.getInt("cond")) {
          case 1:
            return "32576-01.htm";
          case 2:
            return "32576-03.htm";
        }
      case RAYMOND:
        switch (st.getInt("cond")) {
          case 1:
          case 2:
            return "30289-01.htm";
          case 3:
            if (st.getQuestItemsCount(SHUNAIMAN_CONTRACT) == 1) return "30289-09.htm";
            else return "30289-06.htm";
          case 4:
            return "30289-12.htm";
        }
      case IASON_HEINE:
        if (cond == 4) return "30969-01.htm";
    }
    return "<html><body>目前沒有執行任務,或條件不符。</body></html>";
  }
 @Override
 public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
   final QuestState st = getQuestState(player, false);
   if ((st != null) && st.isCond(1)) {
     long skins = st.getQuestItemsCount(BEAR_SKIN);
     if (skins < REQUIRED_COUNT) {
       if (getRandom(100) < MONSTERS.get(npc.getId())) {
         st.giveItems(BEAR_SKIN, 1);
         if ((++skins) < REQUIRED_COUNT) {
           st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
         } else {
           st.setCond(2, true);
         }
       }
     }
   }
   return super.onKill(npc, player, isPet);
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);
    if (st == null) {
      return htmltext;
    }

    L2Clan clan = player.getClan();
    switch (st.getState()) {
      case State.CREATED:
        htmltext =
            ((clan == null) || !player.isClanLeader() || (clan.getLevel() < 5))
                ? "31331-0.htm"
                : "31331-1.htm";
        break;
      case State.STARTED:
        if ((clan == null) || !player.isClanLeader()) {
          st.exitQuest(true);
          return "31331-8.html";
        }

        if (!st.hasQuestItems(TYRANNOSAURUS_CLAW)) {
          htmltext = "31331-4.html";
        } else {
          int count = (int) st.getQuestItemsCount(TYRANNOSAURUS_CLAW);
          int reward = (count < 10) ? (30 * count) : (59 + (30 * count));
          st.playSound(QuestSound.ITEMSOUND_QUEST_FANFARE_1);
          st.takeItems(TYRANNOSAURUS_CLAW, -1);
          clan.addReputationScore(reward, true);
          player.sendPacket(
              SystemMessage.getSystemMessage(
                      SystemMessageId
                          .YOU_HAVE_SUCCESSFULLY_COMPLETED_A_CLAN_QUEST_S1_POINT_S_HAVE_BEEN_ADDED_TO_YOUR_CLAN_REPUTATION)
                  .addInt(reward));
          clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
          htmltext = "31331-7.html";
        }
        break;
      default:
        break;
    }
    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 final String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(qn);
    if (st == null) {
      return "<html><body>目前沒有執行任務,或條件不符。</body></html>";
    }

    final byte id = st.getState();
    if (id == State.CREATED) {
      if (player.getLevel() > 72) {
        if (st.hasQuestItems(FADED_MARK)) {
          return "32010-02.htm";
        }
        if (st.hasQuestItems(VISITOR_MARK)) {
          st.exitQuest(true);
          return "32010-01a.htm";
        }
        if (st.hasQuestItems(MARK)) {
          st.exitQuest(true);
          return "32010-0.htm";
        }
      }
      st.exitQuest(true);
      return "32010-01.htm";
    } else if (id == State.STARTED) {
      if ((st.getInt("cond") == 2) && (st.getQuestItemsCount(NECRO_HEART) == 10)) {
        st.takeItems(NECRO_HEART, 10);
        st.takeItems(FADED_MARK, 1);
        st.giveItems(MARK, 1);
        st.giveItems(8273, 10);
        st.playSound("ItemSound.quest_finish");
        st.exitQuest(true);
        return "32010-05.htm";
      }
      return "32010-04.htm";
    }
    return "<html><body>目前沒有執行任務,或條件不符。</body></html>";
  }
 @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;
 }
  @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;
  }
示例#26
0
  @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 "30505-03.html":
      case "30297-03.html":
        {
          qs.startQuest();
          htmltext = event;
          break;
        }
      case "30332-02.html":
        {
          if (qs.getQuestItemsCount(KEKROPUS_LETTER.getId()) < 1) {
            giveItems(player, KEKROPUS_LETTER);
          }
          htmltext = event;
          break;
        }
      case "30332-03.html":
        {
          if (qs.isCond(1)) {
            qs.setCond(2);
            htmltext = event;
          }
          break;
        }
      case "30332-05.html":
        {
          if (qs.isCond(2)) {
            qs.setCond(3);
            giveItems(player, SCROLL_OF_ESCAPE_HEINE);
            htmltext = event;
          }
          break;
        }
      case "30916-03.html":
        {
          if (qs.isCond(3)) {
            qs.setCond(4);
            giveItems(player, SCROLL_OF_ESCAPE_ALIGATOR_ISLAND);
            htmltext = event;
          }
          break;
        }
      case "33858-02.html":
        {
          if (qs.isCond(4)) {
            giveItems(player, ENCHANT_WEAPON_C);
            giveItems(player, STEEL_DOOR_GUILD);
            addExpAndSp(player, EXP_REWARD, SP_REWARD);
            showOnScreenMsg(
                player,
                NpcStringId
                    .GROW_STRONGER_HERE_UNTIL_YOU_RECEIVE_THE_NEXT_LETTER_FROM_KEKROPUS_AT_LV_46,
                ExShowScreenMessage.TOP_CENTER,
                4500);
            qs.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
      case "30505-02.htm":
      case "30297-02.htm":
      case "30916-02.html":
        {
          htmltext = event;
          break;
        }
    }
    return htmltext;
  }