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 #196 from abuZayed15/issue-181
Changed the filenames as well
- Loading branch information
Showing
34 changed files
with
490 additions
and
490 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
45 changes: 0 additions & 45 deletions
45
DragonFruit.Six.API/Data/Deserializers/ClassicOperatorStatsDeserializer.cs
This file was deleted.
Oops, something went wrong.
149 changes: 0 additions & 149 deletions
149
DragonFruit.Six.API/Data/Deserializers/ClassicStatsDeserializer.cs
This file was deleted.
Oops, something went wrong.
47 changes: 0 additions & 47 deletions
47
DragonFruit.Six.API/Data/Deserializers/ClassicWeaponStatsDeserializer.cs
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
DragonFruit.Six.API/Data/Deserializers/OperatorStatsDeserializer.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,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; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.