Error and server list packets added. Reserve will send error to client if a character name is take for a server. Code to send out server list on GetCharacters added.

This commit is contained in:
Filip Maj 2015-09-02 14:07:45 -04:00
parent c982493d66
commit 091166b41a
8 changed files with 216 additions and 223 deletions

View file

@ -142,7 +142,7 @@ namespace FFXIVClassic_Lobby_Server.packets
}
#region Utility Functions
public BasePacket createPacket(List<SubPacket> subpackets, bool isAuthed, bool isEncrypted)
public static BasePacket createPacket(List<SubPacket> subpackets, bool isAuthed, bool isEncrypted)
{
//Create Header
BasePacketHeader header = new BasePacketHeader();
@ -174,6 +174,32 @@ namespace FFXIVClassic_Lobby_Server.packets
return packet;
}
public static BasePacket createPacket(SubPacket subpacket, bool isAuthed, bool isEncrypted)
{
//Create Header
BasePacketHeader header = new BasePacketHeader();
byte[] data = null;
header.isAuthenticated = isAuthed ? (byte)1 : (byte)0;
header.isEncrypted = isEncrypted ? (byte)1 : (byte)0;
header.numSubpackets = (ushort)1;
header.packetSize = BASEPACKET_SIZE;
//Get packet size
header.packetSize += subpacket.header.subpacketSize;
data = new byte[header.packetSize - 0x10];
//Add Subpackets
byte[] subpacketData = subpacket.getBytes();
Array.Copy(subpacketData, 0, data, 0, subpacketData.Length);
Debug.Assert(data != null);
BasePacket packet = new BasePacket(header, data);
return packet;
}
public static unsafe void encryptPacket(Blowfish blowfish, BasePacket packet)
{
byte[] data = packet.data;