Added account and select character packet creators. Fixed wrong field being read for session id. Most of the server is now NOT hardcoded and customizable from the DB. Only hardcoded packet left is the initial handshake.

This commit is contained in:
Filip Maj 2015-09-13 18:21:28 -04:00
parent caf3968e5b
commit ddf1d2d1a3
10 changed files with 259 additions and 77 deletions

View file

@ -13,13 +13,13 @@ namespace FFXIVClassic_Lobby_Server.packets
public unsafe struct SessionPacket
{
[FieldOffset(0)]
public UInt64 sequence;
public UInt64 sequence;
[FieldOffset(0x10)]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x40)]
public String session;
[FieldOffset(0x50)]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
public String version;
[FieldOffset(0x70)]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
public String session;
public String version;
}
[StructLayout(LayoutKind.Sequential)]
@ -37,38 +37,13 @@ namespace FFXIVClassic_Lobby_Server.packets
public String characterInfoEncoded;
}
//Response Packets
[StructLayout(LayoutKind.Sequential)]
public unsafe struct ReserveCharaResponse
public unsafe struct SelectCharRequestPacket
{
public UInt64 sequence;
public uint errorCode;
public uint statusCode;
public uint errorId;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x2BB)]
public String errorMessage;
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct MakeCharaResponse
{
public UInt64 sequence;
public uint errorCode;
public uint statusCode;
public uint errorId;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x2BB)]
public String errorMessage;
}
[StructLayout(LayoutKind.Sequential)]
public unsafe struct DeleteCharaResponse
{
public UInt64 sequence;
public uint errorCode;
public uint statusCode;
public uint errorId;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x2BB)]
public String errorMessage;
public uint characterId;
public uint unknownId;
public UInt64 ticket;
}
public static unsafe CharacterRequestPacket toCharacterRequestStruct(byte[] bytes)
@ -87,6 +62,14 @@ namespace FFXIVClassic_Lobby_Server.packets
}
}
public static unsafe SelectCharRequestPacket toSelectCharRequestStruct(byte[] bytes)
{
fixed (byte* pdata = &bytes[0])
{
return (SelectCharRequestPacket)Marshal.PtrToStructure(new IntPtr(pdata), typeof(SelectCharRequestPacket));
}
}
public static byte[] StructureToByteArray(object obj)
{
int len = Marshal.SizeOf(obj);