diff --git a/Server/PacketHandlers/ChannelSelectionHandler.cs b/Server/PacketHandlers/ChannelSelectionHandler.cs index 1818578..2e0130c 100644 --- a/Server/PacketHandlers/ChannelSelectionHandler.cs +++ b/Server/PacketHandlers/ChannelSelectionHandler.cs @@ -41,7 +41,7 @@ public class ChannelSelectionHandler : IPacketHandler ChannelSelectionResponsePacket responsePacket; var testingChars = true; - if (charactersOfAccount != null && testingChars) + if (charactersOfAccount != null && !testingChars) { responsePacket = new ChannelSelectionResponsePacket { @@ -99,9 +99,9 @@ public class ChannelSelectionHandler : IPacketHandler { new CharacterData { - Name = "Test243", + Name = "1", Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 }, - Gender = Gender.None, + Gender = Gender.Female, Level = ushort.MaxValue - 1, Experience = 255, Stats = new BaseStats @@ -116,8 +116,50 @@ public class ChannelSelectionHandler : IPacketHandler Health = int.MaxValue - 1, Mana = int.MaxValue - 1, EquippedItems = Enumerable.Repeat((ushort)25, 20).ToArray(), - EquippedCashItems = Enumerable.Repeat((ushort)25, 20).ToArray() + EquippedCashItems = Enumerable.Repeat((ushort)70, 20).ToArray() }, + new CharacterData + { + Name = "2", + Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 }, + Gender = Gender.Female, + Level = ushort.MaxValue - 1, + Experience = 255, + Stats = new BaseStats + { + Strength = 5, + Dexterity = 5, + Intelligence = 5, + Vitality = 5, + Luck = 5, + Wisdom = 5 + }, + Health = int.MaxValue - 1, + Mana = int.MaxValue - 1, + EquippedItems = Enumerable.Repeat((ushort)25, 20).ToArray(), + EquippedCashItems = Enumerable.Repeat((ushort)70, 20).ToArray() + }, + new CharacterData + { + Name = "3", + Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 }, + Gender = Gender.Female, + Level = ushort.MaxValue - 1, + Experience = 255, + Stats = new BaseStats + { + Strength = 5, + Dexterity = 5, + Intelligence = 5, + Vitality = 5, + Luck = 5, + Wisdom = 5 + }, + Health = int.MaxValue - 1, + Mana = int.MaxValue - 1, + EquippedItems = Enumerable.Repeat((ushort)25, 20).ToArray(), + EquippedCashItems = Enumerable.Repeat((ushort)65, 20).ToArray() + } }, }; } diff --git a/Wonderking/Packets/Outgoing/ChannelSelectionResponsePacket.cs b/Wonderking/Packets/Outgoing/ChannelSelectionResponsePacket.cs index 7e4d135..f803786 100644 --- a/Wonderking/Packets/Outgoing/ChannelSelectionResponsePacket.cs +++ b/Wonderking/Packets/Outgoing/ChannelSelectionResponsePacket.cs @@ -18,7 +18,7 @@ public class ChannelSelectionResponsePacket : IPacket public byte[] Serialize() { - Span data = stackalloc byte[1 + 16 + 2 + 2 + 132 * this.Characters.Length + 20]; + Span data = stackalloc byte[1 + 16 + 2 + 1 + 132 * this.Characters.Length]; data.Clear(); data[0] = this.ChannelIsFullFlag; Encoding.ASCII.GetBytes(this.Endpoint, data.Slice(1, 16)); @@ -29,7 +29,7 @@ public class ChannelSelectionResponsePacket : IPacket for (var i = 0; i < Characters.Length; i++) { var character = Characters[i]; - BinaryPrimitives.WriteInt32LittleEndian(data.Slice(20, 4), i); + BinaryPrimitives.WriteInt32LittleEndian(data.Slice(20 + (i * 132), 4), i); Encoding.ASCII.GetBytes(character.Name, data.Slice(24 + (i * 132), 20)); // Job Data @@ -64,6 +64,7 @@ public class ChannelSelectionResponsePacket : IPacket character.EquippedCashItems.Length > j ? character.EquippedCashItems[j] : (ushort)0); } } + return data.ToArray(); } }