@Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (qs.isCompleted()) {
      return getAlreadyCompletedMsg(player);
    }
    if (player.getRace() == Race.ERTHEIA) {
      return "31292-noErtheia.html";
    }
    if (player.isMageClass()) {
      return "31292-noMage.html";
    }

    switch (npc.getId()) {
      case ANDREI:
        {
          if (qs.isCreated()) {
            htmltext = "31292-01.htm";
          } else if (qs.isStarted()) {
            htmltext = "31292-03.html";
          }
          break;
        }
      case JANITT:
        {
          if (qs.isCond(1)) {
            htmltext = "33851-01.html";
          }
          break;
        }
    }
    return htmltext;
  }
Пример #2
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);

    if (qs.isCompleted()) {
      htmltext = getAlreadyCompletedMsg(player);
    }

    switch (npc.getId()) {
      case LEIRA:
        {
          if (qs.isCreated()) {
            htmltext = "33952-01.htm";
          } else if (qs.isStarted()) {
            htmltext = "33952-03.html";
          }
          break;
        }
      case MILONE:
        {
          if (qs.isCond(2)) {
            htmltext = "33953-01.html";
          }
          break;
        }
    }

    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (qs.isCompleted()) {
      return getAlreadyCompletedMsg(player);
    }
    if (player.getRace() == Race.ERTHEIA) {
      return "33864-noErtheia.html";
    }

    switch (npc.getId()) {
      case PATERSON:
        {
          if (qs.isCreated()) {
            htmltext = "33864-01.htm";
          } else if (qs.isStarted()) {
            htmltext = "33864-03.html";
          }
          break;
        }
      case SHUVANN:
        {
          if (qs.isCond(1)) {
            htmltext = "33867-01.html";
          }
          break;
        }
    }
    return htmltext;
  }
Пример #4
0
  @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 ANTON:
        switch (st.getState()) {
          case State.CREATED:
            htmltext = (player.getLevel() < 75) ? "31338-0a.htm" : "31338-0b.htm";
            break;
          case State.STARTED:
            htmltext = "31338-1a.html";
            break;
          case State.COMPLETED:
            htmltext = getAlreadyCompletedMsg(player);
            break;
        }
        break;
      case MARQUEZ:
        if (st.isCond(1)) {
          htmltext = "32113-1.html";
        }
        break;
    }
    return htmltext;
  }
Пример #5
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);

    if (st == null) {
      return null;
    }

    String htmltext = event;
    switch (event) {
      case "32650-04.htm":
      case "32650-05.htm":
      case "32650-06.html":
        break;
      case "32650-07.htm":
        st.startQuest();
        break;
      case "despawn":
        npc.setBusy(false);
        npc.deleteMe();
        htmltext = null;
        break;
      default:
        htmltext = null;
        break;
    }
    return htmltext;
  }
 @Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, false);
   if ((st != null) && (player.getLevel() >= MIN_LEVEL) && event.equals("32612-04.html")) {
     st.startQuest();
     return event;
   }
   return null;
 }
Пример #7
0
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final QuestState qs = getQuestState(killer, false); // kill counts independent on party/no party
   if ((qs != null)
       && qs.isStarted()
       && qs.isCond(1)
       && (Util.checkIfInRange(1500, npc, qs.getPlayer(), false))) {
     qs.setCond(2);
   }
   return super.onKill(npc, killer, isSummon);
 }
 @Override
 public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) {
   final QuestState st = getQuestState(player, false);
   if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) {
     final long currentCount = getQuestItemsCount(player, ZAKENS_SOUL_FRAGMENT);
     final long count = getRandom(1, 3);
     if (count >= (FRAGMENT_COUNT - currentCount)) {
       giveItems(player, ZAKENS_SOUL_FRAGMENT, FRAGMENT_COUNT - currentCount);
       st.setCond(2, true);
     } else {
       giveItems(player, ZAKENS_SOUL_FRAGMENT, count);
       playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
     }
   }
 }
