Skip to content

Commit

Permalink
Add state checks for login pipes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaioru committed Aug 28, 2024
1 parent ce1c6cd commit 2a6668c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ namespace Edelstein.Common.Gameplay.Login.Handling.Pipes;

public class UserOnPacketCheckUserLimit : IPipe<PipedPacketMessage<ILoginStageSystem, ILoginStageSystemUser, CheckUserLimit>>
{
public Task Handle(IPipelineContext ctx, PipedPacketMessage<ILoginStageSystem, ILoginStageSystemUser, CheckUserLimit> message)
=> message.User.Dispatch(new CheckUserLimitResult());
public async Task Handle(IPipelineContext ctx, PipedPacketMessage<ILoginStageSystem, ILoginStageSystemUser, CheckUserLimit> message)
{
if (message.User.State != LoginState.SelectWorld) return;

await message.User.Dispatch(new CheckUserLimitResult());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class UserOnPacketSelectWorld : IPipe<PipedPacketMessage<ILoginStageSyste
{
public async Task Handle(IPipelineContext ctx, PipedPacketMessage<ILoginStageSystem, ILoginStageSystemUser, SelectWorld> message)
{
if (message.User.State != LoginState.SelectWorld) return;

await message.User.Dispatch(new SelectWorldResult
{
Result = LoginResultCode.Success,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ IServerService servers
{
public async Task Handle(IPipelineContext ctx, PipedPacketMessage<ILoginStageSystem, ILoginStageSystemUser, WorldRequest> message)
{
if (message.User.State != LoginState.SelectWorld) return;

foreach (var worldID in message.User.System.Options.Worlds)
{
var template = await templates.Retrieve(worldID);
Expand Down

0 comments on commit 2a6668c

Please sign in to comment.