예제 #1
0
        // Purposefully ignore modifiers here - only 2 maps have them enabled and it doesn't make much sense to just filter to those two
        private static float GetHighestPP(IPreviewBeatmapLevel previewBeatmapLevel, bool ppGain)
        {
            float maxPP = 0;
            var   id    = SongDataUtils.GetHash(previewBeatmapLevel.levelID);

            // Check if in SDC
            if (SongDataCore.Plugin.Songs.Data.Songs.ContainsKey(id))
            {
                // Loop through each diff
                foreach (var diff in SongDataCore.Plugin.Songs.Data.Songs[id].diffs)
                {
                    var difficulty = SongDataUtils.GetBeatmapDifficulty(diff.diff);
                    var songID     = new SongID(id, difficulty);
                    // Only go through ranked songs
                    if (SongDataUtils.IsRankedSong(songID))
                    {
                        float pp = PPUtils.CalculatePP(songID, AccLoader.instance.GetAcc(songID));
                        if (ppGain)
                        {
                            pp = PPUtils.GetPPGain(pp, songID);
                        }
                        maxPP = pp > maxPP ? pp : maxPP;
                    }
                }
                return(maxPP);
            }
            return(0);
        }
예제 #2
0
        private void SetPPText(bool canUsePositiveModifiers)
        {
            float ppValue = canUsePositiveModifiers ? PPUtils.CalculatePP(_rawPP, BeatSaberUtils.GetModifiedAcc(_accuracy, _modifiersModel, _modifiers))
                            : PPUtils.CalculatePP(_rawPP, BeatSaberUtils.GetModifiedAcc(_accuracy, _modifiersModel, BeatSaberUtils.RemovePositiveModifiers(_modifiers)));
            string ppText     = Math.Round(ppValue, 2).ToString("0.00");
            var    ppGain     = Math.Round(PPUtils.GetPPGain(ppValue, _id), 2);
            string ppGainText = ppGain.ToString("0.00");
            var    color      = ppGain > 0 ? "green" : "red";

            _ppText.SetText($"{ppText} (<color=\"{color}\">+{ppGain}</color>)");
        }