コード例 #1
0
  /**
   * That method drops current alliance and retrograde badge.<br>
   * If any Varka quest is in progress, it stops the quest (and drop all related qItems) :
   *
   * @param player The player to check.
   */
  private static void testKetraDemote(L2PcInstance player) {
    if (player.isAlliedWithKetra()) {
      // Drop the alliance (old friends become aggro).
      player.setAllianceWithVarkaKetra(0);

      final PcInventory inventory = player.getInventory();

      // Drop by 1 the level of that alliance (symbolized by a quest item).
      for (int i = 7215; i >= 7211; i--) {
        L2ItemInstance item = inventory.getItemByItemId(i);
        if (item != null) {
          // Destroy the badge.
          player.destroyItemByItemId("Quest", i, item.getCount(), player, true);

          // Badge lvl 1 ; no addition of badge of lower level.
          if (i != 7211) player.addItem("Quest", i - 1, 1, player, true);

          break;
        }
      }

      for (String mission : ketraMissions) {
        QuestState pst = player.getQuestState(mission);
        if (pst != null) pst.exitQuest(true);
      }
    }
  }
コード例 #2
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg();
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    switch (st.getState()) {
      case STATE_CREATED:
        if (player.getLevel() < 40) htmltext = npc.getNpcId() + "-lvl.htm";
        else htmltext = npc.getNpcId() + "-01.htm";
        break;

      case STATE_STARTED:
        // Check inventory for soul crystals.
        for (ItemInstance item : player.getInventory().getItems()) {
          // Crystal found, show "how to" html.
          if (SoulCrystalsTable.getSoulCrystalInfos().get(item.getItemId()) != null)
            return npc.getNpcId() + "-03.htm";
        }
        // No crystal found, offer a new crystal.
        htmltext = npc.getNpcId() + "-21.htm";
        break;
    }

    return htmltext;
  }
コード例 #3
0
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    QuestState st = checkPlayerCondition(player, npc, "cond", "2");
    if (st == null) return null;

    if (st.dropItemsAlways(MAP_PIECE, 1, 30)) st.set("cond", "3");

    return null;
  }
コード例 #4
0
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    QuestState st = checkPlayerCondition(player, npc, "cond", "1");
    if (st == null) return null;

    st.dropItems(ARTICLE_DEAD_HERO, 1, 0, CHANCES.get(npc.getNpcId()));

    return null;
  }
コード例 #5
0
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    QuestState st = checkPlayerCondition(player, npc, "cond", "1");
    if (st == null) return null;

    if (st.dropItems(POISON_SAC, 1, 1, 200000)) st.set("cond", "2");

    return null;
  }
コード例 #6
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("30686-2.htm")) {
      st.setState(STATE_STARTED);
      st.set("cond", "1");
      st.playSound(QuestState.SOUND_ACCEPT);
    } else if (event.equalsIgnoreCase("30686-7.htm")) {
      final int count = st.getQuestItemsCount(JADE_CRYSTAL);
      if (count == 0) htmltext = "30686-4.htm";
      else {
        int reward = (count * 425) + 3500;
        if (count >= 100) reward += 7400;

        st.takeItems(JADE_CRYSTAL, -1);
        st.rewardItems(57, reward);
      }
    } else if (event.equalsIgnoreCase("30686-8.htm")) {
      st.playSound(QuestState.SOUND_FINISH);
      st.exitQuest(true);
    }

    return htmltext;
  }
コード例 #7
0
ファイル: Q645_GhostsOfBatur.java プロジェクト: Barrog/aCis
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    L2PcInstance partyMember = getRandomPartyMember(player, npc, "1");
    if (partyMember == null) return null;

    QuestState st = partyMember.getQuestState(qn);

    if (st.dropItems(CURSED_GRAVE_GOODS, 1, 180, 750000)) st.set("cond", "2");

    return null;
  }
コード例 #8
0
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    QuestState st = checkPlayerState(player, npc, STATE_STARTED);
    if (st == null) return null;

    if (Rnd.get(100) < 50) {
      st.giveItems(WIND_SHARD, 1);
      st.playSound(QuestState.SOUND_ITEMGET);
    }

    return null;
  }
