2024-05-21 21:57:39 +00:00
|
|
|
using MU3.Data;
|
|
|
|
using MU3.DataStudio;
|
2024-06-26 23:15:42 +00:00
|
|
|
using MU3.User;
|
2024-05-21 21:57:39 +00:00
|
|
|
using MU3.Util;
|
2024-07-02 01:35:45 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2024-05-21 21:57:39 +00:00
|
|
|
|
2024-06-26 23:15:42 +00:00
|
|
|
public static class NaiveRating {
|
2024-07-07 14:47:46 +00:00
|
|
|
public static int PrevRating { get; private set; }
|
2024-05-21 21:57:39 +00:00
|
|
|
|
2024-06-26 23:15:42 +00:00
|
|
|
// Adapted from MU3.User.UserRating.calcBest()
|
|
|
|
private static RatingList calcSane() {
|
2024-05-21 21:57:39 +00:00
|
|
|
RatingList ratingList = new();
|
|
|
|
|
2024-06-26 23:15:42 +00:00
|
|
|
var usMgr = Singleton<UserManager>.instance;
|
2024-05-21 21:57:39 +00:00
|
|
|
var musicDict = usMgr.userMusic;
|
|
|
|
|
2024-05-25 23:15:13 +00:00
|
|
|
foreach(KeyValuePair<int, UserMusic> item in musicDict) {
|
2024-06-26 23:15:42 +00:00
|
|
|
var musicData = SingletonStateMachine<DataManager, DataManager.EState>
|
|
|
|
.instance.getMusicData(item.Key);
|
|
|
|
|
2024-05-25 23:15:13 +00:00
|
|
|
if(musicData == null || item.Key == 1 || musicData.isBonusTrack) {
|
2024-05-21 21:57:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
2024-05-25 23:15:13 +00:00
|
|
|
for(int i = 0; i < 5; i++) {
|
2024-06-26 23:15:42 +00:00
|
|
|
var fumenDifficulty = (FumenDifficulty)i;
|
|
|
|
var userFumen = usMgr.getUserFumen(item.Key, fumenDifficulty, create: false);
|
2024-05-25 23:15:13 +00:00
|
|
|
if(userFumen == null) {
|
2024-05-21 21:57:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
2024-06-26 23:15:42 +00:00
|
|
|
Rating rating = new(musicData.id, fumenDifficulty, userFumen.TechScoreMax);
|
2024-05-25 23:15:13 +00:00
|
|
|
if(rating.level100 == 0) {
|
2024-05-21 21:57:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ratingList.Add(rating);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ratingList.Sort();
|
|
|
|
return ratingList;
|
|
|
|
}
|
2024-06-26 23:15:42 +00:00
|
|
|
public static int Get() {
|
|
|
|
int res = 0;
|
2024-05-25 23:15:13 +00:00
|
|
|
foreach(Rating best in calcSane().Take(45)) {
|
2024-06-26 23:15:42 +00:00
|
|
|
res += best.rate100;
|
2024-05-21 21:57:39 +00:00
|
|
|
}
|
2024-06-26 23:28:14 +00:00
|
|
|
return res / 45;
|
2024-05-21 21:57:39 +00:00
|
|
|
}
|
2024-07-07 14:47:46 +00:00
|
|
|
public static bool IsEnabled() {
|
|
|
|
return Singleton<UserManager>.instance.userOption.customSet.Rating == (UserOption.eRating)patch_UserOption.patch_eRating.Naive;
|
|
|
|
}
|
|
|
|
public static void SavePrev() {
|
|
|
|
PrevRating = Get();
|
|
|
|
}
|
2024-05-21 21:57:39 +00:00
|
|
|
}
|