Ejemplo n.º 1
0
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   if (npc.getId() == NPCS[0]) // Pathfinder Worker
   {
     final L2TownZone town = TownManager.getTown(npc.getX(), npc.getY(), npc.getZ());
     final int townId = ((town == null) ? 0 : town.getTownId());
     player.getVariables().set(DELUSION_RETURN, townId);
     player.teleToLocation(HALL_LOCATIONS[getRandom(HALL_LOCATIONS.length)], false);
   } else {
     final int townId = player.getVariables().getInt(DELUSION_RETURN, 0);
     player.teleToLocation(RETURN_LOCATIONS.get(townId), true);
     player.getVariables().remove(DELUSION_RETURN);
   }
   return super.onTalk(npc, player);
 }
  private static boolean rewardDimensionalDiamonds(L2PcInstance player) {
    final PlayerVariables vars = player.getVariables();

    if (vars.getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) {
      if (player.getClassId() == ClassId.knight) {
        rewardItems(player, DIMENSIONAL_DIAMOND, 45);
      } else {
        rewardItems(player, DIMENSIONAL_DIAMOND, 61);
      }

      vars.set("2ND_CLASS_DIAMOND_REWARD", 1);
      return true;
    }
    return false;
  }
Ejemplo n.º 3
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 "ACCEPT":
        {
          if (qs.isCreated()) {
            qs.startQuest();
            if (!hasQuestItems(player, MIRIENS_1ST_SIGIL)) {
              giveItems(player, MIRIENS_1ST_SIGIL, 1);
            }
            playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
            if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) {
              giveItems(player, DIMENSIONAL_DIAMOND, 168);
              player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1);
              htmltext = "30461-04a.htm";
            } else {
              htmltext = "30461-04.htm";
            }
          }
          break;
        }
      case "30103-02.html":
      case "30103-03.html":
      case "30111-02.html":
      case "30111-03.html":
      case "30111-04.html":
      case "30111-08.html":
      case "30111-14.html":
      case "30115-02.html":
      case "30316-03.html":
      case "30461-09.html":
      case "30608-07.html":
      case "30609-02.html":
      case "30609-03.html":
      case "30609-04.html":
      case "30609-08.html":
      case "30609-13.html":
      case "30610-02.html":
      case "30610-03.html":
      case "30610-04.html":
      case "30610-05.html":
      case "30610-06.html":
      case "30610-07.html":
      case "30610-08.html":
      case "30610-09.html":
      case "30610-13.html":
      case "30611-02.html":
      case "30611-03.html":
      case "30611-06.html":
      case "30612-03.html":
        {
          htmltext = event;
          break;
        }
      case "30461-10.html":
        {
          if (hasQuestItems(player, MIRIENS_2ND_SIGIL, SYMBOL_OF_JUREK)) {
            takeItems(player, MIRIENS_2ND_SIGIL, 1);
            giveItems(player, MIRIENS_3RD_SIGIL, 1);
            takeItems(player, SYMBOL_OF_JUREK, 1);
            qs.setCond(19, true);
            htmltext = event;
          }
          break;
        }
      case "30070-02.html":
        {
          giveItems(player, HIGH_PRIESTS_SIGIL, 1);
          giveItems(player, SYLVAINS_LETTER, 1);
          qs.setCond(2, true);
          htmltext = event;
          break;
        }
      case "30071-04.html":
        {
          if (hasQuestItems(player, CRERAS_PAINTING2)) {
            takeItems(player, CRERAS_PAINTING2, 1);
            giveItems(player, CRERAS_PAINTING3, 1);
            qs.setCond(10, true);
            htmltext = event;
          }
          break;
        }
      case "30103-04.html":
        {
          giveItems(player, VALKONS_REQUEST, 1);
          htmltext = event;
          break;
        }
      case "30111-05.html":
        {
          if (hasQuestItems(player, CRONOS_LETTER)) {
            takeItems(player, CRONOS_LETTER, 1);
            giveItems(player, DIETERS_KEY, 1);
            qs.setCond(21, true);
            htmltext = event;
          }
          break;
        }
      case "30111-09.html":
        {
          if (hasQuestItems(player, CRETAS_2ND_LETTER)) {
            takeItems(player, CRETAS_2ND_LETTER, 1);
            giveItems(player, DIETERS_LETTER, 1);
            giveItems(player, DIETERS_DIARY, 1);
            qs.setCond(23, true);
            htmltext = event;
          }
          break;
        }
      case "30115-03.html":
        {
          giveItems(player, JUREKS_LIST, 1);
          giveItems(player, GRAND_MAGISTER_SIGIL, 1);
          qs.setCond(16, true);
          htmltext = event;
          break;
        }
      case "30230-02.html":
        {
          if (hasQuestItems(player, DIETERS_LETTER)) {
            takeItems(player, DIETERS_LETTER, 1);
            giveItems(player, RAUTS_LETTER_ENVELOPE, 1);
            qs.setCond(24, true);
            htmltext = event;
          }
          break;
        }
      case "30316-02.html":
        {
          if (hasQuestItems(player, RAUTS_LETTER_ENVELOPE)) {
            takeItems(player, RAUTS_LETTER_ENVELOPE, 1);
            giveItems(player, SCRIPTURE_CHAPTER_1, 1);
            giveItems(player, STRONG_LIGUOR, 1);
            qs.setCond(25, true);
            htmltext = event;
          }
          break;
        }
      case "30608-02.html":
        {
          if (hasQuestItems(player, SYLVAINS_LETTER)) {
            giveItems(player, MARIAS_1ST_LETTER, 1);
            takeItems(player, SYLVAINS_LETTER, 1);
            qs.setCond(3, true);
            htmltext = event;
          }
          break;
        }
      case "30608-08.html":
        {
          if (hasQuestItems(player, CRETAS_1ST_LETTER)) {
            giveItems(player, LUCILLAS_HANDBAG, 1);
            takeItems(player, CRETAS_1ST_LETTER, 1);
            qs.setCond(7, true);
            htmltext = event;
          }
          break;
        }
      case "30608-14.html":
        {
          if (hasQuestItems(player, CRERAS_PAINTING3)) {
            takeItems(player, CRERAS_PAINTING3, 1);
            takeItems(player, BROWN_SCROLL_SCRAP, -1);
            giveItems(player, CRYSTAL_OF_PURITY1, 1);
            qs.setCond(13, true);
            htmltext = event;
          }
          break;
        }
      case "30609-05.html":
        {
          if (hasQuestItems(player, MARIAS_2ND_LETTER)) {
            takeItems(player, MARIAS_2ND_LETTER, 1);
            giveItems(player, CRETAS_1ST_LETTER, 1);
            qs.setCond(6, true);
            htmltext = event;
          }
          break;
        }
      case "30609-09.html":
        {
          if (hasQuestItems(player, LUCILLAS_HANDBAG)) {
            takeItems(player, LUCILLAS_HANDBAG, 1);
            giveItems(player, CRERAS_PAINTING1, 1);
            qs.setCond(8, true);
            htmltext = event;
          }
          break;
        }
      case "30609-14.html":
        {
          if (hasQuestItems(player, DIETERS_KEY)) {
            takeItems(player, DIETERS_KEY, 1);
            giveItems(player, CRETAS_2ND_LETTER, 1);
            qs.setCond(22, true);
            htmltext = event;
          }
          break;
        }
      case "30610-10.html":
        {
          giveItems(player, CRONOS_SIGIL, 1);
          giveItems(player, CRONOS_LETTER, 1);
          qs.setCond(20, true);
          htmltext = event;
          break;
        }
      case "30610-14.html":
        {
          if (hasQuestItems(
              player,
              SCRIPTURE_CHAPTER_1,
              SCRIPTURE_CHAPTER_2,
              SCRIPTURE_CHAPTER_3,
              SCRIPTURE_CHAPTER_4)) {
            takeItems(player, CRONOS_SIGIL, 1);
            takeItems(player, DIETERS_DIARY, 1);
            takeItems(player, TRIFFS_RING, 1);
            takeItems(player, SCRIPTURE_CHAPTER_1, 1);
            takeItems(player, SCRIPTURE_CHAPTER_2, 1);
            takeItems(player, SCRIPTURE_CHAPTER_3, 1);
            takeItems(player, SCRIPTURE_CHAPTER_4, 1);
            giveItems(player, SYMBOL_OF_CRONOS, 1);
            qs.setCond(31, true);
            htmltext = event;
          }
          break;
        }
      case "30611-04.html":
        {
          if (hasQuestItems(player, STRONG_LIGUOR)) {
            giveItems(player, TRIFFS_RING, 1);
            takeItems(player, STRONG_LIGUOR, 1);
            qs.setCond(26, true);
            htmltext = event;
          }
          break;
        }
      case "30612-04.html":
        {
          giveItems(player, CASIANS_LIST, 1);
          qs.setCond(28, true);
          htmltext = event;
          break;
        }
      case "30612-07.html":
        {
          giveItems(player, SCRIPTURE_CHAPTER_4, 1);
          takeItems(player, POITANS_NOTES, 1);
          takeItems(player, CASIANS_LIST, 1);
          takeItems(player, GHOULS_SKIN, -1);
          takeItems(player, MEDUSAS_BLOOD, -1);
          takeItems(player, FETTERED_SOULS_ICHOR, -1);
          takeItems(player, ENCHANTED_GARGOYLES_NAIL, -1);
          qs.setCond(30, true);
          htmltext = event;
          break;
        }
    }
    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 "ACCEPT":
        {
          if (qs.isCreated()) {
            qs.startQuest();
            qs.setMemoState(1);
            giveItems(player, VOUCHER_OF_TRIAL, 1);
            playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
            if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) {
              giveItems(player, DIMENSIONAL_DIAMOND, 49);
              player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1);
              htmltext = "30648-04a.htm";
            } else {
              htmltext = "30648-04.htm";
            }
          }
          break;
        }
      case "30648-05.html":
      case "30648-06.html":
      case "30648-07.html":
      case "30648-08.html":
        {
          htmltext = event;
          break;
        }
      case "30362-05.html":
        {
          if (qs.isMemoState(15) && hasQuestItems(player, BOOK_OF_DARKNESS)) {
            takeItems(player, BOOK_OF_DARKNESS, 1);
            qs.setMemoState(16);
            qs.setCond(16, true);
            htmltext = event;
          }
          break;
        }
      case "30362-04.html":
        {
          if (qs.isMemoState(15) && hasQuestItems(player, BOOK_OF_DARKNESS)) {
            qs.setMemoState(16);
            qs.setCond(16, true);
            htmltext = event;
          }
          break;
        }
      case "30649-04.html":
        {
          if (qs.isMemoState(4) && hasQuestItems(player, ESSENSE_OF_FLAME)) {
            giveItems(player, SPIRIT_OF_FLAME, 1);
            takeItems(player, ESSENSE_OF_FLAME, 1);
            qs.setMemoState(5);
            qs.setCond(5, true);
            htmltext = event;
          }
          break;
        }
      case "30650-02.html":
        {
          if (qs.isMemoState(6) && hasQuestItems(player, TAG_OF_RUMOR)) {
            if (getQuestItemsCount(player, ADENA) >= 100000) {
              giveItems(player, BOOK_OF_GERALD, 1);
              takeItems(player, ADENA, 100000);
              qs.setMemoState(7);
              htmltext = event;
            } else {
              htmltext = "30650-03.html";
            }
          }
          break;
        }
      case "30650-03.html":
        {
          if (qs.isMemoState(6) && hasQuestItems(player, TAG_OF_RUMOR)) {
            htmltext = event;
          }
          break;
        }
      case "30652-02.html":
        {
          if (qs.isMemoState(14) && hasQuestItems(player, DEBRIS_OF_WILLOW)) {
            giveItems(player, BOOK_OF_DARKNESS, 1);
            takeItems(player, DEBRIS_OF_WILLOW, 1);
            qs.setMemoState(15);
            qs.setCond(15, true);
            htmltext = event;
          }
          break;
        }
    }
    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 "ACCEPT":
        {
          if (qs.isCreated()) {
            qs.startQuest();
            qs.setMemoState(1);
            playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
            if (player.getVariables().getInt("2ND_CLASS_DIAMOND_REWARD", 0) == 0) {
              giveItems(player, DIMENSIONAL_DIAMOND, 23);
              player.getVariables().set("2ND_CLASS_DIAMOND_REWARD", 1);
              htmltext = "30531-04a.htm";
            } else {
              htmltext = "30531-04.htm";
            }
          }
          break;
        }
      case "30533-02.html":
        {
          qs.setMemoState(2);
          htmltext = event;
          break;
        }
      case "30556-02.html":
      case "30556-03.html":
      case "30556-04.html":
        {
          htmltext = event;
          break;
        }
      case "30556-05.html":
        {
          if (hasQuestItems(player, PAINT_OF_TELEPORT_DEVICE)) {
            giveItems(player, BROKEN_TELEPORT_DEVICE, 1);
            takeItems(player, PAINT_OF_TELEPORT_DEVICE, 1);
            player.teleToLocation(140352, -194133, -3146);
            startQuestTimer("SPAWN_KING_BUGBEAR", 5000, npc, player);
            htmltext = event;
          }
          break;
        }
      case "30671-02.html":
        {
          giveItems(player, PAINT_OF_KAMURU, 1);
          htmltext = event;
          break;
        }
      case "30673-04.html":
        {
          if (hasQuestItems(player, INGREDIENTS_OF_ANTIDOTE)
              && (getQuestItemsCount(player, STINGER_WASP_NEEDLE) >= 10)
              && (getQuestItemsCount(player, MARSH_SPIDERS_WEB) >= 10)
              && (getQuestItemsCount(player, BLOOD_OF_LEECH) >= 10)) {
            giveItems(player, REPORT_OF_CRUMA, 1);
            takeItems(player, STINGER_WASP_NEEDLE, -1);
            takeItems(player, MARSH_SPIDERS_WEB, -1);
            takeItems(player, BLOOD_OF_LEECH, -1);
            takeItems(player, INGREDIENTS_OF_ANTIDOTE, 1);
            htmltext = event;
          }
          break;
        }
      case "SPAWN_KING_BUGBEAR":
        {
          addAttackPlayerDesire(
              addSpawn(KING_BUGBEAR, 140395, -194147, -3146, 0, false, 200000, false), player);
          addAttackPlayerDesire(
              addSpawn(KING_BUGBEAR, 140395, -194147, -3146, 0, false, 200000, false), player);
          addAttackPlayerDesire(
              addSpawn(KING_BUGBEAR, 140395, -194147, -3146, 0, false, 200000, false), player);
          break;
        }
    }
    return htmltext;
  }