@Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { QuestState st = player.getQuestState(getClass()); if (st == null) { return event; } int cond = st.getCond(); if (event.equals("32768-11.htm") && cond == 0) { st.set("grendel_kill", "0"); st.set("buffalo_kill", "0"); st.set("cougar_kill", "0"); st.set("kookaburra_kill", "0"); st.set("over_hit", "0"); // Общее кол-во оверхитов st.set( "over_tempcount", "0"); // Количество оверхитов подряд, до того как сфейлил след. оверхит st.set("count", "0"); // Записанное, максимальное количество сделанных подряд оверхитов st.startQuest(); } else if (event.equals("rating")) // Подводим рейтинг { int overhits = st.getInt("over_hit"); if (overhits >= 20) { String content = HtmCache.getInstance() .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-14a.htm"); NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setHtml(content); html.replace("<?number?>", String.valueOf(String.valueOf(overhits))); player.sendPacket(html); } else if (overhits < 20 && overhits >= 7) { String content = HtmCache.getInstance() .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-14b.htm"); NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setHtml(content); html.replace("<?number?>", String.valueOf(String.valueOf(overhits))); player.sendPacket(html); } else if (overhits < 7) { String content = HtmCache.getInstance() .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-14c.htm"); NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setHtml(content); html.replace("<?number?>", String.valueOf(String.valueOf(overhits))); player.sendPacket(html); } } else if (event.equals("rating")) // Подводим по оверхитам подряд { int overhits = st.getInt("count"); if (overhits >= 20) { String content = HtmCache.getInstance() .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-16a.htm"); NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setHtml(content); html.replace("<\\?number\\?>", String.valueOf(String.valueOf(overhits))); player.sendPacket(html); } else if (overhits < 20 && overhits >= 7) { String content = HtmCache.getInstance() .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-16b.htm"); NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setHtml(content); html.replace("<\\?number\\?>", String.valueOf(String.valueOf(overhits))); player.sendPacket(html); } else if (overhits < 7) { String content = HtmCache.getInstance() .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-16c.htm"); NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId()); html.setHtml(content); html.replace("<\\?number\\?>", String.valueOf(String.valueOf(overhits))); player.sendPacket(html); } } else if (event.equals("32768-17.htm")) // Считаем награду и выставляем реюз квесту { calcReward(player); st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH); st.unset("cond"); st.exitQuest(QuestType.DAILY); } return event; }
private String prepareHtml(L2PcInstance player, String filename, String replace) { return getHtm(player.getLang(), filename).replace("%replace%", replace); }