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

    switch (event) {
      case "31340-04.htm":
        {
          if (st.isCreated()) {
            htmltext = event;
          }
          break;
        }
      case "31340-05.html":
        {
          if (st.isCreated()) {
            st.startQuest();
            htmltext = event;
          }
          break;
        }
      case "31340-06.html":
        {
          if (st.isCond(1)) {
            st.setCond(2, true);
            htmltext = event;
          }
          break;
        }
      case "31340-07.html":
        {
          if (st.isCond(1)) {
            st.setCond(3, true);
            htmltext = event;
          }
          break;
        }
      case "31340-08.html":
        {
          if (st.isCond(1)) {
            st.setCond(4, true);
            htmltext = event;
          }
          break;
        }
      case "31340-10.html":
        {
          if (st.isCond(1)) {
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (qs == null) {
      return htmltext;
    }

    if (qs.isCreated()) {
      final QuestState q10288 = player.getQuestState(Q10288_SecretMission.class.getSimpleName());
      if ((player.getLevel() < 82) || (q10288 == null) || !q10288.isCompleted()) {
        htmltext = "32757-00.htm";
      } else {
        htmltext = "32757-01.htm";
      }
    } else if (qs.isStarted()) {
      switch (qs.getCond()) {
        case 1:
          htmltext = "32757-04.html";
          break;
        case 2:
        case 3:
          htmltext = "32757-05.html";
          break;
      }
    } else {
      htmltext = "32757-10.html";
    }
    return htmltext;
  }
示例#3
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 "30307-04.htm":
       {
         htmltext = event;
         break;
       }
     case "30307-05.htm":
       {
         if (qs.isCreated()) {
           qs.startQuest();
           giveItems(player, KAROYDS_LETTER, 1);
           htmltext = event;
         }
         break;
       }
   }
   return htmltext;
 }
  @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 "31388-03.htm":
        {
          if (qs.isCreated()) {
            qs.startQuest();
            htmltext = event;
          }
          break;
        }
      case "31388-04.html":
      case "31388-05.html":
      case "31388-06.html":
        {
          if (qs.isStarted()) {
            htmltext = event;
          }
          break;
        }
      case "31388-07.html":
        {
          if (qs.isCond(2)) {
            if (getQuestItemsCount(player, RIB_BONE_OF_A_BLACK_MAGUS) >= RIB_BONE_REQUIRED_COUNT) {
              giveAdena(player, 25000, true);
              addExpAndSp(player, 305235, 0);
              takeItems(player, RIB_BONE_OF_A_BLACK_MAGUS, -1);
              qs.setCond(1, true);
              htmltext = event;
            } else {
              htmltext = "31388-08.html";
            }
          }
          break;
        }
      case "31388-09.html":
        {
          if (qs.isStarted()) {
            qs.exitQuest(true, true);
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    String html = null;

    if (qs == null) {
      return html;
    }

    switch (event) {
      case "quest_accept":
        {
          if (qs.isCreated()
              && (player.getLevel() >= MIN_LEVEL)
              && player.isInCategory(CategoryType.KNIGHT_GROUP)) {
            qs.startQuest();
            qs.setMemoState(1);
            qs.set("flag", 0);

            if (rewardDimensionalDiamonds(player)) {
              html = "30109-04a.htm";
            } else {
              html = "30109-04.htm";
            }
          }
          break;
        }
      case "30116-02.html":
      case "30116-03.html":
      case "30116-04.html":
        {
          if (qs.isMemoState(10) && hasQuestItems(player, TEAR_OF_LOYALTY)) {
            html = event;
          }
          break;
        }
      case "30116-05.html":
        {
          if (qs.isMemoState(10) && hasQuestItems(player, TEAR_OF_LOYALTY)) {
            html = event;
            takeItems(player, TEAR_OF_LOYALTY, -1);
            qs.setMemoState(11);
            qs.setCond(14, true);
          }
          break;
        }
    }
    return html;
  }
 @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 onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (qs == null) {
      return htmltext;
    }

    if (qs.isCreated()) {
      htmltext = ((player.getLevel() >= MIN_LVL) ? "31388-01.htm" : "31388-02.htm");
    } else if (qs.isStarted()) {
      htmltext =
          ((getQuestItemsCount(player, RIB_BONE_OF_A_BLACK_MAGUS) >= RIB_BONE_REQUIRED_COUNT)
              ? "31388-04.html"
              : "31388-05.html");
    }
    return htmltext;
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   QuestState st = getQuestState(player, true);
   String htmltext = getNoQuestMsg(player);
   if (st.isCreated()) {
     st = player.getQuestState(Q00119_LastImperialPrince.class.getSimpleName());
     htmltext =
         ((player.getLevel() >= MIN_LEVEL) && (st != null) && (st.isCompleted()))
             ? "31453-01.htm"
             : "31453-04.htm";
   } else if (st.isStarted()) {
     if (st.isMemoState(1)) {
       st.setMemoState(2);
       st.setCond(2, true);
       htmltext = "31453-03.html";
     } else if (st.isMemoState(2)) {
       htmltext = (hasQuestItems(player, ANTELOPE_SKIN) ? "31453-06.html" : "31453-05.html");
     }
   }
   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 = ((player.getLevel() >= MIN_LEVEL) ? "30926-01.htm" : "30926-03.html");
    } else if (st.isStarted()) {
      if (hasQuestItems(player, BLADE_STAKATO_FANG)) {
        final long count = getQuestItemsCount(player, BLADE_STAKATO_FANG);
        final long bonus = (count >= 10 ? 9450 : 2000);
        giveAdena(player, (count * 250) + bonus, true);
        takeItems(player, BLADE_STAKATO_FANG, -1);
        htmltext = "30926-04.html";
      } else {
        htmltext = "30926-07.html";
      }
    }
    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 onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(getName());
    String htmltext = null;
    if (st == null) {
      return htmltext;
    }

    switch (event) {
      case "32054-03.htm":
        {
          if (st.isCreated()) {
            st.startQuest();
            htmltext = event;
          }
          break;
        }
      case "32054-07.html":
      case "32054-08.html":
        {
          if (st.isStarted()) {
            htmltext = event;
          }
          break;
        }
      case "32054-09.html":
        {
          if (st.isStarted()) {
            st.exitQuest(true, true);
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState qs = getQuestState(player, true);
   String htmltext = getNoQuestMsg(player);
   if (qs.isCreated() || qs.isCompleted()) {
     if (npc.getId() == PRIEST_MANUEL) {
       if (!hasQuestItems(player, LEAF_OF_ORACLE)) {
         htmltext = "30293-01.htm";
       } else {
         htmltext = "30293-04.htm";
       }
     }
   } else if (qs.isStarted()) {
     switch (npc.getId()) {
       case PRIEST_MANUEL:
         {
           if (hasQuestItems(player, CRYSTAL_MEDALLION)) {
             if (!hasAtLeastOneQuestItem(
                 player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) {
               if (qs.isMemoState(2)) {
                 qs.setMemoState(1);
                 qs.setCond(8);
                 htmltext = "30293-09.html";
               } else {
                 qs.setMemoState(1);
                 htmltext = "30293-06.html";
               }
             } else if (hasQuestItems(
                 player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, LIZARD_CAPTAIN_ORDER)) {
               if (!hasQuestItems(player, HALF_OF_DAIRY)) {
                 giveAdena(player, 163800, true);
                 giveItems(player, LEAF_OF_ORACLE, 1);
                 final int level = player.getLevel();
                 if (level >= 20) {
                   addExpAndSp(player, 320534, 20392);
                 } else if (level == 19) {
                   addExpAndSp(player, 456128, 27090);
                 } else {
                   addExpAndSp(player, 591724, 33788);
                 }
                 qs.exitQuest(false, true);
                 player.sendPacket(new SocialAction(player.getObjectId(), 3));
                 qs.saveGlobalQuestVar("1ClassQuestFinished", "1");
                 htmltext = "30293-08.html";
               }
             } else {
               htmltext = "30293-07.html";
             }
           }
           break;
         }
       case ALLANA:
         {
           if (hasQuestItems(player, CRYSTAL_MEDALLION)) {
             if (!hasAtLeastOneQuestItem(
                 player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) {
               if (qs.isMemoState(2)) {
                 htmltext = "30424-05.html";
               } else if (qs.isMemoState(1)) {
                 qs.setCond(2, true);
                 htmltext = "30424-01.html";
               }
             } else if (!hasAtLeastOneQuestItem(
                     player, SWINDLERS_MONEY, ALLANA_OF_DAIRY, HALF_OF_DAIRY)
                 && hasQuestItems(player, LIZARD_CAPTAIN_ORDER)) {
               qs.setMemoState(2);
               giveItems(player, HALF_OF_DAIRY, 1);
               qs.setCond(4, true);
               htmltext = "30424-02.html";
             } else if (!hasAtLeastOneQuestItem(player, SWINDLERS_MONEY, ALLANA_OF_DAIRY)
                 && hasQuestItems(player, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) {
               if ((qs.isMemoState(3)) && !hasQuestItems(player, TAMIL_NECKLACE)) {
                 qs.setMemoState(2);
                 qs.setCond(4, true);
                 htmltext = "30424-06.html";
               } else {
                 htmltext = "30424-03.html";
               }
             } else if (hasQuestItems(player, SWINDLERS_MONEY, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)
                 && !hasQuestItems(player, ALLANA_OF_DAIRY)) {
               giveItems(player, ALLANA_OF_DAIRY, 1);
               takeItems(player, HALF_OF_DAIRY, 1);
               qs.setCond(9, true);
               htmltext = "30424-04.html";
             } else if (hasQuestItems(
                 player, SWINDLERS_MONEY, LIZARD_CAPTAIN_ORDER, ALLANA_OF_DAIRY)) {
               qs.setCond(7, true);
               htmltext = "30424-05.html";
             }
           }
           break;
         }
       case PERRIN:
         {
           if (hasQuestItems(player, CRYSTAL_MEDALLION, LIZARD_CAPTAIN_ORDER, HALF_OF_DAIRY)) {
             if (hasQuestItems(player, TAMIL_NECKLACE)) {
               giveItems(player, SWINDLERS_MONEY, 1);
               takeItems(player, TAMIL_NECKLACE, 1);
               qs.setCond(6, true);
               htmltext = "30428-04.html";
             } else if (hasQuestItems(player, SWINDLERS_MONEY)) {
               htmltext = "30428-05.html";
             } else if (qs.isMemoState(3)) {
               htmltext = "30428-06.html";
             } else {
               htmltext = "30428-01.html";
             }
           }
           break;
         }
     }
   }
   return htmltext;
 }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState qs = getQuestState(player, true);
   final int memoState = qs.getMemoState();
   String htmltext = getNoQuestMsg(player);
   if (qs.isCreated()) {
     if (npc.getId() == BLACK_JUDGE) {
       if (player.getPkKills() == 0) {
         htmltext = "30981-01.htm";
       } else {
         htmltext = "30981-02.htm";
       }
     }
   } else if (qs.isStarted()) {
     switch (npc.getId()) {
       case BLACK_JUDGE:
         {
           if (memoState == 1000) {
             takeItems(player, PENITENTS_MANACLES, 1);
           } else if (memoState < 9) {
             htmltext = "30981-07.html";
           } else if ((memoState >= 9) && (memoState <= 12)) {
             if (!hasAtLeastOneQuestItem(
                 player,
                 MANUAL_OF_MANACLES,
                 MANACLES_OF_PENITENT,
                 PENITENTS_MANACLES1,
                 PENITENTS_MANACLES)) {
               giveItems(player, MANUAL_OF_MANACLES, 1);
               qs.setCond(14, true);
               htmltext = "30981-08.html";
             } else if (hasQuestItems(player, MANUAL_OF_MANACLES)
                 && !hasAtLeastOneQuestItem(
                     player, MANACLES_OF_PENITENT, PENITENTS_MANACLES1, PENITENTS_MANACLES)) {
               htmltext = "30981-09.html";
             } else if (hasQuestItems(player, PENITENTS_MANACLES1)
                 && !hasAtLeastOneQuestItem(
                     player, MANUAL_OF_MANACLES, MANACLES_OF_PENITENT, PENITENTS_MANACLES)) {
               htmltext = "30981-10.html";
             } else if (hasQuestItems(player, PENITENTS_MANACLES)) {
               final L2ItemInstance petItem =
                   player.getInventory().getItemByItemId(PENITENTS_MANACLES);
               final int petLevel = (petItem == null) ? 0 : petItem.getEnchantLevel();
               if (petLevel < (qs.getMemoStateEx(1) + 1)) {
                 htmltext = "30981-12.html";
               } else {
                 htmltext = "30981-13.html";
               }
             } else if (hasQuestItems(player, MANACLES_OF_PENITENT)
                 && !hasQuestItems(player, PENITENTS_MANACLES)) {
               htmltext = "30981-16t.html";
             }
           }
           break;
         }
       case BLACKSMITH_PUSHKIN:
         {
           if ((memoState >= 9) && (memoState <= 12)) {
             if (!hasAtLeastOneQuestItem(
                     player, PENITENTS_MANACLES1, PENITENTS_MANACLES, MANACLES_OF_PENITENT)
                 && hasQuestItems(player, MANUAL_OF_MANACLES)) {
               if ((getQuestItemsCount(player, BLACKSMITHS_FRAME) > 0)
                   && (getQuestItemsCount(player, STEEL) >= 5)
                   && (getQuestItemsCount(player, ADAMANTITE_NUGGET) >= 2)
                   && (getQuestItemsCount(player, SILVER_NUGGET) >= 10)
                   && (getQuestItemsCount(player, COKES) >= 10)) {
                 takeItems(player, SILVER_NUGGET, 10);
                 takeItems(player, ADAMANTITE_NUGGET, 2);
                 takeItems(player, COKES, 10);
                 takeItems(player, STEEL, 5);
                 takeItems(player, BLACKSMITHS_FRAME, 1);
                 giveItems(player, PENITENTS_MANACLES1, 1);
                 takeItems(player, MANUAL_OF_MANACLES, 1);
                 qs.setCond(15, true);
                 htmltext = "30300-01.html";
               } else {
                 htmltext = "30300-02.html";
               }
             } else if (hasAtLeastOneQuestItem(
                 player, PENITENTS_MANACLES1, PENITENTS_MANACLES, MANACLES_OF_PENITENT)) {
               htmltext = "30300-03.html";
             }
           }
           break;
         }
       case PIOTUR:
         {
           if (memoState == 2) {
             qs.setMemoState(6);
             qs.setCond(7, true);
             htmltext = "30597-01.html";
           } else if (memoState == 6) {
             if (getQuestItemsCount(player, TUREK_WAR_HOUNDS_TAIL) < 10) {
               htmltext = "30597-02.html";
             } else {
               takeItems(player, TUREK_WAR_HOUNDS_TAIL, -1);
               qs.setMemoState(10);
               qs.setCond(11, true);
               htmltext = "30597-03.html";
             }
           } else if (memoState == 10) {
             htmltext = "30597-04.html";
           }
           break;
         }
       case ELDER_CASIAN:
         {
           if (memoState == 3) {
             qs.setMemoState(7);
             qs.setCond(8, true);
             htmltext = "30612-01.html";
           } else if (memoState == 7) {
             if (!hasQuestItems(player, TYRANT_KINGPINS_HEART)) {
               htmltext = "30612-02.html";
             } else {
               takeItems(player, TYRANT_KINGPINS_HEART, -1);
               qs.setMemoState(11);
               qs.setCond(12, true);
               htmltext = "30612-03.html";
             }
           } else if (memoState == 11) {
             htmltext = "30612-04.html";
           }
           break;
         }
       case KATARI:
         {
           if (memoState == 1) {
             qs.setMemoState(5);
             qs.setCond(6, true);
             htmltext = "30668-01.html";
           } else if (memoState == 5) {
             if (getQuestItemsCount(player, RATMAN_SCAVENGERS_SKULL) < 10) {
               htmltext = "30668-02.html";
             } else {
               takeItems(player, RATMAN_SCAVENGERS_SKULL, -1);
               qs.setMemoState(9);
               qs.setCond(10, true);
               htmltext = "30668-03.html";
             }
           } else if (memoState == 9) {
             htmltext = "30668-04.html";
           }
           break;
         }
       case MAGISTER_JOAN:
         {
           if (memoState == 4) {
             qs.setMemoState(8);
             qs.setCond(9, true);
             htmltext = "30718-01.html";
           } else if (memoState == 8) {
             if (getQuestItemsCount(player, TRISALIM_TARANTULAS_VENOM_SAC) < 3) {
               htmltext = "30718-02.html";
             } else {
               takeItems(player, TRISALIM_TARANTULAS_VENOM_SAC, -1);
               qs.setMemoState(12);
               qs.setCond(13, true);
               htmltext = "30718-03.html";
             }
           } else if (memoState == 12) {
             htmltext = "30718-04.html";
           }
           break;
         }
     }
   }
   return htmltext;
 }
示例#14
0
 @Override
 public String onTalk(L2Npc npc, L2PcInstance talker) {
   final QuestState qs = getQuestState(talker, true);
   String htmltext = getNoQuestMsg(talker);
   switch (npc.getId()) {
     case BLACKSMITH_KAROYD:
       {
         if (qs.isCreated()) {
           if (talker.getRace() != Race.DARK_ELF) {
             htmltext = "30307-01.htm";
           } else if (talker.getLevel() < MIN_LVL) {
             htmltext = "30307-02.htm";
           } else {
             htmltext = "30307-03.htm";
           }
         } else if (qs.isStarted()) {
           if (hasAtLeastOneQuestItem(
               talker, KAROYDS_LETTER, CECKTINONS_VOUCHER1, CECKTINONS_VOUCHER2)) {
             htmltext = "30307-06.html";
           } else if (hasQuestItems(talker, STEELBENDERS_HEAD)) {
             // Q00281_HeadForTheHills.giveNewbieReward(talker);
             addExpAndSp(talker, 46663, 3999);
             giveAdena(talker, 19799, true);
             for (ItemHolder reward : REWARDS) {
               rewardItems(talker, reward);
             }
             rewardItems(talker, BLOODSABER, 1);
             qs.exitQuest(false, true);
             talker.sendPacket(new SocialAction(talker.getObjectId(), 3));
             htmltext = "30307-07.html";
           }
         } else if (qs.isCompleted()) {
           htmltext = getAlreadyCompletedMsg(talker);
           break;
         }
       }
     case CECON:
       {
         if (qs.isStarted()) {
           if (hasQuestItems(talker, KAROYDS_LETTER)) {
             qs.setCond(2, true);
             takeItems(talker, KAROYDS_LETTER, 1);
             giveItems(talker, CECKTINONS_VOUCHER1, 1);
             htmltext = "30132-01.html";
           } else if (hasAtLeastOneQuestItem(talker, CECKTINONS_VOUCHER1, CECKTINONS_VOUCHER2)) {
             htmltext = "30132-02.html";
           } else if (hasQuestItems(talker, SOUL_CATCHER)) {
             qs.setCond(6, true);
             takeItems(talker, SOUL_CATCHER, 1);
             giveItems(talker, PRESERVE_OIL, 1);
             htmltext = "30132-03.html";
           } else if (hasQuestItems(talker, PRESERVE_OIL)
               && !hasQuestItems(talker, ZOMBIE_HEAD, STEELBENDERS_HEAD)) {
             htmltext = "30132-04.html";
           } else if (hasQuestItems(talker, ZOMBIE_HEAD)) {
             qs.setCond(8, true);
             takeItems(talker, ZOMBIE_HEAD, 1);
             giveItems(talker, STEELBENDERS_HEAD, 1);
             htmltext = "30132-05.html";
           } else if (hasQuestItems(talker, STEELBENDERS_HEAD)) {
             htmltext = "30132-06.html";
           }
         }
         break;
       }
     case HARNE:
       {
         if (qs.isStarted()) {
           if (hasQuestItems(talker, CECKTINONS_VOUCHER1)) {
             qs.setCond(3, true);
             takeItems(talker, CECKTINONS_VOUCHER1, 1);
             giveItems(talker, CECKTINONS_VOUCHER2, 1);
             htmltext = "30144-01.html";
           } else if (hasQuestItems(talker, CECKTINONS_VOUCHER2)) {
             if (getQuestItemsCount(talker, BONE_FRAGMENT) >= 10) {
               qs.setCond(5, true);
               takeItems(talker, CECKTINONS_VOUCHER2, 1);
               takeItems(talker, BONE_FRAGMENT, 10);
               giveItems(talker, SOUL_CATCHER, 1);
               htmltext = "30144-03.html";
             } else {
               htmltext = "30144-02.html";
             }
           } else if (hasQuestItems(talker, SOUL_CATCHER)) {
             htmltext = "30144-04.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 htmltext = null;
    switch (event) {
      case "ACCEPT":
        {
          if (qs.isCreated()) {
            qs.startQuest();
            qs.setMemoState(1);
            giveItems(player, VOUCHER_OF_TRIAL, 1);
            playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
            if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) {
              giveItems(player, DIMENSIONAL_DIAMOND, 49);
              player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1);
              htmltext = "30648-04a.htm";
            } else {
              htmltext = "30648-04.htm";
            }
          }
          break;
        }
      case "30648-05.html":
      case "30648-06.html":
      case "30648-07.html":
      case "30648-08.html":
        {
          htmltext = event;
          break;
        }
      case "30362-05.html":
        {
          if (qs.isMemoState(15) && hasQuestItems(player, BOOK_OF_DARKNESS)) {
            takeItems(player, BOOK_OF_DARKNESS, 1);
            qs.setMemoState(16);
            qs.setCond(16, true);
            htmltext = event;
          }
          break;
        }
      case "30362-04.html":
        {
          if (qs.isMemoState(15) && hasQuestItems(player, BOOK_OF_DARKNESS)) {
            qs.setMemoState(16);
            qs.setCond(16, true);
            htmltext = event;
          }
          break;
        }
      case "30649-04.html":
        {
          if (qs.isMemoState(4) && hasQuestItems(player, ESSENSE_OF_FLAME)) {
            giveItems(player, SPIRIT_OF_FLAME, 1);
            takeItems(player, ESSENSE_OF_FLAME, 1);
            qs.setMemoState(5);
            qs.setCond(5, true);
            htmltext = event;
          }
          break;
        }
      case "30650-02.html":
        {
          if (qs.isMemoState(6) && hasQuestItems(player, TAG_OF_RUMOR)) {
            if (getQuestItemsCount(player, ADENA) >= 100000) {
              giveItems(player, BOOK_OF_GERALD, 1);
              takeItems(player, ADENA, 100000);
              qs.setMemoState(7);
              htmltext = event;
            } else {
              htmltext = "30650-03.html";
            }
          }
          break;
        }
      case "30650-03.html":
        {
          if (qs.isMemoState(6) && hasQuestItems(player, TAG_OF_RUMOR)) {
            htmltext = event;
          }
          break;
        }
      case "30652-02.html":
        {
          if (qs.isMemoState(14) && hasQuestItems(player, DEBRIS_OF_WILLOW)) {
            giveItems(player, BOOK_OF_DARKNESS, 1);
            takeItems(player, DEBRIS_OF_WILLOW, 1);
            qs.setMemoState(15);
            qs.setCond(15, true);
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    final int memoState = qs.getMemoState();
    String htmltext = getNoQuestMsg(player);
    if (qs.isCreated()) {
      if (npc.getId() == HERMIT_SANTIAGO) {
        if (!player.isInCategory(CategoryType.HEAL_GROUP)) {
          htmltext = "30648-02.html";
        } else if (player.getLevel() < MIN_LVL) {
          htmltext = "30648-01.html";
        } else {
          htmltext = "30648-03.htm";
        }
      }
    } else if (qs.isStarted()) {
      switch (npc.getId()) {
        case HERMIT_SANTIAGO:
          {
            if (memoState >= 1) {
              if (!hasQuestItems(player, BOOK_OF_SAGE)) {
                htmltext = "30648-09.html";
              } else {
                giveAdena(player, 229298, true);
                giveItems(player, MARK_OF_PILGRIM, 1);
                addExpAndSp(player, 1258250, 81606);
                qs.exitQuest(false, true);
                player.sendPacket(new SocialAction(player.getObjectId(), 3));
                htmltext = "30648-10.html";
              }
            }
            break;
          }
        case PRIEST_PETRON:
          {
            if (memoState == 9) {
              giveItems(player, PICTURE_OF_NAHIR, 1);
              qs.setMemoState(10);
              qs.setCond(10, true);
              htmltext = "30036-01.html";
            } else if (memoState == 10) {
              htmltext = "30036-02.html";
            } else if (memoState == 11) {
              takeItems(player, PICTURE_OF_NAHIR, 1);
              takeItems(player, HAIR_OF_NAHIR, 1);
              giveItems(player, STATUE_OF_EINHASAD, 1);
              qs.setMemoState(12);
              qs.setCond(12, true);
              htmltext = "30036-03.html";
            } else if (memoState == 12) {
              if (hasQuestItems(player, STATUE_OF_EINHASAD)) {
                htmltext = "30036-04.html";
              }
            }
            break;
          }
        case PRIEST_PRIMOS:
          {
            if (memoState == 8) {
              qs.setMemoState(9);
              qs.setCond(9, true);
              htmltext = "30117-01.html";
            } else if (memoState == 9) {
              qs.setMemoState(9);
              qs.setCond(9, true);
              htmltext = "30117-02.html";
            }
            break;
          }
        case ANDELLIA:
          {
            if (memoState == 12) {
              if (player.getLevel() >= 0) {
                qs.setMemoState(13);
                qs.setCond(13, true);
                htmltext = "30362-01.html";
              } else {
                htmltext = "30362-01a.html";
              }
            } else if (memoState == 13) {
              htmltext = "30362-02.html";
            } else if (memoState == 14) {
              htmltext = "30362-02a.html";
            } else if (memoState == 15) {
              if (hasQuestItems(player, BOOK_OF_DARKNESS)) {
                htmltext = "30362-03.html";
              } else {
                htmltext = "30362-07.html";
              }
            } else if (memoState == 16) {
              htmltext = "30362-06.html";
            }
            break;
          }
        case GAURI_TWINKLEROCK:
          {
            if (memoState == 5) {
              if (hasQuestItems(player, SPIRIT_OF_FLAME)) {
                takeItems(player, SPIRIT_OF_FLAME, 1);
                giveItems(player, TAG_OF_RUMOR, 1);
                qs.setMemoState(6);
                qs.setCond(7, true);
                htmltext = "30550-01.html";
              }
            } else if (memoState == 6) {
              htmltext = "30550-02.html";
            }
            break;
          }
        case SEER_TANAPI:
          {
            if (memoState == 1) {
              if (hasQuestItems(player, VOUCHER_OF_TRIAL)) {
                takeItems(player, VOUCHER_OF_TRIAL, 1);
                qs.setMemoState(2);
                qs.setCond(2, true);
                htmltext = "30571-01.html";
              }
            } else if (memoState == 2) {
              htmltext = "30571-02.html";
            } else if (memoState == 5) {
              if (hasQuestItems(player, SPIRIT_OF_FLAME)) {
                qs.setCond(6, true);
                htmltext = "30571-03.html";
              }
            }
            break;
          }
        case ELDER_CASIAN:
          {
            if (memoState == 16) {
              qs.setMemoState(17);
              if (!hasQuestItems(player, BOOK_OF_SAGE)) {
                giveItems(player, BOOK_OF_SAGE, 1);
              }
              takeItems(player, GREY_BADGE, 1);
              takeItems(player, SPIRIT_OF_FLAME, 1);
              takeItems(player, STATUE_OF_EINHASAD, 1);
              if (hasQuestItems(player, BOOK_OF_DARKNESS)) {
                addExpAndSp(player, 5000, 500);
                takeItems(player, BOOK_OF_DARKNESS, 1);
              }
              htmltext = "30612-01.html";

            } else if (memoState == 17) {
              qs.setCond(17, true);
              htmltext = "30612-02.html";
            }
            break;
          }
        case ANCESTOR_MARTANKUS:
          {
            if (memoState == 2) {
              qs.setMemoState(3);
              qs.setCond(3, true);
              htmltext = "30649-01.html";
            } else if (memoState == 3) {
              htmltext = "30649-02.html";
            } else if (memoState == 4) {
              if (hasQuestItems(player, ESSENSE_OF_FLAME)) {
                htmltext = "30649-03.html";
              }
            }
            break;
          }
        case PRIEST_OF_THE_EARTH_GERALD:
          {
            if (memoState == 6) {
              if (hasQuestItems(player, TAG_OF_RUMOR)) {
                htmltext = "30650-01.html";
              }
            } else if (hasQuestItems(player, GREY_BADGE, BOOK_OF_GERALD)) {
              giveAdena(player, 100000, true);
              takeItems(player, BOOK_OF_GERALD, 1);
              htmltext = "30650-04.html";
            }
            break;
          }
        case WANDERER_DORF:
          {
            if (memoState == 6) {
              if (hasQuestItems(player, TAG_OF_RUMOR)) {
                giveItems(player, GREY_BADGE, 1);
                takeItems(player, TAG_OF_RUMOR, 1);
                qs.setMemoState(8);
                htmltext = "30651-01.html";
              }
            } else if (memoState == 7) {
              if (hasQuestItems(player, TAG_OF_RUMOR)) {
                giveItems(player, GREY_BADGE, 1);
                takeItems(player, TAG_OF_RUMOR, 1);
                qs.setMemoState(8);
                htmltext = "30651-02.html";
              }
            } else if (memoState == 8) {
              qs.setCond(8, true);
              htmltext = "30651-03.html";
            }
            break;
          }
        case URUHA:
          {
            if (memoState == 14) {
              if (hasQuestItems(player, DEBRIS_OF_WILLOW)) {
                htmltext = "30652-01.html";
              }
            } else if (memoState == 15) {
              if (hasQuestItems(player, BOOK_OF_DARKNESS)) {
                htmltext = "30652-03.html";
              }
            }
            break;
          }
      }
    } else if (qs.isCompleted()) {
      if (npc.getId() == HERMIT_SANTIAGO) {
        htmltext = getAlreadyCompletedMsg(player);
      }
    }
    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 "ACCEPT":
        {
          if (qs.isCreated()) {
            qs.startQuest();
            qs.setMemoState(1);
            playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
            if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) {
              giveItems(player, DIMENSIONAL_DIAMOND, 23);
              player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1);
              htmltext = "30531-04a.htm";
            } else {
              htmltext = "30531-04.htm";
            }
          }
          break;
        }
      case "30533-02.html":
        {
          qs.setMemoState(2);
          htmltext = event;
          break;
        }
      case "30556-02.html":
      case "30556-03.html":
      case "30556-04.html":
        {
          htmltext = event;
          break;
        }
      case "30556-05.html":
        {
          if (hasQuestItems(player, PAINT_OF_TELEPORT_DEVICE)) {
            giveItems(player, BROKEN_TELEPORT_DEVICE, 1);
            takeItems(player, PAINT_OF_TELEPORT_DEVICE, 1);
            player.teleToLocation(140352, -194133, -3146);
            startQuestTimer("SPAWN_KING_BUGBEAR", 5000, npc, player);
            htmltext = event;
          }
          break;
        }
      case "30671-02.html":
        {
          giveItems(player, PAINT_OF_KAMURU, 1);
          htmltext = event;
          break;
        }
      case "30673-04.html":
        {
          if (hasQuestItems(player, INGREDIENTS_OF_ANTIDOTE)
              && (getQuestItemsCount(player, STINGER_WASP_NEEDLE) >= 10)
              && (getQuestItemsCount(player, MARSH_SPIDERS_WEB) >= 10)
              && (getQuestItemsCount(player, BLOOD_OF_LEECH) >= 10)) {
            giveItems(player, REPORT_OF_CRUMA, 1);
            takeItems(player, STINGER_WASP_NEEDLE, -1);
            takeItems(player, MARSH_SPIDERS_WEB, -1);
            takeItems(player, BLOOD_OF_LEECH, -1);
            takeItems(player, INGREDIENTS_OF_ANTIDOTE, 1);
            htmltext = event;
          }
          break;
        }
      case "SPAWN_KING_BUGBEAR":
        {
          addAttackPlayerDesire(
              addSpawn(KING_BUGBEAR, 140395, -194147, -3146, 0, false, 200000, false), player);
          addAttackPlayerDesire(
              addSpawn(KING_BUGBEAR, 140395, -194147, -3146, 0, false, 200000, false), player);
          addAttackPlayerDesire(
              addSpawn(KING_BUGBEAR, 140395, -194147, -3146, 0, false, 200000, false), player);
          break;
        }
    }
    return htmltext;
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState qs = getQuestState(player, true);
   final int memoState = qs.getMemoState();
   String htmltext = getNoQuestMsg(player);
   if (qs.isCreated()) {
     if (npc.getId() == IRON_GATES_LOCKIRIN) {
       if (player.getClassId() == ClassId.artisan) {
         if (player.getLevel() >= MIN_LEVEL) {
           htmltext = "30531-03.htm";
         } else {
           htmltext = "30531-01.html";
         }
       } else {
         htmltext = "30531-02.html";
       }
     }
   } else if (qs.isStarted()) {
     switch (npc.getId()) {
       case IRON_GATES_LOCKIRIN:
         {
           if ((memoState >= 1)
               && !hasQuestItems(
                   player,
                   RECOMMENDATION_OF_BALANKI,
                   RECOMMENDATION_OF_FILAUR,
                   RECOMMENDATION_OF_ARIN)) {
             htmltext = "30531-05.html";
           } else if (hasQuestItems(
               player,
               RECOMMENDATION_OF_BALANKI,
               RECOMMENDATION_OF_FILAUR,
               RECOMMENDATION_OF_ARIN)) {
             giveAdena(player, 372154, true);
             giveItems(player, MARK_OF_MAESTRO, 1);
             addExpAndSp(player, 2085244, 141240);
             qs.exitQuest(false, true);
             player.sendPacket(new SocialAction(player.getObjectId(), 3));
             htmltext = "30531-06.html";
           }
           break;
         }
       case GOLDEN_WHEELS_SPIRON:
         {
           htmltext = "30532-01.html";
           break;
         }
       case SILVER_SCALES_BALANKI:
         {
           if ((memoState == 1) && !hasQuestItems(player, RECOMMENDATION_OF_BALANKI)) {
             htmltext = "30533-01.html";
           } else if (memoState == 2) {
             if (!hasQuestItems(player, LETTER_OF_SOLDER_DERACHMENT)) {
               htmltext = "30533-03.html";
             } else {
               giveItems(player, RECOMMENDATION_OF_BALANKI, 1);
               takeItems(player, LETTER_OF_SOLDER_DERACHMENT, 1);
               qs.setMemoState(1);
               if (hasQuestItems(player, RECOMMENDATION_OF_ARIN, RECOMMENDATION_OF_FILAUR)) {
                 qs.setCond(2, true);
               }
               htmltext = "30533-04.html";
             }
           } else if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI)) {
             htmltext = "30533-05.html";
           }
           break;
         }
       case BRONZE_KEYS_KEEF:
         {
           htmltext = "30534-01.html";
           break;
         }
       case GRAY_PILLAR_MEMBER_FILAUR:
         {
           if ((memoState == 1) && !hasQuestItems(player, RECOMMENDATION_OF_FILAUR)) {
             giveItems(player, ARCHITECTURE_OF_CRUMA, 1);
             qs.setMemoState(4);
             htmltext = "30535-01.html";
           } else if (memoState == 4) {
             if (hasQuestItems(player, ARCHITECTURE_OF_CRUMA)
                 && !hasQuestItems(player, REPORT_OF_CRUMA)) {
               htmltext = "30535-02.html";
             } else if (hasQuestItems(player, REPORT_OF_CRUMA)
                 && !hasQuestItems(player, ARCHITECTURE_OF_CRUMA)) {
               giveItems(player, RECOMMENDATION_OF_FILAUR, 1);
               takeItems(player, REPORT_OF_CRUMA, 1);
               qs.setMemoState(1);
               if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI, RECOMMENDATION_OF_ARIN)) {
                 qs.setCond(2, true);
               }
               htmltext = "30535-03.html";
             }
           } else if (hasQuestItems(player, RECOMMENDATION_OF_FILAUR)) {
             htmltext = "30535-04.html";
           }
           break;
         }
       case BLACK_ANVILS_ARIN:
         {
           if ((memoState == 1) && !hasQuestItems(player, RECOMMENDATION_OF_ARIN)) {
             giveItems(player, PAINT_OF_TELEPORT_DEVICE, 1);
             qs.setMemoState(3);
             htmltext = "30536-01.html";
           } else if (memoState == 3) {
             if (hasQuestItems(player, PAINT_OF_TELEPORT_DEVICE)
                 && !hasQuestItems(player, TELEPORT_DEVICE)) {
               htmltext = "30536-02.html";
             } else if (getQuestItemsCount(player, TELEPORT_DEVICE) >= 5) {
               giveItems(player, RECOMMENDATION_OF_ARIN, 1);
               takeItems(player, TELEPORT_DEVICE, -1);
               qs.setMemoState(1);
               if (hasQuestItems(player, RECOMMENDATION_OF_BALANKI, RECOMMENDATION_OF_FILAUR)) {
                 qs.setCond(2, true);
               }
               htmltext = "30536-03.html";
             }
           } else if (hasQuestItems(player, RECOMMENDATION_OF_ARIN)) {
             htmltext = "30536-04.html";
           }
           break;
         }
       case MASTER_TOMA:
         {
           if (memoState == 3) {
             if (hasQuestItems(player, PAINT_OF_TELEPORT_DEVICE)) {
               htmltext = "30556-01.html";
             } else if (hasQuestItems(player, BROKEN_TELEPORT_DEVICE)) {
               giveItems(player, TELEPORT_DEVICE, 5);
               takeItems(player, BROKEN_TELEPORT_DEVICE, 1);
               htmltext = "30556-06.html";
             } else if (getQuestItemsCount(player, TELEPORT_DEVICE) == 5) {
               htmltext = "30556-07.html";
             }
           }
           break;
         }
       case CHIEF_CROTO:
         {
           if ((memoState == 2)
               && !hasAtLeastOneQuestItem(
                   player, PAINT_OF_KAMURU, NECKLACE_OF_KAMUTU, LETTER_OF_SOLDER_DERACHMENT)) {
             htmltext = "30671-01.html";
           } else if (hasQuestItems(player, PAINT_OF_KAMURU)
               && !hasQuestItems(player, NECKLACE_OF_KAMUTU)) {
             htmltext = "30671-03.html";
           } else if (hasQuestItems(player, NECKLACE_OF_KAMUTU)) {
             giveItems(player, LETTER_OF_SOLDER_DERACHMENT, 1);
             takeItems(player, NECKLACE_OF_KAMUTU, 1);
             takeItems(player, PAINT_OF_KAMURU, 1);
             htmltext = "30671-04.html";
           } else if (hasQuestItems(player, LETTER_OF_SOLDER_DERACHMENT)) {
             htmltext = "30671-05.html";
           }
           break;
         }
       case JAILER_DUBABAH:
         {
           if (hasQuestItems(player, PAINT_OF_KAMURU)) {
             htmltext = "30672-01.html";
           }
           break;
         }
       case RESEARCHER_LORAIN:
         {
           if (memoState == 4) {
             if (hasQuestItems(player, ARCHITECTURE_OF_CRUMA)
                 && !hasAtLeastOneQuestItem(player, INGREDIENTS_OF_ANTIDOTE, REPORT_OF_CRUMA)) {
               giveItems(player, INGREDIENTS_OF_ANTIDOTE, 1);
               takeItems(player, ARCHITECTURE_OF_CRUMA, 1);
               htmltext = "30673-01.html";
             } else if (hasQuestItems(player, INGREDIENTS_OF_ANTIDOTE)
                 && !hasQuestItems(player, REPORT_OF_CRUMA)) {
               if ((getQuestItemsCount(player, STINGER_WASP_NEEDLE) >= 10)
                   && (getQuestItemsCount(player, MARSH_SPIDERS_WEB) >= 10)
                   && (getQuestItemsCount(player, BLOOD_OF_LEECH) >= 10)) {
                 htmltext = "30673-03.html";
               } else {
                 htmltext = "30673-02.html";
               }
             } else if (hasQuestItems(player, REPORT_OF_CRUMA)) {
               htmltext = "30673-05.html";
             }
           }
           break;
         }
     }
   } else if (qs.isCompleted()) {
     if (npc.getId() == IRON_GATES_LOCKIRIN) {
       htmltext = getAlreadyCompletedMsg(player);
     }
   }
   return htmltext;
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance talker) {
    final QuestState qs = getQuestState(talker, true);
    String html = getNoQuestMsg(talker);

    switch (npc.getId()) {
      case HANNAVALT:
        {
          if (qs.isCreated()) {
            if (!talker.isInCategory(CategoryType.KNIGHT_GROUP)) {
              html = "30109-02.html";
            } else if (talker.getLevel() < MIN_LEVEL) {
              html = "30109-01.html";
            } else {
              html = "30109-03.htm";
            }
          } else if (qs.isStarted()) {
            switch (qs.getMemoState()) {
              case 1:
                {
                  html = "30109-04.html";
                  break;
                }
              case 14:
                {
                  if (hasQuestItems(talker, LETTER_OF_DUSTIN)) {
                    html = "30109-05.html";
                    takeItems(talker, LETTER_OF_DUSTIN, -1);
                    addExpAndSp(talker, 762576, 49458);
                    giveAdena(talker, 138968, true);
                    giveItems(talker, MARK_OF_DUTY, 1);
                    qs.exitQuest(false, true);
                    talker.sendPacket(new SocialAction(talker.getObjectId(), 3));
                    rewardDimensionalDiamonds(talker);
                  }
                  break;
                }
            }
          } else {
            html = getAlreadyCompletedMsg(talker);
          }
          break;
        }
      case SIR_ARON_TANFORD:
        {
          switch (qs.getMemoState()) {
            case 1:
              {
                html = "30653-01.html";

                if (!hasQuestItems(talker, OLD_KNIGHTS_SWORD)) {
                  giveItems(talker, OLD_KNIGHTS_SWORD, 1);
                }

                qs.setMemoState(2);
                qs.setCond(2, true);
                break;
              }
            case 2:
              {
                if (hasQuestItems(talker, OLD_KNIGHTS_SWORD)) {
                  html = "30653-02.html";
                }
                break;
              }
            case 3:
              {
                if (hasQuestItems(talker, KNIGHTS_TEAR)) {
                  html = "30653-03.html";
                  takeItems(talker, -1, KNIGHTS_TEAR, OLD_KNIGHTS_SWORD);
                  qs.setMemoState(4);
                  qs.setCond(4, true);
                }
                break;
              }
            case 4:
              {
                html = "30653-04.html";
                break;
              }
          }
          break;
        }
      case SIR_KIEL_NIGHTHAWK:
        {
          switch (qs.getMemoState()) {
            case 4:
              {
                html = "30654-01.html";
                qs.setMemoState(5);
                qs.setCond(5, true);
                break;
              }
            case 5:
              {
                if (!hasQuestItems(talker, TALIANUSS_REPORT)) {
                  html = "30654-02.html";
                } else {
                  html = "30654-03.html";
                  qs.setMemoState(6);
                  qs.setCond(7, true);
                  giveItems(talker, MIRROR_OF_ORPIC, 1);
                }
                break;
              }
            case 6:
              {
                if (hasQuestItems(talker, MIRROR_OF_ORPIC)) {
                  html = "30654-04.html";
                }
                break;
              }
            case 7:
              {
                if (hasQuestItems(talker, TEAR_OF_CONFESSION)) {
                  html = "30654-05.html";
                  takeItems(talker, TEAR_OF_CONFESSION, -1);
                  qs.setMemoState(8);
                  qs.setCond(10, true);
                }
                break;
              }
            case 8:
              {
                html = "30654-06.html";
                break;
              }
          }
          break;
        }
      case SPIRIT_OF_SIR_TALIANUS:
        {
          if (qs.isMemoState(6) && hasQuestItems(talker, MIRROR_OF_ORPIC, TALIANUSS_REPORT)) {
            html = "30656-01.html";
            takeItems(talker, -1, MIRROR_OF_ORPIC, TALIANUSS_REPORT);
            giveItems(talker, TEAR_OF_CONFESSION, 1);
            qs.setMemoState(7);
            qs.setCond(9, true);
            npc.deleteMe();
          }
          break;
        }
      case ISAEL_SILVERSHADOW:
        {
          switch (qs.getMemoState()) {
            case 8:
              {
                if (talker.getLevel() < MIN_LEVEL) {
                  html = "30655-01.html";
                } else {
                  html = "30655-02.html";
                  qs.setMemoState(9);
                  qs.setCond(11, true);
                }
                break;
              }
            case 9:
              {
                if (!hasItem(talker, MILITAS_ARTICLE)) {
                  html = "30655-03.html";
                } else {
                  html = "30655-04.html";
                  giveItems(talker, TEAR_OF_LOYALTY, 1);
                  takeItem(talker, MILITAS_ARTICLE);
                  qs.setMemoState(10);
                  qs.setCond(13, true);
                }
                break;
              }
            case 10:
              {
                if (hasQuestItems(talker, TEAR_OF_LOYALTY)) {
                  html = "30655-05.html";
                }
                break;
              }
          }
          break;
        }
      case DUSTIN:
        {
          switch (qs.getMemoState()) {
            case 10:
              {
                if (hasQuestItems(talker, TEAR_OF_LOYALTY)) {
                  html = "30116-01.html";
                }
                break;
              }
            case 11:
              {
                if (!hasQuestItems(talker, ATHEBALDTS_SKULL, ATHEBALDTS_RIBS, ATHEBALDTS_SHIN)) {
                  html = "30116-06.html";
                } else {
                  html = "30116-07.html";
                  takeItems(talker, -1, ATHEBALDTS_SKULL, ATHEBALDTS_RIBS, ATHEBALDTS_SHIN);
                  giveItems(talker, SAINTS_ASHES_URN, 1);
                  qs.setMemoState(12);
                  qs.setCond(16, true);
                }
                break;
              }
            case 12:
              {
                if (hasQuestItems(talker, SAINTS_ASHES_URN)) {
                  html = "30116-09.html";
                }
                break;
              }
            case 13:
              {
                if (hasQuestItems(talker, LETTER_OF_WINDAWOOD)) {
                  html = "30116-08.html";
                  takeItems(talker, LETTER_OF_WINDAWOOD, -1);
                  giveItems(talker, LETTER_OF_DUSTIN, 1);
                  qs.setMemoState(14);
                  qs.setCond(18, true);
                }
                break;
              }
            case 14:
              {
                if (hasQuestItems(talker, LETTER_OF_DUSTIN)) {
                  html = "30116-10.html";
                }
                break;
              }
          }
          break;
        }
      case SIR_COLLIN_WINDAWOOD:
        {
          switch (qs.getMemoState()) {
            case 12:
              {
                if (hasQuestItems(talker, SAINTS_ASHES_URN)) {
                  html = "30311-01.html";
                  takeItems(talker, SAINTS_ASHES_URN, -1);
                  giveItems(talker, LETTER_OF_WINDAWOOD, 1);
                  qs.setMemoState(13);
                  qs.setCond(17, true);
                }
                break;
              }
            case 13:
              {
                if (hasQuestItems(talker, LETTER_OF_WINDAWOOD)) {
                  html = "30311-02.html";
                }
                break;
              }
          }
          break;
        }
    }
    return html;
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState qs = getQuestState(player, true);
   String htmltext = getNoQuestMsg(player);
   if (qs.isCreated() || qs.isCompleted()) {
     if (npc.getId() == MASTER_VIRGIL) {
       htmltext = "30329-01.htm";
     }
   } else if (qs.isStarted()) {
     switch (npc.getId()) {
       case MASTER_VIRGIL:
         {
           if (hasQuestItems(player, PALLUS_TALISMAN)) {
             if (!hasQuestItems(player, LYCANTHROPE_SKULL)) {
               htmltext = "30329-07.html";
             } else if (hasQuestItems(player, LYCANTHROPE_SKULL)
                 && (getQuestItemsCount(player, LYCANTHROPE_SKULL) < 13)) {
               htmltext = "30329-08.html";
             } else {
               htmltext = "30329-09.html";
             }
           } else if (hasQuestItems(player, COFFIN_OF_ETERNAL_REST)) {
             giveAdena(player, 163800, true);
             giveItems(player, GAZE_OF_ABYSS, 1);
             final int level = player.getLevel();
             if (level >= 20) {
               addExpAndSp(player, 320534, 26212);
             } else if (level == 19) {
               addExpAndSp(player, 456128, 32910);
             } else {
               addExpAndSp(player, 591724, 39608);
             }
             qs.exitQuest(false, true);
             player.sendPacket(new SocialAction(player.getObjectId(), 3));
             qs.saveGlobalQuestVar("1ClassQuestFinished", "1");
             htmltext = "30329-11.html";
           } else if (hasAtLeastOneQuestItem(player, VIRGILS_LETTER, MORTE_TALISMAN)) {
             htmltext = "30329-12.html";
           }
           break;
         }
       case KALINTA:
         {
           if (hasQuestItems(player, VIRGILS_LETTER)) {
             htmltext = "30422-01.html";
           } else if (hasQuestItems(player, MORTE_TALISMAN)) {
             if (!hasQuestItems(player, ARACHNID_TRACKER_SILK, VENOMOUS_SPIDERS_CARAPACE)) {
               htmltext = "30422-03.html";
             } else if (!hasQuestItems(player, ARACHNID_TRACKER_SILK)
                 && hasQuestItems(player, VENOMOUS_SPIDERS_CARAPACE)) {
               htmltext = "30422-04.html";
             } else if ((getQuestItemsCount(player, ARACHNID_TRACKER_SILK) >= 5)
                 && hasQuestItems(player, VENOMOUS_SPIDERS_CARAPACE)) {
               htmltext = "30422-05.html";
             } else if (hasQuestItems(player, ARACHNID_TRACKER_SILK, VENOMOUS_SPIDERS_CARAPACE)) {
               htmltext = "30422-04.html";
             }
           } else if (hasQuestItems(player, COFFIN_OF_ETERNAL_REST)) {
             htmltext = "30422-06.html";
           }
           break;
         }
     }
   }
   return htmltext;
 }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   QuestState qs = getQuestState(player, true);
   String htmltext = getNoQuestMsg(player);
   switch (npc.getId()) {
     case ELCADIA:
       {
         if (qs.isCompleted()) {
           htmltext = "32784-02.html";
         } else if (qs.isCreated()) {
           qs = player.getQuestState(Q10292_SevenSignsGirlOfDoubt.class.getSimpleName());
           htmltext =
               ((player.getLevel() >= MIN_LEVEL) && (qs != null) && (qs.isCompleted()))
                   ? "32784-01.htm"
                   : "32784-11.htm";
         } else if (qs.isStarted()) {
           if (qs.isCond(1)) {
             htmltext = "32784-06.html";
           } else if (qs.isCond(8)) {
             htmltext = "32784-07.html";
           }
         }
         break;
       }
     case ELCADIA_INSTANCE:
       {
         switch (qs.getCond()) {
           case 1:
             {
               htmltext = "32785-01.html";
               break;
             }
           case 2:
             {
               htmltext = "32785-04.html";
               qs.setCond(3, true);
               break;
             }
           case 3:
             {
               htmltext = "32785-05.html";
               break;
             }
           case 4:
             {
               htmltext = "32785-06.html";
               break;
             }
           case 5:
             {
               htmltext = "32785-08.html";
               break;
             }
           case 6:
             {
               htmltext = "32785-09.html";
               break;
             }
           case 7:
             {
               qs.setCond(8, true);
               htmltext = "32785-11.html";
               break;
             }
           case 8:
             {
               htmltext = "32785-12.html";
               break;
             }
         }
         break;
       }
     case SOPHIA1:
       {
         if (qs.isStarted()) {
           if ((qs.getCond() >= 1) && (qs.getCond() < 8)) {
             htmltext = "32596-01.html";
           } else {
             htmltext = "32596-05.html";
           }
         }
         break;
       }
     case SOPHIA2:
       {
         switch (qs.getCond()) {
           case 1:
             {
               htmltext = "32861-01.html";
               break;
             }
           case 2:
             {
               htmltext = "32861-05.html";
               break;
             }
           case 3:
             {
               htmltext = "32861-06.html";
               break;
             }
           case 4:
             {
               htmltext = "32861-09.html";
               break;
             }
           case 5:
             {
               htmltext = "32861-10.html";
               break;
             }
           case 6:
           case 7:
             {
               htmltext = "32861-12.html";
               break;
             }
           case 8:
             {
               htmltext = "32861-14.html";
               break;
             }
         }
         break;
       }
     case PILE_OF_BOOKS1:
       {
         if (qs.isCond(6)) {
           htmltext = "32809-01.html";
         }
         break;
       }
     case PILE_OF_BOOKS2:
       {
         if (qs.isCond(6)) {
           htmltext = "32810-01.html";
         }
         break;
       }
     case PILE_OF_BOOKS3:
       {
         if (qs.isCond(6)) {
           htmltext = "32811-01.html";
         }
         break;
       }
     case PILE_OF_BOOKS4:
       {
         if (qs.isCond(6)) {
           htmltext = "32812-01.html";
         }
         break;
       }
     case PILE_OF_BOOKS5:
       {
         if (qs.isCond(6)) {
           htmltext = "32813-01.html";
         }
         break;
       }
   }
   return htmltext;
 }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance talker) {
   final QuestState qs = getQuestState(talker, true);
   String htmltext = getNoQuestMsg(talker);
   switch (npc.getId()) {
     case TIFAREN:
       {
         switch (qs.getCond()) {
           case 0:
             {
               if (qs.isCreated()) {
                 htmltext = "31334-01.htm";
               } else if (qs.isCompleted()) {
                 htmltext = getAlreadyCompletedMsg(talker);
               }
               break;
             }
           case 1:
           case 3:
             {
               htmltext = "31334-05.html";
               break;
             }
           case 4:
           case 5:
             {
               if (hasQuestItems(talker, CROSS_OF_EINHASAD)) {
                 if (!hasQuestItems(talker, LOST_SKULL_OF_ELF)) {
                   htmltext = "31334-09.html";
                 } else if (_tifarenOwner == 0) {
                   htmltext = "31334-10.html";
                 } else {
                   htmltext = "31334-11.html";
                 }
               }
               break;
             }
           case 6:
           case 7:
             {
               if (hasQuestItems(talker, CROSS_OF_EINHASAD)) {
                 if (_tifarenOwner == 0) {
                   htmltext = "31334-17.html";
                 } else if (_tifarenOwner == talker.getObjectId()) {
                   htmltext = "31334-15.html";
                 } else {
                   htmltext = "31334-16.html";
                   qs.setCond(6, true);
                 }
               }
               break;
             }
           case 8:
             {
               if (hasQuestItems(talker, CROSS_OF_EINHASAD)) {
                 htmltext = "31334-18.html";
               }
               break;
             }
         }
         break;
       }
     case GHOST_OF_PRIEST:
       {
         playSound(talker, QuestSound.AMBSOUND_HORROR_15);
         if (npc.getScriptValue() == talker.getObjectId()) {
           htmltext = "31528-01.html";
         } else {
           htmltext = "31528-03.html";
         }
         break;
       }
     case INNOCENTIN:
       {
         switch (qs.getCond()) {
           case 2:
             {
               if (!hasQuestItems(talker, CROSS_OF_EINHASAD)) {
                 giveItems(talker, CROSS_OF_EINHASAD, 1);
                 qs.setCond(3, true);
                 htmltext = "31328-01.html";
               }
               break;
             }
           case 3:
             {
               if (hasQuestItems(talker, CROSS_OF_EINHASAD)) {
                 htmltext = "31328-01b.html";
               }
               break;
             }
           case 8:
             {
               if (hasQuestItems(talker, CROSS_OF_EINHASAD)) {
                 htmltext = "31328-02.html";
               } else {
                 htmltext = "31328-04.html";
               }
               break;
             }
           case 9:
             {
               htmltext = "31328-09a.html";
               break;
             }
           case 14:
             {
               if (hasQuestItems(talker, REPORT_BOX)) {
                 htmltext = "31328-10.html";
               }
               break;
             }
           case 15:
             {
               htmltext = "31328-12.html";
               break;
             }
           case 16:
             {
               addExpAndSp(talker, 345966, 31578);
               qs.exitQuest(false, true);
               if (talker.getLevel() >= MIN_LVL) {
                 htmltext = "31328-20.html";
               } else {
                 htmltext = "31328-21.html";
               }
               break;
             }
         }
         break;
       }
     case WELL:
       {
         switch (qs.getCond()) {
           case 10:
             {
               if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_1)) {
                 htmltext = "31527-01.html";
                 playSound(talker, QuestSound.AMBSOUND_HORROR_01);
               }
               break;
             }
           case 12:
             {
               if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_2)
                   && !hasQuestItems(talker, SEALED_REPORT_BOX)) {
                 giveItems(talker, SEALED_REPORT_BOX, 1);
                 qs.setCond(13, true);
                 htmltext = "31527-04.html";
               }
               break;
             }
           case 13:
           case 14:
           case 15:
           case 16:
             {
               htmltext = "31527-05.html";
               break;
             }
         }
         break;
       }
     case GHOST_OF_ADVENTURER:
       {
         switch (qs.getCond()) {
           case 9:
             {
               if (hasQuestItems(talker, LETTER_OF_INNOCENTIN)) {
                 switch (qs.getMemoState()) {
                   case 0:
                     {
                       htmltext = "31529-01.html";
                       break;
                     }
                   case 8:
                     {
                       htmltext = "31529-03a.html";
                       break;
                     }
                   case 9:
                     {
                       htmltext = "31529-10.html";
                       break;
                     }
                   default:
                     break;
                 }
               }
               break;
             }
           case 10:
             {
               if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_1)) {
                 final int id = qs.getMemoState();
                 if (id == 10) {
                   htmltext = "31529-12.html";
                 } else if (id == 11) {
                   htmltext = "31529-14.html";
                 }
               }
               break;
             }
           case 11:
             {
               if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_2)
                   && !hasQuestItems(talker, SEALED_REPORT_BOX)) {
                 htmltext = "31529-15.html";
                 qs.setCond(12, true);
               }
               break;
             }
           case 13:
             {
               if (hasQuestItems(talker, JEWEL_OF_ADVENTURER_2)
                   && hasQuestItems(talker, SEALED_REPORT_BOX)) {
                 giveItems(talker, REPORT_BOX, 1);
                 takeItems(talker, SEALED_REPORT_BOX, -1);
                 takeItems(talker, JEWEL_OF_ADVENTURER_2, -1);
                 qs.setCond(14, true);
                 htmltext = "31529-16.html";
               }
               break;
             }
           case 14:
             {
               if (hasQuestItems(talker, REPORT_BOX)) {
                 htmltext = "31529-17.html";
               }
               break;
             }
         }
         break;
       }
   }
   return htmltext;
 }