コード例 #9
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("30050-03.htm")) {
      st.setState(STATE_STARTED);
      st.set("cond", "1");
      st.playSound(QuestState.SOUND_ACCEPT);
    }

    return htmltext;
  }
コード例 #10
0
  /**
   * Remove the old crystal and add new one if stage, broken crystal if break. Send messages in both
   * cases.
   *
   * @param player : The player to check on (inventory and send messages).
   * @param scd : SoulCrystalData of to take information form.
   * @param stage : Switch to determine success or fail.
   */
  private void exchangeCrystal(L2PcInstance player, SoulCrystalData scd, boolean stage) {
    QuestState st = player.getQuestState(qn);

    st.takeItems(scd.getCrystalItemId(), 1);
    if (stage) {
      player.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_SUCCEEDED);
      st.giveItems(scd.getStagedItemId(), 1);
      st.playSound(QuestState.SOUND_ITEMGET);
    } else {
      int broken = scd.getBrokenItemId();
      if (broken != 0) {
        player.sendPacket(SystemMessageId.SOUL_CRYSTAL_BROKE);
        st.giveItems(broken, 1);
      }
    }
  }
コード例 #11
0
  @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:
        htmltext = (player.getLevel() < 47) ? "30686-0a.htm" : "30686-0.htm";
        break;

      case STATE_STARTED:
        htmltext = (!st.hasQuestItems(JADE_CRYSTAL)) ? "30686-4.htm" : "30686-6.htm";
        break;
    }

    return htmltext;
  }
コード例 #12
0
ファイル: Q645_GhostsOfBatur.java プロジェクト: Barrog/aCis
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg();
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    switch (st.getState()) {
      case STATE_CREATED:
        htmltext = (player.getLevel() < 23) ? "32017-02.htm" : "32017-01.htm";
        break;

      case STATE_STARTED:
        final int cond = st.getInt("cond");
        if (cond == 1) htmltext = "32017-04.htm";
        else if (cond == 2) htmltext = "32017-05.htm";
        break;
    }

    return htmltext;
  }
コード例 #13
0
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    // Drop tooth or light to anyone.
    L2PcInstance partyMember = getRandomPartyMemberState(player, npc, STATE_STARTED);
    if (partyMember == null) return null;

    QuestState st = partyMember.getQuestState(qn);

    st.dropItems(
        (npc.getNpcId() == CAVE_BEAST) ? CAVE_BEAST_TOOTH : DEATH_WAVE_LIGHT, 1, 65, 500000);

    // Drop sealed mysterious stone to party member who still need it.
    partyMember = getRandomPartyMember(player, npc, "condStone", "1");
    if (partyMember == null) return null;

    st = partyMember.getQuestState(qn);

    if (st.dropItems(SEALED_MYSTERIOUS_STONE, 1, 1, 1000)) st.unset("condStone");

    return null;
  }
コード例 #14
0
  @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.getLevel() >= 18) htmltext = "30361-03.htm";
        else {
          htmltext = "30361-02.htm";
          st.exitQuest(true);
        }
        break;

      case STATE_STARTED:
        int shards = st.getQuestItemsCount(WIND_SHARD);
        if (shards == 0) htmltext = "30361-05.htm";
        else {
          int reward = 40 * shards + (shards >= 10 ? 2988 : 0);
          htmltext = "30361-07.htm";
          st.takeItems(WIND_SHARD, -1);
          st.rewardItems(57, reward);
        }
        break;
    }
    return htmltext;
  }
コード例 #15
0
  @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:
        htmltext = (player.getLevel() < 48) ? "30754-01.htm" : "30754-02.htm";
        break;

      case STATE_STARTED:
        int cond = st.getInt("cond");
        switch (npc.getNpcId()) {
          case GILMORE:
            if (cond == 1)
              htmltext = (st.hasQuestItems(ARTICLE_DEAD_HERO)) ? "30754-05.htm" : "30754-09.htm";
            else if (cond == 2)
              htmltext = (st.get("success") != null) ? "30754-16.htm" : "30754-15.htm";
            break;

          default:
            if (cond == 2) {
              if (st.get("success") != null) htmltext = npc.getNpcId() + "-02.htm";
              else {
                rewards(st, npc.getNpcId());
                htmltext = npc.getNpcId() + "-01.htm";
              }
            }
            break;
        }
        break;
    }
    return htmltext;
  }
