Пример #1
0
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet) {
   if ((npc.getNpcId() == 29019)
       || (npc.getNpcId() == 29066)
       || (npc.getNpcId() == 29067)
       || (npc.getNpcId() == 29068)) {
     npc.broadcastPacket(
         new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
     _cubeSpawnTask = ThreadPoolManager.getInstance().scheduleGeneral(new CubeSpawn(0), 10000);
     GrandBossManager.getInstance().setBossStatus(npc.getNpcId(), DEAD);
     long respawnTime =
         (long) Config.Interval_Of_Antharas_Spawn + getRandom(Config.Random_Of_Antharas_Spawn);
     ThreadPoolManager.getInstance()
         .scheduleGeneral(new UnlockAntharas(npc.getNpcId()), respawnTime);
     // also save the respawn time so that the info is maintained past reboots
     StatsSet info = GrandBossManager.getInstance().getStatsSet(npc.getNpcId());
     info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
     GrandBossManager.getInstance().setStatsSet(npc.getNpcId(), info);
   } else if (npc.getNpcId() == 29069) {
     int countHPHerb = getRandom(6, 18);
     int countMPHerb = getRandom(6, 18);
     for (int i = 0; i < countHPHerb; i++) {
       ((L2MonsterInstance) npc).dropItem(killer, 8602, 1);
     }
     for (int i = 0; i < countMPHerb; i++) {
       ((L2MonsterInstance) npc).dropItem(killer, 8605, 1);
     }
   }
   if (_monsters.contains(npc)) {
     _monsters.remove(npc);
   }
   return super.onKill(npc, killer, isPet);
 }
Пример #2
0
  @Override
  public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet) {
    if ((npc.getNpcId() == 29019)
        || (npc.getNpcId() == 29066)
        || (npc.getNpcId() == 29067)
        || (npc.getNpcId() == 29068)) {
      _LastAction = System.currentTimeMillis();
      if (GrandBossManager.getInstance().getBossStatus(_antharas.getNpcId()) != FIGHTING) {
        _Zone.oustAllPlayers();
      } else if (!FWA_OLDANTHARAS && (_mobsSpawnTask == null)) {
        startMinionSpawns(npc.getNpcId());
      }
    } else if ((npc.getNpcId() > 29069)
        && (npc.getNpcId() < 29077)
        && (npc.getCurrentHp() <= damage)) {
      L2Skill skill = null;
      switch (npc.getNpcId()) {
        case 29070:
        case 29071:
        case 29072:
        case 29073:
        case 29074:
        case 29075:
          skill = SkillTable.getInstance().getInfo(5097, 1);
          break;
        case 29076:
          skill = SkillTable.getInstance().getInfo(5094, 1);
          break;
      }

      npc.doCast(skill);
    }
    return super.onAttack(npc, attacker, damage, isPet);
  }
Пример #3
0
 @Override
 public void run() {
   Long temp = (System.currentTimeMillis() - _LastAction);
   if (temp > FWA_INACTIVITYTIME) {
     GrandBossManager.getInstance().setBossStatus(_antharas.getNpcId(), DORMANT);
     setUnspawn();
   }
 }
Пример #4
0
 @Override
 public void run() {
   GrandBossManager.getInstance().setBossStatus(_bossId, DORMANT);
   if (FWA_DOSERVEREARTHQUAKE) {
     for (L2PcInstance p : L2World.getInstance().getAllPlayersArray()) {
       p.broadcastPacket(new Earthquake(185708, 114298, -8221, 20, 10));
     }
   }
 }
  private Baium() {
    super(Baium.class.getSimpleName(), "ai/individual");
    addFirstTalkId(ANG_VORTEX);
    addTalkId(ANG_VORTEX, TELE_CUBE, BAIUM_STONE);
    addStartNpc(ANG_VORTEX, TELE_CUBE, BAIUM_STONE);
    addAttackId(BAIUM, ARCHANGEL);
    addKillId(BAIUM);
    addSeeCreatureId(BAIUM);
    addSpellFinishedId(BAIUM);

    final StatsSet info = GrandBossManager.getInstance().getStatsSet(BAIUM);
    final int curr_hp = info.getInt("currentHP");
    final int curr_mp = info.getInt("currentMP");
    final int loc_x = info.getInt("loc_x");
    final int loc_y = info.getInt("loc_y");
    final int loc_z = info.getInt("loc_z");
    final int heading = info.getInt("heading");
    final long respawnTime = info.getLong("respawn_time");

    switch (getStatus()) {
      case WAITING:
        {
          setStatus(ALIVE);
        }
      case ALIVE:
        {
          addSpawn(BAIUM_STONE, BAIUM_LOC, false, 0);
          break;
        }
      case IN_FIGHT:
        {
          _baium = (L2GrandBossInstance) addSpawn(BAIUM, loc_x, loc_y, loc_z, heading, false, 0);
          _baium.setCurrentHpMp(curr_hp, curr_mp);
          _lastAttack = System.currentTimeMillis();
          addBoss(_baium);

          for (Location loc : ARCHANGEL_LOC) {
            final L2Npc archangel = addSpawn(ARCHANGEL, loc, false, 0, true);
            startQuestTimer("SELECT_TARGET", 5000, archangel, null);
          }
          startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
          break;
        }
      case DEAD:
        {
          final long remain = respawnTime - System.currentTimeMillis();
          if (remain > 0) {
            startQuestTimer("CLEAR_STATUS", remain, null, null);
          } else {
            notifyEvent("CLEAR_STATUS", null, null);
          }
          break;
        }
    }
  }
Пример #6
0
 // Setting Antharas spawn task.
 public void setAntharasSpawnTask() {
   if (_monsterSpawnTask == null) {
     synchronized (this) {
       if (_monsterSpawnTask == null) {
         GrandBossManager.getInstance().setBossStatus(ANTHARASOLDID, WAITING);
         _monsterSpawnTask =
             ThreadPoolManager.getInstance()
                 .scheduleGeneral(new AntharasSpawn(1), Config.Antharas_Wait_Time);
       }
     }
   }
 }
 private void setRespawn(long respawnTime) {
   GrandBossManager.getInstance()
       .getStatsSet(BAIUM)
       .set("respawn_time", (System.currentTimeMillis() + respawnTime));
 }
 private void setStatus(int status) {
   GrandBossManager.getInstance().setBossStatus(BAIUM, status);
 }
 private void addBoss(L2GrandBossInstance grandboss) {
   GrandBossManager.getInstance().addBoss(grandboss);
 }
 private int getStatus() {
   return GrandBossManager.getInstance().getBossStatus(BAIUM);
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = "";
    QuestState st = player.getQuestState(getName());

    if (st == null) return null;

    switch (npc.getNpcId()) {
      case 13001:
        if (antharasAI() != null) {
          int status = GrandBossManager.getInstance().getBossStatus(29019);
          int statusW = GrandBossManager.getInstance().getBossStatus(29066);
          int statusN = GrandBossManager.getInstance().getBossStatus(29067);
          int statusS = GrandBossManager.getInstance().getBossStatus(29068);

          if (status == 2 || statusW == 2 || statusN == 2 || statusS == 2)
            htmltext = "13001-02.htm";
          else if (status == 3 || statusW == 3 || statusN == 3 || statusS == 3)
            htmltext = "13001-01.htm";
          else if (status == 0
              || status == 1) // If entrance to see Antharas is unlocked (he is Dormant or Waiting)
          {
            if (st.hasQuestItems(3865)) {
              // st.takeItems(3865, 1); // No longer consumed in h5
              L2BossZone zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);

              if (zone != null) zone.allowPlayerEntry(player, 30);

              player.teleToLocation(179700 + Rnd.get(700), 113800 + Rnd.get(2100), -7709);

              if (status == 0) {
                L2GrandBossInstance antharas = GrandBossManager.getInstance().getBoss(29019);
                antharasAI().notifyEvent("waiting", antharas, player);
              }
            } else htmltext = "13001-03.htm";
          }
        }
        break;

      case 31859:
        player.teleToLocation(79800 + Rnd.get(600), 151200 + Rnd.get(1100), -3534);
        break;

      case 31385:
        if (valakasAI() != null) {
          int status = GrandBossManager.getInstance().getBossStatus(29028);

          if (status == 0 || status == 1) {
            if (playerCount >= 200) htmltext = "31385-03.htm";
            else if (st.getInt("allowEnter") == 1) {
              st.unset("allowEnter");
              L2BossZone zone = GrandBossManager.getInstance().getZone(212852, -114842, -1632);

              if (zone != null) zone.allowPlayerEntry(player, 30);

              player.teleToLocation(204328 + Rnd.get(600), -111874 + Rnd.get(600), 70);

              playerCount++;

              if (status == 0) {
                L2GrandBossInstance valakas = GrandBossManager.getInstance().getBoss(29028);
                valakasAI().startQuestTimer("1001", Config.Valakas_Wait_Time, valakas, null);
                GrandBossManager.getInstance().setBossStatus(29028, 1);
              }
            } else htmltext = "31385-04.htm";
          } else if (status == 2) htmltext = "31385-02.htm";
          else htmltext = "31385-01.htm";
        } else htmltext = "31385-01.htm";
        break;

      case 31384:
        DoorTable.getInstance().getDoor(24210004).openMe();
        break;

      case 31686:
        DoorTable.getInstance().getDoor(24210006).openMe();
        break;

      case 31687:
        DoorTable.getInstance().getDoor(24210005).openMe();
        break;

      case 31540:
        if (playerCount < 50) htmltext = "31540-01.htm";
        else if (playerCount < 100) htmltext = "31540-02.htm";
        else if (playerCount < 150) htmltext = "31540-03.htm";
        else if (playerCount < 200) htmltext = "31540-04.htm";
        else htmltext = "31540-05.htm";
        break;

      case 31759:
        player.teleToLocation(150037 + Rnd.get(500), -57720 + Rnd.get(500), -2976);
        break;
    }

    return htmltext;
  }
