예제 #1
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = "";
    QuestState accessQuest = player.getQuestState("240_ImTheOnlyOneYouCanTrust");
    if ((accessQuest != null) && accessQuest.isCompleted()) htmltext = "32640.htm";
    else htmltext = "32640-no.htm";

    return htmltext;
  }
  private void givePormanders(L2PcInstance player) {
    final int index = getTransferClassIndex(player);

    if (index >= 0) {
      QuestState st = player.getQuestState(qn);
      if (st == null) {
        st = newQuestState(player);
      }

      final String name = qn + String.valueOf(player.getClassId().getId());
      if (st.getInt(name) == 0) {
        st.setInternal(name, "1");
        if (st.getGlobalQuestVar(name).isEmpty()) {
          st.saveGlobalQuestVar(name, "1");
          player.addItem(qn, PORMANDERS[index].getId(), PORMANDERS[index].getCount(), null, true);
        }
      }

      if (Config.SKILL_CHECK_ENABLE && (!player.isGM() || Config.SKILL_CHECK_GM)) {
        long count =
            PORMANDERS[index].getCount()
                - player.getInventory().getInventoryItemCount(PORMANDERS[index].getId(), -1, false);
        for (L2Skill sk : player.getAllSkills()) {
          for (L2SkillLearn s :
              SkillTreesData.getInstance().getTransferSkillTree(player.getClassId()).values()) {
            if (s.getSkillId() == sk.getId()) {
              // Holy Weapon allowed for Shilien Saint/Inquisitor stance
              if ((sk.getId() == 1043) && (index == 2) && player.isInStance()) {
                continue;
              }

              count--;
              if (count < 0) {
                Util.handleIllegalPlayerAction(
                    player,
                    "Player "
                        + player.getName()
                        + " has too many transfered skills or items, skill:"
                        + s.getName()
                        + " ("
                        + sk.getId()
                        + "/"
                        + sk.getLevel()
                        + "), class:"
                        + player.getTemplate().className,
                    1);
                if (Config.SKILL_CHECK_REMOVE) {
                  player.removeSkill(sk);
                }
              }
            }
          }
        }
      }
    }
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    QuestState st = player.getQuestState(qn);
    QuestState prev = player.getQuestState("250_WatchWhatYouEat");

    if (st == null) return htmltext;

    switch (st.getState()) {
      case State.CREATED:
        if (player.getLevel() >= 82 && prev != null && prev.isCompleted())
          htmltext = "32742-01.htm";
        else htmltext = "32742-14.htm";
        break;
      case State.STARTED:
        if (st.getQuestItemsCount(VialOfTantaBlood) < 100) htmltext = "32742-04.html";
        else htmltext = "32742-05.html";
        break;
    }
    return htmltext;
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    L2PcInstance partyMember = getRandomPartyMember(player, "1");
    if (partyMember == null) return null;
    final QuestState st = partyMember.getQuestState(qn);
    int chance = Rnd.get(1000);
    boolean giveItem = false;

    switch (npc.getNpcId()) {
      case 22771: // Tanta Lizardman Berserker
        if (chance < 159) giveItem = true;
        break;
      case 22770: // Tanta Lizardman Soldier
        if (chance < 123) giveItem = true;
        break;
      case 22774: // Tanta Lizardman Summoner
        if (chance < 261) giveItem = true;
        break;
      case 22769: // Tanta Lizardman Warrior
        if (chance < 689) giveItem = true;
        break;
      case 22772: // Tanta Lizardman Archer
        if (chance < 739) giveItem = true;
        break;
      case 22768: // Tanta Lizardman Scout
        if (chance < 509) giveItem = true;
        break;
      case 22773: // Tanta Lizardman Magician
        if (chance < 737) giveItem = true;
        break;
    }

    if (giveItem) {
      st.giveItems(VialOfTantaBlood, 1);
      st.playSound("ItemSound.quest_itemget");
    }
    return null;
  }
