@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 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 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; }