Пример #12
0
    @Override
    public void run() {
      int npcId;
      L2Spawn antharasSpawn = null;

      switch (_taskId) {
        case 1: // Spawn.
          // Strength of Antharas is decided by the number of players that
          // invaded the lair.
          _monsterSpawnTask.cancel(false);
          _monsterSpawnTask = null;
          if (FWA_OLDANTHARAS) {
            npcId = 29019; // old
          } else if (_players.size() <= FWA_LIMITOFWEAK) {
            npcId = 29066; // weak
          } else if (_players.size() > FWA_LIMITOFNORMAL) {
            npcId = 29068; // strong
          } else {
            npcId = 29067; // normal
          }

          // Do spawn.
          antharasSpawn = _monsterSpawn.get(npcId);
          _antharas = (L2GrandBossInstance) antharasSpawn.doSpawn();
          GrandBossManager.getInstance().addBoss(_antharas);

          _monsters.add(_antharas);
          _antharas.setIsImmobilized(true);

          GrandBossManager.getInstance().setBossStatus(ANTHARASOLDID, DORMANT);
          GrandBossManager.getInstance().setBossStatus(npcId, FIGHTING);
          _LastAction = System.currentTimeMillis();
          // Start repeating timer to check for inactivity
          _activityCheckTask =
              ThreadPoolManager.getInstance()
                  .scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);

          // Setting 1st time of minions spawn task.
          if (!FWA_OLDANTHARAS) {
            startMinionSpawns(npcId);
          }

          // Set next task.
          if (_socialTask != null) {
            _socialTask.cancel(true);
            _socialTask = null;
          }
          _socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(2), 16);
          break;
        case 2:
          // Set camera.
          broadcastPacket(
              new SpecialCamera(_antharas.getObjectId(), 700, 13, -19, 0, 20000, 0, 0, 1, 0));

          // Set next task.
          if (_socialTask != null) {
            _socialTask.cancel(true);
            _socialTask = null;
          }
          _socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(3), 3000);
          break;

        case 3:
          // Do social.
          broadcastPacket(
              new SpecialCamera(_antharas.getObjectId(), 700, 13, 0, 6000, 20000, 0, 0, 1, 0));
          // Set next task.
          if (_socialTask != null) {
            _socialTask.cancel(true);
            _socialTask = null;
          }
          _socialTask =
              ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(4), 10000);
          break;
        case 4:
          broadcastPacket(
              new SpecialCamera(_antharas.getObjectId(), 3700, 0, -3, 0, 10000, 0, 0, 1, 0));
          // Set next task.
          if (_socialTask != null) {
            _socialTask.cancel(true);
            _socialTask = null;
          }
          _socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(5), 200);
          break;

        case 5:
          // Do social.
          broadcastPacket(
              new SpecialCamera(_antharas.getObjectId(), 1100, 0, -3, 22000, 30000, 0, 0, 1, 0));
          // Set next task.
          if (_socialTask != null) {
            _socialTask.cancel(true);
            _socialTask = null;
          }
          _socialTask =
              ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(6), 10800);
          break;

        case 6:
          // Set camera.
          broadcastPacket(
              new SpecialCamera(_antharas.getObjectId(), 1100, 0, -3, 300, 7000, 0, 0, 1, 0));
          // Set next task.
          if (_socialTask != null) {
            _socialTask.cancel(true);
            _socialTask = null;
          }
          _socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(7), 1900);
          break;

        case 7:
          _antharas.abortCast();

          _mobiliseTask =
              ThreadPoolManager.getInstance().scheduleGeneral(new SetMobilised(_antharas), 16);

          // Move at random.
          if (FWA_MOVEATRANDOM) {
            L2CharPosition pos =
                new L2CharPosition(getRandom(175000, 178500), getRandom(112400, 116000), -7707, 0);
            _moveAtRandomTask =
                ThreadPoolManager.getInstance()
                    .scheduleGeneral(new MoveAtRandom(_antharas, pos), 500);
          }

          if (_socialTask != null) {
            _socialTask.cancel(true);
            _socialTask = null;
          }
          break;
      }
    }