コード例 #16
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg();
    QuestState st = player.getQuestState(getName());
    if (st == null) return htmltext;

    if (Util.isDigit(event)) {
      final int eventId = Integer.parseInt(event);
      if (eventId >= 0 && eventId <= 7) {
        if (st.getQuestItemsCount(HORN) >= BUFF[eventId - 1][2]) {
          st.takeItems(HORN, BUFF[eventId - 1][2]);
          npc.setTarget(player);
          npc.doCast(SkillTable.getInstance().getInfo(BUFF[eventId - 1][0], BUFF[eventId - 1][1]));
          npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
          htmltext = "31372-4.htm";
        }
      }
    } else if (event.equals("Withdraw")) {
      if (player.getWarehouse().getSize() == 0) htmltext = "31374-0.htm";
      else {
        player.sendPacket(ActionFailed.STATIC_PACKET);
        player.setActiveWarehouse(player.getWarehouse());
        player.sendPacket(new WareHouseWithdrawalList(player, 1));
      }
    } else if (event.equals("Teleport")) {
      switch (player.getAllianceWithVarkaKetra()) {
        case 4:
          htmltext = "31376-4.htm";
          break;
        case 5:
          htmltext = "31376-5.htm";
          break;
      }
    }

    return htmltext;
  }
コード例 #17
0
  @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:
        htmltext = (player.getLevel() < 25) ? "30828-00a.htm" : "30828-00.htm";
        break;

      case STATE_STARTED:
        int cond = st.getInt("cond");
        switch (npc.getNpcId()) {
          case WATERS:
            if (cond == 1)
              htmltext = (!st.hasQuestItems(TRIDENT)) ? "30828-01a.htm" : "30828-02.htm";
            else if (cond == 2) htmltext = "30828-03a.htm";
            else if (cond == 3) htmltext = "30828-04.htm";
            else if (cond == 4) htmltext = "30828-05a.htm";
            else if (cond == 5) htmltext = "30828-06.htm";
            break;

          case SOPHYA:
            if (cond == 4) htmltext = "30735-05.htm";
            else if (cond == 5) htmltext = "30735-06a.htm";
            break;
        }
        break;

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

    return htmltext;
  }
コード例 #18
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg();
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    switch (st.getState()) {
      case STATE_CREATED:
        htmltext = (player.getLevel() < 66) ? "31314-02.htm" : "31314-01.htm";
        break;

      case STATE_STARTED:
        int cond = st.getInt("cond");
        switch (npc.getNpcId()) {
          case DONAL:
            htmltext = "31314-04.htm";
            break;

          case DAISY:
            if (cond == 1) htmltext = "31315-01.htm";
            else if (cond == 2) htmltext = "31315-03.htm";
            break;

          case ABERCROMBIE:
            if (cond == 2) htmltext = "31555-01.htm";
            break;
        }
        break;

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

    return htmltext;
  }
コード例 #19
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg();
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    switch (st.getState()) {
      case STATE_CREATED:
        htmltext = (player.getLevel() < 56) ? "30515-01.htm" : "30515-02.htm";
        break;

      case STATE_STARTED:
        final int cond = st.getInt("cond");
        switch (npc.getNpcId()) {
          case MANAKIA:
            if (!(st.hasQuestItems(SEALED_MYSTERIOUS_STONE))) {
              if (st.getQuestItemsCount(CAVE_BEAST_TOOTH) >= 65
                  && st.getQuestItemsCount(DEATH_WAVE_LIGHT) >= 65) htmltext = "30515-05.htm";
              else htmltext = "30515-04.htm";
            } else {
              if (cond == 1) {
                htmltext = "30515-09.htm";
                st.set("cond", "2");
                st.playSound(QuestState.SOUND_MIDDLE);
              } else htmltext = "30515-10.htm";
            }
            break;

          case TORAI:
            if (cond == 2 && st.hasQuestItems(SEALED_MYSTERIOUS_STONE)) htmltext = "30557-01.htm";
            break;
        }
        break;
    }

    return htmltext;
  }
コード例 #20
0
ファイル: Q645_GhostsOfBatur.java プロジェクト: Barrog/aCis
  @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("32017-03.htm")) {
      st.setState(STATE_STARTED);
      st.set("cond", "1");
      st.playSound(QuestState.SOUND_ACCEPT);
    } else if (Util.isDigit(event)) {
      htmltext = "32017-07.htm";
      st.takeItems(CURSED_GRAVE_GOODS, -1);

      final int reward[] = REWARDS[Integer.parseInt(event)];
      st.giveItems(reward[0], reward[1]);

      st.playSound(QuestState.SOUND_FINISH);
      st.exitQuest(true);
    }

    return htmltext;
  }
コード例 #21
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = event;
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    // Start the quest.
    if (event.endsWith("-04.htm")) {
      st.setState(Quest.STATE_STARTED);
      st.set("cond", "1");
      st.playSound(QuestState.SOUND_ACCEPT);
    }
    // Give Red Soul Crystal.
    else if (event.endsWith("-09.htm")) {
      st.playSound(QuestState.SOUND_MIDDLE);
      st.giveItems(4629, 1);
    }
    // Give Green Soul Crystal.
    else if (event.endsWith("-10.htm")) {
      st.playSound(QuestState.SOUND_MIDDLE);
      st.giveItems(4640, 1);
    }
    // Give Blue Soul Crystal.
    else if (event.endsWith("-11.htm")) {
      st.playSound(QuestState.SOUND_MIDDLE);
      st.giveItems(4651, 1);
    }
    // Terminate the quest.
    else if (event.endsWith("-exit.htm")) st.exitQuest(true);

    return htmltext;
  }
