diff --git a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs
index 57586e3d77..77dcfd39e3 100644
--- a/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs
+++ b/osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs
@@ -154,10 +154,8 @@ namespace osu.Game.Online.API.Requests.Responses
var mods = Mods.Select(apiMod => apiMod.ToMod(rulesetInstance)).ToArray();
- var scoreInfo = ToScoreInfo(mods);
-
+ var scoreInfo = ToScoreInfo(mods, beatmap);
scoreInfo.Ruleset = ruleset;
- if (beatmap != null) scoreInfo.BeatmapInfo = beatmap;
return scoreInfo;
}
@@ -166,25 +164,47 @@ namespace osu.Game.Online.API.Requests.Responses
/// Create a from an API score instance.
///
/// The mod instances, resolved from a ruleset.
- ///
- public ScoreInfo ToScoreInfo(Mod[] mods) => new ScoreInfo
+ /// The object to populate the scores' beatmap with.
+ ///
+ /// - If this is a type, then the score will be fully populated with the given object.
+ /// - Otherwise, if this is an type (e.g. ), then only the beatmap ruleset will be populated.
+ /// - Otherwise, if this is null, then the beatmap ruleset will not be populated.
+ /// - The online beatmap ID is populated in all cases.
+ ///
+ ///
+ /// The populated .
+ public ScoreInfo ToScoreInfo(Mod[] mods, IBeatmapInfo? beatmap = null)
{
- OnlineID = OnlineID,
- User = User ?? new APIUser { Id = UserID },
- BeatmapInfo = new BeatmapInfo { OnlineID = BeatmapID },
- Ruleset = new RulesetInfo { OnlineID = RulesetID },
- Passed = Passed,
- TotalScore = TotalScore,
- Accuracy = Accuracy,
- MaxCombo = MaxCombo,
- Rank = Rank,
- Statistics = Statistics,
- MaximumStatistics = MaximumStatistics,
- Date = EndedAt,
- Hash = HasReplay ? "online" : string.Empty, // TODO: temporary?
- Mods = mods,
- PP = PP,
- };
+ var score = new ScoreInfo
+ {
+ OnlineID = OnlineID,
+ User = User ?? new APIUser { Id = UserID },
+ BeatmapInfo = new BeatmapInfo { OnlineID = BeatmapID },
+ Ruleset = new RulesetInfo { OnlineID = RulesetID },
+ Passed = Passed,
+ TotalScore = TotalScore,
+ Accuracy = Accuracy,
+ MaxCombo = MaxCombo,
+ Rank = Rank,
+ Statistics = Statistics,
+ MaximumStatistics = MaximumStatistics,
+ Date = EndedAt,
+ Hash = HasReplay ? "online" : string.Empty, // TODO: temporary?
+ Mods = mods,
+ PP = PP,
+ };
+
+ if (beatmap is BeatmapInfo realmBeatmap)
+ score.BeatmapInfo = realmBeatmap;
+ else if (beatmap != null)
+ {
+ score.BeatmapInfo.Ruleset.OnlineID = beatmap.Ruleset.OnlineID;
+ score.BeatmapInfo.Ruleset.Name = beatmap.Ruleset.Name;
+ score.BeatmapInfo.Ruleset.ShortName = beatmap.Ruleset.ShortName;
+ }
+
+ return score;
+ }
///
/// Creates a from a local score for score submission.