mirror of
https://github.com/ppy/osu.git
synced 2025-03-03 13:33:07 +08:00
Use lazer accuracy & rank implementations across the board
This commit is contained in:
parent
aa8eee0796
commit
2958631c5d
@ -597,6 +597,17 @@ namespace osu.Game.Database
|
|||||||
return maxBaseScore == 0 ? 1 : baseScore / (double)maxBaseScore;
|
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>
|
/// <summary>
|
||||||
/// Used to populate the <paramref name="score"/> model using data parsed from its corresponding replay file.
|
/// Used to populate the <paramref name="score"/> model using data parsed from its corresponding replay file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -40,7 +40,6 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
};
|
};
|
||||||
|
|
||||||
WorkingBeatmap workingBeatmap;
|
WorkingBeatmap workingBeatmap;
|
||||||
byte[] compressedScoreInfo = null;
|
|
||||||
|
|
||||||
using (SerializationReader sr = new SerializationReader(stream))
|
using (SerializationReader sr = new SerializationReader(stream))
|
||||||
{
|
{
|
||||||
@ -109,6 +108,8 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
else if (version >= 20121008)
|
else if (version >= 20121008)
|
||||||
scoreInfo.LegacyOnlineID = sr.ReadInt32();
|
scoreInfo.LegacyOnlineID = sr.ReadInt32();
|
||||||
|
|
||||||
|
byte[] compressedScoreInfo = null;
|
||||||
|
|
||||||
if (version >= 30000001)
|
if (version >= 30000001)
|
||||||
compressedScoreInfo = sr.ReadByteArray();
|
compressedScoreInfo = sr.ReadByteArray();
|
||||||
|
|
||||||
@ -133,11 +134,8 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
}
|
}
|
||||||
|
|
||||||
PopulateMaximumStatistics(score.ScoreInfo, workingBeatmap);
|
PopulateMaximumStatistics(score.ScoreInfo, workingBeatmap);
|
||||||
|
score.ScoreInfo.Accuracy = StandardisedScoreMigrationTools.ComputeAccuracy(score.ScoreInfo);
|
||||||
if (score.ScoreInfo.IsLegacyScore || compressedScoreInfo == null)
|
score.ScoreInfo.Rank = StandardisedScoreMigrationTools.ComputeRank(score.ScoreInfo);
|
||||||
PopulateLegacyAccuracyAndRank(score.ScoreInfo);
|
|
||||||
else
|
|
||||||
populateLazerAccuracyAndRank(score.ScoreInfo);
|
|
||||||
|
|
||||||
// before returning for database import, we must restore the database-sourced BeatmapInfo.
|
// 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.
|
// if not, the clone operation in GetPlayableBeatmap will cause a dereference and subsequent database exception.
|
||||||
|
Loading…
Reference in New Issue
Block a user