@Override public String onEvent(String event, QuestState st, NpcInstance npc) { String htmltext = event; Castle castle = ResidenceHolder.getInstance().getResidence(ShuttgartCastle); if (castle.getOwner() == null) { return "Castle has no lord"; } Player castleOwner = castle.getOwner().getLeader().getPlayer(); if (event.equals("august_q714_03.htm")) { st.setState(STARTED); st.setCond(1); st.playSound(SOUND_ACCEPT); } else if (event.equals("august_q714_05.htm")) { st.setCond(2); } else if (event.equals("newyear_q714_03.htm")) { st.setCond(3); } else if (event.equals("yasheni_q714_02.htm")) { st.setCond(5); } else if (event.equals("august_q714_08.htm")) { Functions.npcSay( npc, NpcString.S1_HAS_BECOME_THE_LORD_OF_THE_TOWN_OF_SCHUTTGART, st.getPlayer().getName()); castle.getDominion().changeOwner(castleOwner.getClan()); st.playSound(SOUND_FINISH); st.exitCurrentQuest(true); } return htmltext; }
@Override public String onTalk(NpcInstance npc, QuestState st) { String htmltext = "noquest"; int cond = st.getCond(); Player player = st.getPlayer(); Clan clan = player.getClan(); ClanHall clanhall = ResidenceHolder.getInstance().getResidence(35); if (clanhall.getSiegeEvent().isRegistrationOver()) { htmltext = null; showHtmlFile( player, "azit_messenger_q0504_03.htm", false, "%siege_time%", TimeUtils.toSimpleFormat(clanhall.getSiegeDate())); } else if (clan == null || player.getObjectId() != clan.getLeaderId()) htmltext = "azit_messenger_q0504_05.htm"; else if (player.getObjectId() == clan.getLeaderId() && clan.getLevel() < 4) htmltext = "azit_messenger_q0504_04.htm"; else if (clanhall.getSiegeEvent().getSiegeClan(SiegeEvent.ATTACKERS, player.getClan()) != null) htmltext = "azit_messenger_q0504_06.htm"; else if (clan.getHasHideout() > 0) htmltext = "azit_messenger_q0504_10.htm"; else if (cond == 0) htmltext = "azit_messenger_q0504_01.htm"; else if (st.getQuestItemsCount(CONTEST_CERTIFICATE) == 1 && st.getQuestItemsCount(AMULET) < 30) htmltext = "azit_messenger_q0504_07.htm"; else if (st.getQuestItemsCount(ALIANCE_TROPHEY) >= 1) htmltext = "azit_messenger_q0504_07a.htm"; else if (st.getQuestItemsCount(CONTEST_CERTIFICATE) == 1 && st.getQuestItemsCount(AMULET) == 30) { st.takeItems(AMULET, -1); st.takeItems(CONTEST_CERTIFICATE, -1); st.giveItems(ALIANCE_TROPHEY, 1); st.playSound(SOUND_FINISH); st.setCond(-1); htmltext = "azit_messenger_q0504_08.htm"; } return htmltext; }
@Override public String onTalk(NpcInstance npc, QuestState st) { String htmltext = "noquest"; int npcId = npc.getNpcId(); int id = st.getState(); int cond = st.getCond(); Castle castle = ResidenceHolder.getInstance().getResidence(ShuttgartCastle); if (castle.getOwner() == null) { return "Castle has no lord"; } Player castleOwner = castle.getOwner().getLeader().getPlayer(); if (npcId == August) { if (cond == 0) { if (castleOwner == st.getPlayer()) { if (castle.getDominion().getLordObjectId() != st.getPlayer().getObjectId()) { htmltext = "august_q714_01.htm"; } else { htmltext = "august_q714_00.htm"; st.exitCurrentQuest(true); } } else { htmltext = "august_q714_00a.htm"; st.exitCurrentQuest(true); } } else if (cond == 1) { htmltext = "august_q714_04.htm"; } else if (cond == 2) { htmltext = "august_q714_06.htm"; } else if (cond == 7) { htmltext = "august_q714_07.htm"; } } else if (npcId == Newyear) { if (cond == 2) { htmltext = "newyear_q714_01.htm"; } else if (cond == 3) { QuestState q1 = st.getPlayer().getQuestState(_114_ResurrectionOfAnOldManager.class); QuestState q2 = st.getPlayer().getQuestState(_120_PavelsResearch.class); QuestState q3 = st.getPlayer().getQuestState(_121_PavelTheGiants.class); if (q3 != null && q3.isCompleted()) { if (q1 != null && q1.isCompleted()) { if (q2 != null && q2.isCompleted()) { st.setCond(4); htmltext = "newyear_q714_04.htm"; } else { htmltext = "newyear_q714_04a.htm"; } } else { htmltext = "newyear_q714_04b.htm"; } } else { htmltext = "newyear_q714_04c.htm"; } } } else if (npcId == Yasheni) { if (cond == 4) { htmltext = "yasheni_q714_01.htm"; } else if (cond == 5) { htmltext = "yasheni_q714_03.htm"; } else if (cond == 6) { st.takeAllItems(GolemShard); st.setCond(7); htmltext = "yasheni_q714_04.htm"; } } return htmltext; }