continuity/Server/PacketHandlers/ChannelSelectionHandler.cs

38 lines
1.2 KiB
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore;
using Wonderking.Packets.Incoming;
2023-10-12 07:15:34 +00:00
namespace Server.PacketHandlers;
2023-08-14 20:22:43 +00:00
using DB;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using NetCoreServer;
public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
{
private readonly IConfiguration _configuration;
private readonly ILogger<ChannelSelectionHandler> _logger;
private readonly WonderkingContext _wonderkingContext;
2023-08-14 20:22:43 +00:00
public ChannelSelectionHandler(IConfiguration configuration, ILogger<ChannelSelectionHandler> logger,
WonderkingContext wonderkingContext)
{
this._configuration = configuration;
this._logger = logger;
this._wonderkingContext = wonderkingContext;
2023-08-14 20:22:43 +00:00
}
public ChannelSelectionHandler()
{
}
public Task HandleAsync(ChannelSelectionPacket packet, TcpSession session)
{
var authSession = (AuthSession)session;
var charactersOfAccount = this._wonderkingContext.Accounts.Include(account => account.Characters)
.FirstOrDefault(a => a.Id == authSession.AccountId)
?.Characters;
2023-08-14 20:22:43 +00:00
return Task.CompletedTask;
}
}