コード例 #22
0
ファイル: Q222_TestOfTheDuelist.java プロジェクト: D3XV/D3X
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    QuestState st = checkPlayerState(player, npc, STATE_STARTED);
    if (st == null) return null;

    if (st.getInt("cond") == 2) {
      switch (npc.getNpcId()) {
        case PUNCHER:
          if (st.dropItemsAlways(PUNCHER_SHARD, 1, 10))
            if (st.getQuestItemsCount(NOBLE_ANT_FEELER) >= 10
                && st.getQuestItemsCount(DRONE_CHITIN) >= 10
                && st.getQuestItemsCount(DEAD_SEEKER_FANG) >= 10
                && st.getQuestItemsCount(OVERLORD_NECKLACE) >= 10
                && st.getQuestItemsCount(FETTERED_SOUL_CHAIN) >= 10
                && st.getQuestItemsCount(CHIEF_AMULET) >= 10
                && st.getQuestItemsCount(ENCHANTED_EYE_MEAT) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_RING) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_ARROW) >= 10) st.set("cond", "3");
          break;

        case NOBLE_ANT_LEADER:
          if (st.dropItemsAlways(NOBLE_ANT_FEELER, 1, 10))
            if (st.getQuestItemsCount(PUNCHER_SHARD) >= 10
                && st.getQuestItemsCount(DRONE_CHITIN) >= 10
                && st.getQuestItemsCount(DEAD_SEEKER_FANG) >= 10
                && st.getQuestItemsCount(OVERLORD_NECKLACE) >= 10
                && st.getQuestItemsCount(FETTERED_SOUL_CHAIN) >= 10
                && st.getQuestItemsCount(CHIEF_AMULET) >= 10
                && st.getQuestItemsCount(ENCHANTED_EYE_MEAT) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_RING) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_ARROW) >= 10) st.set("cond", "3");
          break;

        case MARSH_STAKATO_DRONE:
          if (st.dropItemsAlways(DRONE_CHITIN, 1, 10))
            if (st.getQuestItemsCount(PUNCHER_SHARD) >= 10
                && st.getQuestItemsCount(NOBLE_ANT_FEELER) >= 10
                && st.getQuestItemsCount(DEAD_SEEKER_FANG) >= 10
                && st.getQuestItemsCount(OVERLORD_NECKLACE) >= 10
                && st.getQuestItemsCount(FETTERED_SOUL_CHAIN) >= 10
                && st.getQuestItemsCount(CHIEF_AMULET) >= 10
                && st.getQuestItemsCount(ENCHANTED_EYE_MEAT) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_RING) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_ARROW) >= 10) st.set("cond", "3");
          break;

        case DEAD_SEEKER:
          if (st.dropItemsAlways(DEAD_SEEKER_FANG, 1, 10))
            if (st.getQuestItemsCount(PUNCHER_SHARD) >= 10
                && st.getQuestItemsCount(NOBLE_ANT_FEELER) >= 10
                && st.getQuestItemsCount(DRONE_CHITIN) >= 10
                && st.getQuestItemsCount(OVERLORD_NECKLACE) >= 10
                && st.getQuestItemsCount(FETTERED_SOUL_CHAIN) >= 10
                && st.getQuestItemsCount(CHIEF_AMULET) >= 10
                && st.getQuestItemsCount(ENCHANTED_EYE_MEAT) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_RING) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_ARROW) >= 10) st.set("cond", "3");
          break;

        case BREKA_ORC_OVERLORD:
          if (st.dropItemsAlways(OVERLORD_NECKLACE, 1, 10))
            if (st.getQuestItemsCount(PUNCHER_SHARD) >= 10
                && st.getQuestItemsCount(NOBLE_ANT_FEELER) >= 10
                && st.getQuestItemsCount(DRONE_CHITIN) >= 10
                && st.getQuestItemsCount(DEAD_SEEKER_FANG) >= 10
                && st.getQuestItemsCount(FETTERED_SOUL_CHAIN) >= 10
                && st.getQuestItemsCount(CHIEF_AMULET) >= 10
                && st.getQuestItemsCount(ENCHANTED_EYE_MEAT) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_RING) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_ARROW) >= 10) st.set("cond", "3");
          break;

        case FETTERED_SOUL:
          if (st.dropItemsAlways(FETTERED_SOUL_CHAIN, 1, 10))
            if (st.getQuestItemsCount(PUNCHER_SHARD) >= 10
                && st.getQuestItemsCount(NOBLE_ANT_FEELER) >= 10
                && st.getQuestItemsCount(DRONE_CHITIN) >= 10
                && st.getQuestItemsCount(DEAD_SEEKER_FANG) >= 10
                && st.getQuestItemsCount(OVERLORD_NECKLACE) >= 10
                && st.getQuestItemsCount(CHIEF_AMULET) >= 10
                && st.getQuestItemsCount(ENCHANTED_EYE_MEAT) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_RING) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_ARROW) >= 10) st.set("cond", "3");
          break;

        case LETO_LIZARDMAN_OVERLORD:
          if (st.dropItemsAlways(CHIEF_AMULET, 1, 10))
            if (st.getQuestItemsCount(PUNCHER_SHARD) >= 10
                && st.getQuestItemsCount(NOBLE_ANT_FEELER) >= 10
                && st.getQuestItemsCount(DRONE_CHITIN) >= 10
                && st.getQuestItemsCount(DEAD_SEEKER_FANG) >= 10
                && st.getQuestItemsCount(OVERLORD_NECKLACE) >= 10
                && st.getQuestItemsCount(FETTERED_SOUL_CHAIN) >= 10
                && st.getQuestItemsCount(ENCHANTED_EYE_MEAT) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_RING) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_ARROW) >= 10) st.set("cond", "3");
          break;

        case ENCHANTED_MONSTEREYE:
          if (st.dropItemsAlways(ENCHANTED_EYE_MEAT, 1, 10))
            if (st.getQuestItemsCount(PUNCHER_SHARD) >= 10
                && st.getQuestItemsCount(NOBLE_ANT_FEELER) >= 10
                && st.getQuestItemsCount(DRONE_CHITIN) >= 10
                && st.getQuestItemsCount(DEAD_SEEKER_FANG) >= 10
                && st.getQuestItemsCount(OVERLORD_NECKLACE) >= 10
                && st.getQuestItemsCount(FETTERED_SOUL_CHAIN) >= 10
                && st.getQuestItemsCount(CHIEF_AMULET) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_RING) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_ARROW) >= 10) st.set("cond", "3");
          break;

        case TAMLIN_ORC:
          if (st.dropItemsAlways(TAMRIN_ORC_RING, 1, 10))
            if (st.getQuestItemsCount(PUNCHER_SHARD) >= 10
                && st.getQuestItemsCount(NOBLE_ANT_FEELER) >= 10
                && st.getQuestItemsCount(DRONE_CHITIN) >= 10
                && st.getQuestItemsCount(DEAD_SEEKER_FANG) >= 10
                && st.getQuestItemsCount(OVERLORD_NECKLACE) >= 10
                && st.getQuestItemsCount(FETTERED_SOUL_CHAIN) >= 10
                && st.getQuestItemsCount(CHIEF_AMULET) >= 10
                && st.getQuestItemsCount(ENCHANTED_EYE_MEAT) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_ARROW) >= 10) st.set("cond", "3");
          break;

        case TAMLIN_ORC_ARCHER:
          if (st.dropItemsAlways(TAMRIN_ORC_ARROW, 1, 10))
            if (st.getQuestItemsCount(PUNCHER_SHARD) >= 10
                && st.getQuestItemsCount(NOBLE_ANT_FEELER) >= 10
                && st.getQuestItemsCount(DRONE_CHITIN) >= 10
                && st.getQuestItemsCount(DEAD_SEEKER_FANG) >= 10
                && st.getQuestItemsCount(OVERLORD_NECKLACE) >= 10
                && st.getQuestItemsCount(FETTERED_SOUL_CHAIN) >= 10
                && st.getQuestItemsCount(CHIEF_AMULET) >= 10
                && st.getQuestItemsCount(ENCHANTED_EYE_MEAT) >= 10
                && st.getQuestItemsCount(TAMRIN_ORC_RING) >= 10) st.set("cond", "3");
          break;
      }
    } else if (st.getInt("cond") == 4) {
      switch (npc.getNpcId()) {
        case EXCURO:
          if (st.dropItemsAlways(EXCURO_SKIN, 1, 3))
            if (st.getQuestItemsCount(KRATOR_SHARD) >= 3
                && st.getQuestItemsCount(LAKIN_MACE) >= 3
                && st.getQuestItemsCount(GRANDIS_SKIN) >= 3
                && st.getQuestItemsCount(TIMAK_ORC_BELT) >= 3) st.set("cond", "5");
          break;

        case KRATOR:
          if (st.dropItemsAlways(KRATOR_SHARD, 1, 3))
            if (st.getQuestItemsCount(EXCURO_SKIN) >= 3
                && st.getQuestItemsCount(LAKIN_MACE) >= 3
                && st.getQuestItemsCount(GRANDIS_SKIN) >= 3
                && st.getQuestItemsCount(TIMAK_ORC_BELT) >= 3) st.set("cond", "5");
          break;

        case LAKIN:
          if (st.dropItemsAlways(LAKIN_MACE, 1, 3))
            if (st.getQuestItemsCount(EXCURO_SKIN) >= 3
                && st.getQuestItemsCount(KRATOR_SHARD) >= 3
                && st.getQuestItemsCount(GRANDIS_SKIN) >= 3
                && st.getQuestItemsCount(TIMAK_ORC_BELT) >= 3) st.set("cond", "5");
          break;

        case GRANDIS:
          if (st.dropItemsAlways(GRANDIS_SKIN, 1, 3))
            if (st.getQuestItemsCount(EXCURO_SKIN) >= 3
                && st.getQuestItemsCount(KRATOR_SHARD) >= 3
                && st.getQuestItemsCount(LAKIN_MACE) >= 3
                && st.getQuestItemsCount(TIMAK_ORC_BELT) >= 3) st.set("cond", "5");
          break;

        case TIMAK_ORC_OVERLORD:
          if (st.dropItemsAlways(TIMAK_ORC_BELT, 1, 3))
            if (st.getQuestItemsCount(EXCURO_SKIN) >= 3
                && st.getQuestItemsCount(KRATOR_SHARD) >= 3
                && st.getQuestItemsCount(LAKIN_MACE) >= 3
                && st.getQuestItemsCount(GRANDIS_SKIN) >= 3) st.set("cond", "5");
          break;
      }
    }

    return null;
  }
コード例 #23
0
ファイル: Q222_TestOfTheDuelist.java プロジェクト: D3XV/D3X
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg();
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    switch (st.getState()) {
      case STATE_CREATED:
        final int classId = player.getClassId().getId();
        if (classId != 0x01 && classId != 0x2f && classId != 0x13 && classId != 0x20)
          htmltext = "30623-02.htm";
        else if (player.getLevel() < 39) htmltext = "30623-01.htm";
        else htmltext = "30623-03.htm";
        break;

      case STATE_STARTED:
        int cond = st.getInt("cond");
        if (cond == 2) htmltext = "30623-07a.htm";
        else if (cond == 3) htmltext = "30623-13.htm";
        else if (cond == 4) htmltext = "30623-17.htm";
        else if (cond == 5) {
          htmltext = "30623-18.htm";
          st.takeItems(FINAL_ORDER, 1);
          st.takeItems(EXCURO_SKIN, -1);
          st.takeItems(KRATOR_SHARD, -1);
          st.takeItems(GRANDIS_SKIN, -1);
          st.takeItems(TIMAK_ORC_BELT, -1);
          st.takeItems(LAKIN_MACE, -1);
          st.giveItems(MARK_OF_DUELIST, 1);
          st.rewardExpAndSp(47015, 20000);
          player.broadcastPacket(new SocialAction(player, 3));
          st.playSound(QuestState.SOUND_FINISH);
          st.exitQuest(false);
        }
        break;

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

    return htmltext;
  }
