#pragma warning disable CS0626 #pragma warning disable CS0649 #pragma warning disable IDE0051 #pragma warning disable IDE1006 using System.Collections.Generic; using System.Linq; using MU3.Data; using MU3.DataStudio; using MU3.User; using MU3.Util; namespace MU3; public static class NaiveRating { public static int PrevRating { get; 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 > 0 ? res / 45 : Singleton.instance.Rating; } }