From 90be5f9752ede5fac5df7031ef3bfcf1ba9475ab Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 27 Sep 2023 13:55:17 +0200 Subject: [PATCH] debugging --- discord/report_new_matches.ps1 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 1aafe99..123faee 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -1,3 +1,4 @@ + if ($PSScriptRoot.length -eq 0) { $scriptroot = Get-Location } @@ -5,6 +6,7 @@ else { $scriptroot = $PSScriptRoot } +Start-Transcript "$scriptroot/debug.txt" -Append $fileContent = Get-Content -Path "$scriptroot/../discord/config.php" -Raw @@ -43,11 +45,11 @@ foreach ($winid in $new_win_matches) { $all_winners_of_match = ($match_stats.included.attributes.stats | where-object {$_.winplace -eq 1}) send-discord -content ":chicken: :chicken: CHICKEN CHICKEN WINNER DINNER!! :chicken: :chicken:" send-discord -content "Gefeliciteerd $($players -join ' ')" - send-discord -content "match Type $($winmatches[0].matchType)" + send-discord -content "match mode $($winmatches[0].gameMode)" send-discord -content "map $($winmatches[0].mapName)" foreach ($player in $all_winners_of_match.name) { - + write-output "creating tble for player $player" $win_stats += [PSCustomObject]@{ playername = $player dmg_h = (($telemetry | where-object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' } | where-object { $_.attacker.name -eq $player } | where-object { $_.victim.accountId -notlike "ai.*" } ).damage | Measure-Object -Sum).Sum @@ -57,8 +59,9 @@ foreach ($winid in $new_win_matches) { k_t = ($all_winners_of_match | Where-Object { $_.name -eq $player }).teamKills t_serv = ($all_winners_of_match | Where-Object { $_.name -eq $player }).timeSurvived } + $win_stats } - + $content_winstats $content_winstats = '```' + ($win_stats | Format-Table | out-string) + '```' send-discord -content $content_winstats @@ -71,6 +74,7 @@ foreach ($winid in $new_win_matches) { k_h = Echte spelers die ge gekilled hebt K_a = alle spelers kills t_serv = time survived in secondes + k_t = team kills " send-discord -content $legenda @@ -89,4 +93,6 @@ foreach ($item in $player_matches) { $newJson = $player_matches | ConvertTo-Json -Depth 100 # Display the updated JSON -$newJson | out-file "$scriptroot/../data/player_matches.json" \ No newline at end of file +$newJson | out-file "$scriptroot/../data/player_matches.json" + +Stop-Transcript \ No newline at end of file