Пример #9
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "31453-02.htm":
      case "31453-03.htm":
      case "31453-10.html":
        {
          htmltext = event;
          break;
        }
      case "31453-04.html":
        {
          st.startQuest();
          htmltext = event;
          break;
        }
      case "31453-11.html":
        {
          if (st.isCond(2)) {
            st.giveAdena(150292, true);
            st.addExpAndSp(902439, 90067);
            st.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
      case "brooch":
        {
          htmltext = (st.hasQuestItems(ANTIQUE_BROOCH)) ? "32009-02.html" : "32009-03.html";
          break;
        }
      case "32009-04.html":
        {
          if (st.isCond(1) && st.hasQuestItems(ANTIQUE_BROOCH)) {
            st.setCond(2, true);
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }
Пример #10
0
 private void openDoor(QuestState st, L2PcInstance player, int doorId) {
   st.unset("correct");
   final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player.getInstanceId());
   if (tmpworld instanceof NornilsWorld) {
     openDoor(doorId, tmpworld.getInstanceId());
   }
 }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    if (qs == null) {
      return null;
    }

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

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

    if ((npc.getId() == _garden_guard) && event.equalsIgnoreCase("enter_instance")) {
      try {
        htmltext = enterInstance(npc, player);
      } catch (Exception e) {
      }
    } else if ((npc.getId() == 32258) && event.equalsIgnoreCase("exit")) {
      try {
        exitInstance(player);
      } catch (Exception e) {
      }
    } else if (Util.contains(_final_gates, npc.getId())) {
      if (event.equalsIgnoreCase("32260-02.html")
          || event.equalsIgnoreCase("32261-02.html")
          || event.equalsIgnoreCase("32262-02.html")) {
        st.unset("correct");
      } else if (Util.isDigit(event)) {
        int correct = st.getInt("correct");
        correct++;
        st.set("correct", String.valueOf(correct));
        htmltext = npc.getId() + "-0" + String.valueOf(correct + 2) + ".html";
      } else if (event.equalsIgnoreCase("check")) {
        final int correct = st.getInt("correct");
        if ((npc.getId() == 32260) && (correct == 3)) {
          openDoor(st, player, 16200014);
        } else if ((npc.getId() == 32261) && (correct == 3)) {
          openDoor(st, player, 16200015);
        } else if ((npc.getId() == 32262) && (correct == 4)) {
          openDoor(st, player, 16200016);
        } else {
          return npc.getId() + "-00.html";
        }
      }
    }
    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    if (qs == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "33864-03.html":
        {
          qs.startQuest();
          giveItems(player, SCROLL_OF_ESCAPE_FIELDS_OF_MASSACRE);
          htmltext = event;
          break;
        }
      case "33867-02.html":
        {
          if (qs.isCond(1)) {
            giveItems(player, STEEL_DOOR_GUILD);
            giveItems(player, ENCHANT_WEAPON_A);
            addExpAndSp(player, 807240, 193);
            showOnScreenMsg(
                player,
                NpcStringId
                    .GROW_STRONGER_HERE_UNTIL_YOU_RECEIVE_THE_NEXT_LETTER_FROM_KEKROPUS_AT_LV_65,
                ExShowScreenMessage.TOP_CENTER,
                4500);
            qs.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
      case "33864-02.htm":
        {
          htmltext = event;
          break;
        }
    }
    return htmltext;
  }
Пример #15
0
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   switch (npc.getId()) {
     case LIZARDMAN_SUB_LEADER:
     case LIZARDMAN_SENTINEL:
       {
         final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc);
         if ((qs != null)
             && giveItemRandomly(
                 qs.getPlayer(), npc, FEATHER.getId(), 1, FEATHER.getCount(), 1.0, true)) {
           qs.setCond(2);
         }
         break;
       }
     case LIZARDMAN_LEADER:
     case LIZARDMAN_SHAMAN:
       {
         final QuestState qs = getRandomPartyMemberState(killer, 6, 3, npc);
         if ((qs != null)
             && giveItemRandomly(
                 qs.getPlayer(),
                 npc,
                 TOTEM_TOOTH_2ND.getId(),
                 1,
                 TOTEM_TOOTH_2ND.getCount(),
                 0.5,
                 true)) {
           qs.setCond(7);
         }
         break;
       }
   }
   return super.onKill(npc, killer, isSummon);
 }
Пример #16
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 "33952-02.htm":
      case "33953-02.html":
        {
          htmltext = event;
          break;
        }
      case "33952-03.html":
        {
          qs.startQuest();
          htmltext = event;
          break;
        }
      case "33953-03.html":
        {
          if (qs.isCond(2)) {
            giveAdena(player, 62000, true);
            addExpAndSp(player, 62876, 0);
            giveItems(player, LEATHER_SHOES);
            showOnScreenMsg(
                player,
                NpcStringId.CHECK_YOUR_EQUIPMENT_IN_YOUR_INVENTORY,
                ExShowScreenMessage.TOP_CENTER,
                4500);
            qs.exitQuest(false, true);
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }
Пример #17
0
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    final QuestState qs = getQuestState(killer, false);

    if ((qs != null)
        && qs.isCond(1)
        && (getQuestItemsCount(killer, PECULIAR_MUSHROOM_SPORE) < 10)) {
      switch (npc.getId()) {
        case GROWLER:
        case ROBUST_GROWLER:
          {
            final int killCount = qs.getInt(KILL_VAR) + 1;
            if (killCount >= 3) {
              addAttackPlayerDesire(addSpawn(EVOLVED_GROWLER, npc.getLocation()), killer);
              qs.set(KILL_VAR, 0);
            } else {
              qs.set(KILL_VAR, killCount);
            }
            break;
          }
        case EVOLVED_GROWLER:
          {
            if (giveItemRandomly(killer, npc, PECULIAR_MUSHROOM_SPORE, 1, 10, 1.0, true)) {
              qs.setCond(2);
            }
            break;
          }
      }
    }
    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;
 }
Пример #19
0
 @Override
 public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) {
   final QuestState st = getQuestState(player, false);
   if ((st != null)
       && st.isStarted()
       && st.isCond(4)
       && (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) < 10)) {
     st.giveItems(RELICS_OF_THE_DARK_ELF_TRAINEE, 1);
     if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10) {
       st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
     } else {
       st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
     }
   }
   return super.onKill(npc, player, isSummon);
 }
