Code:
MSG_DATE_TIME = 1033
Here's the code:
Code:
public unsafe struct ServerTimePacket
{
public DateTime Time;
public static ServerTimePacket Create()
{
var packet = new ServerTimePacket
{
Time = DateTime.UtcNow
.AddHours(Constants.TIME_ADJUST_HOUR)
.AddMinutes(Constants.TIME_ADJUST_MIN)
.AddSeconds(Constants.TIME_ADJUST_SEC)
};
return packet;
}
public static implicit operator byte[](ServerTimePacket packet)
{
var buffer = new byte[36 + 8];
fixed (byte* ptr = buffer)
{
PacketBuilder.AppendHeader(ptr, buffer.Length, Constants.MSG_DATE_TIME);
*((int*)(ptr + 8)) = packet.Time.Year - 1900;
*((int*)(ptr + 12)) = packet.Time.Month - 1;
*((int*)(ptr + 16)) = packet.Time.DayOfYear;
*((int*)(ptr + 20)) = packet.Time.Day;
*((int*)(ptr + 24)) = packet.Time.Hour;
*((int*)(ptr + 28)) = packet.Time.Minute;
*((int*)(ptr + 32)) = packet.Time.Second;
}
return buffer;
}
}
Note, I have someone who are coding for me but he is busy at the moment so I decided to get a free help if there is anyone who can.