示例#23
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 "31521-03.htm":
       {
         if (qs.isCreated()) {
           qs.startQuest();
           giveItems(player, BOILED_EGG, 5);
           htmltext = event;
         }
         break;
       }
     case "31521-06.html":
       {
         if (qs.isCond(6)) {
           if (getQuestItemsCount(player, EGG_PRICE) >= 5) {
             qs.setCond(7, true);
             takeItems(player, EGG_PRICE, -1);
             htmltext = event;
           } else {
             htmltext = "31521-07.html";
           }
         }
         break;
       }
     case "31543-02.html":
       {
         if (qs.isCond(1)) {
           if (hasQuestItems(player, BOILED_EGG)) {
             qs.setCond(2, true);
             takeItems(player, BOILED_EGG, 1);
             giveItems(player, EGG_PRICE, 1);
             htmltext = event;
           } else {
             htmltext = "31543-03.html";
           }
         }
         break;
       }
     case "31544-02.html":
     case "31545-02.html":
     case "31546-02.html":
     case "31547-02.html":
       {
         if (TALKERS.contains(npc.getId()) && qs.isCond(TALKERS.indexOf(npc.getId()) + 2)) {
           if (hasQuestItems(player, BOILED_EGG)) {
             qs.setCond(qs.getCond() + 1, true);
             takeItems(player, BOILED_EGG, 1);
             giveItems(player, EGG_PRICE, 1);
             htmltext = event;
           } else {
             htmltext = npc.getId() + "-03.html";
           }
         }
         break;
       }
     case "31584-02.html":
       {
         if (qs.isCond(7)) {
           int rnd = getRandom(1000);
           if (rnd < 800) {
             rewardItems(player, QUICK_STEP_POTION, 1);
             giveAdena(player, 18800, true);
           } else if (rnd < 880) {
             rewardItems(player, SEALED_RING_OF_AURAKYRA, 1);
           } else if (rnd < 960) {
             rewardItems(player, SEALED_SANDDRAGONS_EARING, 1);
           } else if (rnd < 1000) {
             rewardItems(player, SEALED_DRAGON_NECKLACE, 1);
           }
           qs.exitQuest(true, true);
           htmltext = event;
         }
         break;
       }
   }
   return htmltext;
 }