Пример #20
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, false);
    if (qs == null) {
      return null;
    }

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

    switch (qs.getState()) {
      case State.CREATED:
        {
          htmltext = npc.getId() == THEODORE ? "32975-01.htm" : "32974-04.html";
          break;
        }
      case State.STARTED:
        {
          htmltext = npc.getId() == THEODORE ? "32975-04.html" : "32974-01.html";
          break;
        }
      case State.COMPLETED:
        {
          htmltext = npc.getId() == THEODORE ? "32975-05.html" : "32974-03.html";
          break;
        }
    }
    return htmltext;
  }
Пример #22
0
  @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);
  }
Пример #23
0
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState qs = getQuestState(player, true);
   String texthtml = null;
   switch (qs.getState()) {
     case State.CREATED:
       {
         texthtml = npc.getId() == ZENATH ? "33509-01.htm" : getNoQuestMsg(player);
         break;
       }
     case State.STARTED:
       {
         switch (npc.getId()) {
           case ZENATH:
             {
               if (qs.isCond(1)) {
                 texthtml = "33509-03.htm";
               } else if (qs.isCond(2)) // report defeated kanilov, get the sketch
               {
                 giveItems(player, SAKUMS_SKETCH_A, 1);
                 qs.setCond(3);
                 texthtml = "33509-05.html";
               } else {
                 texthtml = "33509-06.html";
               }
               break;
             }
           case ADV_GUILDSMAN:
             {
               if (qs.isCond(3)) // start end quest dialogs
               {
                 texthtml = "31795-01.html";
               } else {
                 texthtml = getNoQuestMsg(player);
               }
               break;
             }
         }
         break;
       }
     case State.COMPLETED:
       {
         texthtml =
             npc.getId() == ADV_GUILDSMAN ? "31795-04.html" : getAlreadyCompletedMsg(player);
         break;
       }
   }
   return texthtml;
 }
Пример #24
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return getNoQuestMsg(player);
    }

    switch (event) {
      case "31338-1.html":
        st.giveItems(ANCIENT_BOOK, 1);
        st.startQuest();
        break;
      case "32113-2.html":
      case "32113-2a.html":
        st.giveAdena(191678, true);
        st.addExpAndSp(251602, 25245);
        st.exitQuest(false, true);
        break;
    }
    return event;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance talker) {
    final QuestState qs = getQuestState(talker, true);
    String htmltext = getNoQuestMsg(talker);

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

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

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

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

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

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

                        qs.exitQuest(true, true);
                        htmltext = "30747-16.html";
                      } else {
                        npc.setTarget(talker);
                        npc.doCast(CURSE_OF_MIMYU.getSkill());
                        htmltext = "30747-18.html";
                      }
                    }
                  }
                }
                break;
              }
          }
          break;
        }
    }
    return htmltext;
  }
