@Override public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final QuestState st; if ((npc.getId() == FALLEN_ANGEL)) { st = player.getQuestState(getName()); if (st.isCond(5)) { st.giveItems(FALLEN_ANGEL_BLOOD, 1); st.setCond(6, true); isAngelSpawned = false; } } else { final L2PcInstance member = getRandomPartyMember(player, 4); if (member != null) { st = member.getQuestState(getName()); if (getRandom(1000) < MOBS.get(npc.getId())) { st.giveItems(PROPHECY_FRAGMENT, 1); if (st.getQuestItemsCount(PROPHECY_FRAGMENT) >= FRAGMENT_COUNT) { st.takeItems(PROPHECY_FRAGMENT, -1); st.setCond(5, true); } else { st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); } } } } return super.onKill(npc, player, isSummon); }
@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 onSkillSee( L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon) { final QuestState st = getQuestState(caster, false); if ((st == null) || !st.isStarted()) { return null; } if (st.isCond(1) && (skill.getId() == 2630)) { switch (npc.getId()) { case 18684: case 18685: case 18686: st.giveItems(RED, 1); break; case 18687: case 18688: case 18689: st.giveItems(BLUE, 1); break; case 18690: case 18691: case 18692: st.giveItems(GREEN, 1); break; } st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); npc.doDie(caster); } return super.onSkillSee(npc, caster, skill, targets, isSummon); }
@Override public final String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { final QuestState st = player.getQuestState(qn); if ((st != null) && (st.getState() == State.STARTED)) { final long count = st.getQuestItemsCount(NECRO_HEART); if (count < 10) { int chance = (int) (Config.RATE_QUEST_DROP * DROP_CHANCE); int numItems = chance / 100; chance = chance % 100; if (getRandom(100) < chance) { numItems++; } if (numItems > 0) { if ((count + numItems) >= 10) { numItems = 10 - (int) count; st.playSound("ItemSound.quest_middle"); st.set("cond", "2"); } else { st.playSound("ItemSound.quest_itemget"); } st.giveItems(NECRO_HEART, numItems); } } } return null; }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); if (st == null) { return htmltext; } final int cond = st.getCond(); switch (event) { case "31517-02.htm": st.startQuest(); st.giveItems(CRYSTAL_OF_SEAL, 5); break; case "31512-01.html": case "31513-01.html": case "31514-01.html": case "31515-01.html": case "31516-01.html": final int npcId = Integer.parseInt(event.replace("-01.html", "")); if ((cond == (npcId - 31511)) && st.hasQuestItems(CRYSTAL_OF_SEAL)) { st.takeItems(CRYSTAL_OF_SEAL, 1); st.setCond(cond + 1, true); } break; } return htmltext; }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; final QuestState st = getQuestState(player, false); if (st == null) { return htmltext; } switch (event) { case "31296-03.html": st.startQuest(); break; case "31256-02.html": if (st.isCond(1)) { st.setCond(2, true); st.giveItems(BOX, 1); } break; case "31371-02.html": if (st.isCond(2) && st.hasQuestItems(BOX)) { st.addExpAndSp(233125, 18142); st.exitQuest(false, true); } else { htmltext = "31371-03.html"; } break; } return htmltext; }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(getName()); String htmltext = getNoQuestMsg(player); if (st != null) { switch (st.getState()) { case State.CREATED: { htmltext = (player.getRace() == Race.DARK_ELF) ? (player.getLevel() >= MIN_LVL) ? "30348-02.htm" : "30348-01.htm" : "30348-00.htm"; break; } case State.STARTED: { if (st.isCond(2) && (st.getQuestItemsCount(DARK_BEZOAR) >= REQUIRED_COUNT)) { st.giveItems(LESSER_HEALING_POTION, 5); st.addExpAndSp(1000, 0); st.exitQuest(false, true); htmltext = "30348-05.html"; } else { htmltext = "30348-04.html"; } break; } case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } } return htmltext; }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = getQuestState(player, false); if (st == null) { return getNoQuestMsg(player); } if (Util.isDigit(event)) { int i = Integer.valueOf(event); final ClassId cid = player.getClassId(); if ((cid.getRace() == Race.DARK_ELF) && (cid.getId() == CLASSES[i][1])) { int suffix; final boolean item = st.hasQuestItems(CLASSES[i][6]); if (player.getLevel() < 20) { suffix = (!item) ? CLASSES[i][2] : CLASSES[i][3]; } else { if (!item) { suffix = CLASSES[i][4]; } else { suffix = CLASSES[i][5]; st.giveItems(SHADOW_WEAPON_COUPON_DGRADE, 15); st.takeItems(CLASSES[i][6], -1); player.setClassId(CLASSES[i][0]); player.setBaseClass(CLASSES[i][0]); st.playSound(QuestSound.ITEMSOUND_QUEST_FANFARE_2); player.broadcastUserInfo(); st.exitQuest(false); } } event = npc.getId() + "-" + suffix + ".html"; } } return event; }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, killer, false)) { if (!st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) { st.giveItems(MIDDLE_GRADE_LIZARD_SCALE, 1); st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); st.setCond(2, true); } else if (!st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)) { st.giveItems(HIGH_GRADE_LIZARD_SCALE, 1); st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); st.setCond(3, true); } } return super.onKill(npc, killer, isSummon); }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); if (st == null) { return htmltext; } switch (st.getState()) { case State.CREATED: { htmltext = (player.getLevel() >= 79) ? "32711-01.htm" : "32711-02.htm"; break; } case State.STARTED: { if ((hekaton != null) && !hekaton.isDead()) { htmltext = "32711-09.html"; } else if (st.isCond(1)) { htmltext = (!hasQuestItems(player, CET_1_SHEET, CET_2_SHEET, CET_3_SHEET)) ? "32711-07.html" : "32711-08.html"; } else if (st.isCond(2)) { st.giveItems(SUPPORT_ITEMS, 1); st.exitQuest(true, true); htmltext = "32711-10.html"; } 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 String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(player, 1); if (partyMember == null) { return super.onKill(npc, player, isSummon); } final QuestState st = getQuestState(partyMember, false); switch (npc.getId()) { case GORGOLOS: { st.giveItems(CET_1_SHEET, 1); st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); break; } case LAST_TITAN_UTENUS: { st.giveItems(CET_2_SHEET, 1); st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); break; } case GIANT_MARPANAK: { st.giveItems(CET_3_SHEET, 1); st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); break; } case HEKATON_PRIME: { if (player.isInParty()) { for (L2PcInstance pl : player.getParty().getMembers()) { final QuestState qs = getQuestState(pl, false); if ((qs != null) && qs.isCond(1)) { qs.setCond(2, true); } } saveGlobalQuestVar( "Respawn", Long.toString(System.currentTimeMillis() + RESPAWN_DELAY)); } break; } } return super.onKill(npc, player, isSummon); }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); if ((st != null) && (getRandom(10) > 4)) { st.giveItems(MONSTERS.get(npc.getId()), 1); st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); } return super.onKill(npc, killer, isSummon); }
private void giveItem(L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(getName()); if ((st != null) && (st.isStarted()) && (!st.isCond(5)) && Util.checkIfInRange(1500, npc, player, false)) { st.giveItems(MONSTER_DROPS.get(npc.getId()), 1); st.setCond(5, true); } }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(getName()); if ((st != null) && event.equals("30349-03.htm")) { st.startQuest(); st.giveItems(JENNAS_LETTER, 1); return event; } return null; }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = player.getQuestState(getName()); if (st == null) { return htmltext; } switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= MIN_LEVEL) ? "36479-03.html" : "36479-02.html"; break; case State.STARTED: if (TerritoryWarManager.getInstance().isTWInProgress()) { return "36479-05.html"; } switch (st.getCond()) { case 1: htmltext = "36479-06.html"; break; case 2: st.setCond(3, true); htmltext = "36479-07.html"; break; case 3: htmltext = "36479-08.html"; break; case 4: st.setCond(5, true); htmltext = "36479-09.html"; break; case 5: htmltext = "36479-10.html"; break; case 6: st.setCond(7, true); htmltext = "36479-11.html"; break; case 7: htmltext = "36479-12.html"; break; case 8: st.giveItems(CLOAK, 1); st.exitQuest(false, true); htmltext = "36479-13.html"; break; } break; case State.COMPLETED: htmltext = "36479-01.html"; break; } return htmltext; }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(getName()); if (st == null) { return null; } String htmltext = event; switch (event) { case "30894-02.html": case "30289-03.html": case "30289-04.html": case "30612-03.html": case "30612-04.html": case "30612-06.html": case "30612-07.html": break; case "30894-01.html": st.startQuest(); break; case "30894-03.html": st.giveItems(CRYPTOGRAM_OF_THE_ANGEL_SEARCH, 1); st.setCond(2, true); break; case "30289-05.html": st.unset("talk"); st.setCond(3, true); break; case "30612-05.html": st.set("talk", "2"); break; case "30612-08.html": st.unset("talk"); st.setCond(4, true); break; case "32368-04.html": if (isAngelSpawned) { return "32368-03.html"; } addSpawn(FALLEN_ANGEL, npc.getX() + 100, npc.getY() + 100, npc.getZ(), 0, false, 120000); isAngelSpawned = true; startQuestTimer("despawn", 120000, null, player); break; case "despawn": if (isAngelSpawned) { isAngelSpawned = false; } default: htmltext = null; break; } return htmltext; }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = killer.getQuestState(getName()); if ((st != null) && st.isCond(1) && (getRandom(3) < MONSTERS.get(npc.getId()))) { st.giveItems(DARK_BEZOAR, 1); if (st.getQuestItemsCount(DARK_BEZOAR) < REQUIRED_COUNT) { st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); } else { st.setCond(2, true); } } return super.onKill(npc, killer, isSummon); }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); if ((st != null) && st.isCond(1)) { st.giveItems(GRAVE_ROBBERS_HEAD, 1); if (st.getQuestItemsCount(GRAVE_ROBBERS_HEAD) >= 50) { st.setCond(2, true); } else { st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); } } return super.onKill(npc, killer, isSummon); }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, false); if (st == null) { return getNoQuestMsg(player); } if (event.equals("32557-03.html")) { st.startQuest(); st.giveItems(SCROLL, 8); } return event; }
@Override public final String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(qn); if (st == null) { return "<html><body>目前沒有執行任務,或條件不符。</body></html>"; } final byte id = st.getState(); if (id == State.CREATED) { if (player.getLevel() > 72) { if (st.hasQuestItems(FADED_MARK)) { return "32010-02.htm"; } if (st.hasQuestItems(VISITOR_MARK)) { st.exitQuest(true); return "32010-01a.htm"; } if (st.hasQuestItems(MARK)) { st.exitQuest(true); return "32010-0.htm"; } } st.exitQuest(true); return "32010-01.htm"; } else if (id == State.STARTED) { if ((st.getInt("cond") == 2) && (st.getQuestItemsCount(NECRO_HEART) == 10)) { st.takeItems(NECRO_HEART, 10); st.takeItems(FADED_MARK, 1); st.giveItems(MARK, 1); st.giveItems(8273, 10); st.playSound("ItemSound.quest_finish"); st.exitQuest(true); return "32010-05.htm"; } return "32010-04.htm"; } return "<html><body>目前沒有執行任務,或條件不符。</body></html>"; }
@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 String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = getQuestState(killer, false); if ((st != null) && st.isCond(1)) { final long count = st.getQuestItemsCount(KASHA_WOLF_FANG); int amount = ((getRandom(100) < 25) && (count < 49)) ? 2 : 1; st.giveItems(KASHA_WOLF_FANG, amount); if ((count + amount) >= 50) { st.setCond(2, true); } else { st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); } } return super.onKill(npc, killer, isSummon); }
@Override public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 3); if (member == null) { return super.onKill(npc, player, isSummon); } final QuestState st = member.getQuestState(getName()); if ((getRandom(1000) < MOBS.get(npc.getId()))) { if (st.getQuestItemsCount(STOLEN_CARGO) < ITEM_COUNT) { st.giveItems(STOLEN_CARGO, 1); } else if (st.getQuestItemsCount(HATE_CRYSTAL) < ITEM_COUNT) { st.giveItems(HATE_CRYSTAL, 1); } else { st.giveItems(OLD_TREASURE_MAP, 1); } if ((st.getQuestItemsCount(STOLEN_CARGO) >= ITEM_COUNT) && (st.getQuestItemsCount(HATE_CRYSTAL) >= ITEM_COUNT) && (st.getQuestItemsCount(OLD_TREASURE_MAP) >= ITEM_COUNT)) { st.setCond(4, true); } } return super.onKill(npc, player, isSummon); }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { if (npc.getId() == TUNATUN) { String htmltext = getNoQuestMsg(player); QuestState st = player.getQuestState(getName()); if ((st != null) && st.isCond(3)) { if (!st.hasQuestItems(TOPQUALITYMEAT)) { st.giveItems(TOPQUALITYMEAT, 1); return "tunatun_01.htm"; } return "tunatun_02.htm"; } return htmltext; } return super.onTalk(npc, player); }
@Override public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { final L2PcInstance member = getRandomPartyMember(player, 1); if (member != null) { final QuestState st = member.getQuestState(getName()); if (getRandomBoolean()) { st.giveItems(ENCHANTED_IRON, 1); if (st.getQuestItemsCount(ENCHANTED_IRON) >= IRON_COUNT) { st.setCond(2, true); } else { st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); } } } return super.onKill(npc, player, isSummon); }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); if (st == null) { return htmltext; } switch (npc.getId()) { case JOHNNY: switch (st.getState()) { case State.CREATED: final QuestState _prev = player.getQuestState(Q00249_PoisonedPlainsOfTheLizardmen.class.getSimpleName()); if ((_prev != null) && _prev.isCompleted() && (player.getLevel() >= MIN_LEVEL)) { htmltext = (st.hasQuestItems(SEER_UGOROS_PASS)) ? "32744-07.htm" : "32744-01.htm"; } else { htmltext = "32744-00.htm"; } break; case State.STARTED: if (st.isCond(1)) { htmltext = "32744-05.html"; } else if (st.isCond(2)) { htmltext = "32744-06.html"; } break; } break; case BATRACOS: switch (st.getState()) { case State.CREATED: htmltext = (st.hasQuestItems(SEER_UGOROS_PASS)) ? "32740-05.html" : "32740-00.html"; break; case State.STARTED: if (st.isCond(1)) { htmltext = "32740-02.html"; } else if (st.isCond(2)) { st.giveItems(SEER_UGOROS_PASS, 1); st.exitQuest(true, true); htmltext = "32740-04.html"; } break; } } return htmltext; }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(getName()); if (st == null) { return null; } String htmltext = null; switch (event) { case "30621-02.html": case "30512-02.html": { htmltext = event; break; } case "30673-03.htm": { if (st.isCreated()) { st.startQuest(); st.takeItems(LORAINES_CERTIFICATE, -1); st.giveItems(METALLOGRAPH, 1); htmltext = event; } break; } case "30621-03.html": { if (st.isCond(1)) { st.setCond(2, true); htmltext = event; } break; } case "30512-03.html": { if (st.isCond(2)) { st.giveAdena(93383, true); if (player.getLevel() < MIN_LEVEL_FOR_EXP_SP) { st.addExpAndSp(285935, 18711); } st.exitQuest(false, true); htmltext = event; } break; } } return htmltext; }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final L2PcInstance partyMember = getRandomPartyMember(killer, 1); if (partyMember != null) { final QuestState st = partyMember.getQuestState(getName()); final float chance = (MONSTERS.get(npc.getId()) * Config.RATE_QUEST_DROP); if (getRandom(1000) < chance) { st.giveItems(BLOOD_OF_SAINT, 1); if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) { st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); } else { st.setCond(2, true); } } } return super.onKill(npc, killer, isSummon); }
@Override public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { final QuestState st = getQuestState(player, false); if ((st != null) && st.isCond(1)) { long skins = st.getQuestItemsCount(BEAR_SKIN); if (skins < REQUIRED_COUNT) { if (getRandom(100) < MONSTERS.get(npc.getId())) { st.giveItems(BEAR_SKIN, 1); if ((++skins) < REQUIRED_COUNT) { st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET); } else { st.setCond(2, true); } } } } return super.onKill(npc, player, isPet); }