public void AverageMatch(JObject match) { //For older logs JToken playerInfo = match["players"][PlayerId.NormalId]; if (playerInfo == null) { //For newer logs playerInfo = match["players"][PlayerId.Id3]; if (playerInfo == null) { return; } } Classes playedClass = ClassesHelper.FromString(playerInfo["class_stats"][0]["type"].ToString()); if (PlayerClass == Classes.All) { AvgDa = AverageStat(AvgDa, (int)playerInfo["dmg"]); AvgK = AverageStat(AvgK, (int)playerInfo["kills"]); AvgD = AverageStat(AvgD, (int)playerInfo["deaths"]); AvgKd = AverageStat(AvgKd, (float)playerInfo["kpd"]); AvgKad = AverageStat(AvgKad, (float)playerInfo["kapd"]); MatchSpread += 1; } else if (playedClass.Equals(PlayerClass)) { MatchSpread += 1; } }
private void CountClass(JObject match) { //For older logs JToken playerInfo = match["players"][_internalId.NormalId]; if (playerInfo == null) { //For newer logs playerInfo = match["players"][_internalId.Id3]; if (playerInfo == null) { return; } } foreach (JToken classPlayed in playerInfo["class_stats"]) { Classes thisClass = ClassesHelper.FromString(classPlayed["type"].ToString()); ClassOverview[thisClass] += 1; OnPropertyChanged("ClassOverview"); } }