mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 17:29:56 +09:00
Move legacy ScoreInfo
to be completely based on presence of classic mod
This commit is contained in:
@ -21,7 +21,12 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
{
|
{
|
||||||
var ruleset = rulesets.GetRuleset(OnlineRulesetID);
|
var ruleset = rulesets.GetRuleset(OnlineRulesetID);
|
||||||
|
|
||||||
var mods = Mods != null ? ruleset.CreateInstance().GetAllMods().Where(mod => Mods.Contains(mod.Acronym)).ToArray() : Array.Empty<Mod>();
|
var rulesetInstance = ruleset.CreateInstance();
|
||||||
|
|
||||||
|
var mods = Mods != null ? rulesetInstance.GetAllMods().Where(mod => Mods.Contains(mod.Acronym)).ToArray() : Array.Empty<Mod>();
|
||||||
|
|
||||||
|
// all API scores provided by this class are considered to be legacy.
|
||||||
|
mods = mods.Append(rulesetInstance.GetAllMods().OfType<ModClassic>().Single()).ToArray();
|
||||||
|
|
||||||
var scoreInfo = new ScoreInfo
|
var scoreInfo = new ScoreInfo
|
||||||
{
|
{
|
||||||
@ -38,7 +43,6 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
Rank = Rank,
|
Rank = Rank,
|
||||||
Ruleset = ruleset,
|
Ruleset = ruleset,
|
||||||
Mods = mods,
|
Mods = mods,
|
||||||
IsLegacyScore = true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Statistics != null)
|
if (Statistics != null)
|
||||||
|
@ -65,6 +65,10 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
|
|
||||||
scoreInfo.Mods = currentRuleset.ConvertFromLegacyMods((LegacyMods)sr.ReadInt32()).ToArray();
|
scoreInfo.Mods = currentRuleset.ConvertFromLegacyMods((LegacyMods)sr.ReadInt32()).ToArray();
|
||||||
|
|
||||||
|
// lazer replays get a really high version number.
|
||||||
|
if (version < 30000000)
|
||||||
|
scoreInfo.Mods = scoreInfo.Mods.Append(currentRuleset.GetAllMods().OfType<ModClassic>().Single()).ToArray();
|
||||||
|
|
||||||
currentBeatmap = workingBeatmap.GetPlayableBeatmap(currentRuleset.RulesetInfo, scoreInfo.Mods);
|
currentBeatmap = workingBeatmap.GetPlayableBeatmap(currentRuleset.RulesetInfo, scoreInfo.Mods);
|
||||||
scoreInfo.Beatmap = currentBeatmap.BeatmapInfo;
|
scoreInfo.Beatmap = currentBeatmap.BeatmapInfo;
|
||||||
|
|
||||||
|
@ -201,33 +201,12 @@ namespace osu.Game.Scoring
|
|||||||
[JsonProperty("position")]
|
[JsonProperty("position")]
|
||||||
public int? Position { get; set; }
|
public int? Position { get; set; }
|
||||||
|
|
||||||
private bool isLegacyScore;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this <see cref="ScoreInfo"/> represents a legacy (osu!stable) score.
|
/// Whether this <see cref="ScoreInfo"/> represents a legacy (osu!stable) score.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public bool IsLegacyScore
|
public bool IsLegacyScore => mods.OfType<ModClassic>().Any();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (isLegacyScore)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// The above check will catch legacy online scores that have an appropriate UserString + UserId.
|
|
||||||
// For non-online scores such as those imported in, a heuristic is used based on the following table:
|
|
||||||
//
|
|
||||||
// Mode | UserString | UserId
|
|
||||||
// --------------- | ---------- | ---------
|
|
||||||
// stable | <username> | 1
|
|
||||||
// lazer | <username> | <userid>
|
|
||||||
// lazer (offline) | Guest | 1
|
|
||||||
|
|
||||||
return ID > 0 && UserID == 1 && UserString != "Guest";
|
|
||||||
}
|
|
||||||
set => isLegacyScore = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<HitResultDisplayStatistic> GetStatisticsForDisplay()
|
public IEnumerable<HitResultDisplayStatistic> GetStatisticsForDisplay()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user