示例#24
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 "ACCEPT":
        {
          if (qs.isCreated()) {
            qs.startQuest();
            if (!hasQuestItems(player, MIRIENS_1ST_SIGIL)) {
              giveItems(player, MIRIENS_1ST_SIGIL, 1);
            }
            playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
            if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) {
              giveItems(player, DIMENSIONAL_DIAMOND, 168);
              player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1);
              htmltext = "30461-04a.htm";
            } else {
              htmltext = "30461-04.htm";
            }
          }
          break;
        }
      case "30103-02.html":
      case "30103-03.html":
      case "30111-02.html":
      case "30111-03.html":
      case "30111-04.html":
      case "30111-08.html":
      case "30111-14.html":
      case "30115-02.html":
      case "30316-03.html":
      case "30461-09.html":
      case "30608-07.html":
      case "30609-02.html":
      case "30609-03.html":
      case "30609-04.html":
      case "30609-08.html":
      case "30609-13.html":
      case "30610-02.html":
      case "30610-03.html":
      case "30610-04.html":
      case "30610-05.html":
      case "30610-06.html":
      case "30610-07.html":
      case "30610-08.html":
      case "30610-09.html":
      case "30610-13.html":
      case "30611-02.html":
      case "30611-03.html":
      case "30611-06.html":
      case "30612-03.html":
        {
          htmltext = event;
          break;
        }
      case "30461-10.html":
        {
          if (hasQuestItems(player, MIRIENS_2ND_SIGIL, SYMBOL_OF_JUREK)) {
            takeItems(player, MIRIENS_2ND_SIGIL, 1);
            giveItems(player, MIRIENS_3RD_SIGIL, 1);
            takeItems(player, SYMBOL_OF_JUREK, 1);
            qs.setCond(19, true);
            htmltext = event;
          }
          break;
        }
      case "30070-02.html":
        {
          giveItems(player, HIGH_PRIESTS_SIGIL, 1);
          giveItems(player, SYLVAINS_LETTER, 1);
          qs.setCond(2, true);
          htmltext = event;
          break;
        }
      case "30071-04.html":
        {
          if (hasQuestItems(player, CRERAS_PAINTING2)) {
            takeItems(player, CRERAS_PAINTING2, 1);
            giveItems(player, CRERAS_PAINTING3, 1);
            qs.setCond(10, true);
            htmltext = event;
          }
          break;
        }
      case "30103-04.html":
        {
          giveItems(player, VALKONS_REQUEST, 1);
          htmltext = event;
          break;
        }
      case "30111-05.html":
        {
          if (hasQuestItems(player, CRONOS_LETTER)) {
            takeItems(player, CRONOS_LETTER, 1);
            giveItems(player, DIETERS_KEY, 1);
            qs.setCond(21, true);
            htmltext = event;
          }
          break;
        }
      case "30111-09.html":
        {
          if (hasQuestItems(player, CRETAS_2ND_LETTER)) {
            takeItems(player, CRETAS_2ND_LETTER, 1);
            giveItems(player, DIETERS_LETTER, 1);
            giveItems(player, DIETERS_DIARY, 1);
            qs.setCond(23, true);
            htmltext = event;
          }
          break;
        }
      case "30115-03.html":
        {
          giveItems(player, JUREKS_LIST, 1);
          giveItems(player, GRAND_MAGISTER_SIGIL, 1);
          qs.setCond(16, true);
          htmltext = event;
          break;
        }
      case "30230-02.html":
        {
          if (hasQuestItems(player, DIETERS_LETTER)) {
            takeItems(player, DIETERS_LETTER, 1);
            giveItems(player, RAUTS_LETTER_ENVELOPE, 1);
            qs.setCond(24, true);
            htmltext = event;
          }
          break;
        }
      case "30316-02.html":
        {
          if (hasQuestItems(player, RAUTS_LETTER_ENVELOPE)) {
            takeItems(player, RAUTS_LETTER_ENVELOPE, 1);
            giveItems(player, SCRIPTURE_CHAPTER_1, 1);
            giveItems(player, STRONG_LIGUOR, 1);
            qs.setCond(25, true);
            htmltext = event;
          }
          break;
        }
      case "30608-02.html":
        {
          if (hasQuestItems(player, SYLVAINS_LETTER)) {
            giveItems(player, MARIAS_1ST_LETTER, 1);
            takeItems(player, SYLVAINS_LETTER, 1);
            qs.setCond(3, true);
            htmltext = event;
          }
          break;
        }
      case "30608-08.html":
        {
          if (hasQuestItems(player, CRETAS_1ST_LETTER)) {
            giveItems(player, LUCILLAS_HANDBAG, 1);
            takeItems(player, CRETAS_1ST_LETTER, 1);
            qs.setCond(7, true);
            htmltext = event;
          }
          break;
        }
      case "30608-14.html":
        {
          if (hasQuestItems(player, CRERAS_PAINTING3)) {
            takeItems(player, CRERAS_PAINTING3, 1);
            takeItems(player, BROWN_SCROLL_SCRAP, -1);
            giveItems(player, CRYSTAL_OF_PURITY1, 1);
            qs.setCond(13, true);
            htmltext = event;
          }
          break;
        }
      case "30609-05.html":
        {
          if (hasQuestItems(player, MARIAS_2ND_LETTER)) {
            takeItems(player, MARIAS_2ND_LETTER, 1);
            giveItems(player, CRETAS_1ST_LETTER, 1);
            qs.setCond(6, true);
            htmltext = event;
          }
          break;
        }
      case "30609-09.html":
        {
          if (hasQuestItems(player, LUCILLAS_HANDBAG)) {
            takeItems(player, LUCILLAS_HANDBAG, 1);
            giveItems(player, CRERAS_PAINTING1, 1);
            qs.setCond(8, true);
            htmltext = event;
          }
          break;
        }
      case "30609-14.html":
        {
          if (hasQuestItems(player, DIETERS_KEY)) {
            takeItems(player, DIETERS_KEY, 1);
            giveItems(player, CRETAS_2ND_LETTER, 1);
            qs.setCond(22, true);
            htmltext = event;
          }
          break;
        }
      case "30610-10.html":
        {
          giveItems(player, CRONOS_SIGIL, 1);
          giveItems(player, CRONOS_LETTER, 1);
          qs.setCond(20, true);
          htmltext = event;
          break;
        }
      case "30610-14.html":
        {
          if (hasQuestItems(
              player,
              SCRIPTURE_CHAPTER_1,
              SCRIPTURE_CHAPTER_2,
              SCRIPTURE_CHAPTER_3,
              SCRIPTURE_CHAPTER_4)) {
            takeItems(player, CRONOS_SIGIL, 1);
            takeItems(player, DIETERS_DIARY, 1);
            takeItems(player, TRIFFS_RING, 1);
            takeItems(player, SCRIPTURE_CHAPTER_1, 1);
            takeItems(player, SCRIPTURE_CHAPTER_2, 1);
            takeItems(player, SCRIPTURE_CHAPTER_3, 1);
            takeItems(player, SCRIPTURE_CHAPTER_4, 1);
            giveItems(player, SYMBOL_OF_CRONOS, 1);
            qs.setCond(31, true);
            htmltext = event;
          }
          break;
        }
      case "30611-04.html":
        {
          if (hasQuestItems(player, STRONG_LIGUOR)) {
            giveItems(player, TRIFFS_RING, 1);
            takeItems(player, STRONG_LIGUOR, 1);
            qs.setCond(26, true);
            htmltext = event;
          }
          break;
        }
      case "30612-04.html":
        {
          giveItems(player, CASIANS_LIST, 1);
          qs.setCond(28, true);
          htmltext = event;
          break;
        }
      case "30612-07.html":
        {
          giveItems(player, SCRIPTURE_CHAPTER_4, 1);
          takeItems(player, POITANS_NOTES, 1);
          takeItems(player, CASIANS_LIST, 1);
          takeItems(player, GHOULS_SKIN, -1);
          takeItems(player, MEDUSAS_BLOOD, -1);
          takeItems(player, FETTERED_SOULS_ICHOR, -1);
          takeItems(player, ENCHANTED_GARGOYLES_NAIL, -1);
          qs.setCond(30, true);
          htmltext = event;
          break;
        }
    }
    return htmltext;
  }
 @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 "31529-02.html":
     case "31529-04.html":
     case "31529-05.html":
     case "31529-06.html":
     case "31529-07.html":
     case "31529-09.html":
     case "31529-13.html":
     case "31529-13a.html":
     case "31528-02.html":
     case "31528-05.html":
     case "31528-06.html":
     case "31528-07.html":
     case "31328-13.html":
     case "31328-06.html":
     case "31328-05.html":
     case "31328-02.html":
     case "31328-07.html":
     case "31328-08.html":
     case "31328-14.html":
     case "31328-15.html":
     case "31328-16.html":
     case "31328-17.html":
     case "31328-18.html":
     case "31334-12.html":
       {
         htmltext = event;
         break;
       }
     case "31334-02.htm":
       {
         if (qs.isCreated()) {
           final QuestState q21 = player.getQuestState(Q00021_HiddenTruth.class.getSimpleName());
           if ((player.getLevel() >= MIN_LVL) && (q21 != null) && q21.isCompleted()) {
             htmltext = event;
           } else {
             htmltext = "31334-03.html";
           }
         }
         break;
       }
     case "31334-04.html":
       {
         if (qs.isCreated()) {
           qs.startQuest();
           htmltext = event;
         }
         break;
       }
     case "31334-06.html":
       {
         if (qs.isCond(3) && hasQuestItems(player, CROSS_OF_EINHASAD)) {
           htmltext = event;
         } else {
           qs.setCond(2, true);
           htmltext = "31334-07.html";
         }
         break;
       }
     case "31334-08.html":
       {
         if (qs.isCond(3)) {
           qs.setCond(4, true);
           htmltext = event;
         }
         break;
       }
     case "31334-13.html":
       {
         final int cond = qs.getCond();
         if (((5 <= cond) && (cond <= 7)) && hasQuestItems(player, CROSS_OF_EINHASAD)) {
           if (_tifarenOwner == 0) {
             _tifarenOwner = player.getObjectId();
             final L2Npc ghost2 = addSpawn(GHOST_OF_PRIEST, PRIEST_LOC, true, 0);
             ghost2.setScriptValue(player.getObjectId());
             qs.startQuestTimer("DESPAWN_GHOST2", 1000 * 120, ghost2);
             ghost2.broadcastPacket(
                 new NpcSay(
                         ghost2.getObjectId(),
                         Say2.NPC_ALL,
                         ghost2.getId(),
                         NpcStringId.DID_YOU_CALL_ME_S1)
                     .addStringParameter(player.getName()));
             if (((cond == 5) || (cond == 6)) && hasQuestItems(player, LOST_SKULL_OF_ELF)) {
               takeItems(player, LOST_SKULL_OF_ELF, -1);
               qs.setCond(7, true);
             }
             htmltext = event;
           } else {
             qs.setCond(6, true);
             htmltext = "31334-14.html";
           }
         }
         break;
       }
     case "31528-04.html":
       {
         if (npc.getScriptValue() == player.getObjectId()) {
           playSound(player, QuestSound.AMBSOUND_HORROR_03);
           htmltext = event;
         }
         break;
       }
     case "31528-08.html":
       {
         QuestTimer qt = getQuestTimer("DESPAWN_GHOST2", npc, player);
         if ((qt != null) && (npc.getScriptValue() == player.getObjectId())) {
           qt.cancelAndRemove();
           npc.setScriptValue(0);
           qs.startQuestTimer("DESPAWN_GHOST2", 1000 * 3, npc);
           qs.setCond(8);
           htmltext = event;
         }
         break;
       }
     case "DESPAWN_GHOST2":
       {
         _tifarenOwner = 0;
         if (npc.getScriptValue() != 0) {
           npc.broadcastPacket(
               new NpcSay(
                   npc.getObjectId(),
                   Say2.NPC_ALL,
                   npc.getId(),
                   NpcStringId.IM_CONFUSED_MAYBE_ITS_TIME_TO_GO_BACK));
         }
         npc.deleteMe();
         break;
       }
     case "31328-03.html":
       {
         if (qs.isCond(8)) {
           takeItems(player, CROSS_OF_EINHASAD, -1);
           htmltext = event;
         }
         break;
       }
     case "31328-09.html":
       {
         if (qs.isCond(8)) {
           giveItems(player, LETTER_OF_INNOCENTIN, 1);
           qs.setCond(9, true);
           htmltext = event;
         }
         break;
       }
     case "31328-11.html":
       {
         if (qs.isCond(14) && hasQuestItems(player, REPORT_BOX)) {
           takeItems(player, REPORT_BOX, -1);
           qs.setCond(15, true);
           htmltext = event;
         }
         break;
       }
     case "31328-19.html":
       {
         if (qs.isCond(15)) {
           qs.setCond(16, true);
           htmltext = event;
         }
         break;
       }
     case "31527-02.html":
       {
         if (qs.isCond(10) && (_soulWellNpc == null)) {
           _soulWellNpc = addSpawn(SOUL_OF_WELL, SOUL_WELL_LOC, true, 0);
           qs.startQuestTimer("activateSoulOfWell", 90000, _soulWellNpc);
           qs.startQuestTimer("despawnSoulOfWell", 120000, _soulWellNpc);
           _soulWellNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
           playSound(player, QuestSound.SKILLSOUND_ANTARAS_FEAR);
           htmltext = event;
         } else {
           htmltext = "31527-03.html";
         }
         break;
       }
     case "activateSoulOfWell":
       {
         // this enables onAttack ELSE IF block which allows the player to proceed the quest
         npc.setScriptValue(1);
         break;
       }
     case "despawnSoulOfWell":
       {
         // if the player fails to proceed the quest in 2 minutes, the soul is unspawned
         if (!npc.isDead()) {
           _soulWellNpc = null;
         }
         npc.deleteMe();
         break;
       }
     case "31529-03.html":
       {
         if (qs.isCond(9) && hasQuestItems(player, LETTER_OF_INNOCENTIN)) {
           qs.setMemoState(8);
           htmltext = event;
         }
         break;
       }
     case "31529-08.html":
       {
         if (qs.isMemoState(8)) {
           qs.setMemoState(9);
           htmltext = event;
         }
         break;
       }
     case "31529-11.html":
       {
         if (qs.isMemoState(9)) {
           giveItems(player, JEWEL_OF_ADVENTURER_1, 1);
           qs.setCond(10, true);
           qs.setMemoState(10);
           htmltext = event;
         }
         break;
       }
   }
   return htmltext;
 }
