diff --git a/DragonFruit.Six.Api.Tests/Data/LegacyStatsTests.cs b/DragonFruit.Six.Api.Tests/Data/LegacyStatsTests.cs index 2a92abe6..be7ad9e0 100644 --- a/DragonFruit.Six.Api.Tests/Data/LegacyStatsTests.cs +++ b/DragonFruit.Six.Api.Tests/Data/LegacyStatsTests.cs @@ -47,6 +47,7 @@ public async Task TestOperatorStats(string identifier, Platform platform, string var selectedOperator = await Client.GetLegacyOperatorStatsAsync(account).ContinueWith(t => t.Result.SingleOrDefault(y => y.OperatorId == operatorIndex)); Assert.IsNotNull(selectedOperator); + Assert.GreaterOrEqual(selectedOperator.Kills, kills); Assert.GreaterOrEqual(selectedOperator.Wins, wins); @@ -54,6 +55,15 @@ public async Task TestOperatorStats(string identifier, Platform platform, string Assert.IsTrue(selectedOperator.Wl > 0); } + [Test] + public async Task TestOperatorMetadata() + { + var operatorInfo = await Client.GetLegacyOperatorInfoAsync(); + + Assert.IsNotNull(operatorInfo); + Assert.GreaterOrEqual(operatorInfo.Count, 50); + } + [TestCase("603fc6ba-db16-4aba-81b2-e9f9601d7d24", Platform.PC, 300)] public async Task PlayerLevelStatsTest(string identifier, Platform platform, int level) { diff --git a/DragonFruit.Six.Api/Legacy/Entities/LegacyOperatorInfo.cs b/DragonFruit.Six.Api/Legacy/Entities/LegacyOperatorInfo.cs index daf5a621..06c3dbf2 100644 --- a/DragonFruit.Six.Api/Legacy/Entities/LegacyOperatorInfo.cs +++ b/DragonFruit.Six.Api/Legacy/Entities/LegacyOperatorInfo.cs @@ -16,29 +16,26 @@ namespace DragonFruit.Six.Api.Legacy.Entities [Serializable] public class LegacyOperatorInfo { - [JsonProperty("profile")] - internal string ProfileId { get; set; } - /// - /// Operator name (from datasheet/dictionary) + /// Operator name /// [JsonProperty("name")] public string Name { get; set; } /// - /// Operator Identifier (from datasheet/dictionary) + /// Operator Identifier /// [JsonProperty("index")] - public string Index { get; set; } + public string OperatorId { get; set; } /// - /// Logical order (from datasheet/dictionary) + /// Logical order /// [JsonProperty("ord")] public ushort Order { get; set; } /// - /// Operator Icon (from datasheet) + /// Operator Icon /// [JsonProperty("img")] public string ImageUrl { get; set; } @@ -50,13 +47,13 @@ public class LegacyOperatorInfo public string Organisation { get; set; } /// - /// The subtitle, as seen underneath the operator's name in game (from datasheet) + /// The subtitle, as seen underneath the operator's name in game /// [JsonProperty("sub")] public string Subtitle { get; set; } /// - /// The operator's use, attacker/defender (from datasheet) + /// The operator's use, attacker/defender /// [JsonProperty("type")] public OperatorType Type { get; set; } diff --git a/DragonFruit.Six.Api/Legacy/LegacyStatsExtensions.cs b/DragonFruit.Six.Api/Legacy/LegacyStatsExtensions.cs index d0c8eee3..5f29d123 100644 --- a/DragonFruit.Six.Api/Legacy/LegacyStatsExtensions.cs +++ b/DragonFruit.Six.Api/Legacy/LegacyStatsExtensions.cs @@ -66,6 +66,15 @@ public static Task> GetLegacyOperatorStatsA return GetLegacyStatsAsync(client, accounts, a => new LegacyStatsRequest(a, LegacyStatTypes.Operators), LegacyStatsDeserializer.DeserializeOperatorStats, token); } + /// + /// Gets a of legacy operator metadata entries + /// + /// The to use + public static Task> GetLegacyOperatorInfoAsync(this ApiClient client) + { + return client.PerformAsync>(new LegacyOperatorInfoRequest()); + } + /// /// Gets the for the provided /// diff --git a/DragonFruit.Six.Api/Legacy/Requests/LegacyOperatorInfoRequest.cs b/DragonFruit.Six.Api/Legacy/Requests/LegacyOperatorInfoRequest.cs new file mode 100644 index 00000000..0f0b2c91 --- /dev/null +++ b/DragonFruit.Six.Api/Legacy/Requests/LegacyOperatorInfoRequest.cs @@ -0,0 +1,12 @@ +// Dragon6 API Copyright DragonFruit Network +// Licensed under Apache-2. Refer to the LICENSE file for more info + +using DragonFruit.Data; + +namespace DragonFruit.Six.Api.Legacy.Requests +{ + public class LegacyOperatorInfoRequest : ApiRequest + { + public override string Path => $"{Endpoints.AssetsEndpoint}/data/operators.json"; + } +}