@Override public String onTalk(L2Npc npc, L2PcInstance player) { QuestState st = player.getQuestState(qn); String htmltext = getNoQuestMsg(); if (st == null) return htmltext; switch (st.getState()) { case STATE_CREATED: htmltext = (player.getLevel() < 48) ? "30754-01.htm" : "30754-02.htm"; break; case STATE_STARTED: int cond = st.getInt("cond"); switch (npc.getNpcId()) { case GILMORE: if (cond == 1) htmltext = (st.hasQuestItems(ARTICLE_DEAD_HERO)) ? "30754-05.htm" : "30754-09.htm"; else if (cond == 2) htmltext = (st.get("success") != null) ? "30754-16.htm" : "30754-15.htm"; break; default: if (cond == 2) { if (st.get("success") != null) htmltext = npc.getNpcId() + "-02.htm"; else { rewards(st, npc.getNpcId()); htmltext = npc.getNpcId() + "-01.htm"; } } break; } break; } 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 (event.equalsIgnoreCase("30754-04.htm")) { st.setState(STATE_STARTED); st.set("cond", "1"); st.playSound(QuestState.SOUND_ACCEPT); } else if (event.equalsIgnoreCase("30754-07.htm")) { if (st.get("success") != null) { st.set("cond", "1"); st.unset("success"); st.playSound(QuestState.SOUND_MIDDLE); } } else if (event.equalsIgnoreCase("30754-08.htm")) { st.playSound(QuestState.SOUND_FINISH); st.exitQuest(true); } else if (event.equalsIgnoreCase("30754-06.htm")) { if (!st.hasQuestItems(ARTICLE_DEAD_HERO)) htmltext = "30754-06a.htm"; else { final int amount = st.getQuestItemsCount(ARTICLE_DEAD_HERO); st.takeItems(ARTICLE_DEAD_HERO, -1); st.giveItems(57, amount * 60); // Special item, % based on actual number of qItems. if (Rnd.get(1000) < Math.min(10, Math.max(1, amount / 10))) htmltext = "30754-10.htm"; } } else if (event.equalsIgnoreCase("30754-11.htm")) { final int random = Rnd.get(4); if (random < 1) { htmltext = "30754-12.htm"; st.giveItems(OLD_KEY, 1); } else if (random < 2) { htmltext = "30754-13.htm"; st.giveItems(OLD_HILT, 1); } else if (random < 3) { htmltext = "30754-14.htm"; st.giveItems(OLD_TOTEM, 1); } else st.giveItems(CRUCIFIX, 1); st.set("cond", "2"); st.playSound(QuestState.SOUND_MIDDLE); } return htmltext; }