From a9f382963b3005943f2912257d3dc47e287305c6 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Mon, 13 Nov 2023 21:16:02 +0100 Subject: [PATCH] refactor: channel response test packet --- .../PacketHandlers/ChannelSelectionHandler.cs | 65 ++++++++++--------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/Server/PacketHandlers/ChannelSelectionHandler.cs b/Server/PacketHandlers/ChannelSelectionHandler.cs index e1592cf..eedeb90 100644 --- a/Server/PacketHandlers/ChannelSelectionHandler.cs +++ b/Server/PacketHandlers/ChannelSelectionHandler.cs @@ -71,39 +71,44 @@ public class ChannelSelectionHandler : IPacketHandler } else { - responsePacket = new ChannelSelectionResponsePacket - { - ChannelIsFullFlag = 0, - Endpoint = "127.0.0.1", - Port = 12345, - Characters = new[] - { - new CharacterData - { - Name = "Test243", - Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 }, - Gender = Gender.None, - 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)25, 20).ToArray() - }, - }, - }; + responsePacket = CreateTestChannelSelectionResponsePacket(); } authSession.Send(responsePacket); return Task.CompletedTask; } + + private static ChannelSelectionResponsePacket CreateTestChannelSelectionResponsePacket() + { + return new ChannelSelectionResponsePacket + { + ChannelIsFullFlag = 0, + Endpoint = "127.0.0.1", + Port = 12345, + Characters = new[] + { + new CharacterData + { + Name = "Test243", + Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 }, + Gender = Gender.None, + 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)25, 20).ToArray() + }, + }, + }; + } }