예제 #5
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = "";
    QuestState st = player.getQuestState(getName());
    if (st == null) st = newQuestState(player);

    int index = Integer.parseInt(event) - 1;

    if (_locs.length > index) {
      Location loc = _locs[index];

      if (player.getParty() != null) {
        for (L2PcInstance partyMember : player.getParty().getPartyMembers()) {
          if (partyMember.isInsideRadius(player, 1000, true, true))
            partyMember.teleToLocation(loc, true);
        }
      }
      player.teleToLocation(loc, false);
      st.exitQuest(true);
    }

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

    if (st == null) return htmltext;

    if (npc.getNpcId() == JAKAN) {
      if (event.equalsIgnoreCase("32773-3.htm")) {
        st.setState(State.STARTED);
        st.set("cond", "1");
        st.playSound("ItemSound.quest_accept");
      }
    } else if (Util.contains(SOLDIER_CORPSES, npc.getNpcId())) {
      if (st.getInt("cond") == 1) {
        st.giveItems(TAG_ID, 1);
        st.set("cond", "2");
        st.playSound("ItemSound.quest_middle");
        npc.deleteMe();
      } else htmltext = getNoQuestMsg(player);
    }
    return htmltext;
  }
  @Override
  public final String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = Quest.getNoQuestMsg(player);
    QuestState st = player.getQuestState(qn);

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

    if (st.getState() == State.CREATED) {
      if (player.getLevel() >= 76) {
        htmltext = "32245-01.htm";
      } else {
        htmltext = "32245-02.htm";
      }
    } else if (st.isCompleted()) {
      htmltext = getAlreadyCompletedMsg(player);
    } else if (st.getState() == State.STARTED) {
      switch (st.getInt("cond")) {
        case 1:
        case 2:
          if (st.hasQuestItems(BLUEPRINT_RANKU) && st.hasQuestItems(BLUEPRINT_PRINCE)) {
            st.takeItems(BLUEPRINT_RANKU, -1);
            st.takeItems(BLUEPRINT_PRINCE, -1);
            st.set("cond", "3");
            st.playSound("ItemSound.quest_middle");
            htmltext = "32245-05.htm";
          } else {
            htmltext = "32245-04.htm";
          }

          break;
        case 3:
          htmltext = "32245-06.htm";
      }
    }
    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = event;
    QuestState st = player.getQuestState(qn);

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

    if (event.equalsIgnoreCase("32245-03.htm") && (player.getLevel() >= 76) && !st.isCompleted()) {
      if (st.getState() == State.CREATED) {
        st.setState(State.STARTED);
        st.set("cond", "1");
        st.set("rewarded_prince", "1");
        st.set("rewarded_ranku", "1");
        st.playSound("ItemSound.quest_accept");
      } else {
        htmltext = "32245-03a.htm";
      }
    } else if (event.equalsIgnoreCase("32245-07.htm")
        && (st.getInt("cond") == 3)
        && !st.isCompleted()) {
      st.giveAdena(65884, true);
      st.addExpAndSp(50541, 5094);
      st.giveItems(FIRE, 1);
      st.giveItems(WATER, 1);
      st.giveItems(EARTH, 1);
      st.giveItems(WIND, 1);
      st.giveItems(DARKNESS, 1);
      st.giveItems(DIVINITY, 1);
      st.playSound("ItemSound.quest_finish");
      st.exitQuest(false);
    }
    return htmltext;
  }
  @Override
  public final String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    L2PcInstance pl = null;
    switch (npc.getNpcId()) {
      case DEMON_PRINCE:
        pl = getRandomPartyMember(player, "rewarded_prince", "1");
        if (pl != null) {
          final QuestState st = pl.getQuestState(qn);
          st.giveItems(BLUEPRINT_PRINCE, 1);
          st.set("rewarded_prince", "2");

          if (st.hasQuestItems(BLUEPRINT_RANKU)) {
            st.playSound("ItemSound.quest_middle");
            st.set("cond", "2");
          } else {
            st.playSound("ItemSound.quest_itemget");
          }
        }
        break;
      case RANKU:
        pl = getRandomPartyMember(player, "rewarded_ranku", "1");
        if (pl != null) {
          final QuestState st = pl.getQuestState(qn);
          st.giveItems(BLUEPRINT_RANKU, 1);
          st.set("rewarded_ranku", "2");

          if (st.getQuestItemsCount(BLUEPRINT_PRINCE) > 0) {
            st.playSound("ItemSound.quest_middle");
            st.set("cond", "2");
          } else {
            st.playSound("ItemSound.quest_itemget");
          }
        }
        break;
    }
    return null;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    if (npc.getNpcId() == JAKAN) {
      switch (st.getState()) {
        case State.CREATED:
          if (player.getLevel() >= 84) htmltext = "32773-1.htm";
          else htmltext = "32773-0.htm";
          break;
        case State.STARTED:
          if (st.getInt("cond") == 1) htmltext = "32773-4.htm";
          else if (st.getInt("cond") == 2) {
            htmltext = "32773-5.htm";
            st.unset("cond");
            st.takeItems(TAG_ID, 1);
            st.giveItems(57, 95200);
            st.addExpAndSp(435024, 50366);
            st.playSound("ItemSound.quest_finish");
            st.exitQuest(false);

            Calendar reDo = Calendar.getInstance();
            reDo.set(Calendar.MINUTE, RESET_MIN);
            if (reDo.get(Calendar.HOUR_OF_DAY) >= RESET_HOUR) reDo.add(Calendar.DATE, 1);
            reDo.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
            st.set("reDoTime", String.valueOf(reDo.getTimeInMillis()));
          }
          break;
        case State.COMPLETED:
          Long reDoTime = Long.parseLong(st.get("reDoTime"));
          if (reDoTime > System.currentTimeMillis()) htmltext = "32773-6.htm";
          else {
            st.setState(State.CREATED);
            if (player.getLevel() >= 84) htmltext = "32773-1.htm";
            else htmltext = "32773-0.htm";
          }
          break;
      }
    } else if (Util.contains(SOLDIER_CORPSES, npc.getNpcId())) {
      if (st.getInt("cond") == 1) htmltext = "corpse-1.htm";
    }
    return htmltext;
  }
예제 #11
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("32742-03.htm")) {
      st.set("cond", "1");
      st.playSound("ItemSound.quest_accept");
      st.setState(State.STARTED);
    } else if (event.equalsIgnoreCase("Icarus")) {
      if (st.getQuestItemsCount(VialOfTantaBlood) >= 500) {
        st.takeItems(VialOfTantaBlood, 500);
        int i0 = Rnd.get(5);
        if (i0 == 0) st.giveItems(10381, 1);
        else if (i0 == 1) st.giveItems(10405, 1);
        else if (i0 == 2) st.giveItems(10405, 4);
        else if (i0 == 3) st.giveItems(10405, 4);
        else st.giveItems(10405, 6);
        st.playSound("ItemSound.quest_finish");
        htmltext = "32742-06.html";
      } else htmltext = "32742-07.html";
    } else if (event.equalsIgnoreCase("Moirai")) {
      if (st.getQuestItemsCount(VialOfTantaBlood) >= 100) {
        st.takeItems(VialOfTantaBlood, 100);
        int i0 = Rnd.get(10);
        if (i0 == 0) st.giveItems(15776, 1);
        else if (i0 == 1) st.giveItems(15779, 1);
        else if (i0 == 2) st.giveItems(15782, 1);
        else if (i0 == 3) {
          boolean i1 = Rnd.nextBoolean();
          if (!i1) st.giveItems(15785, 1);
          else st.giveItems(15788, 1);
        } else if (i0 == 4) {
          int i1 = Rnd.get(10);
          if (i1 < 4) st.giveItems(15812, 1);
          else if (i1 < 8) st.giveItems(15813, 1);
          else st.giveItems(15814, 1);
        } else if (i0 == 5) st.giveItems(15646, 5);
        else if (i0 == 6) st.giveItems(15649, 5);
        else if (i0 == 7) st.giveItems(15652, 5);
        else if (i0 == 8) {
          boolean i1 = Rnd.nextBoolean();
          if (!i1) st.giveItems(15655, 5);
          else st.giveItems(15658, 5);
        } else {
          int i1 = Rnd.get(10);
          if (i1 < 4) st.giveItems(15772, 1);
          else if (i1 < 7) st.giveItems(15773, 1);
          else st.giveItems(15774, 1);
        }
        st.playSound("ItemSound.quest_finish");
        htmltext = "32742-08.html";
      } else htmltext = "32742-09.html";
    } else if (event.equalsIgnoreCase("32742-11.html")) {
      if (st.hasQuestItems(VialOfTantaBlood)) htmltext = "32742-11.html";
      else {
        st.playSound("ItemSound.quest_finish");
        st.exitQuest(true);
        htmltext = "32742-12.html";
      }
    } else if (event.equalsIgnoreCase("32742-13.html")) {
      st.takeItems(VialOfTantaBlood, -1);
      st.playSound("ItemSound.quest_finish");
      st.exitQuest(true);
      htmltext = "32742-12.html";
    }
    return htmltext;
  }