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

    switch (event) {
      case "31570-03.htm":
        st.set("cond", "1");
        st.setState(State.STARTED);
        st.playSound("ItemSound.quest_accept");
        break;
      case "31570-05.htm":
        if ((st.getInt("cond") == 1) && (st.hasQuestItems(BLUE_TREASURE_BOX))) {
          htmltext = "31570-06.htm";
          st.set("cond", "2");
          st.giveItems(STRANGE_BLUESPRINT, 1);
          st.takeItems(BLUE_TREASURE_BOX, -1);
          st.playSound("ItemSound.quest_middle");
        }
        break;
      case "31434-02.htm":
        if ((st.getInt("cond") == 2) && (st.hasQuestItems(STRANGE_BLUESPRINT))) {
          htmltext = "31434-01.htm";
          st.giveItems(BLACK_PEARL_RING, 1);
          st.takeItems(STRANGE_BLUESPRINT, -1);
          st.playSound("ItemSound.quest_finish");
          st.exitQuest(false);
        }
        break;
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, true);
    if (st == null) {
      return getNoQuestMsg(player);
    }

    String htmltext = getNoQuestMsg(player);
    switch (st.getState()) {
      case State.CREATED:
        {
          if (player.getLevel() < MIN_LEVEL) {
            htmltext = "31540-02.html";
          } else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) {
            htmltext = "31540-04.html";
          } else {
            htmltext = "31540-01.htm";
          }
          break;
        }
      case State.STARTED:
        {
          switch (st.getCond()) {
            case 1:
              {
                htmltext = "31540-08.html";
                break;
              }
            case 2:
              {
                st.giveItems(MEDAL_OF_GLORY, 30);
                st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
                st.exitQuest(QuestType.DAILY, true);
                htmltext = "31540-09.html";
                break;
              }
          }
          break;
        }
      case State.COMPLETED:
        {
          if (!st.isNowAvailable()) {
            htmltext = "31540-03.html";
          } else {
            st.setState(State.CREATED);
            if (player.getLevel() < MIN_LEVEL) {
              htmltext = "31540-02.html";
            } else if (!st.hasQuestItems(VACUALITE_FLOATING_STONE)) {
              htmltext = "31540-04.html";
            } else {
              htmltext = "31540-01.htm";
            }
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(qn);

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

    final int cond = st.getInt("cond");
    if (event.equalsIgnoreCase("31001-05.htm")) {
      if (cond == 0) {
        st.set("cond", "1");
        st.setState(State.STARTED);
        st.playSound("ItemSound.quest_accept");
      }
    } else if (event.equalsIgnoreCase("32576-02.htm")) {
      if (cond == 1) {
        st.giveItems(IDENTITY_CARD, 1);
        st.set("cond", "2");
        st.playSound("ItemSound.quest_middle");
      }
    } else if (event.equalsIgnoreCase("30289-04.htm")) {
      if (cond == 2) {
        st.set("cond", "3");
        player.stopAllEffects();
        SkillTable.getInstance().getInfo(GUARD_DAWN, 1).getEffects(player, player);
      }
    } else if (event.equalsIgnoreCase("30289-07.htm")) {
      if (cond == 3) {
        SkillTable.getInstance().getInfo(GUARD_DAWN, 1).getEffects(player, player);
      }
    } else if (event.equalsIgnoreCase("30289-08.htm")) {
      if (cond == 3) {
        player.stopAllEffects();
      }
    } else if (event.equalsIgnoreCase("30289-11.htm")) {
      if (cond == 3) {
        st.set("cond", "4");
        st.playSound("ItemSound.quest_middle");
        player.stopAllEffects();
      }
    } else if (event.equalsIgnoreCase("30969-03.htm")) {
      if (cond == 4) {
        st.addExpAndSp(52518015, 5817677);
        // st.addExpAndSp(25000000, 2500000); // High Five
        st.unset("cond");
        st.exitQuest(false);
        st.playSound("ItemSound.quest_finish");
      }
    }
    return event;
  }
  @Override
  public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(qn);
    if (st == null) {
      return null;
    }

    if ("32010-03.htm".equalsIgnoreCase(event)) {
      st.set("cond", "1");
      st.setState(State.STARTED);
      st.playSound("ItemSound.quest_accept");
    } else if ("32010-10.htm".equalsIgnoreCase(event)) {
      st.exitQuest(true);
    }

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

    if (st == null) {
      return null;
    }
    String htmltext = null;
    switch (event) {
      case "30512-02.htm":
      case "30673-02.html":
      case "30673-03.html":
        {
          htmltext = event;
          break;
        }
      case "30512-03.htm":
        {
          st.startQuest();
          htmltext = event;
          break;
        }
      case "30673-04.html":
        {
          st.setCond(2, true);
          htmltext = event;
          break;
        }
      case "30621-02.html":
        {
          if (player.getLevel() < 43) {
            st.addExpAndSp(60000, 3000);
          }
          st.giveAdena(18100, true);
          st.exitQuest(false, true);
          htmltext = event;
          break;
        }
      case "Contract":
        {
          final Quest quest =
              QuestManager.getInstance().getQuest("184_Nikolas_Cooperation_Contract");
          st = player.getQuestState("184_Nikolas_Cooperation_Contract");
          if ((quest != null) && (st == null)) {
            st = quest.newQuestState(player);
            st.setState(State.STARTED);
            quest.notifyEvent("30621-01.htm", npc, player);
          }
          break;
        }
      case "Consideration":
        {
          final Quest quest =
              QuestManager.getInstance().getQuest("185_Nikolas_Cooperation_Consideration");
          st = player.getQuestState("185_Nikolas_Cooperation_Consideration");
          if ((quest != null) && (st == null)) {
            st = quest.newQuestState(player);
            st.setState(State.STARTED);
            quest.notifyEvent("30621-01.htm", npc, player);
          }
          break;
        }
    }
    return htmltext;
  }
