feat: initial ChannelSelection
All checks were successful
Test if Server can be built / build-server (push) Successful in 23s
All checks were successful
Test if Server can be built / build-server (push) Successful in 23s
This commit is contained in:
parent
d44d072823
commit
756031b186
4 changed files with 52 additions and 1 deletions
|
@ -10,6 +10,7 @@ public class AuthSession : TcpSession
|
|||
{
|
||||
private readonly ILogger<AuthSession> logger;
|
||||
private readonly IMediator mediator;
|
||||
public Guid AccountId { get; set; }
|
||||
|
||||
public AuthSession(TcpServer
|
||||
server, IMediator mediator, ILogger<AuthSession> logger) : base(server)
|
||||
|
|
33
Server/PacketHandlers/ChannelSelectionHandler.cs
Normal file
33
Server/PacketHandlers/ChannelSelectionHandler.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
namespace Server.PacketHandlers;
|
||||
|
||||
using DB;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NetCoreServer;
|
||||
using Packets.Incoming;
|
||||
|
||||
public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
|
||||
{
|
||||
private readonly IConfiguration configuration;
|
||||
private readonly ILogger<ChannelSelectionHandler> logger;
|
||||
private readonly WonderkingContext wonderkingContext;
|
||||
|
||||
public ChannelSelectionHandler(IConfiguration configuration, ILogger<ChannelSelectionHandler> logger,
|
||||
WonderkingContext wonderkingContext)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
this.logger = logger;
|
||||
this.wonderkingContext = wonderkingContext;
|
||||
}
|
||||
|
||||
public ChannelSelectionHandler()
|
||||
{
|
||||
}
|
||||
|
||||
public Task HandleAsync(ChannelSelectionPacket packet, TcpSession session)
|
||||
{
|
||||
var authSession = (AuthSession)session;
|
||||
var charactersOfAccount = this.wonderkingContext.Accounts.FirstOrDefault(a => a.Id == authSession.AccountId);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
16
Server/Packets/Incoming/ChannelSelectionPacket.cs
Normal file
16
Server/Packets/Incoming/ChannelSelectionPacket.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
namespace Server.Packets.Incoming;
|
||||
|
||||
[PacketId(OperationCode.ChannelSelection)]
|
||||
public class ChannelSelectionPacket : IPacket
|
||||
{
|
||||
public required ushort ServerId { get; set; }
|
||||
public required ushort ChannelId { get; set; }
|
||||
|
||||
public void Deserialize(byte[] data)
|
||||
{
|
||||
this.ServerId = BitConverter.ToUInt16(data, 0);
|
||||
this.ChannelId = BitConverter.ToUInt16(data, 2);
|
||||
}
|
||||
|
||||
public byte[] Serialize() => throw new NotImplementedException();
|
||||
}
|
|
@ -3,5 +3,6 @@
|
|||
public enum OperationCode : ushort
|
||||
{
|
||||
LoginInfo = 11,
|
||||
LoginResponse = 12
|
||||
LoginResponse = 12,
|
||||
ChannelSelection
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue