using MU3.Data; using MU3.DataStudio; using MU3.User; using MU3.Util; using System.Collections.Generic; using System.Linq; public static class NaiveRating { public static int PrevRating { get; private set; } // Adapted from MU3.User.UserRating.calcBest() private static RatingList calcSane() { RatingList ratingList = new(); var usMgr = Singleton.instance; var musicDict = usMgr.userMusic; foreach(KeyValuePair item in musicDict) { var musicData = SingletonStateMachine .instance.getMusicData(item.Key); if(musicData == null || item.Key == 1 || musicData.isBonusTrack) { continue; } for(int i = 0; i < 5; i++) { var fumenDifficulty = (FumenDifficulty)i; var userFumen = usMgr.getUserFumen(item.Key, fumenDifficulty, create: false); if(userFumen == null) { continue; } Rating rating = new(musicData.id, fumenDifficulty, userFumen.TechScoreMax); if(rating.level100 == 0) { continue; } ratingList.Add(rating); } } ratingList.Sort(); return ratingList; } public static int Get() { int res = 0; foreach(Rating best in calcSane().Take(45)) { res += best.rate100; } return res / 45; } public static bool IsEnabled() { return Singleton.instance.userOption.customSet.Rating == (UserOption.eRating)patch_UserOption.patch_eRating.Naive; } public static void SavePrev() { PrevRating = Get(); } }