@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) { String htmltext = getNoQuestMsg(player); final QuestState st = getQuestState(player, true); if (st == null) { return htmltext; } int npcId = npc.getId(); switch (st.getState()) { case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; case State.CREATED: if (npcId == CADMON) { htmltext = (player.getLevel() >= 74) ? "31296-01.htm" : "31296-02.html"; } break; case State.STARTED: if ((npcId == CADMON) && st.isCond(1)) { htmltext = "31296-04.html"; } else if (npcId == LEON) { if (st.isCond(1)) { htmltext = "31256-01.html"; } else if (st.isCond(2)) { htmltext = "31256-03.html"; } } else if ((npcId == WAHKAN) && st.isCond(2)) { htmltext = "31371-01.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; } 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 onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); if (st == null) { return htmltext; } switch (st.getState()) { case State.CREATED: htmltext = (player.getLevel() < MIN_LEVEL) ? "32741-01.html" : "32741-02.htm"; break; case State.STARTED: if (st.isCond(1) && !st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE) && !st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) { htmltext = "32741-05.html"; } else if (st.isCond(2) && st.hasQuestItems(MIDDLE_GRADE_LIZARD_SCALE)) { htmltext = "32741-06.html"; } if (st.isCond(2) && st.hasQuestItems(HIGH_GRADE_LIZARD_SCALE)) { htmltext = "32741-07.html"; } break; } return htmltext; }
@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 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(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 onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); final QuestState st = player.getQuestState(getName()); if (st == null) { return htmltext; } switch (npc.getId()) { case HEAD_BLACKSMITH_KUSTO: { switch (st.getState()) { case State.CREATED: { htmltext = (player.getLevel() < 40) ? "30512-00.htm" : "30512-01.htm"; break; } case State.STARTED: { if (st.isCond(1)) { htmltext = "30512-04.html"; } break; } case State.COMPLETED: { htmltext = getAlreadyCompletedMsg(player); break; } } break; } case RESEARCHER_LORAIN: { if (st.isStarted()) { htmltext = st.isCond(1) ? "30673-01.html" : "30673-05.html"; } break; } case MAESTRO_NIKOLA: { if (st.isCond(2)) { htmltext = "30621-01.html"; } break; } } return htmltext; }
@Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); if (qs != null) { final ItemChanceHolder info = MOBS_DROP_CHANCES.get(npc.getId()); switch (info.getId()) { case RIB_BONE_OF_A_BLACK_MAGUS: { if (qs.isCond(1) && giveItemRandomly( qs.getPlayer(), npc, RIB_BONE_OF_A_BLACK_MAGUS, 1, RIB_BONE_REQUIRED_COUNT, info.getChance(), true)) { qs.setCond(2); } break; } case ZOMBIES_LIVER: { giveItemRandomly(qs.getPlayer(), npc, ZOMBIES_LIVER, 1, 0, info.getChance(), true); break; } } } return super.onKill(npc, killer, isSummon); }
@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 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 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 void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon) { final QuestState st = getQuestState(player, false); if ((st != null) && st.isCond(1) && Util.checkIfInRange(1500, npc, player, false)) { st.setCond(2, true); } }
@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) { final QuestState st = getQuestState(player, false); String htmltext = getNoQuestMsg(player); if (st != null) { switch (st.getState()) { case State.CREATED: { htmltext = player.getLevel() >= MIN_LVL ? "30078-01.html" : "30078-02.htm"; break; } case State.STARTED: { if (st.isCond(2) && (st.getQuestItemsCount(BEAR_SKIN) >= REQUIRED_COUNT)) { st.giveAdena(ADENA_COUNT, true); st.exitQuest(true, true); htmltext = "30078-05.html"; } else { htmltext = "30078-06.html"; } break; } } } return htmltext; }
@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 QuestState st = killer.getQuestState(getName()); if ((st != null) && st.isCond(1)) { st.setCond(2, true); } return super.onKill(npc, killer, isSummon); }
@Override public String onTalk(L2Npc npc, L2PcInstance talker) { final QuestState qs = talker.getQuestState(Q00196_SevenSignsSealOfTheEmperor.class.getSimpleName()); String htmltext = getNoQuestMsg(talker); if (qs == null) { return htmltext; } switch (npc.getId()) { case PROMISE_OF_MAMMON: { if (qs.isCond(3) || qs.isCond(4)) { enterInstance(talker, new DNPWorld(), "DisciplesNecropolisPast.xml", TEMPLATE_ID); return ""; } break; } case LEON: { if (qs.getCond() >= 3) { takeItems(talker, SACRED_SWORD_OF_EINHASAD, -1); InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(talker); world.removeAllowed(talker.getObjectId()); talker.teleToLocation(EXIT, 0); htmltext = "32587-01.html"; } break; } case DISCIPLES_GATEKEEPER: { if (qs.getCond() >= 3) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if (tmpworld instanceof DNPWorld) { DNPWorld world = (DNPWorld) tmpworld; openDoor(DISCIPLES_NECROPOLIS_DOOR, world.getInstanceId()); talker.showQuestMovie(12); startQuestTimer("FIGHT", 1000, null, talker); } } break; } } return htmltext; }
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 qs = getQuestState(player, false); String htmltext = null; if (qs == null) { return htmltext; } switch (event) { case "31388-03.htm": { if (qs.isCreated()) { qs.startQuest(); htmltext = event; } break; } case "31388-04.html": case "31388-05.html": case "31388-06.html": { if (qs.isStarted()) { htmltext = event; } break; } case "31388-07.html": { if (qs.isCond(2)) { if (getQuestItemsCount(player, RIB_BONE_OF_A_BLACK_MAGUS) >= RIB_BONE_REQUIRED_COUNT) { giveAdena(player, 25000, true); addExpAndSp(player, 305235, 0); takeItems(player, RIB_BONE_OF_A_BLACK_MAGUS, -1); qs.setCond(1, true); htmltext = event; } else { htmltext = "31388-08.html"; } } break; } case "31388-09.html": { if (qs.isStarted()) { qs.exitQuest(true, true); htmltext = event; } 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) { 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); }
@Override public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState st = getQuestState(player, true); String htmltext = getNoQuestMsg(player); if (st == null) { return htmltext; } if (st.isCreated()) { htmltext = "31537-01.htm"; } else if (st.isStarted()) { if (st.isCond(1)) { if (st.getQuestItemsCount(PRIME_MEAT) < PRIME_MEAT_COUNT) { htmltext = "31537-04.html"; } } else if (st.isCond(2)) { if (st.getQuestItemsCount(PRIME_MEAT) >= PRIME_MEAT_COUNT) { htmltext = "31537-05.html"; } } } return htmltext; }
@Override public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) { final QuestState qs = getQuestState(attacker, false); if ((qs != null) && qs.isCond(10) && hasQuestItems(attacker, JEWEL_OF_ADVENTURER_1)) { if (qs.isMemoState(10)) { qs.setMemoState(11); } else if (npc.isScriptValue(1)) { takeItems(attacker, JEWEL_OF_ADVENTURER_1, -1); giveItems(attacker, JEWEL_OF_ADVENTURER_2, 1); qs.setCond(11, true); } } return super.onAttack(npc, attacker, damage, isSummon); }
@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 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) { 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 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); }