@Override protected void runImpl() { Player player = getClient().getActiveChar(); if (player == null || player.getTransformation() != 0 || SkillTable.getInstance().getInfo(_id, _level) == null || _type == null) { return; } NpcInstance trainer = player.getLastNpc(); if ((trainer == null || player.getDistance(trainer.getX(), trainer.getY()) > Creature.INTERACTION_DISTANCE) && !player.isGM() && _type != AcquireType.NORMAL) { return; } SkillLearn skillLearn = SkillAcquireHolder.getInstance().getSkillLearn(player, _id, _level, _type); if (skillLearn == null) { return; } if (_type == AcquireType.NORMAL) { sendPacket(new ExAcquireSkillInfo(skillLearn)); } else { sendPacket(new AcquireSkillInfo(_type, skillLearn)); } }
@Override protected void onEvtDead(Creature killer) { NpcInstance actor = getActor(); if (killer != null) { Player player = killer.getPlayer(); if (player != null && player.getEffectList().containEffectFromSkills(KISS_OF_EVA)) { actor.dropItem(player, Rnd.chance(50) ? Red_Coral : Crystal_Fragment, 1); } } super.onEvtDead(killer); }
@Override public String onKill(NpcInstance npc, QuestState st) { int cond = st.getCond(); boolean doneKill = updateKill(npc, st); if (cond == 1) { if (ArrayUtils.contains(Mobs, npc.getNpcId())) { Party party = st.getPlayer().getParty(); if (party != null) { for (Player member : party.getPartyMembers()) { QuestState qs = member.getQuestState(getClass()); if (qs != null && qs.isStarted()) { if (st.getQuestItemsCount(Deadmans_Flesh) < 40) { qs.giveItems(Deadmans_Flesh, 1); qs.playSound(SOUND_ITEMGET); if (doneKill && st.getQuestItemsCount(Deadmans_Flesh) == 40) { st.setCond(2); } } } } } else { if (st.getQuestItemsCount(Deadmans_Flesh) < 50) { st.giveItems(Deadmans_Flesh, 1); st.playSound(SOUND_ITEMGET); if (doneKill && st.getQuestItemsCount(Deadmans_Flesh) == 40) { st.setCond(2); } } } } if (npc.getNpcId() == Scaldisect) { Party party = st.getPlayer().getParty(); if (party != null) { for (Player member : party.getPartyMembers()) { QuestState qs = member.getQuestState(getClass()); if (qs != null && qs.isStarted()) { updateKill(npc, st); if (st.getQuestItemsCount(Deadmans_Flesh) == 40) { st.setCond(2); } } } } else { updateKill(npc, st); if (st.getQuestItemsCount(Deadmans_Flesh) == 40) { st.setCond(2); } } } } return null; }
@Override public void onEvtAttacked(Creature attacker, int damage) { NpcInstance actor = getActor(); super.onEvtAttacked(attacker, damage); if (PositionUtils.calculateDistance(attacker, actor, false) > 300. && Rnd.chance(0.13)) { addTaskCast(attacker, DRAIN_SKILL); } Creature target = actor.getAggroList().getMostHated(); if (target == attacker && Rnd.chance(0.3)) { addTaskCast(attacker, DAMAGE_SKILL); } }
@Override protected void onEvtAggression(Creature attacker, int aggro) { NpcInstance actor = getActor(); if (attacker == null) { return; } if (!actor.isRunning()) { startRunningTask(AI_TASK_ATTACK_DELAY); } if (getIntention() != CtrlIntention.AI_INTENTION_ATTACK) { setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker); } }
@Override public String onTalk(NpcInstance npc, QuestState st) { String htmltext = "noquest"; int cond = st.getCond(); if (npc.getNpcId() == Roderik) { switch (st.getState()) { case CREATED: if (st.getPlayer().getLevel() >= 95) { if (st.isNowAvailableByTime()) { htmltext = "30631.htm"; } else { htmltext = "30631-0.htm"; } } else { htmltext = "lvl.htm"; st.exitCurrentQuest(true); } break; case STARTED: if (cond == 1) { htmltext = "30631-3.htm"; } else if (cond == 2) { htmltext = "30631-4.htm"; } break; } } return htmltext; }
@Override public String onTalk(NpcInstance npc, QuestState st) { String htmltext = "noquest"; int npcId = npc.getNpcId(); int cond = st.getCond(); if (npcId == Dilios) { if (cond == 0) { if (st.getPlayer().getLevel() >= 75) { htmltext = "dilios_q692_1.htm"; } else { htmltext = "dilios_q692_0.htm"; st.exitCurrentQuest(true); } } } else if (npcId == Kutran) { if (cond == 2) { htmltext = "kutran_q692_1.htm"; } else if (cond == 3) { htmltext = "kutran_q692_3.htm"; } } else if (npcId == Lekon) { if (cond == 1) { htmltext = "lekon_q692_1.htm"; } } return htmltext; }
@Override public String onKill(NpcInstance npc, QuestState st) { int npcId = npc.getNpcId(); int cond = st.getCond(); if (cond == 3) { if (ArrayUtils.contains(SOD, npcId)) { st.rollAndGive( FleetSteedTroupsTotem, (int) Config.RATE_QUESTS_REWARD * 1, 17); // Шанс на глаз и с потолка. Умножается на рейт квестов и делится на кол-во членов // группы. Для нас это (nRate*3)/9 } else if (ArrayUtils.contains(SOI, npcId)) { st.rollAndGive( NucleusofanIncompleteSoul, (int) Config.RATE_QUESTS_REWARD * 1, 17); // Шанс на глаз и с потолка. Умножается на рейт квестов и делится на кол-во членов // группы. Для нас это (nRate*3)/9 } else if (ArrayUtils.contains(SOA, npcId)) { st.rollAndGive( SpiritStoneDust, (int) Config.RATE_QUESTS_REWARD * 1, 20); // Шанс на глаз и с потолка. Умножается на рейт квестов и делится на кол-во членов // группы. Для нас это (nRate*3)/9 } } return null; }
@Override public String onKill(NpcInstance npc, QuestState st) { Player player = st.getPlayer(); int npcId = npc.getNpcId(); int refId = player.getReflectionId(); if (npcId == KAMS && st.getQuestItemsCount(KDROP) == 0) { st.giveItems(KDROP, 1); } else if (npcId == ALKASO && st.getQuestItemsCount(ADROP) == 0) { st.giveItems(ADROP, 1); } else if (npcId == LEMATAN) { st.setCond(4); st.playSound(SOUND_MIDDLE); addSpawnToInstance(DADVENTURER2, new Location(84990, -208376, -3342, 55000), 0, refId); } else if (ArrayUtils.contains(Pailaka2nd, npcId)) { if (Rnd.get(100) < 80) { st.dropItem(npc, HERBS[Rnd.get(HERBS.length)], Rnd.get(1, 2)); } } else if (npcId == CHEST) { if (Rnd.get(100) < 80) { st.dropItem(npc, CHESTDROP[Rnd.get(CHESTDROP.length)], Rnd.get(1, 10)); } } // TODO вернуть когда будут работать двери // else // dropItem(npc, KEY, 1); return null; }
@Override public String onTalk(NpcInstance npc, QuestState st) { int npcId = npc.getNpcId(); String htmltext = "noquest"; int cond = st.getCond(); if (npcId == NANARIN) { if (cond == 0) { if (st.getPlayer().getLevel() < 15) { htmltext = "30956-00.htm"; st.exitCurrentQuest(true); } else { htmltext = "30956_1.htm"; } } else if (cond == 1) { htmltext = "30956_8.htm"; } else if (cond == 2) { htmltext = "30956_3.htm"; } else if (cond == 3) { htmltext = "30956_6.htm"; } else if (cond == 4) { htmltext = "30956_5.htm"; } } else if (npcId == BARBADO) { if (cond == 3) { if (st.getQuestItemsCount(EVENT_CLOTHES) > 0) { st.takeItems(EVENT_CLOTHES, -1); htmltext = "30959_2.htm"; st.exitCurrentQuest(true); } else if (st.getQuestItemsCount(SABRINS_BLACK_BEER) > 0) { st.takeItems(SABRINS_BLACK_BEER, -1); htmltext = "30959_2.htm"; st.exitCurrentQuest(true); } else { st.takeItems(NANARINS_FLUTE, -1); st.setCond(4); st.playSound(SOUND_MIDDLE); htmltext = "30959_1.htm"; } } else if (cond == 4) { htmltext = "30959_3.htm"; } } else if (npcId == HOLVAS && (cond == 1 || cond == 2)) { st.setCond(2); if (Rnd.chance(60)) { htmltext = "30058_2.htm"; } else { htmltext = "30058_1.htm"; } } else if (npcId == POITAN && (cond == 1 || cond == 2)) { st.setCond(2); if (Rnd.chance(60)) { htmltext = "30458_2.htm"; } else { htmltext = "30458_1.htm"; } } return htmltext; }
@Override public void onSpawn() { super.onSpawn(); FortressSiegeEvent siegeEvent = getEvent(FortressSiegeEvent.class); if (siegeEvent == null) { return; } siegeEvent.barrackAction(3, false); }
@Override public String onTalk(NpcInstance npc, QuestState st) { String htmltext = "noquest"; int npcId = npc.getNpcId(); int cond = st.getCond(); int id = st.getState(); Player player = st.getPlayer(); if (npcId == CROOP) { if (id == CREATED && player.getLevel() >= 79) { htmltext = "30676-01.htm"; } else if (cond == 1) { htmltext = "30676-04.htm"; } else if (cond == 2) { htmltext = "30676-05.htm"; st.setCond(3); st.playSound(SOUND_MIDDLE); st.giveItems(CROOP_INTRO, 1); } else if (cond >= 3 && cond <= 5) { htmltext = "30676-06.htm"; } else if (cond == 6) { htmltext = "30676-07.htm"; } else if (id == COMPLETED) { htmltext = "30676-13.htm"; } else if (player.getLevel() < 79) { htmltext = "30676-00.htm"; st.exitCurrentQuest(true); } } else if (npcId == HECTOR) { if (cond == 3) { htmltext = "30197-01.htm"; } if (cond >= 4 && cond <= 7) { htmltext = "30197-04.htm"; } } else if (npcId == STAN) { if (cond == 4) { htmltext = "30200-01.htm"; } if (cond >= 5 && cond <= 7) { htmltext = "30200-05.htm"; } } else if (npcId == CORPSE) { if (cond == 5) { htmltext = "32568-01.htm"; } } else if (npcId == HOLLINT) { if (cond == 7) { htmltext = "30191-01.htm"; } } return htmltext; }
@Override protected boolean thinkActive() { NpcInstance actor = getActor(); if (actor.isDead()) return false; GArray<NpcInstance> around = actor.getAroundNpc(3000, 3000); if (around != null && !around.isEmpty()) for (NpcInstance npc : around) if (npc.isMonster()) actor.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, npc, 300); return true; }
@Override protected boolean thinkActive() { NpcInstance actor = getActor(); if (actor.isDead()) { return false; } GArray<NpcInstance> around = actor.getAroundNpc(2000, 1000); if (around != null && !around.isEmpty()) { for (NpcInstance npc : around) { if (npc.getNpcId() != 19153 && npc.getNpcId() != 19152) { actor.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, npc, 3); } } } return true; }
@Override public String onTalk(NpcInstance npc, QuestState st) { String htmltext = "noquest"; int npcId = npc.getNpcId(); int id = st.getState(); int cond = st.getCond(); if (id == COMPLETED) { htmltext = "completed"; } else if (npcId == MOIRA) { if (id == CREATED) { if (st.getPlayer().getLevel() >= 40) { htmltext = "seer_moirase_q0113_0101.htm"; } else { htmltext = "seer_moirase_q0113_0103.htm"; st.exitCurrentQuest(true); } } else if (cond == 1) { htmltext = "seer_moirase_q0113_0105.htm"; } } else if (npcId == TORRANT && st.getQuestItemsCount(BOX) == 1) { htmltext = "torant_q0113_0101.htm"; } return htmltext; }
@Override public void onBypassFeedback(Player player, String command) { if (!canBypassCheck(player, this)) { return; } if (CastleManorManager.getInstance().isDisabled()) { NpcHtmlMessage html = new NpcHtmlMessage(player, this); html.setFile("npcdefault.htm"); player.sendPacket(html); return; } int condition = validateCondition(player); if (condition <= COND_ALL_FALSE) { return; } if (condition == COND_BUSY_BECAUSE_OF_SIEGE) { return; } if (condition == COND_OWNER) { if (command.startsWith("Chat")) { int val = 0; try { val = Integer.parseInt(command.substring(5)); } catch (IndexOutOfBoundsException ioobe) { } catch (NumberFormatException nfe) { } showMessageWindow(player, val); } else { super.onBypassFeedback(player, command); } } }
@Override public void onEvtDead(Creature killer) { NpcInstance actor = getActor(); super.onEvtDead(killer); ZONE_3.setActive(false); Functions.npcShout(actor, NpcString.AARGH_IF_I_DIE_THEN_THE_MAGIC_FORCE_FIELD_OF_BLOOD_WILL); ClanHallSiegeEvent siegeEvent = actor.getEvent(ClanHallSiegeEvent.class); if (siegeEvent == null) { return; } SpawnExObject spawnExObject = siegeEvent.getFirstObject(ClanHallSiegeEvent.BOSS); NpcInstance lidiaNpc = spawnExObject.getFirstSpawned(); if (lidiaNpc.getCurrentHpRatio() == 1.) { lidiaNpc.setCurrentHp(lidiaNpc.getMaxHp() / 2, true); } }
@Override public String onTalk(NpcInstance npc, QuestState st) { String htmltext = "noquest"; int npcId = npc.getNpcId(); int cond = st.getCond(); int id = st.getState(); Player player = st.getPlayer(); if (npcId == DISURVIVOR) { if (cond == 0) { if (player.getLevel() < 61 || player.getLevel() > 67) { htmltext = "32498-no.htm"; st.exitCurrentQuest(true); } else { return "32498-01.htm"; } } else if (id == COMPLETED) { htmltext = "32498-no.htm"; } else if (cond == 1 || cond == 2) { htmltext = "32498-06.htm"; } else { htmltext = "32498-07.htm"; } } else if (npcId == SUPPORTER) { if (cond == 1 || cond == 2) { htmltext = "32501-01.htm"; } else { htmltext = "32501-04.htm"; } } else if (npcId == DADVENTURER) { if (st.getQuestItemsCount(SWORD) > 0 && st.getQuestItemsCount(KDROP) == 0) { htmltext = "32508-01.htm"; } if (st.getQuestItemsCount(ENCHSWORD) > 0 && st.getQuestItemsCount(ADROP) == 0) { htmltext = "32508-01.htm"; } if (st.getQuestItemsCount(SWORD) == 0 && st.getQuestItemsCount(KDROP) > 0) { htmltext = "32508-05.htm"; } if (st.getQuestItemsCount(ENCHSWORD) == 0 && st.getQuestItemsCount(ADROP) > 0) { htmltext = "32508-05.htm"; } if (st.getQuestItemsCount(SWORD) == 0 && st.getQuestItemsCount(ENCHSWORD) == 0) { htmltext = "32508-05.htm"; } if (st.getQuestItemsCount(KDROP) == 0 && st.getQuestItemsCount(ADROP) == 0) { htmltext = "32508-01.htm"; } if (player.getPets() != null) { htmltext = "32508-04.htm"; } if (st.getQuestItemsCount(SWORD) > 0 && st.getQuestItemsCount(KDROP) > 0) { st.takeItems(SWORD, 1); st.takeItems(KDROP, 1); st.giveItems(ENCHSWORD, 1); htmltext = "32508-02.htm"; } if (st.getQuestItemsCount(ENCHSWORD) > 0 && st.getQuestItemsCount(ADROP) > 0) { st.takeItems(ENCHSWORD, 1); st.takeItems(ADROP, 1); st.giveItems(LASTSWORD, 1); htmltext = "32508-03.htm"; } if (st.getQuestItemsCount(LASTSWORD) > 0) { htmltext = "32508-03.htm"; } } else if (npcId == DADVENTURER2) { if (cond == 4) { // if(player.getPets() != null) // htmltext = "32511-03.htm"; // if(player.getPets() == null) // { st.giveItems(ScrollOfEscape, 1); st.giveItems(PBRACELET, 1); st.giveItems(57, 411500); st.addExpAndSp(4010000, 1235000); st.setCond(5); st.setState(COMPLETED); st.playSound(SOUND_FINISH); st.exitCurrentQuest(false); player.getReflection().startCollapseTimer(60000); htmltext = "32511-01.htm"; // } } else if (id == COMPLETED) { htmltext = "32511-02.htm"; } } return htmltext; }
@Override public String onTalk(NpcInstance npc, QuestState st) { int npcId = npc.getNpcId(); Player player = st.getPlayer(); String back = player.getVar("FestivalBackCoords"); if (back == null) { back = "1"; } // Dawn Locations String htmltext = "Started.htm"; if (npcId == GLUDIN_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "1", -1); return htmltext; } if (npcId == GLUDIO_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "2", -1); return htmltext; } if (npcId == DION_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "3", -1); return htmltext; } if (npcId == GIRAN_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "4", -1); return htmltext; } if (npcId == OREN_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "5", -1); return htmltext; } if (npcId == ADEN_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "6", -1); return htmltext; } if (npcId == HEINE_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "7", -1); return htmltext; } if (npcId == GODDARD_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "8", -1); return htmltext; } if (npcId == RUNE_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "9", -1); return htmltext; } if (npcId == SCHUTTGART_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "10", -1); return htmltext; } if (npcId == HV_DAWN) { player.teleToLocation(-80157, 111344, -4901); player.setVar("id", "11", -1); return htmltext; } // Dusk Locations // if (npcId == GLUDIN_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "1", -1); return htmltext; } if (npcId == GLUDIO_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "2", -1); return htmltext; } if (npcId == DION_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "3", -1); return htmltext; } if (npcId == GIRAN_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "4", -1); return htmltext; } if (npcId == OREN_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "5", -1); return htmltext; } if (npcId == ADEN_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "6", -1); return htmltext; } if (npcId == HEINE_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "7", -1); return htmltext; } if (npcId == GODDARD_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "8", -1); return htmltext; } if (npcId == RUNE_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "9", -1); return htmltext; } if (npcId == SCHUTTGART_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "10", -1); return htmltext; } if (npcId == HV_DUSK) { player.teleToLocation(-81261, 86531, -5157); player.setVar("id", "11", -1); return htmltext; } // Oracle of Dusk/Dawn // htmltext = "Completed.htm"; // back to Gludin Village if (back.equals("1")) { player.teleToLocation(-80826, 149775, -3043); return htmltext; } // back to Gludio Castle Town if (back.equals("2")) { player.teleToLocation(-12672, 122776, -3116); return htmltext; } // back to Dion Castle Town if (back.equals("3")) { player.teleToLocation(15670, 142983, -2705); return htmltext; } // back to Giran Castle Town if (back.equals("4")) { player.teleToLocation(83400, 147943, -3404); return htmltext; } // back to Town of Oren if (back.equals("5")) { player.teleToLocation(82956, 53162, -1495); return htmltext; } // back to Town of Aden if (back.equals("6")) { player.teleToLocation(146331, 25762, -2018); return htmltext; } // back to Heine if (back.equals("7")) { player.teleToLocation(111409, 219364, -3545); return htmltext; } // back to Goddard if (back.equals("8")) { player.teleToLocation(147928, -55273, -2734); return htmltext; } // back to Rune if (back.equals("9")) { player.teleToLocation(43799, -47727, -798); return htmltext; } // back to Schuttgart if (back.equals("10")) { player.teleToLocation(87386, -143246, -1293); return htmltext; } // back to Hunters Village if (back.equals("11")) { player.teleToLocation(116819, 76994, -2714); return htmltext; } return htmltext; }
@Override protected boolean thinkActive() { NpcInstance actor = getActor(); if (actor.isDead()) { return true; } if (_def_think) { doTask(); return true; } if (actor.isMoving) { return true; } if (System.currentTimeMillis() > wait_timeout && (current_point > -1 || Rnd.chance(5))) { if (!wait) { switch (current_point) { case 0: wait_timeout = System.currentTimeMillis() + 30000; wait = true; return true; case 2: wait_timeout = System.currentTimeMillis() + 30000; wait = true; return true; case 14: wait_timeout = System.currentTimeMillis() + 60000; wait = true; return true; case 26: wait_timeout = System.currentTimeMillis() + 30000; wait = true; return true; case 28: wait_timeout = System.currentTimeMillis() + 30000; wait = true; return true; } } wait_timeout = 0; wait = false; current_point++; if (current_point >= points.length) { current_point = 0; } addTaskMove(points[current_point], false); doTask(); return true; } if (randomAnimation()) { return true; } return false; }