Exemple #1
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);
      }
    }
  }
  @Override
  protected final void writeImpl() {
    writeC(0xcb);
    writeD(_castle.getResidenceId());
    writeD(0x00); // Unknown
    writeD(0x01); // Unknown
    writeD(0x00); // Unknown

    final int size =
        _castle.getSiege().getDefenderWaitingClans().size()
            + _castle.getSiege().getDefenderClans().size()
            + (_castle.getOwner() != null ? 1 : 0);

    writeD(size);
    writeD(size);

    // Add owners
    final L2Clan ownerClan = _castle.getOwner();
    if (ownerClan != null) {
      writeD(ownerClan.getId());
      writeS(ownerClan.getName());
      writeS(ownerClan.getLeaderName());
      writeD(ownerClan.getCrestId());
      writeD(0x00); // signed time (seconds) (not storated by L2J)
      writeD(SiegeClanType.OWNER.ordinal());
      writeD(ownerClan.getAllyId());
      writeS(ownerClan.getAllyName());
      writeS(""); // AllyLeaderName
      writeD(ownerClan.getAllyCrestId());
    }

    // List of confirmed defenders
    for (L2SiegeClan siegeClan : _castle.getSiege().getDefenderClans()) {
      final L2Clan defendingClan = ClanTable.getInstance().getClan(siegeClan.getClanId());
      if ((defendingClan == null) || (defendingClan == _castle.getOwner())) {
        continue;
      }

      writeD(defendingClan.getId());
      writeS(defendingClan.getName());
      writeS(defendingClan.getLeaderName());
      writeD(defendingClan.getCrestId());
      writeD(0x00); // signed time (seconds) (not storated by L2J)
      writeD(SiegeClanType.DEFENDER.ordinal());
      writeD(defendingClan.getAllyId());
      writeS(defendingClan.getAllyName());
      writeS(""); // AllyLeaderName
      writeD(defendingClan.getAllyCrestId());
    }

    // List of not confirmed defenders
    for (L2SiegeClan siegeClan : _castle.getSiege().getDefenderWaitingClans()) {
      final L2Clan defendingClan = ClanTable.getInstance().getClan(siegeClan.getClanId());
      if (defendingClan == null) {
        continue;
      }

      writeD(defendingClan.getId());
      writeS(defendingClan.getName());
      writeS(defendingClan.getLeaderName());
      writeD(defendingClan.getCrestId());
      writeD(0x00); // signed time (seconds) (not storated by L2J)
      writeD(SiegeClanType.DEFENDER_PENDING.ordinal());
      writeD(defendingClan.getAllyId());
      writeS(defendingClan.getAllyName());
      writeS(""); // AllyLeaderName
      writeD(defendingClan.getAllyCrestId());
    }
  }