示例#26
0
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState qs = getQuestState(player, true);
   String htmltext = getNoQuestMsg(player);
   if (qs.isCreated()) {
     if (npc.getId() == MAGISTER_MIRIEN) {
       if ((player.getClassId() == ClassId.WIZARD)
           || (player.getClassId() == ClassId.ELVEN_WIZARD)
           || ((player.getClassId() == ClassId.DARK_WIZARD))) {
         if (player.getLevel() < MIN_LVL) {
           htmltext = "30461-02.html";
         } else {
           htmltext = "30461-03.htm";
         }
       } else {
         htmltext = "30461-01.html";
       }
     }
   } else if (qs.isStarted()) {
     switch (npc.getId()) {
       case MAGISTER_MIRIEN:
         {
           if (hasQuestItems(player, MIRIENS_1ST_SIGIL)) {
             if (!hasQuestItems(player, SYMBOL_OF_SYLVAIN)) {
               htmltext = "30461-05.html";
             } else {
               takeItems(player, MIRIENS_1ST_SIGIL, 1);
               giveItems(player, MIRIENS_2ND_SIGIL, 1);
               takeItems(player, SYMBOL_OF_SYLVAIN, 1);
               qs.setCond(15, true);
               htmltext = "30461-06.html";
             }
           } else if (hasQuestItems(player, MIRIENS_2ND_SIGIL)) {
             if (!hasQuestItems(player, SYMBOL_OF_JUREK)) {
               htmltext = "30461-07.html";
             } else {
               htmltext = "30461-08.html";
             }
           } else if (hasQuestItems(player, MIRIENS_INSTRUCTION)) {
             if (player.getLevel() < LEVEL) {
               htmltext = "30461-11.html";
             } else {
               takeItems(player, MIRIENS_INSTRUCTION, 1);
               giveItems(player, MIRIENS_3RD_SIGIL, 1);
               qs.setCond(19, true);
               htmltext = "30461-12.html";
             }
           } else if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) {
             if (!hasQuestItems(player, SYMBOL_OF_CRONOS)) {
               htmltext = "30461-13.html";
             } else {
               giveAdena(player, 319628, true);
               giveItems(player, MARK_OF_SCHOLAR, 1);
               addExpAndSp(player, 1753926, 113754);
               qs.exitQuest(false, true);
               player.sendPacket(new SocialAction(player.getObjectId(), 3));
               htmltext = "30461-14.html";
             }
           }
           break;
         }
       case HIGH_PRIEST_SYLVAIN:
         {
           if (hasQuestItems(player, MIRIENS_1ST_SIGIL)
               && !hasAtLeastOneQuestItem(player, HIGH_PRIESTS_SIGIL, SYMBOL_OF_SYLVAIN)) {
             htmltext = "30070-01.html";
           } else if (!hasQuestItems(player, CRYSTAL_OF_PURITY1)
               && hasQuestItems(player, HIGH_PRIESTS_SIGIL, MIRIENS_1ST_SIGIL)) {
             htmltext = "30070-03.html";
           } else if (hasQuestItems(
               player, HIGH_PRIESTS_SIGIL, MIRIENS_1ST_SIGIL, CRYSTAL_OF_PURITY1)) {
             takeItems(player, CRYSTAL_OF_PURITY1, 1);
             takeItems(player, HIGH_PRIESTS_SIGIL, 1);
             giveItems(player, SYMBOL_OF_SYLVAIN, 1);
             qs.setCond(14, true);
             htmltext = "30070-04.html";
           } else if (hasQuestItems(player, MIRIENS_1ST_SIGIL, SYMBOL_OF_SYLVAIN)
               && !hasQuestItems(player, HIGH_PRIESTS_SIGIL)) {
             htmltext = "30070-05.html";
           } else if (hasAtLeastOneQuestItem(player, MIRIENS_2ND_SIGIL, MIRIENS_3RD_SIGIL)) {
             htmltext = "30070-06.html";
           }
           break;
         }
       case CAPTAIN_LUCAS:
         {
           if (hasQuestItems(player, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL)) {
             if (hasQuestItems(player, MARIAS_1ST_LETTER)) {
               takeItems(player, MARIAS_1ST_LETTER, 1);
               giveItems(player, LUCASS_LETTER, 1);
               qs.setCond(4, true);
               htmltext = "30071-01.html";
             } else if (hasAtLeastOneQuestItem(
                 player,
                 MARIAS_2ND_LETTER,
                 CRETAS_1ST_LETTER,
                 LUCILLAS_HANDBAG,
                 CRERAS_PAINTING1,
                 LUCASS_LETTER)) {
               htmltext = "30071-02.html";
             } else if (hasQuestItems(player, CRERAS_PAINTING2)) {
               htmltext = "30071-03.html";
             } else if (hasQuestItems(player, CRERAS_PAINTING3)) {
               if (getQuestItemsCount(player, BROWN_SCROLL_SCRAP) < 5) {
                 htmltext = "30071-05.html";
               } else {
                 htmltext = "30071-06.html";
               }
             }
           } else if (hasAtLeastOneQuestItem(
               player,
               SYMBOL_OF_SYLVAIN,
               MIRIENS_2ND_SIGIL,
               MIRIENS_3RD_SIGIL,
               CRYSTAL_OF_PURITY1)) {
             htmltext = "30071-07.html";
           }
           break;
         }
       case WAREHOUSE_KEEPER_VALKON:
         {
           if (hasQuestItems(player, TRIFFS_RING)) {
             if (!hasAtLeastOneQuestItem(
                 player, VALKONS_REQUEST, CRYSTAL_OF_PURITY2, SCRIPTURE_CHAPTER_2)) {
               htmltext = "30103-01.html";
             } else if (hasQuestItems(player, VALKONS_REQUEST)
                 && !hasAtLeastOneQuestItem(player, CRYSTAL_OF_PURITY2, SCRIPTURE_CHAPTER_2)) {
               htmltext = "30103-05.html";
             } else if (hasQuestItems(player, CRYSTAL_OF_PURITY2)
                 && !hasAtLeastOneQuestItem(player, VALKONS_REQUEST, SCRIPTURE_CHAPTER_2)) {
               giveItems(player, SCRIPTURE_CHAPTER_2, 1);
               takeItems(player, CRYSTAL_OF_PURITY2, 1);
               htmltext = "30103-06.html";
             } else if (hasQuestItems(player, SCRIPTURE_CHAPTER_2)
                 && !hasAtLeastOneQuestItem(player, VALKONS_REQUEST, CRYSTAL_OF_PURITY2)) {
               htmltext = "30103-07.html";
             }
           }
           break;
         }
       case MAGISTER_DIETER:
         {
           if (hasQuestItems(player, MIRIENS_3RD_SIGIL, CRONOS_SIGIL)) {
             if (hasQuestItems(player, CRONOS_LETTER)) {
               htmltext = "30111-01.html";
             } else if (hasQuestItems(player, DIETERS_KEY)) {
               htmltext = "30111-06.html";
             } else if (hasQuestItems(player, CRETAS_2ND_LETTER)) {
               htmltext = "30111-07.html";
             } else if (hasQuestItems(player, DIETERS_DIARY, DIETERS_LETTER)) {
               htmltext = "30111-10.html";
             } else if (hasQuestItems(player, DIETERS_DIARY, RAUTS_LETTER_ENVELOPE)) {
               htmltext = "30111-11.html";
             } else if (hasQuestItems(player, DIETERS_DIARY)
                 && !hasAtLeastOneQuestItem(player, DIETERS_LETTER, RAUTS_LETTER_ENVELOPE)) {
               if (hasQuestItems(
                   player,
                   SCRIPTURE_CHAPTER_1,
                   SCRIPTURE_CHAPTER_2,
                   SCRIPTURE_CHAPTER_3,
                   SCRIPTURE_CHAPTER_4)) {
                 htmltext = "30111-13.html";
               } else {
                 htmltext = "30111-12.html";
               }
             }
           } else if (hasQuestItems(player, SYMBOL_OF_CRONOS)) {
             htmltext = "30111-15.html";
           }
           break;
         }
       case GRAND_MAGISTER_JUREK:
         {
           if (hasQuestItems(player, MIRIENS_2ND_SIGIL)) {
             if (!hasAtLeastOneQuestItem(player, GRAND_MAGISTER_SIGIL, SYMBOL_OF_JUREK)) {
               htmltext = "30115-01.html";
             } else if (hasQuestItems(player, JUREKS_LIST)) {
               if ((getQuestItemsCount(player, MONSTER_EYE_DESTROYER_SKIN)
                       + getQuestItemsCount(player, SHAMANS_NECKLACE)
                       + getQuestItemsCount(player, SHACKLES_SCALP))
                   < 12) {
                 htmltext = "30115-04.html";
               } else {
                 takeItems(player, GRAND_MAGISTER_SIGIL, 1);
                 takeItems(player, JUREKS_LIST, 1);
                 takeItems(player, MONSTER_EYE_DESTROYER_SKIN, -1);
                 takeItems(player, SHAMANS_NECKLACE, -1);
                 takeItems(player, SHACKLES_SCALP, -1);
                 giveItems(player, SYMBOL_OF_JUREK, 1);
                 qs.setCond(18, true);
                 htmltext = "30115-05.html";
               }
             } else if (hasQuestItems(player, SYMBOL_OF_JUREK)
                 && !hasQuestItems(player, GRAND_MAGISTER_SIGIL)) {
               htmltext = "30115-06.html";
             }
           } else if (hasAtLeastOneQuestItem(player, MIRIENS_1ST_SIGIL, MIRIENS_3RD_SIGIL)) {
             htmltext = "30115-07.html";
           }
           break;
         }
       case TRADER_EDROC:
         {
           if (hasQuestItems(player, DIETERS_DIARY)) {
             if (hasQuestItems(player, DIETERS_LETTER)) {
               htmltext = "30230-01.html";
             } else if (hasQuestItems(player, RAUTS_LETTER_ENVELOPE)) {
               htmltext = "30230-03.html";
             } else if (hasAtLeastOneQuestItem(player, STRONG_LIGUOR, TRIFFS_RING)) {
               htmltext = "30230-04.html";
             }
           }
           break;
         }
       case WAREHOUSE_KEEPER_RAUT:
         {
           if (hasQuestItems(player, DIETERS_DIARY)) {
             if (hasQuestItems(player, RAUTS_LETTER_ENVELOPE)) {
               htmltext = "30316-01.html";
             } else if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, STRONG_LIGUOR)) {
               htmltext = "30316-04.html";
             } else if (hasQuestItems(player, SCRIPTURE_CHAPTER_1, TRIFFS_RING)) {
               htmltext = "30316-05.html";
             }
           }
           break;
         }
       case BLACKSMITH_POITAN:
         {
           if (hasQuestItems(player, TRIFFS_RING)) {
             if (!hasAtLeastOneQuestItem(
                 player, POITANS_NOTES, CASIANS_LIST, SCRIPTURE_CHAPTER_4)) {
               giveItems(player, POITANS_NOTES, 1);
               htmltext = "30458-01.html";
             } else if (hasQuestItems(player, POITANS_NOTES)
                 && !hasAtLeastOneQuestItem(player, CASIANS_LIST, SCRIPTURE_CHAPTER_4)) {
               htmltext = "30458-02.html";
             } else if (hasQuestItems(player, POITANS_NOTES, CASIANS_LIST)
                 && !hasQuestItems(player, SCRIPTURE_CHAPTER_4)) {
               htmltext = "30458-03.html";
             } else if (hasQuestItems(player, SCRIPTURE_CHAPTER_4)
                 && !hasAtLeastOneQuestItem(player, POITANS_NOTES, CASIANS_LIST)) {
               htmltext = "30458-04.html";
             }
           }
           break;
         }
       case MARIA:
         {
           if (hasQuestItems(player, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL)) {
             if (hasQuestItems(player, SYLVAINS_LETTER)) {
               htmltext = "30608-01.html";
             } else if (hasQuestItems(player, MARIAS_1ST_LETTER)) {
               htmltext = "30608-03.html";
             } else if (hasQuestItems(player, LUCASS_LETTER)) {
               giveItems(player, MARIAS_2ND_LETTER, 1);
               takeItems(player, LUCASS_LETTER, 1);
               qs.setCond(5, true);
               htmltext = "30608-04.html";
             } else if (hasQuestItems(player, MARIAS_2ND_LETTER)) {
               htmltext = "30608-05.html";
             } else if (hasQuestItems(player, CRETAS_1ST_LETTER)) {
               htmltext = "30608-06.html";
             } else if (hasQuestItems(player, LUCILLAS_HANDBAG)) {
               htmltext = "30608-09.html";
             } else if (hasQuestItems(player, CRERAS_PAINTING1)) {
               takeItems(player, CRERAS_PAINTING1, 1);
               giveItems(player, CRERAS_PAINTING2, 1);
               qs.setCond(9, true);
               htmltext = "30608-10.html";
             } else if (hasQuestItems(player, CRERAS_PAINTING2)) {
               htmltext = "30608-11.html";
             } else if (hasQuestItems(player, CRERAS_PAINTING3)) {
               if (getQuestItemsCount(player, BROWN_SCROLL_SCRAP) < 5) {
                 qs.setCond(11, true);
                 htmltext = "30608-12.html";
               } else {
                 htmltext = "30608-13.html";
               }
             } else if (hasQuestItems(player, CRYSTAL_OF_PURITY1)) {
               htmltext = "30608-15.html";
             }
           } else if (hasAtLeastOneQuestItem(player, SYMBOL_OF_SYLVAIN, MIRIENS_2ND_SIGIL)) {
             htmltext = "30608-16.html";
           } else if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) {
             if (!hasQuestItems(player, VALKONS_REQUEST)) {
               htmltext = "30608-17.html";
             } else {
               takeItems(player, VALKONS_REQUEST, 1);
               giveItems(player, CRYSTAL_OF_PURITY2, 1);
               htmltext = "30608-18.html";
             }
           }
           break;
         }
       case ASTROLOGER_CRETA:
         {
           if (hasQuestItems(player, MIRIENS_1ST_SIGIL, HIGH_PRIESTS_SIGIL)) {
             if (hasQuestItems(player, MARIAS_2ND_LETTER)) {
               htmltext = "30609-01.html";
             } else if (hasQuestItems(player, CRETAS_1ST_LETTER)) {
               htmltext = "30609-06.html";
             } else if (hasQuestItems(player, LUCILLAS_HANDBAG)) {
               htmltext = "30609-07.html";
             } else if (hasAtLeastOneQuestItem(
                 player, CRERAS_PAINTING1, CRERAS_PAINTING2, CRERAS_PAINTING3)) {
               htmltext = "30609-10.html";
             }
           } else if (hasAtLeastOneQuestItem(
               player, CRYSTAL_OF_PURITY1, SYMBOL_OF_SYLVAIN, MIRIENS_2ND_SIGIL)) {
             htmltext = "30609-11.html";
           } else if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) {
             if (hasQuestItems(player, DIETERS_KEY)) {
               htmltext = "30609-12.html";
             } else {
               htmltext = "30609-15.html";
             }
           }
           break;
         }
       case ELDER_CRONOS:
         {
           if (hasQuestItems(player, MIRIENS_3RD_SIGIL)) {
             if (!hasAtLeastOneQuestItem(player, CRONOS_SIGIL, SYMBOL_OF_CRONOS)) {
               htmltext = "30610-01.html";
             } else if (hasQuestItems(player, CRONOS_SIGIL)) {
               if (hasQuestItems(
                   player,
                   SCRIPTURE_CHAPTER_1,
                   SCRIPTURE_CHAPTER_2,
                   SCRIPTURE_CHAPTER_3,
                   SCRIPTURE_CHAPTER_4)) {
                 htmltext = "30610-12.html";
               } else {
                 htmltext = "30610-11.html";
               }
             } else if (hasQuestItems(player, SYMBOL_OF_CRONOS)
                 && !hasQuestItems(player, CRONOS_SIGIL)) {
               htmltext = "30610-15.html";
             }
           }
           break;
         }
       case DRUNKARD_TRIFF:
         {
           if (hasQuestItems(player, DIETERS_DIARY, SCRIPTURE_CHAPTER_1, STRONG_LIGUOR)) {
             htmltext = "30611-01.html";
           } else if (hasAtLeastOneQuestItem(player, TRIFFS_RING, SYMBOL_OF_CRONOS)) {
             htmltext = "30611-05.html";
           }
           break;
         }
       case ELDER_CASIAN:
         {
           if (hasQuestItems(player, TRIFFS_RING, POITANS_NOTES)) {
             if (!hasQuestItems(player, CASIANS_LIST)) {
               if (hasQuestItems(
                   player, SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3)) {
                 htmltext = "30612-02.html";
               } else {
                 htmltext = "30612-01.html";
               }
             } else {
               if ((getQuestItemsCount(player, GHOULS_SKIN)
                       + getQuestItemsCount(player, MEDUSAS_BLOOD)
                       + getQuestItemsCount(player, FETTERED_SOULS_ICHOR)
                       + getQuestItemsCount(player, ENCHANTED_GARGOYLES_NAIL))
                   < 32) {
                 htmltext = "30612-05.html";
               } else {
                 htmltext = "30612-06.html";
               }
             }
           } else if (hasQuestItems(
                   player,
                   TRIFFS_RING,
                   SCRIPTURE_CHAPTER_1,
                   SCRIPTURE_CHAPTER_2,
                   SCRIPTURE_CHAPTER_3,
                   SCRIPTURE_CHAPTER_4)
               && !hasAtLeastOneQuestItem(player, POITANS_NOTES, CASIANS_LIST)) {
             htmltext = "30612-08.html";
           }
           break;
         }
     }
   } else if (qs.isCompleted()) {
     if (npc.getId() == MAGISTER_MIRIEN) {
       htmltext = getAlreadyCompletedMsg(player);
     }
   }
   return htmltext;
 }
  @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 "31683-03.htm":
        {
          if (qs.isCreated()) {
            qs.set("tablet_" + TABLET_1, 0);
            qs.set("tablet_" + TABLET_2, 0);
            qs.set("tablet_" + TABLET_3, 0);
            qs.set("tablet_" + TABLET_4, 0);
            qs.set("tablet_" + TABLET_5, 0);
            qs.startQuest();
            htmltext = event;
          }
          break;
        }
      case "31548-02.html":
      case "31549-02.html":
      case "31550-02.html":
      case "31551-02.html":
      case "31552-02.html":
        {
          if (qs.getCond() < 6) {
            giveItems(player, BROKEN_CRYSTAL, 1);
            qs.set("TABLET_" + npc.getId(), 1);
            qs.setCond(qs.getCond() + 1, true);
            htmltext = event;
          }
          break;
        }
      case "31683-06.html":
        {
          if (qs.isCond(6) && (getQuestItemsCount(player, BROKEN_CRYSTAL) >= 5)) {
            takeItems(player, BROKEN_CRYSTAL, -1);
            qs.setCond(7, true);
            htmltext = event;
          }
          break;
        }
      case "31683-10.html":
        {
          if (qs.isCond(8)) {
            if (getQuestItemsCount(player, SPIRIT_OF_DARKNESS) >= 200) {
              takeItems(player, SPIRIT_OF_DARKNESS, -1);
              giveItems(player, UNFINISHED_CRYSTAL, 1);
              qs.exitQuest(true, true);
              htmltext = event;
            } else {
              htmltext = "31683-11.html";
            }
          }
          break;
        }
    }
    return htmltext;
  }