/** * Method onEvtClanAttacked. * * @param attacked_member Creature * @param attacker Creature * @param damage int */ @Override protected void onEvtClanAttacked(Creature attacked_member, Creature attacker, int damage) { super.onEvtClanAttacked(attacked_member, attacker, damage); final NpcInstance actor = getActor(); if (_healSkills.length == 0) { return; } if (attacked_member.isDead() || actor.isDead() || (attacked_member.getCurrentHpPercents() > 50)) { return; } int heal_chance = 0; if (attacked_member.getId() == actor.getId()) { heal_chance = (attacked_member.getObjectId() == actor.getObjectId()) ? 100 : 0; } else { heal_chance = (attacked_member.getId() == Orfen_id) ? 90 : 10; } if (Rnd.chance(heal_chance) && canUseSkill(_healSkills[0], attacked_member, -1)) { addTaskAttack(attacked_member, _healSkills[0], 1000000); } }
@Override public String onKill(NpcInstance npc, QuestState qs) { if (qs.getCond() == 1) { qs.rollAndGive(ARTICLES_DEAD_HEROES, 1, CHANCE + ((npc.getId() - 20234) * 2)); } return null; }
@Override public String onTalk(NpcInstance npc, QuestState qs) { if (qs.isCompleted()) { return "completed"; } String htmltext = "noquest"; final int cond = qs.getCond(); final int npcId = npc.getId(); switch (npcId) { case BABENCO: if (cond == 0) { if (qs.getPlayer().getLevel() < 20) { htmltext = "guard_babenco_q0039_0102.htm"; qs.exitCurrentQuest(true); } else if (qs.getPlayer().getLevel() >= 20) { htmltext = "guard_babenco_q0039_0101.htm"; } } else if (cond == 1) { htmltext = "guard_babenco_q0039_0105.htm"; } break; case BATHIS: switch (cond) { case 1: htmltext = "captain_bathia_q0039_0101.htm"; break; case 2: if ((qs.getQuestItemsCount(BBN) < 100) || (qs.getQuestItemsCount(RBN) < 100)) { htmltext = "captain_bathia_q0039_0203.htm"; } break; case 3: if ((qs.getQuestItemsCount(BBN) == 100) && (qs.getQuestItemsCount(RBN) == 100)) { htmltext = "captain_bathia_q0039_0202.htm"; } break; case 4: if ((qs.getQuestItemsCount(IP) < 30) || (qs.getQuestItemsCount(GML) < 30)) { htmltext = "captain_bathia_q0039_0304.htm"; } break; case 5: if ((qs.getQuestItemsCount(IP) == 30) && (qs.getQuestItemsCount(GML) == 30)) { htmltext = "captain_bathia_q0039_0303.htm"; } break; } break; } return htmltext; }
@Override public String onKill(NpcInstance npc, QuestState qs) { if ((qs.getCond() == 1) && (npc.getId() == SPEZION)) { qs.playSound(SOUND_MIDDLE); qs.setCond(2); } return null; }
/** * Method getBrother. * * @return NpcInstance */ private NpcInstance getBrother() { final NpcInstance actor = getActor(); int brotherId = 0; if (actor.getId() == 25665) { brotherId = 25666; } else if (actor.getId() == 25666) { brotherId = 25665; } for (NpcInstance npc : actor.getReflection().getNpcs()) { if (npc.getId() == brotherId) { return npc; } } return null; }
@Override public String onKill(NpcInstance npc, QuestState qs) { if ((qs.getState() != STARTED) || (qs.getQuestItemsCount(ROYAL_MEMBERSHIP) == 0)) { return null; } final int[] droplist = MOBS.get(npc.getId()); qs.rollAndGive(droplist[Rnd.get(droplist.length)], 1, 10); return null; }
@Override public String onKill(NpcInstance npc, QuestState qs) { final int npcId = npc.getId(); final int cond = qs.getCond(); if (cond == 2) { switch (npcId) { case LIZARDMAN: case LIZARDMAN_SCOUT: if (qs.getQuestItemsCount(BBN) <= 99) { qs.giveItems(BBN, 1); } break; case LIZARDMAN_GUARD: if (qs.getQuestItemsCount(RBN) <= 99) { qs.giveItems(RBN, 1); } break; } if ((qs.getQuestItemsCount(BBN) + qs.getQuestItemsCount(RBN)) == 200) { qs.setCond(3); qs.playSound(SOUND_MIDDLE); } else { qs.playSound(SOUND_ITEMGET); } } else if (cond == 4) { switch (npcId) { case LIZARDMAN_SCOUT: case LIZARDMAN_GUARD: if (qs.getQuestItemsCount(IP) <= 29) { qs.giveItems(IP, 1); } break; case GIANT_ARANEID: if (qs.getQuestItemsCount(GML) <= 29) { qs.giveItems(GML, 1); } break; } if ((qs.getQuestItemsCount(IP) + qs.getQuestItemsCount(GML)) == 60) { qs.setCond(5); qs.playSound(SOUND_MIDDLE); } else { qs.playSound(SOUND_ITEMGET); } } return null; }
@Override public String onTalk(NpcInstance npc, QuestState qs) { final int cond = qs.getCond(); if (qs.getState() == 1) { if (qs.getPlayer().getLevel() < 38) { return "33155-lvl.htm"; } else if (!qs.isNowAvailable()) { return "33155-comp.htm"; } } switch (npc.getId()) { case LILEJ: if (cond < 5) { return "33155.htm"; } break; case LINKENS: if (cond == 1) { return "33163.htm"; } else if (cond == 2) { return "33163-5.htm"; } else if (cond == 5) { if (qs.getQuestItemsCount(MARTES_CORE) == 0) { return "33163-14.htm"; } else if (qs.getQuestItemsCount(MARTES_CORE) != 0) { qs.takeItems(MARTES_CORE, -1); qs.takeItems(TRESURE_TOOL, -1); qs.addExpAndSp(240000, 156000); qs.unset("cond"); qs.playSound(SOUND_FINISH); qs.exitCurrentQuest(this); return "33163-15.htm"; } } break; case MARTES_NPC: if (cond == 3) { return "33292.htm"; } else if (cond == 5) { return "33292-1.htm"; } break; } return "noquest"; }
@Override public String onEvent(String event, QuestState qs, NpcInstance npc) { String htmltext = event; switch (event) { case "head_blacksmith_vergara_q0382_03.htm": if ((qs.getPlayer().getLevel() >= 55) && (qs.getQuestItemsCount(ROYAL_MEMBERSHIP) > 0)) { qs.setCond(1); qs.setState(STARTED); qs.playSound(SOUND_ACCEPT); } else { htmltext = "head_blacksmith_vergara_q0382_01.htm"; qs.exitCurrentQuest(true); } break; case "list": MultiSellHolder.getInstance().SeparateAndSend(382, qs.getPlayer(), 0, npc.getId()); htmltext = null; break; } return htmltext; }
@Override public String onTalk(NpcInstance npc, QuestState qs) { if (qs.isCompleted()) { return "completed"; } String htmltext = "noquest"; final int cond = qs.getCond(); final int npcId = npc.getId(); final int id = qs.getState(); final long amount = qs.getQuestItemsCount(ARTICLES_DEAD_HEROES); if (id == CREATED) { if (qs.getPlayer().getLevel() >= 48) { htmltext = "30754-02.htm"; } else { htmltext = "30754-01.htm"; qs.exitCurrentQuest(true); } } else if ((npcId == GILMORE) && (cond == 1)) { if (amount > 0) { htmltext = "30754-05.htm"; } else { htmltext = "30754-09.htm"; } } else if (cond == 2) { if (npcId == GILMORE) { htmltext = "30754-15.htm"; } else if (rewards(qs, npcId)) { htmltext = str(npcId) + "-01.htm"; qs.setCond(3); qs.playSound(SOUND_MIDDLE); } } else if (cond == 3) { if (npcId == GILMORE) { int amt = qs.getInt("amount"); int mission = qs.getInt("mission"); int bonus = 0; if (mission == 1) { bonus = 1500; } else if (mission == 2) { qs.giveItems(4044, 1); } else if (mission == 3) { qs.giveItems(4043, 1); } else if (mission == 4) { qs.giveItems(4042, 1); } if (amt > 0) { qs.unset("amount"); qs.giveItems(ADENA_ID, (amt * 50) + bonus, true); } htmltext = "30754-16.htm"; qs.setCond(1); qs.unset("mission"); } else { htmltext = str(npcId) + "-02.htm"; } } return htmltext; }
@Override public String onTalk(NpcInstance npc, QuestState qs) { if (qs.isCompleted()) { return "completed"; } String htmltext = "noquest"; final int cond = qs.getCond(); final int npcId = npc.getId(); final int id = qs.getState(); switch (npcId) { case Flauen: if (id == CREATED) { if (qs.getPlayer().getLevel() < 82) { qs.exitCurrentQuest(true); htmltext = "30899-00.htm"; } else { htmltext = "30899-01.htm"; } } else if (id == COMPLETED) { htmltext = "30899-09.htm"; } else if (cond < 5) { htmltext = "30899-07.htm"; } else { htmltext = "30899-08.htm"; } break; case Iason: if (cond == 1) { qs.takeItems(FlauensLetter, -1); htmltext = "30969-01.htm"; } else if ((cond > 1) && (cond < 4)) { htmltext = "30969-06.htm"; } else if (cond == 4) { htmltext = "30969-07.htm"; } else if (cond > 4) { htmltext = "30969-11.htm"; } break; case Roman: if (cond == 2) { htmltext = "30897-01.htm"; } else if (cond > 2) { htmltext = "30897-04.htm"; } break; case Morelyn: if (cond == 3) { htmltext = "30925-01.htm"; } else if (cond > 3) { htmltext = "30925-04.htm"; } break; case Helvetica: if (cond == 5) { htmltext = "32641-01.htm"; } else if (id == COMPLETED) { htmltext = "32641-03.htm"; } break; case Athenia: if (cond == 6) { htmltext = "32643-01.htm"; } else if (id == COMPLETED) { htmltext = "32643-03.htm"; } break; } return htmltext; }