From e5678d00fd0d58d946495e29868e230ffbfb00d2 Mon Sep 17 00:00:00 2001 From: esuo1198 <54134.es@gmail.com> Date: Fri, 22 Sep 2023 03:58:16 +0900 Subject: [PATCH] Synchronize VerupNo of VerupNoData2 with json --- .../Game/InitialDataCheckController.cs | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs b/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs index b4d1c1b..8f3d59f 100644 --- a/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs +++ b/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs @@ -24,7 +24,7 @@ public class InitialDataCheckController : BaseController new InitialdatacheckResponse.VerupNoData1 - { - MasterType = i, - VerupNo = 1 - }) + { + MasterType = i, + VerupNo = 1 + }) .ToList(); response.AryVerupNoData1s.AddRange(aryVerUp); - + var danData = new List(); for (var danId = Constants.MIN_DAN_ID; danId <= Constants.MAX_DAN_ID; danId++) { + gameDataService.GetDanDataDictionary().TryGetValue((uint)danId, out var odaiData); danData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData { InfoId = (uint)danId, - VerupNo = 1 + VerupNo = odaiData is not null ? odaiData.VerupNo : 1 }); } var verUp2Type101 = new InitialdatacheckResponse.VerupNoData2 @@ -72,33 +73,35 @@ public class InitialDataCheckController : BaseController(); var gaidenDataDictionary = gameDataService.GetGaidenDataDictionary(); foreach (var gaidenId in gaidenDataDictionary.Keys) { + gaidenDataDictionary.TryGetValue(gaidenId, out var odaiData); gaidenData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData { InfoId = gaidenId, - VerupNo = 1 + VerupNo = odaiData is not null ? odaiData.VerupNo : 1 }); } - + var verUp2Type102 = new InitialdatacheckResponse.VerupNoData2 { MasterType = 102, }; verUp2Type102.AryInformationDatas.AddRange(gaidenData); response.AryVerupNoData2s.Add(verUp2Type102); - + var eventFolderData = new List(); var eventFolderDictionary = gameDataService.GetFolderDictionary(); foreach (var folderId in eventFolderDictionary.Keys) { + eventFolderDictionary.TryGetValue(folderId, out var folderData); eventFolderData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData { InfoId = folderId, - VerupNo = 1 + VerupNo = folderData is not null ? folderData.VerupNo : 1 }); } var verUp2Type103 = new InitialdatacheckResponse.VerupNoData2 @@ -109,22 +112,24 @@ public class InitialDataCheckController : BaseController(); + var songIntroDictionary = gameDataService.GetSongIntroDictionary(); + foreach (var setId in songIntroDictionary.Select(item => item.Value.SetId)) + { + songIntroDictionary.TryGetValue(setId, out var introData); + songIntroData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData + { + InfoId = setId, + VerupNo = introData is not null ? introData.VerupNo : 1 + }); + } var verUp2Type105 = new InitialdatacheckResponse.VerupNoData2 { MasterType = 105, }; - for (var setId = 1; setId <= gameDataService.GetSongIntroDictionary().Count; setId++) - { - songIntroData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData - { - InfoId = (uint)setId, - VerupNo = 1 - }); - } verUp2Type105.AryInformationDatas.AddRange(songIntroData); response.AryVerupNoData2s.Add(verUp2Type105); - - response.AryChassisFunctionIds = new uint[] {1,2,3}; + + response.AryChassisFunctionIds = new uint[] { 1, 2, 3 }; return Ok(response); }