TigerEmu/Communication/Messages/Outgoing/Handshake/SessionParametersComposer.cs

49 lines
1.6 KiB
C#

using Tiger.Communication.Messages.Interfaces;
using Tiger.Communication.Messages.Types;
namespace Tiger.Communication.Messages.Outgoing.Handshake;
public class SessionParametersComposer : IMessageComposer
{
private readonly int _coppaType;
private readonly bool _voucherEnabled;
private readonly bool _parentEmailRequest;
private readonly bool _parentEmailRequestRegistration;
private readonly bool _allowDirectMail;
private readonly string _dateFormat;
public SessionParametersComposer(int coppaType, bool voucherEnabled, bool parentEmailRequest,
bool parentEmailRequestRegistration, bool allowDirectMail, string dateFormat)
{
_coppaType = coppaType;
_voucherEnabled = voucherEnabled;
_parentEmailRequest = parentEmailRequest;
_parentEmailRequestRegistration = parentEmailRequestRegistration;
_allowDirectMail = allowDirectMail;
_dateFormat = dateFormat;
}
public OutgoingHeaders Header => OutgoingHeaders.SessionParameters;
public void Compose(ServerMessage message)
{
message.AppendWire(6);
message.AppendWire(0);
message.AppendWire(_coppaType);
message.AppendWire(1);
message.AppendWire(_voucherEnabled);
message.AppendWire(2);
message.AppendWire(_parentEmailRequest);
message.AppendWire(3);
message.AppendWire(_parentEmailRequestRegistration);
message.AppendWire(4);
message.AppendWire(_allowDirectMail);
message.AppendWire(5);
message.AppendString(_dateFormat);
}
}