@Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    final QuestState st = getRandomPartyMemberState(killer, -1, 3, npc);
    if (st != null) {
      final DropInfo info = MONSTERS.get(npc.getId());
      if (st.getCond() >= 1) {
        giveItemRandomly(
            st.getPlayer(), npc, SILVER_ICE_CRYSTAL, 1, 0, info.getFirstChance(), true);
      }

      if (info.getSecondChance() > 0) {
        final QuestState st2 =
            st.getPlayer().getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName());
        if ((st.getCond() >= 2) && (st2 != null) && st2.isCompleted()) {
          giveItemRandomly(
              st.getPlayer(), npc, SILVER_HEMOCYTE, 1, 0, info.getSecondChance(), true);
        }
      }
    }
    return super.onKill(npc, killer, isSummon);
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, true);
   String htmltext = getNoQuestMsg(player);
   switch (st.getState()) {
     case State.CREATED:
       {
         htmltext = (player.getLevel() < MIN_LEVEL) ? "32612-02.html" : "32612-01.htm";
         break;
       }
     case State.STARTED:
       {
         switch (st.getCond()) {
           case 1:
             {
               htmltext = "32612-05.html";
               break;
             }
           case 2:
             {
               if (getQuestItemsCount(player, ZAKENS_SOUL_FRAGMENT) >= FRAGMENT_COUNT) {
                 giveItems(player, SOUL_CLOAK_OF_ZAKEN, 1);
                 playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
                 st.exitQuest(false, true);
                 htmltext = "32612-06.html";
               }
               break;
             }
         }
         break;
       }
     case State.COMPLETED:
       {
         htmltext = "32612-03.html";
         break;
       }
   }
   return htmltext;
 }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   String htmltext = getNoQuestMsg(player);
   final QuestState st = getQuestState(player, true);
   if (st == null) {
     return htmltext;
   }
   switch (npc.getId()) {
     case SYLVAIN:
       switch (st.getCond()) {
         case 1:
           htmltext = "30070-02.htm";
           break;
         case 2:
         case 3:
         case 4:
         case 5:
         case 6:
           htmltext = "30070-03.html";
           break;
         case 7:
           htmltext = "30070-04.html";
           break;
         default:
           if (st.isCompleted()) {
             return getAlreadyCompletedMsg(player);
           }
           final QuestState qs =
               player.getQuestState(Q00137_TempleChampionPart1.class.getSimpleName());
           htmltext =
               (player.getLevel() >= 36)
                   ? ((qs != null) && qs.isCompleted()) ? "30070-01.htm" : "30070-00a.htm"
                   : "30070-00.htm";
           break;
       }
       break;
     case PUPINA:
       switch (st.getCond()) {
         case 2:
           htmltext = "30118-01.html";
           break;
         case 3:
         case 4:
           htmltext = "30118-07.html";
           break;
         case 5:
           htmltext = "30118-08.html";
           if (st.hasQuestItems(ANGUS_RECOMMENDATION)) {
             st.takeItems(ANGUS_RECOMMENDATION, -1);
           }
           break;
         case 6:
           htmltext = "30118-10.html";
           break;
       }
       break;
     case ANGUS:
       switch (st.getCond()) {
         case 3:
           htmltext = "30474-01.html";
           break;
         case 4:
           if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10) {
             st.takeItems(RELICS_OF_THE_DARK_ELF_TRAINEE, -1);
             st.giveItems(ANGUS_RECOMMENDATION, 1);
             st.setCond(5, true);
             htmltext = "30474-04.html";
           } else {
             htmltext = "30474-03.html";
           }
           break;
         case 5:
           htmltext = "30474-05.html";
           break;
       }
       break;
     case SLA:
       switch (st.getCond()) {
         case 6:
           switch (st.getInt("talk")) {
             case 1:
               htmltext = "30666-02.html";
               break;
             case 2:
               htmltext = "30666-03.html";
               break;
             default:
               htmltext = "30666-01.html";
               break;
           }
           break;
         case 7:
           htmltext = "30666-09.html";
           break;
       }
       break;
   }
   return htmltext;
 }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    final QuestState q115 = player.getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName());
    if (st == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "ACCEPT":
        {
          st.startQuest();
          if ((q115 != null) && (q115.isCompleted())) {
            htmltext = "32020-04.htm";
          } else {
            st.setCond(2);
            htmltext = "32020-05.htm";
          }
          break;
        }
      case "ASK":
        {
          if (st.getCond() >= 1) {
            htmltext = ((q115 != null) && !q115.isCompleted()) ? "32020-14.html" : "32020-15.html";
          }
          break;
        }
      case "LATER":
        {
          if (st.getCond() >= 1) {
            htmltext = ((q115 != null) && !q115.isCompleted()) ? "32020-19.html" : "32020-20.html";
          }
          break;
        }
      case "REWARD":
        {
          if (st.getCond() >= 1) {
            final long silverCryCount = getQuestItemsCount(player, SILVER_ICE_CRYSTAL);
            final long blackCryCount = getQuestItemsCount(player, BLACK_ICE_CRYSTAL);
            if ((silverCryCount + blackCryCount) > 0) {
              giveAdena(player, (silverCryCount * 300) + (blackCryCount * 1200), true);
              takeItems(player, -1, SILVER_ICE_CRYSTAL, BLACK_ICE_CRYSTAL);
              htmltext =
                  ((q115 != null) && !q115.isCompleted()) ? "32020-16.html" : "32020-17.html";
            } else {
              htmltext = "32020-18.html";
            }
          }
          break;
        }
      case "QUIT":
        {
          if (st.getCond() >= 1) {
            if ((q115 != null) && !q115.isCompleted()) {
              htmltext = "32020-21.html";
              st.exitQuest(true, true);
            } else {
              htmltext = "32020-22.html";
            }
          }
          break;
        }
      case "32020-06.html":
      case "32020-07.html":
      case "32020-08.html":
      case "32020-09.html":
        {
          if (st.getCond() >= 1) {
            htmltext = event;
          }
          break;
        }
      case "32020-23.html":
        {
          if (st.getCond() >= 1) {
            st.exitQuest(true, true);
            htmltext = event;
          }
          break;
        }
      case "32023-04.html":
        {
          if ((st.getCond() >= 1)
              && hasQuestItems(player, SILVER_ICE_CRYSTAL)
              && (st.getInt("ex") == 0)) {
            st.set("ex", ((getRandom(4) + 1) * 10));
            htmltext = event;
          }
          break;
        }
      case "32023-05.html":
        {
          if ((st.getCond() >= 1)
              && hasQuestItems(player, SILVER_ICE_CRYSTAL)
              && (st.getInt("ex") > 0)) {
            takeItems(player, SILVER_ICE_CRYSTAL, 1);
            final int val = (st.getInt("ex") + 1);
            st.set("ex", val);
            playSound(player, QuestSound.ITEMSOUND_BROKEN_KEY);
            htmltext = event;
          }
          break;
        }
      case "32023-06.html":
        {
          if ((st.getCond() >= 1)
              && hasQuestItems(player, SILVER_ICE_CRYSTAL)
              && (st.getInt("ex") > 0)) {
            takeItems(player, SILVER_ICE_CRYSTAL, 1);
            final int val = (st.getInt("ex") + 2);
            st.set("ex", val);
            playSound(player, QuestSound.ITEMSOUND_BROKEN_KEY);
            htmltext = event;
          }
          break;
        }
      case "REPLY4":
        {
          if ((st.getCond() >= 1) && (st.getInt("ex") > 0)) {
            final int ex = st.getInt("ex");
            final int val1 = ex / 10;
            final int val2 = ex - (val1 * 10);
            if (val1 == val2) {
              htmltext = "32023-07.html";
              giveItems(player, BLACK_ICE_CRYSTAL, 1);
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_SUCCESS);
            } else {
              htmltext = "32023-08.html";
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_FAILED);
            }
            st.set("ex", 0);
          }
          break;
        }
      case "REPLY5":
        {
          if ((st.getCond() >= 1) && (st.getInt("ex") > 0)) {
            final int ex = st.getInt("ex");
            final int val1 = ex / 10;
            final int val2 = ((ex - (val1 * 10)) + 2);
            if (val1 == val2) {
              htmltext = "32023-07.html";
              giveItems(player, BLACK_ICE_CRYSTAL, 1);
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_SUCCESS);
            } else {
              htmltext = "32023-08.html";
              playSound(player, QuestSound.ITEMSOUND_ENCHANT_FAILED);
            }
            st.set("ex", 0);
          }
          break;
        }
    }
    return htmltext;
  }
