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-04-13 18:19:50 +09:00
|
|
|
|
|
2022-06-17 16:37:17 +09:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2018-12-22 16:51:24 +01:00
|
|
|
|
using System;
|
2017-06-15 21:13:40 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2021-07-23 22:37:08 +02:00
|
|
|
|
using osu.Framework.Localisation;
|
2021-11-04 18:02:44 +09:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2018-12-22 16:51:24 +01:00
|
|
|
|
using osu.Game.Scoring;
|
2020-02-04 11:17:23 +07:00
|
|
|
|
using osu.Game.Utils;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
namespace osu.Game.Users
|
|
|
|
|
{
|
|
|
|
|
public class UserStatistics
|
|
|
|
|
{
|
2019-11-27 21:56:22 +03:00
|
|
|
|
[JsonProperty]
|
2021-11-04 18:02:44 +09:00
|
|
|
|
public APIUser User;
|
2019-11-27 21:56:22 +03:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"level")]
|
|
|
|
|
public LevelInfo Level;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-25 10:51:54 +08:00
|
|
|
|
public struct LevelInfo
|
2017-06-15 21:13:40 +08:00
|
|
|
|
{
|
|
|
|
|
[JsonProperty(@"current")]
|
|
|
|
|
public int Current;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"progress")]
|
|
|
|
|
public int Progress;
|
|
|
|
|
}
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2021-12-19 12:55:24 +01:00
|
|
|
|
[JsonProperty(@"is_ranked")]
|
|
|
|
|
public bool IsRanked;
|
|
|
|
|
|
2021-02-17 08:50:48 +03:00
|
|
|
|
[JsonProperty(@"global_rank")]
|
|
|
|
|
public int? GlobalRank;
|
|
|
|
|
|
2021-03-01 22:41:09 +03:00
|
|
|
|
[JsonProperty(@"country_rank")]
|
2021-02-18 15:37:52 +03:00
|
|
|
|
public int? CountryRank;
|
|
|
|
|
|
2021-02-19 13:40:12 +09:00
|
|
|
|
// populated via User model, as that's where the data currently lives.
|
2021-11-05 13:38:37 +09:00
|
|
|
|
public APIRankHistory RankHistory;
|
2021-02-19 13:40:12 +09:00
|
|
|
|
|
2021-02-16 07:28:51 +03:00
|
|
|
|
[JsonProperty(@"pp")]
|
|
|
|
|
public decimal? PP;
|
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"ranked_score")]
|
|
|
|
|
public long RankedScore;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"hit_accuracy")]
|
2021-03-25 17:34:29 +09:00
|
|
|
|
public double Accuracy;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2020-02-03 22:09:07 +07:00
|
|
|
|
[JsonIgnore]
|
2021-07-23 22:37:08 +02:00
|
|
|
|
public LocalisableString DisplayAccuracy => (Accuracy / 100).FormatAccuracy();
|
2020-02-03 22:09:07 +07:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"play_count")]
|
|
|
|
|
public int PlayCount;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2018-12-22 16:51:24 +01:00
|
|
|
|
[JsonProperty(@"play_time")]
|
|
|
|
|
public int? PlayTime;
|
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"total_score")]
|
|
|
|
|
public long TotalScore;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"total_hits")]
|
|
|
|
|
public int TotalHits;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"maximum_combo")]
|
|
|
|
|
public int MaxCombo;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"replays_watched_by_others")]
|
2017-09-13 15:20:49 +09:00
|
|
|
|
public int ReplaysWatched;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"grade_counts")]
|
|
|
|
|
public Grades GradesCount;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-25 10:51:54 +08:00
|
|
|
|
public struct Grades
|
2017-06-15 21:13:40 +08:00
|
|
|
|
{
|
2018-02-01 15:19:49 +01:00
|
|
|
|
[JsonProperty(@"ssh")]
|
2020-02-04 16:20:15 +03:00
|
|
|
|
public int? SSPlus;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"ss")]
|
|
|
|
|
public int SS;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2018-02-01 15:19:49 +01:00
|
|
|
|
[JsonProperty(@"sh")]
|
2020-02-04 16:20:15 +03:00
|
|
|
|
public int? SPlus;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"s")]
|
|
|
|
|
public int S;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2017-06-15 21:13:40 +08:00
|
|
|
|
[JsonProperty(@"a")]
|
|
|
|
|
public int A;
|
2018-12-22 16:51:24 +01:00
|
|
|
|
|
2020-02-04 21:02:10 +03:00
|
|
|
|
public int this[ScoreRank rank]
|
2018-12-22 16:51:24 +01:00
|
|
|
|
{
|
2019-03-06 16:30:56 +09:00
|
|
|
|
get
|
2018-12-22 16:51:24 +01:00
|
|
|
|
{
|
2019-03-06 16:30:56 +09:00
|
|
|
|
switch (rank)
|
|
|
|
|
{
|
|
|
|
|
case ScoreRank.XH:
|
2020-02-04 21:02:10 +03:00
|
|
|
|
return SSPlus ?? 0;
|
2019-05-07 13:23:09 +09:00
|
|
|
|
|
2019-03-06 16:30:56 +09:00
|
|
|
|
case ScoreRank.X:
|
|
|
|
|
return SS;
|
2019-05-07 13:23:09 +09:00
|
|
|
|
|
2019-03-06 16:30:56 +09:00
|
|
|
|
case ScoreRank.SH:
|
2020-02-04 21:02:10 +03:00
|
|
|
|
return SPlus ?? 0;
|
2019-05-07 13:23:09 +09:00
|
|
|
|
|
2019-03-06 16:30:56 +09:00
|
|
|
|
case ScoreRank.S:
|
|
|
|
|
return S;
|
2019-05-07 13:23:09 +09:00
|
|
|
|
|
2019-03-06 16:30:56 +09:00
|
|
|
|
case ScoreRank.A:
|
|
|
|
|
return A;
|
2019-05-07 13:23:09 +09:00
|
|
|
|
|
2019-03-06 16:30:56 +09:00
|
|
|
|
default:
|
|
|
|
|
throw new ArgumentException($"API does not return {rank.ToString()}");
|
|
|
|
|
}
|
2018-12-22 16:51:24 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-15 21:13:40 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|