Ejemplo n.º 1
0
  @Override
  protected void runImpl() {
    if (_castleId < 100) {
      Castle castle = CastleManager.getInstance().getCastleById(_castleId);

      if (castle == null) return;

      SiegeAttackerList sal = new SiegeAttackerList(castle);
      sendPacket(sal);
    } else {
      Fort fort = FortManager.getInstance().getFortById(_castleId);

      if (fort == null) return;

      FortSiegeAttackerList sal = new FortSiegeAttackerList(fort);
      sendPacket(sal);
    }
  }
Ejemplo n.º 2
0
  // Private stuff
  public void dissolveClan(L2PcInstance player, int clanId) {
    if (Config.DEBUG) {
      _log.info(
          player.getObjectId()
              + "("
              + player.getName()
              + ") requested dissolve a clan from "
              + getObjectId()
              + "("
              + getName()
              + ")");
    }

    if (!player.isClanLeader()) {
      player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT));
      return;
    }

    L2Clan clan = player.getClan();
    if (clan.getAllyId() != 0) {
      player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISPERSE_THE_CLANS_IN_ALLY));
      return;
    }

    if (clan.isAtWar() != 0) {
      player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISSOLVE_WHILE_IN_WAR));
      return;
    }

    if (clan.getHasCastle() != 0 || clan.getHasHideout() != 0 || clan.getHasFort() != 0) {
      player.sendPacket(
          new SystemMessage(SystemMessageId.CANNOT_DISSOLVE_WHILE_OWNING_CLAN_HALL_OR_CASTLE));
      return;
    }

    for (Castle castle : CastleManager.getInstance().getCastles()) {
      if (SiegeManager.getInstance().checkIsRegistered(clan, castle.getCastleId())) {
        player.sendPacket(
            new SystemMessage(
                SystemMessageId.CANNOT_DISSOLVE_CAUSE_CLAN_WILL_PARTICIPATE_IN_CASTLE_SIEGE));
        return;
      }
    }

    for (Fort fort : FortManager.getInstance().getForts()) {
      if (FortSiegeManager.getInstance().checkIsRegistered(clan, fort.getFortId())) {
        player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISSOLVE_WHILE_IN_SIEGE));
        return;
      }
    }

    if (player.isInsideZone(L2PcInstance.ZONE_SIEGE)) {
      player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISSOLVE_WHILE_IN_SIEGE));
      return;
    }

    if (clan.getDissolvingExpiryTime() > System.currentTimeMillis()) {
      player.sendPacket(new SystemMessage(SystemMessageId.DISSOLUTION_IN_PROGRESS));
      return;
    }

    clan.setDissolvingExpiryTime(
        System.currentTimeMillis()
            + Config.ALT_CLAN_DISSOLVE_DAYS * 86400000L); // 24*60*60*1000 = 86400000
    clan.updateClanInDB();

    ClanTable.getInstance().scheduleRemoveClan(clan.getClanId());

    // The clan leader should take the XP penalty of a full death.
    player.deathPenalty(false);

    clan = null;
  }