示例#5
0
 @Override
 public String onTalk(L2Npc npc, L2PcInstance talker) {
   final QuestState qs = getQuestState(talker, true);
   String htmltext = getNoQuestMsg(talker);
   switch (npc.getId()) {
     case IRIS:
       {
         switch (qs.getCond()) {
           case 3:
             {
               htmltext = "30034-01.html";
               break;
             }
           case 4:
             {
               htmltext = "30034-04.html";
               break;
             }
           case 5:
             {
               htmltext = "30034-05.html";
               break;
             }
           case 6:
             {
               htmltext = "30034-09.html";
               break;
             }
           case 7:
             {
               if (hasItem(talker, TOTEM_TOOTH_2ND)) {
                 htmltext = "30034-08.html";
               }
               break;
             }
         }
         break;
       }
     case MAGISTER_ROHMER:
       {
         if (qs.isCond(4)) {
           htmltext = "30344-01.html";
         } else if (qs.isCond(5)) {
           htmltext = "30344-04.html";
         }
         break;
       }
     case GUARD_LUIS:
       {
         if (qs.isCreated()) {
           htmltext = (talker.getLevel() >= MIN_LVL) ? "30386-01.htm" : "30386-02.htm";
         } else if (qs.isStarted()) {
           switch (qs.getCond()) {
             case 1:
               {
                 htmltext = "30386-05.html";
                 break;
               }
             case 2:
               {
                 if (hasItem(talker, FEATHER)) {
                   htmltext = "30386-04.html";
                 }
                 break;
               }
             case 3:
               {
                 htmltext = "30386-08.html";
                 break;
               }
           }
         } else if (qs.isCompleted()) {
           htmltext = getAlreadyCompletedMsg(talker);
         }
         break;
       }
   }
   return htmltext;
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);
    if (st == null) {
      return htmltext;
    }

    switch (npc.getId()) {
      case NATOOLS:
        switch (st.getState()) {
          case State.STARTED:
            switch (st.getCond()) {
              case 1:
                htmltext = "30894-01.html";
                break;
              default:
                htmltext = "30894-04.html";
                break;
            }
            break;
          case State.COMPLETED:
            htmltext = getAlreadyCompletedMsg(player);
            break;
        }
        break;
      case TOBIAS:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
              htmltext = "30297-01.html";
              break;
            case 2:
              htmltext = (st.isSet("talk")) ? "30297-04.html" : "30297-02.html";
              break;
            case 3:
            case 4:
              htmltext = "30297-06.html";
              break;
            case 5:
              st.giveAdena(89046, true);
              if (player.getLevel() <= MAX_REWARD_LEVEL) {
                st.addExpAndSp(223036, 13901);
              }
              st.exitQuest(false, true);
              htmltext = "30297-07.html";
              break;
          }
        }
        break;
      case CASIAN:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
            case 2:
              htmltext = "30612-01.html";
              break;
            case 3:
              htmltext = (st.isSet("talk")) ? "30612-04.html" : "30612-02.html";
              break;
            default:
              htmltext = "30612-10.html";
              break;
          }
        }
        break;
      case ROCK:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
            case 2:
            case 3:
              htmltext = "32368-01.html";
              break;
            case 4:
              htmltext = "32368-02.html";
              break;
            case 5:
              htmltext = "32368-05.html";
              break;
          }
        }
        break;
      case ANGEL:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
            case 2:
            case 3:
              htmltext = "32369-01.html";
              break;
            case 4:
              if (st.getInt("talk") == 1) {
                htmltext = "32369-04.html";
              } else if (st.getInt("talk") == 2) {
                htmltext = "32369-07.html";
              } else {
                htmltext = "32369-02.html";
              }
              break;
          }
        }
        break;
    }
    return htmltext;
  }