Merge pull request #174 from OpzekerIT/dev
Skip all and calculate KD per match
This commit is contained in:
commit
da4403fcea
2 changed files with 18 additions and 13 deletions
|
|
@ -25,11 +25,14 @@ $ogDescription = "Explore detailed player statistics over the past month includi
|
||||||
if ($key == 'updated') {
|
if ($key == 'updated') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ($key == 'all') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
if ($key == 'all') {
|
// if ($key == 'all') {
|
||||||
echo "Stats for $key (minimal 20 matches)";
|
// echo "Stats for $key (minimal 20 matches)";
|
||||||
}
|
// }
|
||||||
if ($key == 'Intense') {
|
if ($key == 'Intense') {
|
||||||
echo "Stats for $key (minimal 8 matches)";
|
echo "Stats for $key (minimal 8 matches)";
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +68,7 @@ $ogDescription = "Explore detailed player statistics over the past month includi
|
||||||
continue; // Skip this iteration and move to the next
|
continue; // Skip this iteration and move to the next
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($key == 'all' && $player_data['matches'] < 20) {
|
if ($key == 'all' && $player_data['matches'] < 20) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($key == 'Intense' && $player_data['matches'] < 8) {
|
if ($key == 'Intense' && $player_data['matches'] < 8) {
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ function get-killstats {
|
||||||
$gameMode
|
$gameMode
|
||||||
)
|
)
|
||||||
$LOGPLAYERKILLV2 = $telemetry | where-object { $_._T -eq 'LOGPLAYERKILLV2' }
|
$LOGPLAYERKILLV2 = $telemetry | where-object { $_._T -eq 'LOGPLAYERKILLV2' }
|
||||||
$kills = $LOGPLAYERKILLV2 | where-object { $_.killer.name -eq $player_name}
|
$kills = $LOGPLAYERKILLV2 | where-object { $_.killer.name -eq $player_name }
|
||||||
$deaths = $LOGPLAYERKILLV2 | where-object { $_.victim.name -eq $player_name -and $_.finisher.name.count -ge 1 }
|
$deaths = $LOGPLAYERKILLV2 | where-object { $_.victim.name -eq $player_name -and $_.finisher.name.count -ge 1 }
|
||||||
$HumanDmg = $([math]::Round(($telemetry | Where-Object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and $_.attacker.name -eq $player_name -and $_.victim.accountId -notlike "ai.*" -and $_.victim.teamId -ne $_.attacker.teamId } | Measure-Object -Property damage -Sum).Sum))
|
$HumanDmg = $([math]::Round(($telemetry | Where-Object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and $_.attacker.name -eq $player_name -and $_.victim.accountId -notlike "ai.*" -and $_.victim.teamId -ne $_.attacker.teamId } | Measure-Object -Property damage -Sum).Sum))
|
||||||
return @{
|
return @{
|
||||||
|
|
@ -130,11 +130,11 @@ foreach ($player in $all_player_matches) {
|
||||||
|
|
||||||
|
|
||||||
$savekillstats = @{
|
$savekillstats = @{
|
||||||
|
matchid = $match.id
|
||||||
matchid = $match.id
|
created = $match.createdAt
|
||||||
created = $match.createdAt
|
stats = $killstat
|
||||||
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
|
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"
|
Write-Output "Writing to file $scriptroot/../data/killstats/$($match.id)_$player_name.json"
|
||||||
$savekillstats | ConvertTo-Json | out-file "$scriptroot/../data/killstats/$($match.id)_$player_name.json"
|
$savekillstats | ConvertTo-Json | out-file "$scriptroot/../data/killstats/$($match.id)_$player_name.json"
|
||||||
|
|
@ -181,7 +181,8 @@ function Get-MatchStatsPlayer {
|
||||||
if ($MatchType) {
|
if ($MatchType) {
|
||||||
$filterProperty = '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
|
$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
|
$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
|
$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
|
write-host $change
|
||||||
|
|
||||||
$MatchStatsPlayer += [PSCustomObject]@{
|
$MatchStatsPlayer += [PSCustomObject]@{
|
||||||
|
alives = $alives
|
||||||
playername = $player
|
playername = $player
|
||||||
deaths = $deaths
|
deaths = $deaths
|
||||||
kills = $kills
|
kills = $kills
|
||||||
humankills = $humankills
|
humankills = $humankills
|
||||||
matches = $player_matches
|
matches = $player_matches
|
||||||
KD_H = $humankills / $deaths
|
KD_H = $humankills / ($deaths + $alives) # KD_Human calculated per match (kills / (deaths + alives))
|
||||||
KD_ALL = $kills / $deaths
|
KD_ALL = $kills / ($deaths + $alives) # KD_ALL calculated per match (kills / (deaths + alives))
|
||||||
winratio = $winratio
|
winratio = $winratio
|
||||||
wins = $player_wins
|
wins = $player_wins
|
||||||
dbno = $dbno
|
dbno = $dbno
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue