@Override
  public String onKill(NpcInstance npc, QuestState qs) {
    final Player player = qs.getPlayer();

    if (player.getParty() == null) {
      qs.setCond(5);
    } else {
      for (Player member : player.getParty().getPartyMembers()) {
        final QuestState stats = member.getQuestState(Q00480_AnotherLegacyOfCrumaTower.class);

        if ((stats == null) || (stats.getCond() != 4)) {
          continue;
        }

        stats.setCond(5);
      }
    }

    qs.getPlayer()
        .getReflection()
        .addSpawnWithoutRespawn(
            MARTES_NPC,
            Location.findPointToStay(qs.getPlayer(), 50, 100),
            qs.getPlayer().getGeoIndex());
    return null;
  }
 /** 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;
 }
Example #3
0
 /**
  * Method onEvtAttacked.
  *
  * @param attacker Creature
  * @param damage int
  */
 @Override
 protected void onEvtAttacked(Creature attacker, int damage) {
   final NpcInstance actor = getActor();
   if (attacker != null) {
     final Location pos = Location.findPointToStay(actor, 150, 250);
     if (GeoEngine.canMoveToCoord(
         attacker.getX(),
         attacker.getY(),
         attacker.getZ(),
         pos.x,
         pos.y,
         pos.z,
         actor.getGeoIndex())) {
       actor.setRunning();
       addTaskMove(pos, false);
     }
   }
 }
Example #4
0
 /**
  * Method onEvtSeeSpell.
  *
  * @param skill Skill
  * @param caster Creature
  */
 @Override
 protected void onEvtSeeSpell(Skill skill, Creature caster) {
   final NpcInstance actor = getActor();
   if (skill.isMagic()) {
     return;
   }
   if (_mobsNotSpawned) {
     _mobsNotSpawned = false;
     for (int i = 0; i < MOBS_COUNT; i++) {
       try {
         SimpleSpawner sp = new SimpleSpawner(NpcHolder.getInstance().getTemplate(MOBS));
         sp.setLoc(Location.findPointToStay(actor, 100, 120));
         NpcInstance npc = sp.doSpawn(true);
         if (caster.isPet() || caster.isServitor()) {
           npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, caster, Rnd.get(2, 100));
         }
         npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, caster.getPlayer(), Rnd.get(1, 100));
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }
 }
 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);
 }