1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

Use lazer accuracy & rank implementations across the board

This commit is contained in:
Bartłomiej Dach 2024-01-17 19:14:53 +01:00
parent aa8eee0796
commit 2958631c5d
No known key found for this signature in database
2 changed files with 15 additions and 6 deletions

View File

@ -597,6 +597,17 @@ namespace osu.Game.Database
return maxBaseScore == 0 ? 1 : baseScore / (double)maxBaseScore;
}
public static ScoreRank ComputeRank(ScoreInfo scoreInfo)
{
Ruleset ruleset = scoreInfo.Ruleset.CreateInstance();
var rank = ruleset.CreateScoreProcessor().RankFromScore(scoreInfo.Accuracy, scoreInfo.Statistics);
foreach (var mod in scoreInfo.Mods.OfType<IApplicableToScoreProcessor>())
rank = mod.AdjustRank(rank, scoreInfo.Accuracy);
return rank;
}
/// <summary>
/// Used to populate the <paramref name="score"/> model using data parsed from its corresponding replay file.
/// </summary>

View File

@ -40,7 +40,6 @@ namespace osu.Game.Scoring.Legacy
};
WorkingBeatmap workingBeatmap;
byte[] compressedScoreInfo = null;
using (SerializationReader sr = new SerializationReader(stream))
{
@ -109,6 +108,8 @@ namespace osu.Game.Scoring.Legacy
else if (version >= 20121008)
scoreInfo.LegacyOnlineID = sr.ReadInt32();
byte[] compressedScoreInfo = null;
if (version >= 30000001)
compressedScoreInfo = sr.ReadByteArray();
@ -133,11 +134,8 @@ namespace osu.Game.Scoring.Legacy
}
PopulateMaximumStatistics(score.ScoreInfo, workingBeatmap);
if (score.ScoreInfo.IsLegacyScore || compressedScoreInfo == null)
PopulateLegacyAccuracyAndRank(score.ScoreInfo);
else
populateLazerAccuracyAndRank(score.ScoreInfo);
score.ScoreInfo.Accuracy = StandardisedScoreMigrationTools.ComputeAccuracy(score.ScoreInfo);
score.ScoreInfo.Rank = StandardisedScoreMigrationTools.ComputeRank(score.ScoreInfo);
// before returning for database import, we must restore the database-sourced BeatmapInfo.
// if not, the clone operation in GetPlayableBeatmap will cause a dereference and subsequent database exception.