public CalculatedScoreEntry(AudicaScore localScore) { this.localScore = localScore; this.songID = localScore.songID; this.maxScorePercent = localScore.maxScorePercent; this.audicaPointsWeighted = 0f; this.audicaPointsRaw = DifficultyCalculator.GetRating(songID, localScore.difficultyString).value *maxScorePercent * 30; }
private static IEnumerator PostProcess() { MapperNames.FixMappers(); yield return(null); if (SongBrowser.songDataLoaderInstalled) { SafeDataLoaderReload(); } yield return(null); // calculate song difficulties // only slow the first time this runs since results are cached songIDs.Clear(); songFilenames.Clear(); songDictionary.Clear(); for (int i = 0; i < SongList.I.songs.Count; i++) { string songID = SongList.I.songs[i].songID; songIDs.Add(songID); string path = Path.GetFileName(SongList.I.songs[i].zipPath); songFilenames.Add(path); songDictionary.Add(path, songID); DifficultyCalculator.GetRating(songID, KataConfig.Difficulty.Easy.ToString()); DifficultyCalculator.GetRating(songID, KataConfig.Difficulty.Normal.ToString()); DifficultyCalculator.GetRating(songID, KataConfig.Difficulty.Hard.ToString()); DifficultyCalculator.GetRating(songID, KataConfig.Difficulty.Expert.ToString()); yield return(null); } SongSearch.Search(); // update the search results with any new songs (if there is a search) yield return(null); foreach (Action cb in postProcessingActions) { cb(); yield return(null); } KataConfig.I.CreateDebugText("Songs Loaded", new Vector3(0f, -1f, 5f), 5f, null, false, 0.2f); EnableButtons(); searching = false; yield return(null); }
private static void Postfix(SongPlayHistory __instance, string songID, int score, KataConfig.Difficulty difficulty, float percent, bool fullCombo, bool noFail) { if (counter % 2 == 0) { MelonLogger.Msg("Recorded new score!"); if (noFail) { return; } if (percent < 30f) { return; } float maxScorePercent = (float)score / (float)StarThresholds.I.GetMaxRawScore(songID, difficulty); DifficultyCalculator.CachedCalculation difficultyRating = DifficultyCalculator.GetRating(songID, difficulty.ToString()); AddScore(songID, score, maxScorePercent, difficultyRating.value, ScoreKeeper.I.mStreak, ScoreKeeper.I.mMaxStreak, difficulty); } counter++; }
private static void Postfix(SongSelect __instance, SongSelect.SongSelectItemEntry entry) { var song = SongList.I.GetSong(entry.songID); if (entry.item.mapperLabel != null) { //package data to be used for display SongBrowser.SongDisplayPackage songd = new SongBrowser.SongDisplayPackage(); songd.hasEasy = song.hasEasy; songd.hasStandard = song.hasNormal; songd.hasAdvanced = song.hasHard; songd.hasExpert = song.hasExpert; //if song data loader is installed look for custom tags if (SongBrowser.songDataLoaderInstalled) { songd = SongBrowser.SongDisplayPackage.FillCustomData(songd, song.songID); } CachedCalculation easy = DifficultyCalculator.GetRating(song.songID, KataConfig.Difficulty.Easy.ToString()); CachedCalculation normal = DifficultyCalculator.GetRating(song.songID, KataConfig.Difficulty.Normal.ToString()); CachedCalculation hard = DifficultyCalculator.GetRating(song.songID, KataConfig.Difficulty.Hard.ToString()); CachedCalculation expert = DifficultyCalculator.GetRating(song.songID, KataConfig.Difficulty.Expert.ToString()); //add mine tag if there are mines if (song.hasEasy && easy.hasMines) { songd.customEasyTags.Insert(0, "Mines"); } if (song.hasNormal && normal.hasMines) { songd.customStandardTags.Insert(0, "Mines"); } if (song.hasHard && hard.hasMines) { songd.customAdvancedTags.Insert(0, "Mines"); } if (song.hasExpert && expert.hasMines) { songd.customExpertTags.Insert(0, "Mines"); } //add 360 tag if (song.hasEasy && easy.is360) { songd.customEasyTags.Insert(0, "360"); } if (song.hasNormal && normal.is360) { songd.customStandardTags.Insert(0, "360"); } if (song.hasHard && hard.is360) { songd.customAdvancedTags.Insert(0, "360"); } if (song.hasExpert && expert.is360) { songd.customExpertTags.Insert(0, "360"); } songd.customExpertTags = songd.customExpertTags.Distinct().ToList(); songd.customStandardTags = songd.customStandardTags.Distinct().ToList(); songd.customAdvancedTags = songd.customAdvancedTags.Distinct().ToList(); songd.customEasyTags = songd.customEasyTags.Distinct().ToList(); entry.item.mapperLabel.text += SongBrowser.GetDifficultyString(songd); } }
public static string CreateDisplayString(List <CalculatedScoreEntry> scores) { string output = "Difficulty Rating\n"; var songData = SongDataHolder.I.songData; fillData AdditionHolder = new fillData(); AdditionHolder.easyAdditions = new List <string>(); AdditionHolder.advancedAdditions = new List <string>(); AdditionHolder.standardAdditions = new List <string>(); AdditionHolder.expertAdditions = new List <string>(); if (SongBrowser.songDataLoaderInstalled) { //fillAdditions() is separated into its own function to avoid errors if !songDataLoaderInstalled /*Explanation: * When CreateDisplayString() is called the first time it loads in all the functions it needs. * If we include anything from the Song Data Loader utility in CreateDisplayString() it will try to * load from the dll. In the case they dont have the dll, it will throw an exception and the rest of * CreateDisplayString() won't run. Since all mentions of Son Data Loader are in fillAdditions(), which * is behind a conditional we wont have that issue. */ AdditionHolder = fillAdditions(songData.songID, AdditionHolder); } CachedCalculation easy = DifficultyCalculator.GetRating(songData.songID, KataConfig.Difficulty.Easy.ToString()); CachedCalculation normal = DifficultyCalculator.GetRating(songData.songID, KataConfig.Difficulty.Normal.ToString()); CachedCalculation hard = DifficultyCalculator.GetRating(songData.songID, KataConfig.Difficulty.Hard.ToString()); CachedCalculation expert = DifficultyCalculator.GetRating(songData.songID, KataConfig.Difficulty.Expert.ToString()); //add mine tags if it has mines if (songData.hasEasy && easy.hasMines) { AdditionHolder.easyAdditions.Insert(0, "Mines"); } if (songData.hasNormal && normal.hasMines) { AdditionHolder.standardAdditions.Insert(0, "Mines"); } if (songData.hasHard && hard.hasMines) { AdditionHolder.advancedAdditions.Insert(0, "Mines"); } if (songData.hasExpert && expert.hasMines) { AdditionHolder.expertAdditions.Insert(0, "Mines"); } //add 360 if it is if (songData.hasEasy && easy.is360) { AdditionHolder.easyAdditions.Insert(0, "360"); } if (songData.hasNormal && normal.is360) { AdditionHolder.standardAdditions.Insert(0, "360"); } if (songData.hasHard && hard.is360) { AdditionHolder.advancedAdditions.Insert(0, "360"); } if (songData.hasExpert && expert.is360) { AdditionHolder.expertAdditions.Insert(0, "360"); } AdditionHolder.expertAdditions = AdditionHolder.expertAdditions.Distinct().ToList(); AdditionHolder.standardAdditions = AdditionHolder.standardAdditions.Distinct().ToList(); AdditionHolder.advancedAdditions = AdditionHolder.advancedAdditions.Distinct().ToList(); AdditionHolder.easyAdditions = AdditionHolder.easyAdditions.Distinct().ToList(); if (expert.value != 0) { output += $"<color=#b119f7>{expert.value.ToString("n2")} "; output += AdditionHolder.expertAdditions.Count > 0 ? "(" + string.Join(", ", AdditionHolder.expertAdditions.ToArray()) + ")</color> " : "</color> "; } if (hard.value != 0) { output += $"<color=#f7a919>{hard.value.ToString("n2")} "; output += AdditionHolder.advancedAdditions.Count > 0 ? "(" + string.Join(", ", AdditionHolder.advancedAdditions.ToArray()) + ")</color> " : "</color> "; } if (normal.value != 0) { output += $"<color=#19d2f7>{normal.value.ToString("n2")} "; output += AdditionHolder.standardAdditions.Count > 0 ? "(" + string.Join(", ", AdditionHolder.standardAdditions.ToArray()) + ")</color> " : "</color> "; } if (easy.value != 0) { output += $"<color=#54f719>{easy.value.ToString("n2")} "; output += AdditionHolder.easyAdditions.Count > 0 ? "(" + string.Join(", ", AdditionHolder.easyAdditions.ToArray()) + ")</color> " : "</color> "; } return(output); }