Skip all and calculate KD per match #174

Merged
OpzekerIT merged 9 commits from dev into main 2024-07-17 14:39:09 +00:00
2 changed files with 18 additions and 13 deletions

View file

@ -25,11 +25,14 @@ $ogDescription = "Explore detailed player statistics over the past month includi
if ($key == 'updated') {
continue;
}
if ($key == 'all') {
continue;
}
echo "<br>";
if ($key == 'all') {
echo "Stats for $key (minimal 20 matches)";
}
// if ($key == 'all') {
// echo "Stats for $key (minimal 20 matches)";
// }
if ($key == 'Intense') {
echo "Stats for $key (minimal 8 matches)";
}

View file

@ -130,10 +130,10 @@ foreach ($player in $all_player_matches) {
$savekillstats = @{
matchid = $match.id
created = $match.createdAt
stats = $killstat
deathType = $match.stats.deathType
winplace = (($all_player_matches | where-object { $_.playername -eq $player_name } ).player_matches | where-object { $_.id -eq $match.id }).stats.winplace
}
Write-Output "Writing to file $scriptroot/../data/killstats/$($match.id)_$player_name.json"
@ -181,7 +181,8 @@ function Get-MatchStatsPlayer {
if ($MatchType) {
$filterProperty = 'matchType'
}
$deaths = (($killstats.stats | where-object { $_.playername -eq $player -and $_.$filterProperty -like $typemodevalue }).deaths | Measure-Object -sum).sum
$alives = (($killstats | where-object { $_.stats.playername -eq $player -and $_.stats.$filterProperty -like $typemodevalue }).deathType | where-object {$_ -eq 'alive'}).count
$deaths = (($killstats | where-object { $_.stats.playername -eq $player -and $_.stats.$filterProperty -like $typemodevalue }).deathType | where-object {$_ -ne 'alive'}).count
$kills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.$filterProperty -like $typemodevalue }).kills | Measure-Object -sum).sum
$dbno = (($killstats.stats | where-object { $_.playername -eq $player -and $_.$filterProperty -like $typemodevalue }).dbno | Measure-Object -sum).sum
$humankills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.$filterProperty -like $typemodevalue }).humankills | Measure-Object -sum).sum
@ -199,13 +200,14 @@ function Get-MatchStatsPlayer {
write-host $change
$MatchStatsPlayer += [PSCustomObject]@{
alives = $alives
playername = $player
deaths = $deaths
kills = $kills
humankills = $humankills
matches = $player_matches
KD_H = $humankills / $deaths
KD_ALL = $kills / $deaths
KD_H = $humankills / ($deaths + $alives) # KD_Human calculated per match (kills / (deaths + alives))
KD_ALL = $kills / ($deaths + $alives) # KD_ALL calculated per match (kills / (deaths + alives))
winratio = $winratio
wins = $player_wins
dbno = $dbno