From 208ce9b0c3f798e72f02250c700320abc6410150 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Mon, 6 Nov 2023 10:50:02 +0100 Subject: [PATCH] chore: fetch all required information for characters --- Server/PacketHandlers/ChannelSelectionHandler.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Server/PacketHandlers/ChannelSelectionHandler.cs b/Server/PacketHandlers/ChannelSelectionHandler.cs index dbba883..12c2030 100644 --- a/Server/PacketHandlers/ChannelSelectionHandler.cs +++ b/Server/PacketHandlers/ChannelSelectionHandler.cs @@ -1,3 +1,4 @@ +using Microsoft.EntityFrameworkCore; using Wonderking.Packets.Incoming; namespace Server.PacketHandlers; @@ -28,7 +29,9 @@ public class ChannelSelectionHandler : IPacketHandler public Task HandleAsync(ChannelSelectionPacket packet, TcpSession session) { var authSession = (AuthSession)session; - var charactersOfAccount = this._wonderkingContext.Accounts.FirstOrDefault(a => a.Id == authSession.AccountId); + var charactersOfAccount = this._wonderkingContext.Accounts.Include(account => account.Characters) + .FirstOrDefault(a => a.Id == authSession.AccountId) + ?.Characters; return Task.CompletedTask; } }