@Override public String onKill(NpcInstance npc, QuestState qs) { final Player player = qs.getPlayer(); if (player.getParty() == null) { qs.setCond(5); } else { for (Player member : player.getParty().getPartyMembers()) { final QuestState stats = member.getQuestState(Q00480_AnotherLegacyOfCrumaTower.class); if ((stats == null) || (stats.getCond() != 4)) { continue; } stats.setCond(5); } } qs.getPlayer() .getReflection() .addSpawnWithoutRespawn( MARTES_NPC, Location.findPointToStay(qs.getPlayer(), 50, 100), qs.getPlayer().getGeoIndex()); return null; }
@Override public String onEvent(String event, QuestState qs, NpcInstance npc) { final Player player = qs.getPlayer(); switch (event) { case "33155-9.htm": SupportMagic.getSupportMagic(npc, player); break; case "33155-10.htm": SupportMagic.getSupportServitorMagic(npc, player); break; case "advanceCond3": if (qs.getCond() != 3) { qs.setCond(3); } return null; case "teleportCruma": qs.setCond(1); qs.setState(STARTED); qs.playSound(SOUND_ACCEPT); player.teleToLocation(17192, 114173, -3439); return null; case "33163-8.htm": if (qs.getQuestItemsCount(TRESURE_TOOL) == 0) { qs.giveItems(TRESURE_TOOL, 30); qs.setCond(2); } else { return "33163-12.htm"; } break; case "EnterInstance": if (player.getParty() == null) { player.sendMessage("You cannot enter without party!"); // pts message? return null; } for (Player member : player.getParty().getPartyMembers()) { final QuestState state = member.getQuestState(Q00480_AnotherLegacyOfCrumaTower.class); if ((state == null) || (state.getCond() != 3)) { // nothing as I've seen everybody can enter this instance } else if (state.getCond() == 3) { state.setCond(4); } } ReflectionUtils.enterReflection(player, 198); return null; case "LeaveInstance": player.teleToLocation(17192, 114173, -3439, ReflectionManager.DEFAULT); return null; } return event; }
@Override public String onTalk(NpcInstance npc, QuestState qs) { String htmltext = "noquest"; if (qs == null) { return htmltext; } final Player player = qs.getPlayer(); final QuestState previous = player.getQuestState(Q10315_ToThePrisonOfDarkness.class); if ((previous == null) || (!previous.isCompleted())) { if (player.getLevel() < 90) { qs.exitCurrentQuest(true); return "32946-02.htm"; } } else { qs.exitCurrentQuest(true); return "32946-09.htm"; } switch (qs.getState()) { case COMPLETED: htmltext = "32946-10.htm"; break; case CREATED: htmltext = "32946-01.htm"; break; case STARTED: if (qs.getCond() == 1) { htmltext = "32946-07.htm"; } else { if (qs.getCond() != 2) { break; } htmltext = "32946-08.htm"; } } return htmltext; }
@Override public String onKill(NpcInstance npc, QuestState qs) { final Party party = qs.getPlayer().getParty(); if (qs.getCond() == 1) { if (party == null) { qs.setCond(2); qs.giveItems(ShilensMark, 1); qs.playSound(SOUND_MIDDLE); } else { for (Player pmember : party.getPartyMembers()) { final QuestState pst = pmember.getQuestState(Q00149_PrimalMotherIstina.class); if ((pst != null) && (pst.getCond() == 1)) { pst.setCond(2); pst.giveItems(ShilensMark, 1); pst.playSound("SOUND_MIDDLE"); } } } } return null; }
@Override public boolean isVisible(Player player) { final QuestState qs = player.getQuestState(Q10315_ToThePrisonOfDarkness.class); return ((qs == null) && isAvailableFor(player)) || ((qs != null) && qs.isNowAvailableByTime()); }