continuity/Server/PacketHandlers/ChannelSelectionHandler.cs
Timothy Schenk 208ce9b0c3
Some checks failed
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Failing after 13s
Build, Package and Push Images / sonarqube (push) Has been skipped
Build, Package and Push Images / sbom-scan (push) Has been skipped
Build, Package and Push Images / container-build (push) Has been skipped
Build, Package and Push Images / container-sbom-scan (push) Has been skipped
chore: fetch all required information for characters
2023-11-06 10:50:02 +01:00

37 lines
1.2 KiB
C#

using Microsoft.EntityFrameworkCore;
using Wonderking.Packets.Incoming;
namespace Server.PacketHandlers;
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;
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.Include(account => account.Characters)
.FirstOrDefault(a => a.Id == authSession.AccountId)
?.Characters;
return Task.CompletedTask;
}
}