namespace AcDream.Core.Net.Packets;
///
/// Builds retail's connection-level disconnect packet.
///
///
/// ClientNet::LogOffServer at 0x00543EF0 creates the
/// 0x8000 optional header and sends it through
/// SharedNet::SendOptionalHeader at 0x00543160. That path
/// zero-initializes the packet sequence and copies the receiver's network id
/// and iteration into the fixed header. The disconnect is cleartext and has
/// no body.
///
public static class TransportDisconnect
{
public static byte[] Build(ushort networkId, ushort iteration)
{
var header = new PacketHeader
{
Sequence = 0,
Flags = PacketHeaderFlags.Disconnect,
Id = networkId,
Iteration = iteration,
};
return PacketCodec.Encode(
header,
ReadOnlySpan.Empty,
outboundIsaac: null);
}
}