Пример #26
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);

    if (st == null) {
      return htmltext;
    }

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

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

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

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

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

    return htmltext;
  }
  @Override
  public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) {
    final QuestState qs = getQuestState(attacker, false);
    if ((qs != null) && qs.isCond(2)) {
      if (isSummon) {
        final NpcData data = NPC_DATA.get(npc.getId());
        if ((qs.getMemoState() % data.memoStateMod) < data.memoStateValue) {
          final L2Summon pet = attacker.getPet();
          if ((pet != null) && (pet.getControlObjectId() == qs.getInt("fluteObjectId"))) {
            final int hits = qs.getInt("hits") + 1;
            qs.set("hits", hits);

            if (hits < data.minHits) {
              if ((npc.getId() == TREE_OF_ABYSS) && (getRandom(100) < 2)) {
                npc.setTarget(attacker);
                npc.doCast(DRYAD_ROOT.getSkill());
              }
            } else if (getRandom(100) < 2) {
              if (hasQuestItems(attacker, FAIRY_LEAF)) {
                npc.broadcastPacket(
                    new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.GIVE_ME_A_FAIRY_LEAF));
                takeItems(attacker, FAIRY_LEAF, 1);
                qs.setMemoState(qs.getMemoState() + data.memoStateValue);
                qs.unset("hits");
                playSound(attacker, QuestSound.ITEMSOUND_QUEST_MIDDLE);

                if (qs.getMemoState() == 15) {
                  qs.setCond(3);
                }
              }
            }
          }
        } else {
          switch (getRandom(3)) {
            case 0:
              npc.broadcastPacket(
                  new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.WHY_DO_YOU_BOTHER_ME_AGAIN));
              break;
            case 1:
              npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, data.message));
              break;
            case 2:
              npc.broadcastPacket(
                  new NpcSay(
                      npc,
                      ChatType.NPC_GENERAL,
                      NpcStringId.LEAVE_NOW_BEFORE_YOU_INCUR_THE_WRATH_OF_THE_GUARDIAN_GHOST));
              break;
          }
        }
      } else if (getRandom(100) < 30) {
        npc.setTarget(attacker);
        npc.doCast(VICIOUS_POISON.getSkill());
      }
    } else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.67)) && (getRandom(100) < 30)) {
      npc.setTarget(attacker);
      npc.doCast(VICIOUS_POISON.getSkill());
    }

    return super.onAttack(npc, attacker, damage, isSummon);
  }
Пример #28
0
 @Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, false);
   if (st == null) {
     return getNoQuestMsg(player);
   }
   switch (event) {
     case "30070-02.htm":
       st.startQuest();
       st.giveItems(TEMPLE_MANIFESTO, 1);
       break;
     case "30070-05.html":
       st.giveAdena(84593, true);
       if ((player.getLevel() < 42)) {
         st.addExpAndSp(187062, 11307);
       }
       st.exitQuest(false, true);
       break;
     case "30070-03.html":
       st.setCond(2, true);
       break;
     case "30118-06.html":
       st.setCond(3, true);
       break;
     case "30118-09.html":
       st.setCond(6, true);
       st.giveItems(PUPINAS_RECOMMENDATION, 1);
       break;
     case "30474-02.html":
       st.setCond(4, true);
       break;
     case "30666-02.html":
       if (st.hasQuestItems(PUPINAS_RECOMMENDATION)) {
         st.set("talk", "1");
         st.takeItems(PUPINAS_RECOMMENDATION, -1);
       }
       break;
     case "30666-03.html":
       if (st.hasQuestItems(TEMPLE_MANIFESTO)) {
         st.set("talk", "2");
         st.takeItems(TEMPLE_MANIFESTO, -1);
       }
       break;
     case "30666-08.html":
       st.setCond(7, true);
       st.unset("talk");
       break;
   }
   return event;
 }
Пример #29
0
 @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) {
    if ("DESPAWN_GUARDIAN".equals(event)) {
      if (npc != null) {
        npc.deleteMe();
      }
      return super.onAdvEvent(event, npc, player);
    }

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

    switch (event) {
      case "30610-05.htm":
        {
          if (qs.isCreated()) {
            if (getQuestItemsCount(
                    player, DRAGONFLUTE_OF_WIND, DRAGONFLUTE_OF_STAR, DRAGONFLUTE_OF_TWILIGHT)
                == 1) {
              final L2ItemInstance flute = getFlute(player);

              if (flute.getEnchantLevel() < MIN_HACHLING_LVL) {
                htmltext = "30610-06.html";
              } else {
                qs.startQuest();
                qs.setMemoState(100);
                qs.set("fluteObjectId", flute.getObjectId());
                htmltext = event;
              }
            } else {
              htmltext = "30610-06.html";
            }
          }
          break;
        }
      case "30747-04.html":
        {
          final L2Summon summon = player.getPet();

          if (summon == null) {
            htmltext = "30747-02.html";
          } else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) {
            htmltext = "30747-03.html";
          } else {
            htmltext = event;
          }
          break;
        }
      case "30747-05.html":
        {
          final L2Summon summon = player.getPet();

          if (summon == null) {
            htmltext = "30747-06.html";
          } else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) {
            htmltext = "30747-06.html";
          } else {
            giveItems(player, FAIRY_LEAF, 4);
            qs.setCond(2, true);
            qs.setMemoState(0);
            htmltext = event;
          }
          break;
        }
      case "30747-07.html":
      case "30747-08.html":
      case "30747-09.html":
      case "30747-10.html":
        {
          htmltext = event;
          break;
        }
    }
    return htmltext;
  }