@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 onZoneEnter.
     *
     * @param zone Zone
     * @param cha Creature
     * @see lineage2.gameserver.listener.zone.OnZoneEnterLeaveListener#onZoneEnter(Zone, Creature)
     */
    @Override
    public void onZoneEnter(Zone zone, Creature cha) {
      if ((zone.getParams() == null) || !cha.isPlayable() || cha.getPlayer().isGM()) {
        return;
      }

      if (cha.getLevel() > zone.getParams().getInteger("levelLimit")) {
        if (cha.isPlayer()) {
          cha.getPlayer()
              .sendMessage("Your level is too high to access this zone. You've been banished out.");
        }

        cha.teleToLocation(Location.parseLoc(zone.getParams().getString("tele")));
      }
    }
 @Override
 protected final void writeImpl() {
   writeEx(0x6E);
   writeD(char_id);
   writeD(boat_id);
   writeD(_destination.getX());
   writeD(_destination.getY());
   writeD(_destination.getZ());
   writeD(_origin.getX());
   writeD(_origin.getY());
   writeD(_origin.getZ());
 }
Example #5
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 #6
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();
       }
     }
   }
 }
Example #7
0
  /** Method thinkAttack. */
  @Override
  protected void thinkAttack() {
    final NpcInstance actor = getActor();
    final NpcInstance brother = getBrother();

    if (!brother.isDead() && !actor.isInRange(brother, 300)) {
      actor.altOnMagicUseTimer(getActor(), SkillTable.getInstance().getInfo(6371, 1));
    } else {
      removeInvul(actor);
    }

    if ((_spawnTimer + 40000) < System.currentTimeMillis()) {
      _spawnTimer = System.currentTimeMillis();
      final NpcInstance mob =
          actor
              .getReflection()
              .addSpawnWithoutRespawn(
                  _minions[Rnd.get(_minions.length)], Location.findAroundPosition(actor, 300), 0);
      mob.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, actor.getAggressionTarget(), 1000);
    }

    super.thinkAttack();
  }
 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);
 }
 /**
  * Constructor for CastleMassTeleporterInstance.
  *
  * @param objectId int
  * @param template NpcTemplate
  */
 public CastleMassTeleporterInstance(int objectId, NpcTemplate template) {
   super(objectId, template);
   _teleportLoc = Location.parseLoc(template.getAIParams().getString("teleport_loc"));
 }