コード例 #24
0
ファイル: Q222_TestOfTheDuelist.java プロジェクト: D3XV/D3X
  @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;
  }
コード例 #25
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg();
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    switch (st.getState()) {
      case STATE_CREATED:
        htmltext = (player.getLevel() < 15) ? "30050-01.htm" : "30050-02.htm";
        break;

      case STATE_STARTED:
        int cond = st.getInt("cond");
        switch (npc.getNpcId()) {
          case ELIAS:
            if (cond == 1) htmltext = "30050-04.htm";
            else if (cond == 2) htmltext = "30050-05.htm";
            else if (cond == 3) {
              htmltext = "30050-06.htm";
              st.takeItems(FEVER_MEDICINE, 1);
              st.giveItems(102, 1);
              st.playSound(QuestState.SOUND_FINISH);
              st.exitQuest(false);
            }
            break;

          case YOHANES:
            if (cond == 2) {
              htmltext = "30032-01.htm";
              st.set("cond", "3");
              st.playSound(QuestState.SOUND_MIDDLE);
              st.takeItems(POISON_SAC, 1);
              st.giveItems(FEVER_MEDICINE, 1);
            } else if (cond == 3) htmltext = "30032-02.htm";
            break;
        }
        break;

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

    return htmltext;
  }
コード例 #26
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("31314-03.htm")) {
      st.setState(STATE_STARTED);
      st.set("cond", "1");
      st.playSound(QuestState.SOUND_ACCEPT);
    } else if (event.equalsIgnoreCase("31315-02.htm")) {
      st.set("cond", "2");
      st.playSound(QuestState.SOUND_MIDDLE);
      st.giveItems(SUPPLY_BOX, 1);
    } else if (event.equalsIgnoreCase("31555-02.htm")) {
      st.takeItems(SUPPLY_BOX, 1);
      st.rewardItems(57, 15000);
      st.rewardExpAndSp(50000, 0);
      st.playSound(QuestState.SOUND_FINISH);
      st.exitQuest(false);
    }

    return htmltext;
  }
コード例 #27
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("30754-04.htm")) {
      st.setState(STATE_STARTED);
      st.set("cond", "1");
      st.playSound(QuestState.SOUND_ACCEPT);
    } else if (event.equalsIgnoreCase("30754-07.htm")) {
      if (st.get("success") != null) {
        st.set("cond", "1");
        st.unset("success");
        st.playSound(QuestState.SOUND_MIDDLE);
      }
    } else if (event.equalsIgnoreCase("30754-08.htm")) {
      st.playSound(QuestState.SOUND_FINISH);
      st.exitQuest(true);
    } else if (event.equalsIgnoreCase("30754-06.htm")) {
      if (!st.hasQuestItems(ARTICLE_DEAD_HERO)) htmltext = "30754-06a.htm";
      else {
        final int amount = st.getQuestItemsCount(ARTICLE_DEAD_HERO);

        st.takeItems(ARTICLE_DEAD_HERO, -1);
        st.giveItems(57, amount * 60);

        // Special item, % based on actual number of qItems.
        if (Rnd.get(1000) < Math.min(10, Math.max(1, amount / 10))) htmltext = "30754-10.htm";
      }
    } else if (event.equalsIgnoreCase("30754-11.htm")) {
      final int random = Rnd.get(4);
      if (random < 1) {
        htmltext = "30754-12.htm";
        st.giveItems(OLD_KEY, 1);
      } else if (random < 2) {
        htmltext = "30754-13.htm";
        st.giveItems(OLD_HILT, 1);
      } else if (random < 3) {
        htmltext = "30754-14.htm";
        st.giveItems(OLD_TOTEM, 1);
      } else st.giveItems(CRUCIFIX, 1);

      st.set("cond", "2");
      st.playSound(QuestState.SOUND_MIDDLE);
    }

    return htmltext;
  }
コード例 #28
0
  private void rewards(QuestState st, int npcId) {
    switch (npcId) {
      case ORVEN:
        if (st.hasQuestItems(CRUCIFIX)) {
          st.set("success", "1");
          st.takeItems(CRUCIFIX, -1);

          final int chance = Rnd.get(100);
          if (chance < 80) st.giveItems(1875, 19);
          else if (chance < 95) st.giveItems(952, 5);
          else st.giveItems(2437, 1);
        }
        break;

      case GARVARENTZ:
        if (st.hasQuestItems(OLD_TOTEM)) {
          st.set("success", "1");
          st.takeItems(OLD_TOTEM, -1);

          final int chance = Rnd.get(100);
          if (chance < 55) st.giveItems(1882, 70);
          else if (chance < 99) st.giveItems(1881, 50);
          else st.giveItems(191, 1);
        }
        break;

      case KAIEN:
        if (st.hasQuestItems(OLD_HILT)) {
          st.set("success", "1");
          st.takeItems(OLD_HILT, -1);

          final int chance = Rnd.get(100);
          if (chance < 60) st.giveItems(1874, 25);
          else if (chance < 85) st.giveItems(1887, 10);
          else if (chance < 99) st.giveItems(951, 1);
          else st.giveItems(133, 1);
        }
        break;

      case RODEMAI:
        if (st.hasQuestItems(OLD_KEY)) {
          st.set("success", "1");
          st.takeItems(OLD_KEY, -1);

          final int chance = Rnd.get(100);
          if (chance < 80) st.giveItems(1879, 55);
          else if (chance < 95) st.giveItems(951, 1);
          else st.giveItems(885, 1);
        }
        break;
    }
  }
コード例 #29
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("30828-01.htm")) {
      st.set("cond", "1");
      st.setState(STATE_STARTED);
      st.playSound(QuestState.SOUND_ACCEPT);
    } else if (event.equalsIgnoreCase("30828-03.htm") && st.hasQuestItems(TRIDENT)) {
      st.set("cond", "2");
      st.takeItems(TRIDENT, 1);
      st.playSound(QuestState.SOUND_MIDDLE);
    } else if (event.equalsIgnoreCase("30828-05.htm")) {
      st.takeItems(MAP_PIECE, 30);
      st.giveItems(MAP, 1);
      st.set("cond", "4");
      st.playSound(QuestState.SOUND_MIDDLE);
    } else if (event.equalsIgnoreCase("30735-06.htm")) {
      st.takeItems(MAP, 1);
      st.set("cond", "5");
      st.playSound(QuestState.SOUND_MIDDLE);
    } else if (event.equalsIgnoreCase("30828-07.htm")) {
      st.giveItems(PET_TICKET, 1);
      st.playSound(QuestState.SOUND_FINISH);
      st.exitQuest(false);
    }

    return htmltext;
  }
コード例 #30
0
  @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;
  }