diff --git a/TaikoLocalServer/Common/Constants.cs b/TaikoLocalServer/Common/Constants.cs index ae4ab64..6f4653b 100644 --- a/TaikoLocalServer/Common/Constants.cs +++ b/TaikoLocalServer/Common/Constants.cs @@ -20,10 +20,6 @@ public static class Constants public const string INTRO_DATA_FILE_NAME = "intro_data.json"; public const string EVENT_FOLDER_DATA_FILE_NAME = "event_folder_data.json"; - public static readonly int[] EVENT_FOLDER_IDS = { - 1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14 - }; - public const int MIN_DAN_ID = 1; public const int MAX_DAN_ID = 19; @@ -43,6 +39,5 @@ public static class Constants COSTUME_FLAG_3_ARRAY_SIZE, COSTUME_FLAG_4_ARRAY_SIZE, COSTUME_FLAG_5_ARRAY_SIZE - }; } \ No newline at end of file diff --git a/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs b/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs index da98de8..b4d1c1b 100644 --- a/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs +++ b/TaikoLocalServer/Controllers/Game/InitialDataCheckController.cs @@ -92,11 +92,12 @@ public class InitialDataCheckController : BaseController(); - foreach (var folderId in Constants.EVENT_FOLDER_IDS) + var eventFolderDictionary = gameDataService.GetFolderDictionary(); + foreach (var folderId in eventFolderDictionary.Keys) { eventFolderData.Add(new InitialdatacheckResponse.VerupNoData2.InformationData { - InfoId = (uint)folderId, + InfoId = folderId, VerupNo = 1 }); } diff --git a/TaikoLocalServer/Controllers/Game/UserDataController.cs b/TaikoLocalServer/Controllers/Game/UserDataController.cs index db02b1d..0b24b4e 100644 --- a/TaikoLocalServer/Controllers/Game/UserDataController.cs +++ b/TaikoLocalServer/Controllers/Game/UserDataController.cs @@ -34,13 +34,34 @@ public class UserDataController : BaseController Logger.LogInformation("UserData request : {Request}", request.Stringify()); var songIdMax = settings.EnableMoreSongs ? Constants.MUSIC_ID_MAX_EXPANDED : Constants.MUSIC_ID_MAX; - var releaseSongArray = - FlagCalculator.GetBitArrayFromIds(gameDataService.GetMusicList(), songIdMax, Logger); - - var uraSongArray = - FlagCalculator.GetBitArrayFromIds(gameDataService.GetMusicWithUraList(), songIdMax, Logger); var userData = await userDatumService.GetFirstUserDatumOrDefault(request.Baid); + + var unlockedSongIdList = new List(); + try + { + unlockedSongIdList = !string.IsNullOrEmpty(userData.UnlockedSongIdList) + ? JsonSerializer.Deserialize>(userData.UnlockedSongIdList) + : new List(); + } + catch (JsonException e) + { + Logger.LogError(e, "Parsing UnlockedSongIdList data for user with baid {Request} failed!", request.Baid); + } + + unlockedSongIdList.ThrowIfNull("UnlockedSongIdList should never be null"); + + var musicList = gameDataService.GetMusicList(); + var lockedSongsList = gameDataService.GetLockedSongsList(); + lockedSongsList = lockedSongsList.Except(unlockedSongIdList).ToList(); + var enabledMusicList = musicList.Except(lockedSongsList); + var releaseSongArray = + FlagCalculator.GetBitArrayFromIds(enabledMusicList, songIdMax, Logger); + + var defaultSongWithUraList = gameDataService.GetMusicWithUraList(); + var enabledUraMusicList = defaultSongWithUraList.Except(lockedSongsList); + var uraSongArray = + FlagCalculator.GetBitArrayFromIds(enabledUraMusicList, songIdMax, Logger); var toneFlg = Array.Empty(); try