private static final void dissolveClan(L2PcInstance player, int clanId) {
    if (!player.isClanLeader()) {
      player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT));
      return;
    }

    final L2Clan clan = player.getClan();
    if (clan.getAllyId() != 0) {
      player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_DISPERSE_THE_CLANS_IN_ALLY));
      return;
    }
    if (clan.isAtWar()) {
      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_WHILE_IN_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, false, false);
  }
Esempio n. 2
0
  @Override
  protected final void writeImpl() {
    writeC(0x96);
    writeS(_activeChar.getName());
    writeD(_clan.getClanId());
    writeD(0x00);
    writeS(_clan.getName());
    writeS(_clan.getLeaderName());
    writeD(_clan.getCrestId()); // -> no, it's no longer used (nuocnam) fix by game
    writeD(_clan.getLevel());
    writeD(_clan.getCastleId());
    writeD(_clan.getHideoutId());
    writeD(_clan.getFortId());
    writeD(_clan.getRank());
    writeD(_clan.getReputationScore());
    writeD(0x00);
    writeD(0x00);

    writeD(_clan.getAllyId()); // c2
    writeS(_clan.getAllyName()); // c2
    writeD(_clan.getAllyCrestId()); // c2
    writeD(_clan.isAtWar() ? 1 : 0); // c3
    writeD(0x00); // T3 Unknown
    writeD(_clan.getMembers().length);

    for (L2ClanMember member : _clan.getMembers()) {
      if (member != null) {
        writeS(member.getName());
        writeD(member.getLevel());
        writeD(member.getClassId());
        writeD(member.getSex() ? 1 : 0);
        writeD(member.getRaceOrdinal());
        writeD(member.isOnline() ? member.getObjectId() : 0);
        writeD(member.getSponsor() != 0 ? 1 : 0);
      }
    }
  }