Ejemplo n.º 1
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);
  }
Ejemplo n.º 2
0
 protected void broadcastPacket(L2GameServerPacket mov) {
   if (_Zone != null) {
     for (L2Character characters : _Zone.getCharactersInside()) {
       if (characters instanceof L2PcInstance) {
         characters.sendPacket(mov);
       }
     }
   }
 }
Ejemplo n.º 3
0
  // Clean Antharas's lair.
  public void setUnspawn() {
    // Eliminate players.
    _Zone.oustAllPlayers();

    // Not executed tasks is canceled.
    if (_cubeSpawnTask != null) {
      _cubeSpawnTask.cancel(true);
      _cubeSpawnTask = null;
    }
    if (_monsterSpawnTask != null) {
      _monsterSpawnTask.cancel(true);
      _monsterSpawnTask = null;
    }
    if (_activityCheckTask != null) {
      _activityCheckTask.cancel(false);
      _activityCheckTask = null;
    }
    if (_socialTask != null) {
      _socialTask.cancel(true);
      _socialTask = null;
    }
    if (_mobiliseTask != null) {
      _mobiliseTask.cancel(true);
      _mobiliseTask = null;
    }
    if (_mobsSpawnTask != null) {
      _mobsSpawnTask.cancel(true);
      _mobsSpawnTask = null;
    }
    if (_selfDestructionTask != null) {
      _selfDestructionTask.cancel(true);
      _selfDestructionTask = null;
    }
    if (_moveAtRandomTask != null) {
      _moveAtRandomTask.cancel(true);
      _moveAtRandomTask = null;
    }

    // Delete monsters.
    for (L2Npc mob : _monsters) {
      mob.getSpawn().stopRespawn();
      mob.deleteMe();
    }
    _monsters.clear();

    // Delete teleport cube.
    for (L2Npc cube : _teleportCube) {
      cube.getSpawn().stopRespawn();
      cube.deleteMe();
    }
    _teleportCube.clear();
  }
  @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;
  }