From 091166b41a2d9ba788b740008b21e473337fdd65 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 2 Sep 2015 14:07:45 -0400 Subject: [PATCH] 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. --- FFXIVClassic_Lobby_Server/Database.cs | 8 +- FFXIVClassic_Lobby_Server/PacketProcessor.cs | 76 ++++++- FFXIVClassic_Lobby_Server/Server.cs | 2 +- .../dataobjects/World.cs | 2 +- .../packets/BasePacket.cs | 28 ++- .../packets/HardCoded_Packets.cs | 208 ------------------ .../packets/PacketStructs.cs | 92 +++++++- .../packets/SubPacket.cs | 23 +- 8 files changed, 216 insertions(+), 223 deletions(-) diff --git a/FFXIVClassic_Lobby_Server/Database.cs b/FFXIVClassic_Lobby_Server/Database.cs index 5d73fa9f..c33771ae 100644 --- a/FFXIVClassic_Lobby_Server/Database.cs +++ b/FFXIVClassic_Lobby_Server/Database.cs @@ -193,7 +193,7 @@ namespace FFXIVClassic_Lobby_Server var name = Reader.GetString("name"); var address = Reader.GetString("address"); var port = Reader.GetUInt16("port"); - var unknown = Reader.GetUInt16("unknown"); + var listPosition = Reader.GetUInt16("listPosition"); var numChars = Reader.GetUInt32("numChars"); var maxChars = Reader.GetUInt32("maxChars"); var isActive = Reader.GetBoolean("isActive"); @@ -205,7 +205,7 @@ namespace FFXIVClassic_Lobby_Server world.name = name; world.address = address; world.port = port; - world.unknown = unknown; + world.listPosition = listPosition; uint result = ((numChars / maxChars) *0xFF) & 0xFF; world.population = (ushort)result; world.isActive = isActive; @@ -248,7 +248,7 @@ namespace FFXIVClassic_Lobby_Server var name = Reader.GetString("name"); var address = Reader.GetString("address"); var port = Reader.GetUInt16("port"); - var unknown = Reader.GetUInt16("unknown"); + var listPosition = Reader.GetUInt16("listPosition"); var numChars = Reader.GetUInt32("numChars"); var maxChars = Reader.GetUInt32("maxChars"); var isActive = Reader.GetBoolean("isActive"); @@ -260,7 +260,7 @@ namespace FFXIVClassic_Lobby_Server world.name = name; world.address = address; world.port = port; - world.unknown = unknown; + world.listPosition = listPosition; uint result = ((numChars / maxChars) * 0xFF) & 0xFF; world.population = (ushort)result; world.isActive = isActive; diff --git a/FFXIVClassic_Lobby_Server/PacketProcessor.cs b/FFXIVClassic_Lobby_Server/PacketProcessor.cs index 107f6842..7ebc4ab8 100644 --- a/FFXIVClassic_Lobby_Server/PacketProcessor.cs +++ b/FFXIVClassic_Lobby_Server/PacketProcessor.cs @@ -1,4 +1,5 @@ using FFXIVClassic_Lobby_Server.common; +using FFXIVClassic_Lobby_Server.dataobjects; using FFXIVClassic_Lobby_Server.packets; using MySql.Data.MySqlClient; using System; @@ -91,7 +92,9 @@ namespace FFXIVClassic_Lobby_Server break; case 0x0B: ProcessModifyCharacter(client, subpacket); - break; + break; + case 0x0F: + //Mod Retainers default: Debug.WriteLine("Unknown command 0x{0:X} received.", subpacket.header.opcode); break; @@ -143,6 +146,9 @@ namespace FFXIVClassic_Lobby_Server private void ProcessGetCharacters(ClientConnection client, SubPacket packet) { Console.WriteLine("{0} => Get characters", client.currentUserId == 0 ? client.getAddress() : "User " + client.currentUserId); + + buildWorldLists(client, packet); + BasePacket outgoingPacket = new BasePacket("./packets/getCharsPacket.bin"); BasePacket.encryptPacket(client.blowfish, outgoingPacket); client.queuePacket(outgoingPacket); @@ -183,7 +189,6 @@ namespace FFXIVClassic_Lobby_Server private void ProcessModifyCharacter(ClientConnection client, SubPacket packet) { - packet.debugPrintSubPacket(); PacketStructs.CharacterRequestPacket charaReq = PacketStructs.toCharacterRequestStruct(packet.data); var slot = charaReq.slot; @@ -197,7 +202,23 @@ namespace FFXIVClassic_Lobby_Server var alreadyTaken = Database.reserveCharacter(client.currentUserId, slot, worldId, name); if (alreadyTaken) - { } + { + PacketStructs.ErrorPacket errorPacket = new PacketStructs.ErrorPacket(); + errorPacket.sequence = charaReq.sequence; + errorPacket.errorId = 13005; + errorPacket.errorCode = 0; + errorPacket.statusCode = 0; + byte[] data = PacketStructs.StructureToByteArray(errorPacket); + + SubPacket subpacket = new SubPacket(0x02, packet.header.sourceId, packet.header.targetId, data); + BasePacket basePacket = BasePacket.createPacket(subpacket, true, false); + basePacket.debugPrintPacket(); + BasePacket.encryptPacket(client.blowfish, basePacket); + client.queuePacket(basePacket); + + Console.WriteLine("User {0} => Error; name taken: \"{1}\"", client.currentUserId, charaReq.characterName); + return; + } //Confirm Reserve BasePacket confirmReservePacket = new BasePacket("./packets/chara/confirmReserve.bin"); @@ -231,5 +252,54 @@ namespace FFXIVClassic_Lobby_Server } } + private void buildWorldLists(ClientConnection client, SubPacket packet) + { + List serverList = Database.getServers(); + + int serverCount = 0; + int totalCount = 0; + PacketStructs.WorldListPacket worldListPacket = new PacketStructs.WorldListPacket(); + worldListPacket.isEndList = serverList.Count <= 6 ? (byte)1 : (byte)0; + worldListPacket.numWorlds = serverList.Count <= 6 ? (byte)serverList.Count : (byte)6; + worldListPacket.sequence = 0; + worldListPacket.unknown1 = 0; + worldListPacket.unknown2 = 0; + + foreach (World world in serverList) + { + //Insert world entry + PacketStructs.WorldListEntry entry = new PacketStructs.WorldListEntry(); + entry.id = world.id; + entry.listPosition = world.listPosition; + entry.population = world.population; + entry.name = world.name; + worldListPacket.worlds[serverCount] = entry; + + serverCount++; + totalCount++; + if (serverCount % 6 == 0 || totalCount >= serverList.Count) + { + //Send this chunk of world list + byte[] data = PacketStructs.StructureToByteArray(worldListPacket); + SubPacket subpacket = new SubPacket(0x02, packet.header.sourceId, packet.header.targetId, data); + BasePacket basePacket = BasePacket.createPacket(subpacket, true, false); + basePacket.debugPrintPacket(); + BasePacket.encryptPacket(client.blowfish, basePacket); + client.queuePacket(basePacket); + + //Make new worldlist if still remaining + if (totalCount <= serverList.Count) + { + worldListPacket = new PacketStructs.WorldListPacket(); + worldListPacket.isEndList = serverList.Count - totalCount <= 6 ? (byte)1 : (byte)0; + worldListPacket.numWorlds = serverList.Count - totalCount <= 6 ? (byte)(serverList.Count - totalCount) : (byte)6; + worldListPacket.sequence = 0; + worldListPacket.unknown1 = 0; + worldListPacket.unknown2 = 0; + } + } + } + } + } } diff --git a/FFXIVClassic_Lobby_Server/Server.cs b/FFXIVClassic_Lobby_Server/Server.cs index 42eda318..ce77cb5c 100644 --- a/FFXIVClassic_Lobby_Server/Server.cs +++ b/FFXIVClassic_Lobby_Server/Server.cs @@ -133,7 +133,7 @@ namespace FFXIVClassic_Lobby_Server { if (conn.socket != null) { - Console.WriteLine("Connection @ {0}:{1} has disconnected.", conn.currentUserId == 0 ? conn.getAddress() : "User " + conn.currentUserId); + Console.WriteLine("Connection @ {0} has disconnected.", conn.currentUserId == 0 ? "Unknown User " : "User " + conn.currentUserId); conn.socket.Close(); lock (mConnectionList) { diff --git a/FFXIVClassic_Lobby_Server/dataobjects/World.cs b/FFXIVClassic_Lobby_Server/dataobjects/World.cs index f1407a2d..20569fcc 100644 --- a/FFXIVClassic_Lobby_Server/dataobjects/World.cs +++ b/FFXIVClassic_Lobby_Server/dataobjects/World.cs @@ -11,7 +11,7 @@ namespace FFXIVClassic_Lobby_Server.dataobjects public ushort id; public string address; public ushort port; - public ushort unknown; + public ushort listPosition; public ushort population; public string name; public bool isActive; diff --git a/FFXIVClassic_Lobby_Server/packets/BasePacket.cs b/FFXIVClassic_Lobby_Server/packets/BasePacket.cs index 53aa1028..f44d10e7 100644 --- a/FFXIVClassic_Lobby_Server/packets/BasePacket.cs +++ b/FFXIVClassic_Lobby_Server/packets/BasePacket.cs @@ -142,7 +142,7 @@ namespace FFXIVClassic_Lobby_Server.packets } #region Utility Functions - public BasePacket createPacket(List subpackets, bool isAuthed, bool isEncrypted) + public static BasePacket createPacket(List 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; diff --git a/FFXIVClassic_Lobby_Server/packets/HardCoded_Packets.cs b/FFXIVClassic_Lobby_Server/packets/HardCoded_Packets.cs index 9b5ed64f..624fa9a3 100644 --- a/FFXIVClassic_Lobby_Server/packets/HardCoded_Packets.cs +++ b/FFXIVClassic_Lobby_Server/packets/HardCoded_Packets.cs @@ -54,213 +54,5 @@ namespace FFXIVClassic_Lobby_Server.packets 0xC0, 0x5A, 0x33, 0x02, 0x0C, 0x69, 0x00, 0xE0, 0xA0, 0x32, 0xAC, 0x01, 0x00, 0x00, 0x00, 0x00, }; - public static byte[] g_characterListPacket = -{ - 0x01, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x05, 0x00, 0xEA, 0xCE, 0x8A, 0xEE, 0x3B, 0x01, 0x00, 0x00, - - 0x10, 0x02, 0x03, 0x00, 0x68, 0x68, 0x00, 0xE0, 0x68, 0x68, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xE8, 0xE0, 0x50, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //(9) 0x06 -> Item Count - 0x02, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x44, 0x75, 0x72, 0x61, 0x6E, 0x64, 0x61, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x48, 0x79, 0x70, 0x65, 0x72, 0x69, 0x6F, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x02, 0x00, 0x5E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x4D, 0x61, 0x73, 0x61, 0x6D, 0x75, 0x6E, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x03, 0x00, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x75, 0x6E, 0x67, 0x6E, 0x69, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x04, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x41, 0x65, 0x67, 0x69, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0A, 0x00, 0x05, 0x00, 0x5E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x53, 0x61, 0x72, 0x67, 0x61, 0x74, 0x61, 0x6E, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0x10, 0x02, 0x03, 0x00, 0x68, 0x68, 0x00, 0xE0, 0x68, 0x68, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xE8, 0xE0, 0x50, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0B, 0x00, 0x06, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x42, 0x61, 0x6C, 0x6D, 0x75, 0x6E, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0C, 0x00, 0x07, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x69, 0x64, 0x69, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x08, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x45, 0x78, 0x63, 0x61, 0x6C, 0x69, 0x62, 0x75, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x09, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x61, 0x67, 0x6E, 0x61, 0x72, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0x10, 0x02, 0x03, 0x00, 0x68, 0x68, 0x00, 0xE0, 0x68, 0x68, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xE8, 0xE0, 0x50, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0xF0, 0x01, 0x03, 0x00, 0x68, 0x68, 0x00, 0xE0, 0x68, 0x68, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xE8, 0xE0, 0x50, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0xF5, 0xA5, 0xE0, - 0x09, 0x79, 0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x6F, 0x72, 0x6E, //(C) "Cornelius" Retainer Name - 0x65, 0x6C, 0x69, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x79, 0xC1, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0xD0, 0x03, 0x03, 0x00, 0x68, 0x68, 0x00, 0xE0, 0x68, 0x68, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xE8, 0xE0, 0x50, 0x00, 0x00, 0x00, 0x00, //(8) 0x50E0E824 -> Timestamp - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - -// 0xFC, 0xE7, 0x58, 0x01, 0x09, 0x79, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x00, 0x00, 0x00, //(4) 0x00C17909 -> Character Id -// 0x57, 0x72, 0x65, 0x6E, 0x69, 0x78, 0x20, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x00, 0x00, 0x00, 0x00, //(0) "Wrenix Wrong" -> Character Name - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x61, 0x67, 0x6E, 0x61, 0x72, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //(0) "Ragnarok" -> Server Name - 0x77, 0x41, 0x51, 0x41, 0x41, 0x4F, 0x6F, 0x6E, 0x49, 0x79, 0x4D, 0x4E, 0x41, 0x41, 0x41, 0x41, //(0) base64 stuff -> Character Data - 0x56, 0x33, 0x4A, 0x6C, 0x62, 0x6D, 0x6C, 0x34, 0x49, 0x46, 0x64, 0x79, 0x62, 0x32, 0x35, 0x6E, - 0x41, 0x42, 0x77, 0x41, 0x41, 0x41, 0x41, 0x45, 0x41, 0x41, 0x41, 0x41, 0x41, 0x77, 0x41, 0x41, - 0x41, 0x41, 0x4D, 0x41, 0x41, 0x41, 0x41, 0x5F, 0x38, 0x4F, 0x41, 0x44, 0x41, 0x41, 0x48, 0x51, - 0x46, 0x41, 0x41, 0x45, 0x41, 0x41, 0x41, 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x42, 0x54, 0x51, - 0x43, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, - 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, - 0x41, 0x47, 0x45, 0x67, 0x41, 0x41, 0x41, 0x41, 0x4D, 0x51, 0x41, 0x41, 0x51, 0x43, 0x51, 0x41, - 0x41, 0x4D, 0x41, 0x73, 0x41, 0x41, 0x43, 0x4B, 0x56, 0x41, 0x41, 0x41, 0x41, 0x50, 0x67, 0x43, - 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, - 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x51, 0x41, - 0x41, 0x41, 0x41, 0x6B, 0x41, 0x77, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, - 0x41, 0x4E, 0x76, 0x62, 0x31, 0x4D, 0x30, 0x35, 0x41, 0x51, 0x41, 0x41, 0x42, 0x42, 0x6F, 0x41, - 0x41, 0x41, 0x45, 0x41, 0x42, 0x71, 0x6F, 0x69, 0x49, 0x75, 0x49, 0x4B, 0x41, 0x41, 0x41, 0x41, - 0x63, 0x48, 0x4A, 0x32, 0x4D, 0x45, 0x6C, 0x75, 0x62, 0x6A, 0x41, 0x78, 0x41, 0x42, 0x45, 0x41, - 0x41, 0x41, 0x42, 0x6B, 0x5A, 0x57, 0x5A, 0x68, 0x64, 0x57, 0x78, 0x30, 0x56, 0x47, 0x56, 0x79, - 0x63, 0x6D, 0x6C, 0x30, 0x62, 0x33, 0x4A, 0x35, 0x41, 0x41, 0x77, 0x4A, 0x41, 0x68, 0x63, 0x41, - 0x42, 0x41, 0x41, 0x41, 0x41, 0x41, 0x51, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, - 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, - 0x41, 0x67, 0x41, 0x41, 0x41, 0x41, 0x49, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, - 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - -// 0xFD, 0xE7, 0x58, 0x01, 0x0B, 0x79, 0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //(4) 0x00C17909 -> Character Id (8) -> 0x72 = Legacy account? -// 0x59, 0x72, 0x65, 0x6E, 0x69, 0x78, 0x20, 0x57, 0x72, 0x6F, 0x6E, 0x67, 0x00, 0x00, 0x00, 0x00, //(0) "Wrenix Wrong" -> Character Name - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //(4) 0x00C17909 -> Character Id (8) -> 0x72 = Legacy account? - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //(0) "Wrenix Wrong" -> Character Name - - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x61, 0x67, 0x6E, 0x61, 0x72, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //(0) "Ragnarok" -> Server Name - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; } } diff --git a/FFXIVClassic_Lobby_Server/packets/PacketStructs.cs b/FFXIVClassic_Lobby_Server/packets/PacketStructs.cs index 6b519120..261f0f78 100644 --- a/FFXIVClassic_Lobby_Server/packets/PacketStructs.cs +++ b/FFXIVClassic_Lobby_Server/packets/PacketStructs.cs @@ -13,7 +13,7 @@ namespace FFXIVClassic_Lobby_Server.packets public unsafe struct SessionPacket { [FieldOffset(0)] - public uint sequence; + public UInt64 sequence; [FieldOffset(0x50)] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)] public String version; @@ -22,13 +22,35 @@ namespace FFXIVClassic_Lobby_Server.packets public String session; } + [StructLayout(LayoutKind.Sequential)] + public unsafe struct WorldListPacket + { + public UInt64 sequence; + public byte isEndList; + public uint numWorlds; + public byte unknown1; + public ushort unknown2; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public WorldListEntry[] worlds; + } + + [StructLayout(LayoutKind.Sequential)] + public unsafe struct WorldListEntry + { + public ushort id; + public ushort listPosition; + public uint population; + public UInt64 unknown; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x40)] + public String name; + } + [StructLayout(LayoutKind.Sequential)] public unsafe struct CharacterRequestPacket { - public uint sequence; - public uint unknown; + public UInt64 sequence; public uint characterId; - public uint unknown2; + public uint personType; public byte slot; public byte command; public ushort worldId; @@ -38,6 +60,51 @@ namespace FFXIVClassic_Lobby_Server.packets public String characterInfoEncoded; } + //Response Packets + [StructLayout(LayoutKind.Sequential)] + public unsafe struct ReserveCharaResponse + { + 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; + } + + [StructLayout(LayoutKind.Sequential)] + public unsafe struct ErrorPacket + { + public UInt64 sequence; + public uint errorCode; + public uint statusCode; + public uint errorId; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x2BB)] + public String errorMessage; + } + public static unsafe CharacterRequestPacket toCharacterRequestStruct(byte[] bytes) { fixed (byte* pdata = &bytes[0]) @@ -53,5 +120,22 @@ namespace FFXIVClassic_Lobby_Server.packets return (SessionPacket)Marshal.PtrToStructure(new IntPtr(pdata), typeof(SessionPacket)); } } + + public static byte[] StructureToByteArray(object obj) + { + int len = Marshal.SizeOf(obj); + + byte[] arr = new byte[len]; + + IntPtr ptr = Marshal.AllocHGlobal(len); + + Marshal.StructureToPtr(obj, ptr, true); + + Marshal.Copy(ptr, arr, 0, len); + + Marshal.FreeHGlobal(ptr); + + return arr; + } } } diff --git a/FFXIVClassic_Lobby_Server/packets/SubPacket.cs b/FFXIVClassic_Lobby_Server/packets/SubPacket.cs index d27228fe..390f7306 100644 --- a/FFXIVClassic_Lobby_Server/packets/SubPacket.cs +++ b/FFXIVClassic_Lobby_Server/packets/SubPacket.cs @@ -17,7 +17,7 @@ namespace FFXIVClassic_Lobby_Server.packets public uint sourceId; public uint targetId; public uint unknown1; - public ushort unknown4; //Always 0x13 + public ushort unknown4; //Always 0x14 public ushort opcode; public uint unknown5; public uint timestamp; @@ -50,6 +50,27 @@ namespace FFXIVClassic_Lobby_Server.packets offset += header.subpacketSize; } + public SubPacket(ushort opcode, uint sourceId, uint targetId, byte[] data) + { + this.header = new SubPacketHeader(); + header.opcode = opcode; + header.sourceId = sourceId; + header.targetId = targetId; + + UInt32 unixTimestamp = (UInt32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; + header.timestamp = unixTimestamp; + + header.unknown0 = 0x03; + header.unknown1 = 0x00; + header.unknown4 = 0x14; + header.unknown5 = 0x00; + header.unknown6 = 0x00; + + this.data = data; + + header.subpacketSize = (ushort)(0x20 + data.Length); + } + public byte[] getHeaderBytes() { int size = Marshal.SizeOf(header);