From 45ece5b4876118bb45f54f6ccfbb9a7b4e40f32b Mon Sep 17 00:00:00 2001 From: rfi Date: Wed, 1 May 2024 16:43:20 +0700 Subject: [PATCH] correctter echelon implementation --- .../Api/ProtocolHandlers/Account.cs | 14 ++------- .../Api/ProtocolHandlers/Echelon.cs | 29 +++++++++++++++++++ .../Api/ProtocolHandlers/Mission.cs | 2 +- .../Api/ProtocolHandlers/Scenario.cs | 4 +-- 4 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Echelon.cs diff --git a/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Account.cs b/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Account.cs index 82c7587..eed2d64 100644 --- a/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Account.cs +++ b/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Account.cs @@ -183,6 +183,7 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers context.Echelons.Add(new() { AccountServerId = account.ServerId, + EchelonNumber = 1, LeaderServerId = newCharacters[0].ServerId, MainSlotServerIds = newCharacters.Take(3).Select(x => x.ServerId).Append(0).ToList() }); @@ -286,18 +287,7 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers }, EchelonListResponse = new EchelonListResponse() { - EchelonDBs = [ - new EchelonDB() - { - AccountServerId = req.AccountId, - EchelonType = EchelonType.Adventure, - EchelonNumber = 1, - LeaderServerId = 1, - MainSlotServerIds = [1, 2, 3, 0 ], - SupportSlotServerIds = [ 444, 0], - SkillCardMulliganCharacterIds = [] - } - ] + EchelonDBs = [.. account.Echelons] }, EventContentPermanentListResponse = new EventContentPermanentListResponse() { diff --git a/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Echelon.cs b/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Echelon.cs new file mode 100644 index 0000000..0f732c5 --- /dev/null +++ b/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Echelon.cs @@ -0,0 +1,29 @@ +using SCHALE.Common.Database; +using SCHALE.Common.NetworkProtocol; +using SCHALE.GameServer.Services; + +namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers +{ + public class Echelon : ProtocolHandlerBase + { + private readonly ISessionKeyService sessionKeyService; + private readonly SCHALEContext context; + + public Echelon(IProtocolHandlerFactory protocolHandlerFactory, ISessionKeyService _sessionKeyService, SCHALEContext _context) : base(protocolHandlerFactory) + { + sessionKeyService = _sessionKeyService; + context = _context; + } + + [ProtocolHandler(Protocol.Echelon_List)] + public ResponsePacket ListHandler(EchelonListRequest req) + { + var account = sessionKeyService.GetAccount(req.SessionKey); + + return new EchelonListResponse() + { + EchelonDBs = account.Echelons.ToList() + }; + } + } +} diff --git a/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Mission.cs b/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Mission.cs index 80e2b41..27fe89a 100644 --- a/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Mission.cs +++ b/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Mission.cs @@ -19,7 +19,7 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers [ProtocolHandler(Protocol.Mission_List)] public ResponsePacket ListHandler(MissionListRequest req) { - Log.Information($"MissionListRequest EventContentId: {req.EventContentId}"); + Log.Debug($"MissionListRequest EventContentId: {req.EventContentId}"); var missionProgresses = context.MissionProgresses.Where(x => x.AccountServerId == sessionKeyService.GetAccount(req.SessionKey).ServerId).ToList(); diff --git a/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Scenario.cs b/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Scenario.cs index 21afbc3..9fef772 100644 --- a/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Scenario.cs +++ b/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/Scenario.cs @@ -10,8 +10,8 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers [ProtocolHandler(Protocol.Scenario_Skip)] public ResponsePacket SkipHandler(ScenarioSkipRequest req) { - Log.Information($"ScenarioSkipRequest ScriptGroupId:" + req.ScriptGroupId); - Log.Information($"ScenarioSkipRequest SkipPointScriptCount: " + req.SkipPointScriptCount); + Log.Debug($"ScenarioSkipRequest ScriptGroupId:" + req.ScriptGroupId); + Log.Debug($"ScenarioSkipRequest SkipPointScriptCount: " + req.SkipPointScriptCount); // skip story doesn't work yet, probably need to implement missiondb return new ScenarioSkipResponse();