Ejemplo n.º 6
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = "";
    QuestState st = getQuestState(player, true);

    int npcId = npc.getId();
    if (Util.contains(TOWN_DAWN, npcId)) {
      st.setState(State.STARTED);
      int i = 0;
      for (int dawn : TELEPORTERS) {
        if (dawn == npcId) {
          break;
        }
        i++;
      }
      st.set("id", Integer.toString(i));
      playSound(player, QuestSound.ITEMSOUND_QUEST_ACCEPT);
      player.teleToLocation(new Location(-80157, 111344, -4901));
      player.setIsIn7sDungeon(true);
    }
    if (Util.contains(TOWN_DUSK, npcId)) {
      st.setState(State.STARTED);
      int i = 0;
      for (int dusk : TELEPORTERS) {
        if (dusk == npcId) {
          break;
        }
        i++;
      }
      st.set("id", Integer.toString(i));
      playSound(player, QuestSound.ITEMSOUND_QUEST_ACCEPT);
      player.teleToLocation(new Location(-81261, 86531, -5157));
      player.setIsIn7sDungeon(true);
    } else if ((npcId >= 31494) && (npcId <= 31507)) {
      if (player.getLevel() < 20) {
        htmltext = "1.htm";
        st.exitQuest(true);
      } else if (player.getAllActiveQuests().length > 23) {
        htmltext = "1a.htm";
        st.exitQuest(true);
      } else if (!hasQuestItems(player, DIMENSIONAL_FRAGMENT)) {
        htmltext = "3.htm";
      } else {
        st.setState(State.CREATED);
        htmltext = "4.htm";
      }
    } else if (((npcId >= 31095) && (npcId <= 31111)) || ((npcId >= 31114) && (npcId <= 31126))) {
      int playerLevel = player.getLevel();
      if (playerLevel < 20) {
        htmltext = "ziggurat_lowlevel.htm";
        st.exitQuest(true);
      } else if (player.getAllActiveQuests().length > 40) {
        player.sendPacket(SystemMessageId.TOO_MANY_QUESTS);
        st.exitQuest(true);
      } else if (!hasQuestItems(player, DIMENSIONAL_FRAGMENT)) {
        htmltext = "ziggurat_nofrag.htm";
        st.exitQuest(true);
      } else if ((playerLevel >= 20) && (playerLevel < 30) && (player.getAdena() < 2000)) {
        htmltext = "ziggurat_noadena.htm";
        st.exitQuest(true);
      } else if ((playerLevel >= 30) && (playerLevel < 40) && (player.getAdena() < 4500)) {
        htmltext = "ziggurat_noadena.htm";
        st.exitQuest(true);
      } else if ((playerLevel >= 40) && (playerLevel < 50) && (player.getAdena() < 8000)) {
        htmltext = "ziggurat_noadena.htm";
        st.exitQuest(true);
      } else if ((playerLevel >= 50) && (playerLevel < 60) && (player.getAdena() < 12500)) {
        htmltext = "ziggurat_noadena.htm";
        st.exitQuest(true);
      } else if ((playerLevel >= 60) && (playerLevel < 70) && (player.getAdena() < 18000)) {
        htmltext = "ziggurat_noadena.htm";
        st.exitQuest(true);
      } else if ((playerLevel >= 70) && (player.getAdena() < 24500)) {
        htmltext = "ziggurat_noadena.htm";
        st.exitQuest(true);
      } else {
        htmltext = "ziggurat.htm";
      }
    }
    return htmltext;
  }
