feature/84-character-creation #88

Merged
rainote merged 60 commits from feature/84-character-creation into master 2023-11-17 07:29:21 +00:00
3 changed files with 14 additions and 9 deletions
Showing only changes of commit 42c53584f7 - Show all commits

View file

@ -1,3 +1,4 @@
using System.Net.Sockets;
using Wonderking.Packets; using Wonderking.Packets;
namespace Server; namespace Server;
@ -105,4 +106,9 @@ public class AuthSession : TcpSession
return buffer; return buffer;
} }
protected override void OnError(SocketError error)
{
_logger.LogWarning("An error has occured: {Error}", error);
}
} }

View file

@ -25,10 +25,6 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
this._wonderkingContext = wonderkingContext; this._wonderkingContext = wonderkingContext;
} }
public ChannelSelectionHandler()
{
}
public async Task HandleAsync(ChannelSelectionPacket packet, TcpSession session) public async Task HandleAsync(ChannelSelectionPacket packet, TcpSession session)
{ {
var authSession = (AuthSession)session; var authSession = (AuthSession)session;
@ -80,12 +76,16 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
{ {
ChannelIsFullFlag = 0, ChannelIsFullFlag = 0,
Endpoint = "127.0.0.1", Endpoint = "127.0.0.1",
Port = 12345, Port = 2000,
Characters = Array.Empty<CharacterData>() Characters = Array.Empty<CharacterData>()
}; };
} }
authSession.Send(responsePacket); authSession.Send(responsePacket);
authSession.Send(guildNameResponsePacket); if (guildNameResponsePacket.GuildNames.Length > 0 &&
guildNameResponsePacket.GuildNames.Select(n => n != string.Empty).Any())
{
authSession.Send(guildNameResponsePacket);
}
} }
} }

View file

@ -1,3 +1,4 @@
using System.Buffers.Binary;
using Wonderking.Packets.Outgoing.Data; using Wonderking.Packets.Outgoing.Data;
namespace Wonderking.Packets.Outgoing; namespace Wonderking.Packets.Outgoing;
@ -34,9 +35,7 @@ public class LoginResponsePacket : IPacket
dataSpan[0] = (byte)this.ResponseReason; dataSpan[0] = (byte)this.ResponseReason;
dataSpan[1] = this.UnknownFlag; dataSpan[1] = this.UnknownFlag;
dataSpan[2] = BitConverter.GetBytes(this.IsGameMaster)[0]; dataSpan[2] = BitConverter.GetBytes(this.IsGameMaster)[0];
var bytesOfChannelAmount = BitConverter.GetBytes((ushort)this.ChannelData.Length); BinaryPrimitives.WriteUInt16LittleEndian(dataSpan.Slice(3, 2), (ushort)this.ChannelData.Length);
dataSpan[3] = bytesOfChannelAmount[0];
dataSpan[4] = bytesOfChannelAmount[1];
for (var i = 0; i < this.ChannelData.Length; i++) for (var i = 0; i < this.ChannelData.Length; i++)
{ {