From 7edcd07723ba5bf1bf614be1153241dbcb09c411 Mon Sep 17 00:00:00 2001 From: asesidaa <1061472754@qq.com> Date: Thu, 12 Oct 2023 02:20:43 +0800 Subject: [PATCH] Test temp fix for cond --- Application/Game/Card/Write/WriteCondCommand.cs | 14 ++++++++++++++ Domain/Enums/CardRequestType.cs | 1 + MainServer/Controllers/Game/CardController.cs | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 Application/Game/Card/Write/WriteCondCommand.cs diff --git a/Application/Game/Card/Write/WriteCondCommand.cs b/Application/Game/Card/Write/WriteCondCommand.cs new file mode 100644 index 0000000..98a4846 --- /dev/null +++ b/Application/Game/Card/Write/WriteCondCommand.cs @@ -0,0 +1,14 @@ +namespace Application.Game.Card.Write; + +public record WriteCondCommand(long CardId, string Data) : IRequestWrapper; + +public class WriteCondCommandHandler : RequestHandlerBase +{ + public WriteCondCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate) {} + + public override Task> Handle(WriteCondCommand request, CancellationToken cancellationToken) + { + // TODO: Add proper implementation + return Task.FromResult(new ServiceResult(request.Data)); + } +} \ No newline at end of file diff --git a/Domain/Enums/CardRequestType.cs b/Domain/Enums/CardRequestType.cs index 5c1fd75..67c446e 100644 --- a/Domain/Enums/CardRequestType.cs +++ b/Domain/Enums/CardRequestType.cs @@ -53,6 +53,7 @@ public enum CardRequestType WriteCoin = 980, WriteUnlockKeynum = 1020, WriteSoundEffect = 8969, + WriteCond = 8976, #endregion diff --git a/MainServer/Controllers/Game/CardController.cs b/MainServer/Controllers/Game/CardController.cs index 063d815..8e70574 100644 --- a/MainServer/Controllers/Game/CardController.cs +++ b/MainServer/Controllers/Game/CardController.cs @@ -25,7 +25,7 @@ public class CardController : BaseController cardCommandType.Throw().IfOutOfRange(); if (cardCommandType is CardCommandType.CardReadRequest or CardCommandType.CardWriteRequest) { - cardRequestType.Throw().IfOutOfRange(); + cardRequestType.Throw($"Failed to process {cardCommandType.ToString()}").IfOutOfRange(); } request.Data = WebUtility.UrlDecode(request.Data); @@ -84,6 +84,8 @@ public class CardController : BaseController new WriteUnlockKeynumCommand(request.CardId, request.Data)), CardRequestType.WriteSoundEffect => await Mediator.Send( new WriteSoundEffectCommand(request.CardId, request.Data)), + CardRequestType.WriteCond => await Mediator.Send( + new WriteCondCommand(request.CardId, request.Data)), CardRequestType.StartOnlineMatching => await Mediator.Send( new StartOnlineMatchingCommand(request.CardId, request.Data)), CardRequestType.UpdateOnlineMatching => await Mediator.Send(