@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 onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final List<L2PcInstance> randomList = new ArrayList<>(); final QuestState st = killer.getQuestState(getName()); if ((st != null) && st.isStarted()) { randomList.add(killer); randomList.add(killer); } final int monsterChance = MONSTER_DROP_CHANCES.get(npc.getId()); if (killer.isInParty()) { for (L2PcInstance member : killer.getParty().getMembers()) { final QuestState qs = member.getQuestState(getName()); if ((qs != null) && qs.isStarted()) { randomList.add(member); } } } if (!randomList.isEmpty()) { final L2PcInstance player = randomList.get(getRandom(randomList.size())); if ((getRandom(1000) < monsterChance) && Util.checkIfInRange(1500, npc, player, true)) { giveItems(player, REMNANTS_OF_OLD_DWARVES_DREAMS, 1); playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } return super.onKill(npc, killer, isSummon); }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(getName()); String htmltext = getNoQuestMsg(player); if (st == null) { return htmltext; } switch (st.getState()) { case State.CREATED: { if (player.getLevel() < MIN_LVL) { htmltext = "32054-02.htm"; } else { final QuestState q117 = player.getQuestState("117_OceanOfDistantStar"); // TODO: Update. htmltext = (q117 != null) && q117.isCompleted() ? "32054-01.htm" : "32054-04.htm"; } break; } case State.STARTED: { htmltext = st.hasQuestItems(REMNANTS_OF_OLD_DWARVES_DREAMS) ? "32054-05.html" : "32054-06.html"; break; } } return htmltext; }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = player.getQuestState(getName()); if (st == null) { return htmltext; } switch (npc.getId()) { case RESEARCHER_LORAIN: { switch (st.getState()) { case State.CREATED: { final QuestState qs = player.getQuestState("185_Nikolas_Cooperation_Consideration"); if ((qs != null) && qs.isCompleted() && st.hasQuestItems(LORAINES_CERTIFICATE)) { htmltext = player.getLevel() < MIN_LEVEL ? "30673-02.htm" : "30673-01.htm"; } break; } case State.STARTED: { if (st.getCond() >= 1) { htmltext = "30673-04.html"; } break; } case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } case MAESTRO_NIKOLA: { if (st.isStarted()) { htmltext = st.isCond(1) ? "30621-01.html" : "30621-04.html"; } break; } case HEAD_BLACKSMITH_KUSTO: { if (st.isCond(2) && st.hasQuestItems(METALLOGRAPH)) { htmltext = "30512-01.html"; } break; } } return htmltext; }
@Override public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = ""; boolean hellboundLock = HellboundManager.getInstance().isLocked(); QuestState st1 = player.getQuestState("133_ThatsBloodyHot"); QuestState st2 = player.getQuestState("130_PathToHellbound"); if (st1 != null) npc.showChatWindow(player); else if (st2 != null) { if (hellboundLock) npc.showChatWindow(player); else htmltext = "warpgate-locked.htm"; } else if (!hellboundLock) htmltext = "warpgate-locked.htm"; else if (hellboundLock) npc.showChatWindow(player); return htmltext; }
@Override public String onFirstTalk(L2Npc npc, L2PcInstance player) { if (player.getQuestState(getName()) == null) { newQuestState(player); } return npc.getId() + ".htm"; }
@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 onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = player.getQuestState(getName()); if (st == null) { return htmltext; } if (npc.getId() == MOUEN) { switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() >= 82) ? "30196-01.htm" : "30196-00.htm"; break; case State.STARTED: if (st.isCond(1)) { htmltext = "30196-04.htm"; } break; case State.COMPLETED: htmltext = "30196-05.htm"; break; } } else if (npc.getId() == JOHNNY) { if (st.isCond(1)) { htmltext = "32744-01.htm"; } else if (st.isCompleted()) { htmltext = "32744-04.htm"; } } 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 "30926-02.htm": { st.startQuest(); htmltext = event; break; } case "30926-05.html": { st.exitQuest(true, true); htmltext = event; break; } case "30926-06.html": { htmltext = event; break; } } return htmltext; }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); if (qs == null) { return htmltext; } if (qs.isCreated()) { final QuestState q10288 = player.getQuestState(Q10288_SecretMission.class.getSimpleName()); if ((player.getLevel() < 82) || (q10288 == null) || !q10288.isCompleted()) { htmltext = "32757-00.htm"; } else { htmltext = "32757-01.htm"; } } else if (qs.isStarted()) { switch (qs.getCond()) { case 1: htmltext = "32757-04.html"; break; case 2: case 3: htmltext = "32757-05.html"; break; } } else { htmltext = "32757-10.html"; } return htmltext; }
@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) { final QuestState st = player.getQuestState(getName()); if (st == null) { return null; } String htmltext = event; switch (event) { case "31517-05.html": break; case "31517-02.htm": st.startQuest(); break; case "Exp": if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) { return "31517-06.html"; } st.addExpAndSp(XP_COUNT, SP_COUNT); st.exitQuest(true, true); htmltext = "31517-07.html"; break; case "Adena": if (st.getQuestItemsCount(BLOOD_OF_SAINT) < ITEMS_COUNT_REQUIRED) { return "31517-06.html"; } st.giveAdena(ADENA_COUNT, true); st.exitQuest(true, true); htmltext = "31517-07.html"; break; default: htmltext = null; 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 "32740.html": case "32740-01.html": case "32744-02.html": case "32744-03.htm": break; case "32744-04.htm": st.startQuest(); break; case "32744-quit.html": st.exitQuest(true); break; default: htmltext = null; break; } return htmltext; }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; QuestState qs = player.getQuestState("10273_GoodDayToFly"); if (qs == null || qs.getState() != State.COMPLETED) { player.sendPacket(new RadarControl(2, 2, 0, 0, 0)); player.sendPacket(new RadarControl(0, 2, -184545, 243120, 1581)); htmltext = "32627.htm"; } else if (event.equals("32627-3.htm")) { player.sendPacket(new RadarControl(2, 2, 0, 0, 0)); player.sendPacket(new RadarControl(0, 2, -192361, 254528, 3598)); } else if (event.equals("32627-4.htm")) { player.sendPacket(new RadarControl(2, 2, 0, 0, 0)); player.sendPacket(new RadarControl(0, 2, -174600, 219711, 4424)); } else if (event.equals("32627-5.htm")) { player.sendPacket(new RadarControl(2, 2, 0, 0, 0)); player.sendPacket(new RadarControl(0, 2, -181989, 208968, 4424)); } else if (event.equals("32627-6.htm")) { player.sendPacket(new RadarControl(2, 2, 0, 0, 0)); player.sendPacket(new RadarControl(0, 2, -252898, 235845, 5343)); } else if (event.equals("32627-8.htm")) { player.sendPacket(new RadarControl(2, 2, 0, 0, 0)); player.sendPacket(new RadarControl(0, 2, -212819, 209813, 4288)); } else if (event.equals("32627-9.htm")) { player.sendPacket(new RadarControl(2, 2, 0, 0, 0)); player.sendPacket(new RadarControl(0, 2, -246899, 251918, 4352)); } return htmltext; }
@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 onFirstTalk(L2Npc npc, L2PcInstance player) { final MDWorld world = (MDWorld) InstanceManager.getInstance().getWorld(npc.getInstanceId()); final QuestState qs = player.getQuestState(Q10327_IntruderWhoWantsTheBookOfGiants.class.getSimpleName()); String htmltext = null; if (qs.isCond(1)) { if (world.deskSpawns.get(world.randomDesk) == npc) { qs.setCond(2); giveItems(player, THE_WAR_OF_GODS_AND_GIANTS, 1); world.thiefSpawns = spawnGroup("thiefs", world.getInstanceId()); showOnScreenMsg( player, NpcStringId.WATCH_OUT_YOU_ARE_BEING_ATTACKED, ExShowScreenMessage.TOP_CENTER, 5000); startQuestTimer("assist_player", 2000, world.toyron, player); htmltext = "desk_correct.html"; } else { htmltext = "desk_wrong.html"; } } return htmltext; }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = ""; boolean hellboundLock = HellboundManager.getInstance().isLocked(); QuestState st1 = player.getQuestState("133_ThatsBloodyHot"); QuestState st2 = player.getQuestState("130_PathToHellbound"); if (st1 != null) { if (st1.getState() == State.COMPLETED) player.teleToLocation(-11272, 236464, -3248); else htmltext = "cant-port.htm"; } else if (st2 != null) { if (st2.getState() == State.COMPLETED && hellboundLock) player.teleToLocation(-11272, 236464, -3248); else htmltext = "cant-port.htm"; } else htmltext = "cant-port.htm"; return htmltext; }
@Override public final String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(qn); if (st == null) { return getNoQuestMsg(player); } final int cond = st.getInt("cond"); switch (npc.getNpcId()) { case ADLER1: switch (st.getState()) { case State.CREATED: if (player.getLevel() < MIN_LEVEL) { return "32497-05.htm"; } if (player.getLevel() > MAX_LEVEL) { return "32497-06.htm"; } return "32497-01.htm"; case State.STARTED: if (cond > 1) { return "32497-00.htm"; } return "32497-03.htm"; case State.COMPLETED: return "32497-07.htm"; default: return "32497-01.htm"; } case SINAI: if (cond > 1) { return "32500-00.htm"; } return "32500-01.htm"; case INSPECTOR: switch (st.getInt("cond")) { case 1: return "32507-01.htm"; case 2: return "32507-02.htm"; case 3: return "32507-03.htm"; case 4: case 5: return "32507-05.htm"; case 6: return "32507-06.htm"; default: return "32507-09.htm"; } case ADLER2: if (st.getState() == State.COMPLETED) { return "32510-00.htm"; } else if (cond == 9) { return "32510-01.htm"; } } return getNoQuestMsg(player); }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState st = killer.getQuestState(getName()); if ((st != null) && st.isCond(1)) { st.setCond(2, true); } return super.onKill(npc, killer, isSummon); }
@Override public String onFirstTalk(L2Npc npc, L2PcInstance player) { QuestState st = player.getQuestState(qn); if (st == null) st = this.newQuestState(player); player.setLastQuestNpcObject(npc.getObjectId()); npc.showChatWindow(player); return null; }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(getName()); String htmltext = null; if (st == null) { return htmltext; } switch (event) { case "31340-04.htm": { if (st.isCreated()) { htmltext = event; } break; } case "31340-05.html": { if (st.isCreated()) { st.startQuest(); htmltext = event; } break; } case "31340-06.html": { if (st.isCond(1)) { st.setCond(2, true); htmltext = event; } break; } case "31340-07.html": { if (st.isCond(1)) { st.setCond(3, true); htmltext = event; } break; } case "31340-08.html": { if (st.isCond(1)) { st.setCond(4, true); htmltext = event; } break; } case "31340-10.html": { if (st.isCond(1)) { htmltext = event; } break; } } return htmltext; }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = player.getQuestState(qn); if (st == null) { return htmltext; } final int npcId = npc.getNpcId(); switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; case State.CREATED: final QuestState qs = player.getQuestState("50_LanoscosSpecialBait"); if (npcId == LANOSCO) { htmltext = "31570-02.htm"; if (qs != null) { htmltext = ((player.getLevel() >= 27) && qs.isCompleted()) ? "31570-01.htm" : htmltext; } } break; case State.STARTED: final int cond = st.getInt("cond"); switch (npcId) { case LANOSCO: if (cond == 1) { if (st.hasQuestItems(BLUE_TREASURE_BOX)) { htmltext = "31570-04.htm"; } else { htmltext = "31570-05.htm"; } } else { htmltext = "31570-07.htm"; } break; case SHALING: if (cond == 2) { htmltext = "31434-00.htm"; } break; } } return htmltext; }
@Override public final String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(qn); final QuestState contractOfMammon = player.getQuestState("194_SevenSignContractOfMammon"); if (st == null) return "<html><body>目前沒有執行任務,或條件不符。</body></html>"; final int cond = st.getInt("cond"); switch (npc.getNpcId()) { case CLAUDIA: switch (st.getState()) { case State.CREATED: if (cond == 0 && player.getLevel() >= 79 && contractOfMammon.getState() == State.COMPLETED) return "31001-01.htm"; else st.exitQuest(true); return "31001-00.htm"; case State.STARTED: if (cond == 1) return "31001-06.htm"; case State.COMPLETED: return "<html><body>這是已經完成的任務。</body></html>"; } case JOHN: switch (st.getInt("cond")) { case 1: return "32576-01.htm"; case 2: return "32576-03.htm"; } case RAYMOND: switch (st.getInt("cond")) { case 1: case 2: return "30289-01.htm"; case 3: if (st.getQuestItemsCount(SHUNAIMAN_CONTRACT) == 1) return "30289-09.htm"; else return "30289-06.htm"; case 4: return "30289-12.htm"; } case IASON_HEINE: if (cond == 4) return "30969-01.htm"; } return "<html><body>目前沒有執行任務,或條件不符。</body></html>"; }
@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState st = player.getQuestState(getName()); if ((st != null) && event.equalsIgnoreCase("36479-04.html")) { st.startQuest(); return event; } return null; }
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 onAdvEvent(String event, L2Npc npc, L2PcInstance player) { if (event.equals("assist_player")) { final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); if ((tmpworld == null) || !(tmpworld instanceof MDWorld)) { return null; } final MDWorld world = (MDWorld) tmpworld; world.toyron.setIsRunning(true); if (player.isInCombat() && (player.getTarget() != null) && player.getTarget().isMonster() && !((L2MonsterInstance) player.getTarget()).isAlikeDead()) { if (world.toyron.calculateDistance(player.getTarget(), false, false) > 50) { world .toyron .getAI() .setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, player.getTarget().getLocation()); broadcastNpcSay( world.toyron, ChatType.NPC_GENERAL, NpcStringId.ENOUGH_OF_THIS_COME_AT_ME); } else if (world.toyron.getTarget() != player.getTarget()) { world.toyron.addDamageHate((L2Character) player.getTarget(), 0, 1000); } } else { world.toyron.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); } if (world.thiefSpawns.get(0).isDead() && world.thiefSpawns.get(1).isDead()) { final QuestState qs = player.getQuestState(Q10327_IntruderWhoWantsTheBookOfGiants.class.getSimpleName()); if ((qs != null) && qs.isCond(2)) { qs.setCond(3, true); showOnScreenMsg( player, NpcStringId.TALK_TO_TOYRON_TO_RETURN_TO_THE_MUSEUM_LOBBY, ExShowScreenMessage.TOP_CENTER, 5000); } } else { startQuestTimer("assist_player", 1000, world.toyron, player); } } else if (event.equals("enter_instance")) { if (npc.getId() != PANTHEON) { return null; } enterInstance(player, new MDWorld(), "MuseumDungeon.xml", TEMPLATE_ID); } return super.onAdvEvent(event, npc, player); }