/** * Method sendOrderToMinions. * * @param actor NpcInstance */ private void sendOrderToMinions(NpcInstance actor) { if (!actor.isInCombat()) { _lastMinionsTargetRef = HardReferences.emptyRef(); return; } final MinionList ml = actor.getMinionList(); if ((ml == null) || !ml.hasMinions()) { _lastMinionsTargetRef = HardReferences.emptyRef(); return; } final long now = System.currentTimeMillis(); if ((_nextOrderTime > now) && (_lastMinionsTargetRef.get() != null)) { final Player old_target = _lastMinionsTargetRef.get(); if ((old_target != null) && !old_target.isAlikeDead()) { for (MinionInstance m : ml.getAliveMinions()) { if (!m.getAI().getAttackTarget().equals(old_target)) { m.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, old_target, 10000000); } } return; } } _nextOrderTime = now + 30000; final List<Player> pl = World.getAroundPlayers(actor); if (pl.isEmpty()) { _lastMinionsTargetRef = HardReferences.emptyRef(); return; } final List<Player> alive = new LazyArrayList<>(); for (Player p : pl) { if (!p.isAlikeDead()) { alive.add(p); } } if (alive.isEmpty()) { _lastMinionsTargetRef = HardReferences.emptyRef(); return; } final Player target = alive.get(Rnd.get(alive.size())); _lastMinionsTargetRef = target.getRef(); Functions.npcSay(actor, "You " + target.getName() + "! Attack them!"); for (MinionInstance m : ml.getAliveMinions()) { m.getAggroList().clear(); m.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, target, 10000000); } }
@Override protected boolean thinkActive() { NpcInstance actor = getActor(); if (Rnd.chance(8)) { Functions.npcSay(actor, NpcString.I_HIT_THINGS_THEY_FALL_DEAD); } return false; }
/** * Method run. * * @see java.lang.Runnable#run() */ @Override public void run() { Functions.npcShout(BlacksmithNpc, mammonText[Rnd.get(mammonText.length)]); final int nextTown = Rnd.get(MAMMON_PRIEST_POINTS.length); PriestNpc.teleToLocation(MAMMON_PRIEST_POINTS[nextTown]); MerchantNpc.teleToLocation(MAMMON_MERCHANT_POINTS[nextTown]); BlacksmithNpc.teleToLocation(MAMMON_BLACKSMITH_POINTS[nextTown]); }
/** * Method onEvtDead. * * @param killer Creature */ @Override protected void onEvtDead(Creature killer) { final NpcInstance actor = getActor(); if (Rnd.chance(30)) { Functions.npcSay(actor, "Враги! В�?�?ду враги! В�?е �?�?да, враги зде�?�?!"); } actor.deleteMe(); }
@Override protected boolean thinkActive() { NpcInstance actor = getActor(); if (Rnd.chance(3)) { switch (actor.getNpcId()) { case 33172: Functions.npcSay(actor, NpcString.THE_ONLY_GOOD_SHILEN_CREATURE_IS_A_DEAD_ONE); break; case 33170: Functions.npcSay(actor, NpcString.GET_BEHIND_ME_GET_BEHIND_ME); break; default: break; } } return startAttack(); }
/** Method onEvtSpawn. */ @Override public void onEvtSpawn() { super.onEvtSpawn(); ZONE_3.setActive(true); Functions.npcShout( getActor(), NpcString .HEH_HEH_I_SEE_THAT_THE_FEAST_HAS_BEGAN_BE_WARY_THE_CURSE_OF_THE_HELLMANN_FAMILY_HAS_POISONED_THIS_LAND); }
/** Method runImpl. */ @Override public void runImpl() { Functions.npcShout( CastleMassTeleporterInstance.this, NpcString.THE_DEFENDERS_OF_S1_CASTLE_WILL_BE_TELEPORTED_TO_THE_INNER_CASTLE, "#" + getCastle().getNpcStringName().getId()); for (Player p : World.getAroundPlayers(CastleMassTeleporterInstance.this, 200, 50)) { p.teleToLocation(Location.findPointToStay(_teleportLoc, 10, 100, p.getGeoIndex())); } _teleportTask = null; }
/** * Method onEvtScriptEvent. * * @param event String * @param arg1 Object * @param arg2 Object */ @Override protected void onEvtScriptEvent(String event, Object arg1, Object arg2) { super.onEvtScriptEvent(event, arg1, arg2); switch (event) { case "SHOUT_ALL_1": Functions.npcSayInRange( getActor(), 1500, NpcString.valueOf(MESSAGES_1[Rnd.get(MESSAGES_1.length)])); startBattle = true; break; case "SHOUT_ALL_2": Functions.npcSayInRange( getActor(), 1500, NpcString.valueOf(MESSAGES_2[Rnd.get(MESSAGES_2.length)])); break; case "TENTACLE_DIE": diedTentacle++; break; } }
/** * Method thinkActive. * * @return boolean */ @Override protected boolean thinkActive() { final NpcInstance actor = getActor(); if (actor.isDead()) { return true; } if (_def_think) { doTask(); return true; } if ((System.currentTimeMillis() > wait_timeout) && ((current_point > -1) || Rnd.chance(5))) { if (!wait) { switch (current_point) { case 5: wait_timeout = System.currentTimeMillis() + 15000; Functions.npcSay(actor, "The Mother Tree is always so gorgeous!"); wait = true; return true; case 9: wait_timeout = System.currentTimeMillis() + 60000; Functions.npcSay(actor, "Lady Mirabel, may the peace of the lake be with you!"); wait = true; return true; } } wait_timeout = 0; wait = false; current_point++; if (current_point >= points.length) { current_point = 0; } addTaskMove(points[current_point], true); doTask(); return true; } if (randomAnimation()) { return true; } return false; }
/** * Method onEvtDead. * * @param killer Creature */ @Override public void onEvtDead(Creature killer) { final 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); final ClanHallSiegeEvent siegeEvent = actor.getEvent(ClanHallSiegeEvent.class); if (siegeEvent == null) { return; } final SpawnExObject spawnExObject = siegeEvent.getFirstObject(ClanHallSiegeEvent.BOSS); final NpcInstance lidiaNpc = spawnExObject.getFirstSpawned(); if (lidiaNpc.getCurrentHpRatio() == 1.) { lidiaNpc.setCurrentHp(lidiaNpc.getMaxHp() >> 1, true); } }
/** Method sayRndMsg. */ private void sayRndMsg() { final NpcInstance actor = getActor(); if (actor == null) { return; } NpcString ns; switch (Rnd.get(6)) { case 1: ns = NpcString.WHEN_YOU_GO_TO_THE_MUSEUM_SPEAK_TO_PANTHEON; break; case 2: ns = NpcString.WHEN_YOU_GO_TO_THE_MUSEUM_SPEAK_TO_PANTHEON; break; case 3: ns = NpcString.WHEN_YOU_GO_TO_THE_MUSEUM_SPEAK_TO_PANTHEON; break; case 4: ns = NpcString.WHEN_YOU_GO_TO_THE_MUSEUM_SPEAK_TO_PANTHEON; break; case 5: ns = NpcString.WHEN_YOU_GO_TO_THE_MUSEUM_SPEAK_TO_PANTHEON; break; default: ns = NpcString.WHEN_YOU_GO_TO_THE_MUSEUM_SPEAK_TO_PANTHEON; break; } Functions.npcSay(actor, ns); }
private void spawnSoulOfWell(QuestState st) { SoulOfWellInstance = Functions.spawn(Location.findPointToStay(st.getPlayer(), 50, 100), SoulOfWell); }
private void spawnGhostOfPriest(QuestState st) { GhostOfPriestInstance = Functions.spawn(Location.findPointToStay(st.getPlayer(), 50, 100), GhostOfPriest); }