2019-01-24 17:43:03 +09:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-06-08 12:04:33 +09:00
|
|
|
|
|
2019-07-09 17:53:34 +03:00
|
|
|
|
using System;
|
2018-06-08 12:04:33 +09:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests.Responses
|
|
|
|
|
{
|
|
|
|
|
public class APIBeatmap : BeatmapMetadata
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty(@"id")]
|
2018-06-08 12:46:34 +09:00
|
|
|
|
public int OnlineBeatmapID { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"beatmapset_id")]
|
|
|
|
|
public int OnlineBeatmapSetID { get; set; }
|
2018-06-08 12:04:33 +09:00
|
|
|
|
|
2018-09-13 11:57:33 +02:00
|
|
|
|
[JsonProperty(@"status")]
|
|
|
|
|
public BeatmapSetOnlineStatus Status { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"beatmapset")]
|
|
|
|
|
public APIBeatmapSet BeatmapSet { get; set; }
|
|
|
|
|
|
2018-06-08 12:04:33 +09:00
|
|
|
|
[JsonProperty(@"playcount")]
|
|
|
|
|
private int playCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"passcount")]
|
|
|
|
|
private int passCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"mode_int")]
|
|
|
|
|
private int ruleset { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"difficulty_rating")]
|
|
|
|
|
private double starDifficulty { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"drain")]
|
|
|
|
|
private float drainRate { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"cs")]
|
|
|
|
|
private float circleSize { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"ar")]
|
|
|
|
|
private float approachRate { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"accuracy")]
|
|
|
|
|
private float overallDifficulty { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"total_length")]
|
|
|
|
|
private double length { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"count_circles")]
|
|
|
|
|
private int circleCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"count_sliders")]
|
|
|
|
|
private int sliderCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"version")]
|
|
|
|
|
private string version { get; set; }
|
|
|
|
|
|
2019-06-13 16:39:38 +09:00
|
|
|
|
[JsonProperty(@"failtimes")]
|
|
|
|
|
private BeatmapMetrics metrics { get; set; }
|
|
|
|
|
|
2020-02-19 17:58:41 +01:00
|
|
|
|
[JsonProperty(@"max_combo")]
|
|
|
|
|
private int? maxCombo { get; set; }
|
|
|
|
|
|
2020-06-02 14:03:13 +09:00
|
|
|
|
public virtual BeatmapInfo ToBeatmap(RulesetStore rulesets)
|
2018-06-08 12:04:33 +09:00
|
|
|
|
{
|
2018-12-14 15:03:49 +09:00
|
|
|
|
var set = BeatmapSet?.ToBeatmapSet(rulesets);
|
2018-12-14 13:43:52 +09:00
|
|
|
|
|
2018-06-08 12:04:33 +09:00
|
|
|
|
return new BeatmapInfo
|
|
|
|
|
{
|
2018-12-14 15:03:49 +09:00
|
|
|
|
Metadata = set?.Metadata ?? this,
|
2018-06-08 12:04:33 +09:00
|
|
|
|
Ruleset = rulesets.GetRuleset(ruleset),
|
|
|
|
|
StarDifficulty = starDifficulty,
|
2018-06-08 12:46:34 +09:00
|
|
|
|
OnlineBeatmapID = OnlineBeatmapID,
|
2018-09-13 11:57:33 +02:00
|
|
|
|
Version = version,
|
2020-12-03 16:42:06 +09:00
|
|
|
|
// this is actually an incorrect mapping (Length is calculated as drain length in lazer's import process, see BeatmapManager.calculateLength).
|
2019-07-10 23:12:18 +03:00
|
|
|
|
Length = TimeSpan.FromSeconds(length).TotalMilliseconds,
|
2018-09-13 11:57:33 +02:00
|
|
|
|
Status = Status,
|
2018-12-14 13:43:52 +09:00
|
|
|
|
BeatmapSet = set,
|
2019-06-13 16:39:38 +09:00
|
|
|
|
Metrics = metrics,
|
2020-02-19 17:58:41 +01:00
|
|
|
|
MaxCombo = maxCombo,
|
2018-06-08 12:04:33 +09:00
|
|
|
|
BaseDifficulty = new BeatmapDifficulty
|
|
|
|
|
{
|
|
|
|
|
DrainRate = drainRate,
|
|
|
|
|
CircleSize = circleSize,
|
|
|
|
|
ApproachRate = approachRate,
|
|
|
|
|
OverallDifficulty = overallDifficulty,
|
|
|
|
|
},
|
|
|
|
|
OnlineInfo = new BeatmapOnlineInfo
|
|
|
|
|
{
|
|
|
|
|
PlayCount = playCount,
|
|
|
|
|
PassCount = passCount,
|
|
|
|
|
CircleCount = circleCount,
|
|
|
|
|
SliderCount = sliderCount,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|