2024-01-15 21:49:09 +01:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
|
|
|
|
namespace CS2GSI.GameState;
|
2024-01-15 20:04:37 +01:00
|
|
|
|
|
|
|
|
|
public struct PlayerMatchStats
|
|
|
|
|
{
|
|
|
|
|
public int Kills, Assists, Deaths, MVPs, Score;
|
2024-01-15 20:39:38 +01:00
|
|
|
|
|
2024-01-15 21:49:09 +01:00
|
|
|
|
internal static PlayerMatchStats ParseFromJObject(JObject jsonObject)
|
|
|
|
|
{
|
|
|
|
|
return new PlayerMatchStats()
|
|
|
|
|
{
|
|
|
|
|
Kills = jsonObject.SelectToken($"player.match_stats.kills")!.Value<int>(),
|
|
|
|
|
Assists = jsonObject.SelectToken($"player.match_stats.assists")!.Value<int>(),
|
|
|
|
|
Deaths = jsonObject.SelectToken($"player.match_stats.deaths")!.Value<int>(),
|
|
|
|
|
MVPs = jsonObject.SelectToken($"player.match_stats.mvps")!.Value<int>(),
|
|
|
|
|
Score = jsonObject.SelectToken($"player.match_stats.score")!.Value<int>(),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-15 20:39:38 +01:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return $"{GetType()}\n" +
|
|
|
|
|
$"\tKAD: {Kills} {Assists} {Deaths}\n" +
|
|
|
|
|
$"\tMVPs: {MVPs}\n" +
|
|
|
|
|
$"\tScore: {Score}\n";
|
|
|
|
|
}
|
2024-01-15 20:04:37 +01:00
|
|
|
|
}
|