Beispiel #1
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = event;
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    if (event.equalsIgnoreCase("30623-04.htm")) {
      if (player.getRace() == Race.Orc) htmltext = "30623-05.htm";
    } else if (event.equalsIgnoreCase("30623-07.htm")) {
      st.setState(STATE_STARTED);
      st.set("cond", "1");
      st.set("cond", "2");
      st.playSound(QuestState.SOUND_ACCEPT);
      st.giveItems(ORDER_GLUDIO, 1);
      st.giveItems(ORDER_DION, 1);
      st.giveItems(ORDER_GIRAN, 1);
      st.giveItems(ORDER_OREN, 1);
      st.giveItems(ORDER_ADEN, 1);
      st.giveItems(DIMENSIONAL_DIAMOND, 72);
    } else if (event.equalsIgnoreCase("30623-16.htm")) {
      if (st.getInt("cond") == 3) {
        st.set("cond", "4");
        st.playSound(QuestState.SOUND_MIDDLE);

        st.takeItems(ORDER_GLUDIO, 1);
        st.takeItems(ORDER_DION, 1);
        st.takeItems(ORDER_GIRAN, 1);
        st.takeItems(ORDER_OREN, 1);
        st.takeItems(ORDER_ADEN, 1);

        st.takeItems(PUNCHER_SHARD, -1);
        st.takeItems(NOBLE_ANT_FEELER, -1);
        st.takeItems(DRONE_CHITIN, -1);
        st.takeItems(DEAD_SEEKER_FANG, -1);
        st.takeItems(OVERLORD_NECKLACE, -1);
        st.takeItems(FETTERED_SOUL_CHAIN, -1);
        st.takeItems(CHIEF_AMULET, -1);
        st.takeItems(ENCHANTED_EYE_MEAT, -1);
        st.takeItems(TAMRIN_ORC_RING, -1);
        st.takeItems(TAMRIN_ORC_ARROW, -1);

        st.giveItems(FINAL_ORDER, 1);
      }
    }

    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(qn);
    String htmltext = getNoQuestMsg();
    if (st == null) return htmltext;

    switch (st.getState()) {
      case STATE_CREATED:
        if (player.getRace() == Race.Elf) {
          if (player.getLevel() >= 3) htmltext = "30370-03.htm";
          else {
            htmltext = "30370-02.htm";
            st.exitQuest(true);
          }
        } else {
          htmltext = "30370-00.htm";
          st.exitQuest(true);
        }
        break;

      case STATE_STARTED:
        int cond = st.getInt("cond");
        switch (npc.getNpcId()) {
          case NERUPA:
            if (cond >= 1 && cond <= 3) htmltext = "30370-05.htm";
            else if (cond == 4) {
              if (st.getQuestItemsCount(NIGHTSHADE_LEAF) == 1) {
                htmltext = "30370-06.htm";
                st.playSound(QuestState.SOUND_FINISH);
                st.takeItems(NIGHTSHADE_LEAF, 1);
                st.rewardItems(LESSER_HEALING_POTION, 5);
                st.rewardExpAndSp(1000, 0);
                st.exitQuest(false);
              }
            }
            break;

          case UNOREN:
            if (cond == 1) {
              st.set("cond", "2");
              htmltext = "30147-01.htm";
              st.playSound(QuestState.SOUND_MIDDLE);
              st.takeItems(SILVERY_SPIDERSILK, 1);
              st.giveItems(UNOS_RECEIPT, 1);
            } else if (cond == 2) htmltext = "30147-02.htm";
            else if (cond == 4) htmltext = "30147-03.htm";
            break;

          case CREAMEES:
            if (cond == 2) {
              st.set("cond", "3");
              htmltext = "30149-01.htm";
              st.takeItems(UNOS_RECEIPT, 1);
              st.giveItems(CELS_TICKET, 1);
              st.playSound(QuestState.SOUND_MIDDLE);
            } else if (cond == 3) htmltext = "30149-02.htm";
            else if (cond == 4) htmltext = "30149-03.htm";
            break;

          case JULIA:
            if (cond == 3) {
              st.set("cond", "4");
              htmltext = "30152-01.htm";
              st.takeItems(CELS_TICKET, -1);
              st.giveItems(NIGHTSHADE_LEAF, 1);
              st.playSound(QuestState.SOUND_MIDDLE);
            } else if (cond == 4) htmltext = "30152-02.htm";
            break;
        }
        break;

      case STATE_COMPLETED:
        htmltext = getAlreadyCompletedMsg();
        break;
    }

    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(qn);
    String htmltext = getNoQuestMsg();
    if (st == null) return htmltext;

    switch (st.getState()) {
      case STATE_CREATED:
        if (player.getRace() != Race.DarkElf) htmltext = "30130-00.htm";
        else if (player.getLevel() < 2) htmltext = "30130-02.htm";
        else htmltext = "30130-03.htm";
        break;

      case STATE_STARTED:
        int cond = st.getInt("cond");
        switch (npc.getNpcId()) {
          case UNDRIAS:
            if (cond == 1) htmltext = "30130-05.htm";
            else if (cond == 2) {
              htmltext = "30130-06.htm";
              st.takeItems(CEREMONIAL_DAGGER, 1);
              st.takeItems(DREVIANT_WINE, 1);
              st.takeItems(GARMIEL_SCRIPTURE, 1);
              st.takeItems(UNDRIAS_LETTER, 1);
              st.rewardItems(57, 500);
              st.rewardExpAndSp(500, 0);
              st.playSound(QuestState.SOUND_FINISH);
              st.exitQuest(false);
            }
            break;

          case IRIA:
            if (cond == 1 && !st.hasQuestItems(CEREMONIAL_DAGGER)) {
              htmltext = "30135-01.htm";
              st.giveItems(CEREMONIAL_DAGGER, 1);

              if (st.hasQuestItems(DREVIANT_WINE, GARMIEL_SCRIPTURE)) {
                st.set("cond", "2");
                st.playSound(QuestState.SOUND_MIDDLE);
              } else st.playSound(QuestState.SOUND_ITEMGET);
            } else if (cond == 2) htmltext = "30135-02.htm";
            break;

          case DORANKUS:
            if (cond == 1 && !st.hasQuestItems(DREVIANT_WINE)) {
              htmltext = "30139-01.htm";
              st.giveItems(DREVIANT_WINE, 1);

              if (st.hasQuestItems(CEREMONIAL_DAGGER, GARMIEL_SCRIPTURE)) {
                st.set("cond", "2");
                st.playSound(QuestState.SOUND_MIDDLE);
              } else st.playSound(QuestState.SOUND_ITEMGET);
            } else if (cond == 2) htmltext = "30139-02.htm";
            break;

          case TRUDY:
            if (cond == 1 && !st.hasQuestItems(GARMIEL_SCRIPTURE)) {
              htmltext = "30143-01.htm";
              st.giveItems(GARMIEL_SCRIPTURE, 1);

              if (st.hasQuestItems(CEREMONIAL_DAGGER, DREVIANT_WINE)) {
                st.set("cond", "2");
                st.playSound(QuestState.SOUND_MIDDLE);
              } else st.playSound(QuestState.SOUND_ITEMGET);
            } else if (cond == 2) htmltext = "30143-02.htm";
            break;
        }
        break;

      case STATE_COMPLETED:
        htmltext = getAlreadyCompletedMsg();
        break;
    }

    return htmltext;
  }