Пример #13
0
  // Initialize
  private void init() {
    // Setting spawn data of monsters.
    try {
      _Zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);
      L2NpcTemplate template1;
      L2Spawn tempSpawn;

      // Old Antharas
      template1 = NpcTable.getInstance().getTemplate(ANTHARASOLDID);
      tempSpawn = new L2Spawn(template1);
      tempSpawn.setLocx(181323);
      tempSpawn.setLocy(114850);
      tempSpawn.setLocz(-7623);
      tempSpawn.setHeading(32542);
      tempSpawn.setAmount(1);
      tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
      SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
      _monsterSpawn.put(29019, tempSpawn);

      // Weak Antharas
      template1 = NpcTable.getInstance().getTemplate(ANTHARASWEAKID);
      tempSpawn = new L2Spawn(template1);
      tempSpawn.setLocx(181323);
      tempSpawn.setLocy(114850);
      tempSpawn.setLocz(-7623);
      tempSpawn.setHeading(32542);
      tempSpawn.setAmount(1);
      tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
      SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
      _monsterSpawn.put(29066, tempSpawn);

      // Normal Antharas
      template1 = NpcTable.getInstance().getTemplate(ANTHARASNORMALID);
      tempSpawn = new L2Spawn(template1);
      tempSpawn.setLocx(181323);
      tempSpawn.setLocy(114850);
      tempSpawn.setLocz(-7623);
      tempSpawn.setHeading(32542);
      tempSpawn.setAmount(1);
      tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
      SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
      _monsterSpawn.put(29067, tempSpawn);

      // Strong Antharas
      template1 = NpcTable.getInstance().getTemplate(ANTHARASSTRONGID);
      tempSpawn = new L2Spawn(template1);
      tempSpawn.setLocx(181323);
      tempSpawn.setLocy(114850);
      tempSpawn.setLocz(-7623);
      tempSpawn.setHeading(32542);
      tempSpawn.setAmount(1);
      tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
      SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
      _monsterSpawn.put(29068, tempSpawn);
    } catch (Exception e) {
      log.warning(e.getMessage());
    }

    // Setting spawn data of teleport cube.
    try {
      L2NpcTemplate Cube = NpcTable.getInstance().getTemplate(_teleportCubeId);
      L2Spawn spawnDat;
      for (int[] element : _teleportCubeLocation) {
        spawnDat = new L2Spawn(Cube);
        spawnDat.setAmount(1);
        spawnDat.setLocx(element[0]);
        spawnDat.setLocy(element[1]);
        spawnDat.setLocz(element[2]);
        spawnDat.setHeading(element[3]);
        spawnDat.setRespawnDelay(60);
        spawnDat.setLocation(0);
        SpawnTable.getInstance().addNewSpawn(spawnDat, false);
        _teleportCubeSpawn.add(spawnDat);
      }
    } catch (Exception e) {
      log.warning(e.getMessage());
    }
    int status = GrandBossManager.getInstance().getBossStatus(ANTHARASOLDID);
    if (FWA_OLDANTHARAS || (status == WAITING)) {
      StatsSet info = GrandBossManager.getInstance().getStatsSet(ANTHARASOLDID);
      Long respawnTime = info.getLong("respawn_time");
      if ((status == DEAD) && (respawnTime <= System.currentTimeMillis())) {
        // the time has already expired while the server was offline. Immediately spawn antharas in
        // his cave.
        // also, the status needs to be changed to DORMANT
        GrandBossManager.getInstance().setBossStatus(ANTHARASOLDID, DORMANT);
        status = DORMANT;
      } else if (status == FIGHTING) {
        int loc_x = info.getInteger("loc_x");
        int loc_y = info.getInteger("loc_y");
        int loc_z = info.getInteger("loc_z");
        int heading = info.getInteger("heading");
        int hp = info.getInteger("currentHP");
        int mp = info.getInteger("currentMP");
        _antharas =
            (L2GrandBossInstance) addSpawn(ANTHARASOLDID, loc_x, loc_y, loc_z, heading, false, 0);
        GrandBossManager.getInstance().addBoss(_antharas);
        _antharas.setCurrentHpMp(hp, mp);
        _LastAction = System.currentTimeMillis();
        // Start repeating timer to check for inactivity
        _activityCheckTask =
            ThreadPoolManager.getInstance()
                .scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);
      } else if (status == DEAD) {
        ThreadPoolManager.getInstance()
            .scheduleGeneral(
                new UnlockAntharas(ANTHARASOLDID), respawnTime - System.currentTimeMillis());
      } else {
        setAntharasSpawnTask();
      }
    } else {
      int statusWeak = GrandBossManager.getInstance().getBossStatus(ANTHARASWEAKID);
      int statusNormal = GrandBossManager.getInstance().getBossStatus(ANTHARASNORMALID);
      int statusStrong = GrandBossManager.getInstance().getBossStatus(ANTHARASSTRONGID);
      int antharasId = 0;
      if ((statusWeak == FIGHTING) || (statusWeak == DEAD)) {
        antharasId = ANTHARASWEAKID;
        status = statusWeak;
      } else if ((statusNormal == FIGHTING) || (statusNormal == DEAD)) {
        antharasId = ANTHARASNORMALID;
        status = statusNormal;
      } else if ((statusStrong == FIGHTING) || (statusStrong == DEAD)) {
        antharasId = ANTHARASSTRONGID;
        status = statusStrong;
      }
      if ((antharasId != 0) && (status == FIGHTING)) {
        StatsSet info = GrandBossManager.getInstance().getStatsSet(antharasId);
        int loc_x = info.getInteger("loc_x");
        int loc_y = info.getInteger("loc_y");
        int loc_z = info.getInteger("loc_z");
        int heading = info.getInteger("heading");
        int hp = info.getInteger("currentHP");
        int mp = info.getInteger("currentMP");
        _antharas =
            (L2GrandBossInstance) addSpawn(antharasId, loc_x, loc_y, loc_z, heading, false, 0);
        GrandBossManager.getInstance().addBoss(_antharas);
        _antharas.setCurrentHpMp(hp, mp);
        _LastAction = System.currentTimeMillis();
        // Start repeating timer to check for inactivity
        _activityCheckTask =
            ThreadPoolManager.getInstance()
                .scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);
      } else if ((antharasId != 0) && (status == DEAD)) {
        StatsSet info = GrandBossManager.getInstance().getStatsSet(antharasId);
        Long respawnTime = info.getLong("respawn_time");
        if (respawnTime <= System.currentTimeMillis()) {
          // the time has already expired while the server was offline. Immediately spawn antharas
          // in his cave.
          // also, the status needs to be changed to DORMANT
          GrandBossManager.getInstance().setBossStatus(antharasId, DORMANT);
          status = DORMANT;
        } else {
          ThreadPoolManager.getInstance()
              .scheduleGeneral(
                  new UnlockAntharas(antharasId), respawnTime - System.currentTimeMillis());
        }
      }
    }
  }