diff --git a/AquaMai/Helpers/Shim.cs b/AquaMai/Helpers/Shim.cs index 865fb23a..040af605 100644 --- a/AquaMai/Helpers/Shim.cs +++ b/AquaMai/Helpers/Shim.cs @@ -1,8 +1,11 @@ using System; +using System.Collections.Generic; +using System.Linq; using System.Reflection; using HarmonyLib; using MAI2.Util; using Manager; +using Manager.UserDatas; using Net.Packet; using Net.Packet.Mai2; @@ -64,4 +67,24 @@ public static class Shim throw new MissingMethodException("No matching PacketUpsertUserAll constructor found"); } })(); + + public static IEnumerable[] GetUserScoreList(UserData userData) + { + var tUserData = Traverse.Create(userData); + + var tScoreList = tUserData.Property("ScoreList"); + if (tScoreList.PropertyExists()) + { + return tScoreList.GetValue[]>(); + } + + var tScoreDic = tUserData.Property("ScoreDic"); + if (tScoreDic.PropertyExists()) + { + var scoreDic = tScoreDic.GetValue[]>(); + return scoreDic.Select(dic => dic.Values).ToArray(); + } + + throw new MissingFieldException("No matching UserData.ScoreList/ScoreDic found"); + } } diff --git a/AquaMai/UX/ImmediateSave.cs b/AquaMai/UX/ImmediateSave.cs index 290614f9..f63b06f3 100644 --- a/AquaMai/UX/ImmediateSave.cs +++ b/AquaMai/UX/ImmediateSave.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.Linq; using AquaMai.Helpers; using AquaMai.Resources; -using AquaMai.Utils; -using CriAtomDebugDetail; using DB; using HarmonyLib; using MAI2.Util; @@ -16,7 +14,6 @@ using MelonLoader; using Monitor.Entry.Parts.Screens; using Net.Packet; using Net.Packet.Helper; -using Net.Packet.Mai2; using Process; using Process.UserDataNet.State.UserDataULState; using UnityEngine; @@ -109,7 +106,6 @@ public class ImmediateSave private static void SaveDataFix(UserData userData) { UserDetail detail = userData.Detail; - _ = userData.ScoreList; detail.EventWatchedDate = TimeManager.GetDateString(TimeManager.PlayBaseTime); userData.CalcTotalValue(); float num = 0f; @@ -147,7 +143,7 @@ public class ImmediateSave List list = new List(); List list2 = new List(); - List[] scoreList = userData.ScoreList; + IEnumerable[] scoreList = Shim.GetUserScoreList(userData); List ratingList = userData.RatingList.RatingList; List newRatingList = userData.RatingList.NewRatingList; int achive = RatingTableID.Rate_22.GetAchive(); diff --git a/src/main/java/icu/samnyan/aqua/sega/maimai2/Maimai2ServletController.kt b/src/main/java/icu/samnyan/aqua/sega/maimai2/Maimai2ServletController.kt index 0fa746c9..894c092f 100644 --- a/src/main/java/icu/samnyan/aqua/sega/maimai2/Maimai2ServletController.kt +++ b/src/main/java/icu/samnyan/aqua/sega/maimai2/Maimai2ServletController.kt @@ -222,6 +222,10 @@ class Maimai2ServletController( val getGameNgMusicId = BaseHandler { mapOf("length" to 0, "musicIdList" to empty) } val getGameRanking = BaseHandler { mapOf("type" to it["type"].toString(), "gameRankingList" to empty) } val getGameTournamentInfo = BaseHandler { mapOf("length" to 0, "gameTournamentInfoList" to empty) } + val getGameKaleidxScope = BaseHandler { mapOf("gameKaleidxScopeList" to empty) } + val getUserKaleidxScope = UserReqHandler { _, uid -> mapOf("userId" to uid, "userKaleidxScopeList" to empty) } + val getUserNewItem = UserReqHandler { _, uid -> mapOf("userId" to uid, "itemKind" to 0, "itemId" to 0) } + val getUserNewItemList = UserReqHandler { _, uid -> mapOf("userId" to uid, "userItemList" to empty) } val getGameSetting = BaseHandler { // The client-side implementation for reboot time is extremely cursed. @@ -289,6 +293,15 @@ class Maimai2ServletController( "userMissionDataList" to empty ) } + val getGameMusicScore = BaseHandler { mapOf( + "gameMusicScore" to mapOf( + "musicId" to 0, + "level" to 0, + "type" to 0, + "scoreData" to "" + ) + ) } + val endpointList = setOf("GetGameEventApi", "GetGameRankingApi", "GetGameSettingApi", "GetGameTournamentInfoApi", "GetGameWeeklyDataApi", "GetTransferFriendApi", "GetUserActivityApi", "GetUserCardApi", "GetUserCharacterApi", "GetUserDataApi", "GetUserExtendApi", "GetUserFavoriteApi", "GetUserGhostApi", "GetUserItemApi", "GetUserLoginBonusApi", @@ -303,7 +316,8 @@ class Maimai2ServletController( "CMUpsertUserPrintlogApi", "GetUserFavoriteItemApi", "GetUserRivalDataApi", "GetUserRivalMusicApi", "GetUserScoreRankingApi", "UpsertClientBookkeepingApi", "UpsertClientSettingApi", "UpsertClientTestmodeApi", "UpsertClientUploadApi", "Ping", "RemoveTokenApi", "CMLoginApi", "CMLogoutApi", - "CMUpsertBuyCardApi", "GetGameSettingApi").toMutableList() + "CMUpsertBuyCardApi", "GetGameSettingApi", "GetGameKaleidxScopeApi", "GetGameMusicScoreApi", + "GetUserKaleidxScopeApi", "GetUserNewItemApi", "GetUserNewItemListApi").toMutableList() val noopEndpoint = endpointList.popAll("GetUserScoreRankingApi", "UpsertClientBookkeepingApi", "UpsertClientSettingApi", "UpsertClientTestmodeApi", "UpsertClientUploadApi", "Ping", "RemoveTokenApi",