This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from dragonfruitnetwork/ranked2-stats
Add ranked2 stats
- Loading branch information
Showing
11 changed files
with
200 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Dragon6 API Copyright DragonFruit Network <inbox@dragonfruit.network> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System; | ||
|
||
namespace DragonFruit.Six.Api.Enums | ||
{ | ||
[Flags] | ||
public enum PlatformGroup | ||
{ | ||
PC = 1, | ||
Console = 2 | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
DragonFruit.Six.Api/Seasonal/Entities/Ranked2SeasonMatchStats.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Dragon6 API Copyright DragonFruit Network <inbox@dragonfruit.network> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System; | ||
using DragonFruit.Six.Api.Utils; | ||
using Newtonsoft.Json; | ||
|
||
namespace DragonFruit.Six.Api.Seasonal.Entities | ||
{ | ||
[Serializable] | ||
[JsonObject(MemberSerialization.OptIn)] | ||
public class Ranked2SeasonMatchStats | ||
{ | ||
[JsonProperty("wins")] | ||
public int Wins { get; set; } | ||
|
||
[JsonProperty("losses")] | ||
public int Losses { get; set; } | ||
|
||
[JsonProperty("abandons")] | ||
public int Abandons { get; set; } | ||
|
||
public float WL => RatioUtils.RatioOf(Wins, Losses + Abandons); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
DragonFruit.Six.Api/Seasonal/Entities/Ranked2SeasonStats.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Dragon6 API Copyright DragonFruit Network <inbox@dragonfruit.network> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System; | ||
using DragonFruit.Six.Api.Enums; | ||
using DragonFruit.Six.Api.Seasonal.Enums; | ||
using DragonFruit.Six.Api.Utils; | ||
using Newtonsoft.Json; | ||
|
||
namespace DragonFruit.Six.Api.Seasonal.Entities | ||
{ | ||
[Serializable] | ||
[JsonObject(MemberSerialization.OptIn)] | ||
public class Ranked2SeasonStats | ||
{ | ||
[JsonProperty("board_id")] | ||
public BoardType Board { get; set; } | ||
|
||
[JsonProperty("id")] | ||
public string ProfileId { get; set; } | ||
|
||
[JsonProperty("season_id")] | ||
public int SeasonId { get; set; } | ||
|
||
[JsonProperty("platform_family")] | ||
public PlatformGroup Platform { get; set; } | ||
|
||
[JsonProperty("rank")] | ||
public int Rank { get; set; } | ||
|
||
[JsonProperty("rank_points")] | ||
public int RankPoints { get; set; } | ||
|
||
[JsonProperty("top_rank_position")] | ||
public int TopRankPosition { get; set; } | ||
|
||
[JsonProperty("max_rank")] | ||
public int MaxRank { get; set; } | ||
|
||
[JsonProperty("max_rank_points")] | ||
public int MaxRankPoints { get; set; } | ||
|
||
public RankInfo RankInfo => Ranks.GetFromId(Rank); | ||
|
||
public RankInfo MaxRankInfo => Ranks.GetFromId(MaxRank); | ||
|
||
[JsonProperty("kills")] | ||
public int Kills { get; set; } | ||
|
||
[JsonProperty("deaths")] | ||
public int Deaths { get; set; } | ||
|
||
[JsonProperty("match_outcomes")] | ||
public Ranked2SeasonMatchStats Matches { get; set; } | ||
|
||
public float KD => RatioUtils.RatioOf(Kills, Deaths); | ||
|
||
public override string ToString() => $"{Platform}/{Board}: {ProfileId}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
DragonFruit.Six.Api/Seasonal/Entities/SeasonalStatsResponse.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
DragonFruit.Six.Api/Seasonal/Requests/Ranked2StatsRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Dragon6 API Copyright DragonFruit Network <inbox@dragonfruit.network> | ||
// Licensed under Apache-2. Refer to the LICENSE file for more info | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using DragonFruit.Data; | ||
using DragonFruit.Data.Parameters; | ||
using DragonFruit.Six.Api.Accounts.Entities; | ||
using DragonFruit.Six.Api.Accounts.Enums; | ||
using DragonFruit.Six.Api.Enums; | ||
|
||
namespace DragonFruit.Six.Api.Seasonal.Requests | ||
{ | ||
public class Ranked2StatsRequest : UbiApiRequest | ||
{ | ||
public override string Path => Platform.CrossPlatform.SpaceUrl(2) + "/title/r6s/skill/full_profiles"; | ||
|
||
protected override UbisoftService? RequiredTokenSource => UbisoftService.RainbowSixClient; | ||
|
||
public Ranked2StatsRequest(IEnumerable<UbisoftAccount> accounts, PlatformGroup platforms) | ||
{ | ||
Accounts = accounts; | ||
PlatformGroups = platforms; | ||
} | ||
|
||
public IEnumerable<UbisoftAccount> Accounts { get; set; } | ||
|
||
[QueryParameter("platform_families", EnumHandlingMode.StringLower)] | ||
public PlatformGroup PlatformGroups { get; set; } | ||
|
||
[QueryParameter("profile_ids", CollectionConversionMode.Concatenated)] | ||
private IEnumerable<string> AccountIdentifiers => Accounts.Select(x => x.ProfileId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters