Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #196 from abuZayed15/issue-181
Browse files Browse the repository at this point in the history
Changed the filenames as well
  • Loading branch information
aspriddell authored Dec 11, 2020
2 parents da966ca + 04077a1 commit 6e3aa38
Show file tree
Hide file tree
Showing 34 changed files with 490 additions and 490 deletions.
6 changes: 3 additions & 3 deletions DragonFruit.Six.API.Demo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ private static async Task Main(string[] args)

var seasonStats = d6Client.GetSeasonStats(playerInfo);

var generalStats = d6Client.GetClassicStats(playerInfo);
var opStats = d6Client.GetClassicOperatorStats(playerInfo, await operatorInformationTask);
var weapons = d6Client.GetClassicWeaponStats(playerInfo);
var generalStats = d6Client.GetStats(playerInfo);
var opStats = d6Client.GetOperatorStats(playerInfo, await operatorInformationTask);
var weapons = d6Client.GetWeaponStats(playerInfo);

var stats = new JObject
{
Expand Down
14 changes: 7 additions & 7 deletions DragonFruit.Six.API.Tests/Tests/StatsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public class PlayerStatsTests : TestBase
public void GetGeneralStats()
{
//single user
Client.GetClassicStats(TestData.TestAccounts.First());
Client.GetStats(TestData.TestAccounts.First());

//multi users - different platforms
Client.GetClassicStats(TestData.TestAccounts);
Client.GetStats(TestData.TestAccounts);
}

[TestMethod]
Expand All @@ -40,10 +40,10 @@ public void GetRankedStats()
public void GetWeaponStats()
{
//single user
Client.GetClassicWeaponStats(TestData.TestAccounts.First());
Client.GetWeaponStats(TestData.TestAccounts.First());

//multi users - different platforms
Client.GetClassicWeaponStats(TestData.TestAccounts);
Client.GetWeaponStats(TestData.TestAccounts);
}

[TestMethod]
Expand All @@ -59,7 +59,7 @@ public void GetLevelInfo()
[TestMethod]
public void GetOperatorStats()
{
IEnumerable<ClassicOperatorStats> opData = null;
IEnumerable<OperatorStats> opData = null;

try
{
Expand All @@ -72,10 +72,10 @@ public void GetOperatorStats()
}

//single user
Client.GetClassicOperatorStats(TestData.TestAccounts.First(), opData);
Client.GetOperatorStats(TestData.TestAccounts.First(), opData);

//multi users - different platforms
Client.GetClassicOperatorStats(TestData.TestAccounts, opData);
Client.GetOperatorStats(TestData.TestAccounts, opData);
}
}
}

This file was deleted.

149 changes: 0 additions & 149 deletions DragonFruit.Six.API/Data/Deserializers/ClassicStatsDeserializer.cs

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Dragon6 API Copyright 2020 DragonFruit Network <[email protected]>
// Licensed under Apache-2. Please refer to the LICENSE file for more info

using System.Collections.Generic;
using System.Linq;
using DragonFruit.Common.Data.Extensions;
using DragonFruit.Six.API.Data.Strings;
using DragonFruit.Six.API.Utils;
using Newtonsoft.Json.Linq;

namespace DragonFruit.Six.API.Data.Deserializers
{
public static class OperatorStatsDeserializer
{
public static IEnumerable<OperatorStats> DeserializeOperatorStatsFor(this JObject jObject, string guid, IEnumerable<OperatorStats> data)
{
var json = jObject[Misc.Results]?[guid] as JObject;

if (json == null)
yield break;

foreach (var op in data.Select(x => x.Clone()))
{
op.Guid = guid;

op.Kills = json.GetUInt(Operator.Kills.ToIndexedStatsKey(op.Index));
op.Deaths = json.GetUInt(Operator.Deaths.ToIndexedStatsKey(op.Index));

op.Wins = json.GetUInt(Operator.Wins.ToIndexedStatsKey(op.Index));
op.Losses = json.GetUInt(Operator.Losses.ToIndexedStatsKey(op.Index));

op.RoundsPlayed = json.GetUInt(Operator.Rounds.ToIndexedStatsKey(op.Index));
op.Duration = json.GetUInt(Operator.Time.ToIndexedStatsKey(op.Index));

op.Headshots = json.GetUInt(Operator.Headshots.ToIndexedStatsKey(op.Index));
op.Downs = json.GetUInt(Operator.Downs.ToIndexedStatsKey(op.Index));

op.Experience = json.GetUInt(Operator.Experience.ToIndexedStatsKey(op.Index));
op.ActionCount = (uint?)json[op.OperatorActionResultId];

yield return op;
}
}
}
}
Loading

0 comments on commit 6e3aa38

Please sign in to comment.