Ejemplo n.º 7
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = "";
    QuestState st = getQuestState(player, false);

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

    final int npcId = npc.getId();
    if (event.equalsIgnoreCase("Return")) {
      if (Util.contains(TEMPLE_PRIEST, npcId) && (st.getState() == State.STARTED)) {
        player.teleToLocation(RETURN_LOCS[st.getInt("id")]);
        player.setIsIn7sDungeon(false);
        st.exitQuest(true);
      } else if (Util.contains(RIFT_POSTERS, npcId) && (st.getState() == State.STARTED)) {
        player.teleToLocation(RETURN_LOCS[st.getInt("id")]);
        htmltext = "rift_back.htm";
        st.exitQuest(true);
      }
    } else if (event.equalsIgnoreCase("Festival")) {
      int id = st.getInt("id");
      if (Util.contains(TOWN_DAWN, id)) {
        player.teleToLocation(new Location(-80157, 111344, -4901));
        player.setIsIn7sDungeon(true);
      } else if (Util.contains(TOWN_DUSK, id)) {
        player.teleToLocation(new Location(-81261, 86531, -5157));
        player.setIsIn7sDungeon(true);
      } else {
        htmltext = "oracle1.htm";
      }
    } else if (event.equalsIgnoreCase("Dimensional")) {
      htmltext = "oracle.htm";
      player.teleToLocation(new Location(-114755, -179466, -6752));
    } else if (event.equalsIgnoreCase("5.htm")) {
      int id = st.getInt("id");
      if (id > -1) {
        htmltext = "5a.htm";
      }
      int i = 0;
      for (int id1 : TELEPORTERS) {
        if (id1 == npcId) {
          break;
        }
        i++;
      }
      st.set("id", Integer.toString(i));
      st.setState(State.STARTED);
      player.teleToLocation(new Location(-114755, -179466, -6752));
    } else if (event.equalsIgnoreCase("6.htm")) {
      htmltext = "6.htm";
      st.exitQuest(true);
    } else if (event.equalsIgnoreCase("zigurratDimensional")) {
      int playerLevel = player.getLevel();
      if ((playerLevel >= 20) && (playerLevel < 30)) {
        takeItems(player, Inventory.ADENA_ID, 2000);
      } else if ((playerLevel >= 30) && (playerLevel < 40)) {
        takeItems(player, Inventory.ADENA_ID, 4500);
      } else if ((playerLevel >= 40) && (playerLevel < 50)) {
        takeItems(player, Inventory.ADENA_ID, 8000);
      } else if ((playerLevel >= 50) && (playerLevel < 60)) {
        takeItems(player, Inventory.ADENA_ID, 12500);
      } else if ((playerLevel >= 60) && (playerLevel < 70)) {
        takeItems(player, Inventory.ADENA_ID, 18000);
      } else if (playerLevel >= 70) {
        takeItems(player, Inventory.ADENA_ID, 24500);
      }
      int i = 0;
      for (int ziggurat : TELEPORTERS) {
        if (ziggurat == npcId) {
          break;
        }
        i++;
      }
      st.set("id", Integer.toString(i));
      st.setState(State.STARTED);
      playSound(player, QuestSound.ITEMSOUND_QUEST_ACCEPT);
      htmltext = "ziggurat_rift.htm";
      player.teleToLocation(new Location(-114755, -179466, -6752));
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(getName());
    String htmltext = getNoQuestMsg(player);
    if (st == null) {
      return htmltext;
    }

    switch (st.getState()) {
      case State.COMPLETED:
        {
          if (!st.isNowAvailable()) {
            htmltext = "31340-02.htm";
            break;
          }
          st.setState(State.CREATED);
        }
      case State.CREATED:
        {
          htmltext = (player.getLevel() >= MIN_LVL) ? "31340-01.htm" : "31340-03.htm";
          break;
        }
      case State.STARTED:
        {
          switch (st.getCond()) {
            case 1:
              {
                htmltext = "31340-09.html";
                break;
              }
            case 2:
              {
                htmltext = "31340-11.html";
                break;
              }
            case 3:
              {
                htmltext = "31340-12.html";
                break;
              }
            case 4:
              {
                htmltext = "31340-13.html";
                break;
              }
            case 5:
              {
                if (st.hasQuestItems(SHATTERED_BONES)) {
                  st.giveItems(PROOF_OF_CHALLENGE, 1);
                  st.giveAdena(134038, true);
                } else if (st.hasQuestItems(CANNIBALISTIC_STAKATO_LDR_CLAW)) {
                  st.giveItems(PROOF_OF_CHALLENGE, 3);
                  st.giveAdena(210119, true);
                } else if (st.hasQuestItems(ANAIS_SCROLL)) {
                  st.giveItems(PROOF_OF_CHALLENGE, 3);
                  st.giveAdena(348155, true);
                }
                st.exitQuest(QuestType.DAILY, true);
                htmltext = "31340-14.html";
                break;
              }
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(qn);
    if (st == null) {
      return getNoQuestMsg(player);
    }

    final int cond = st.getInt("cond");
    if (event.equalsIgnoreCase("enter")) {
      enterInstance(player);
      return null;
    } else if (event.equalsIgnoreCase("32497-03.htm")) {
      if (cond == 0) {
        st.set("cond", "1");
        st.setState(State.STARTED);
        st.playSound("ItemSound.quest_accept");
      }
    } else if (event.equalsIgnoreCase("32500-06.htm")) {
      if (cond == 1) {
        st.set("cond", "2");
        st.playSound("ItemSound.quest_itemget");
        st.giveItems(SWORD, 1);
        st.giveItems(BOOK1, 1);
      }
    } else if (event.equalsIgnoreCase("32507-04.htm")) {
      if (cond == 3) {
        st.set("cond", "4");
        st.playSound("ItemSound.quest_middle");
        st.takeItems(SWORD, -1);
        st.takeItems(WATER_ESSENCE, -1);
        st.takeItems(BOOK2, -1);
        st.giveItems(BOOK3, 1);
        st.giveItems(ENH_SWORD1, 1);
      }
    } else if (event.equalsIgnoreCase("32507-08.htm")) {
      if (cond == 6) {
        st.set("cond", "7");
        st.playSound("ItemSound.quest_itemget");
        st.takeItems(ENH_SWORD1, -1);
        st.takeItems(BOOK5, -1);
        st.takeItems(FIRE_ESSENCE, -1);
        st.giveItems(ENH_SWORD2, 1);
        st.giveItems(BOOK6, 1);
      }
    } else if (event.equalsIgnoreCase("32510-02.htm")) {
      st.unset("cond");
      st.playSound("ItemSound.quest_finish");
      st.exitQuest(false);

      Instance inst = InstanceManager.getInstance().getInstance(npc.getInstanceId());
      inst.setDuration(EXIT_TIME * 60000);
      inst.setEmptyDestroyTime(0);

      if (inst.containsPlayer(player.getObjectId())) {
        player.setVitalityPoints(20000, true);
        st.addExpAndSp(810000, 50000);
        for (int id : REWARDS) {
          st.giveItems(id, 1);
        }
      }
    }
    return event;
  }