variable naming
This commit is contained in:
parent
2317bade0b
commit
028477f946
1 changed files with 8 additions and 8 deletions
|
|
@ -73,17 +73,17 @@ foreach ($winid in $new_win_matches) {
|
||||||
if ($null -eq $winid) { continue }
|
if ($null -eq $winid) { continue }
|
||||||
$winmatches = $player_matches.player_matches | Where-Object { $_.id -eq $winid }
|
$winmatches = $player_matches.player_matches | Where-Object { $_.id -eq $winid }
|
||||||
$telemetry = (invoke-webrequest @($winmatches.telemetry_url)[0]).content | convertfrom-json | where-object { ($_._T -eq 'LOGPLAYERTAKEDAMAGE') -or ($_._T -eq 'LOGPLAYERKILLV2') }
|
$telemetry = (invoke-webrequest @($winmatches.telemetry_url)[0]).content | convertfrom-json | where-object { ($_._T -eq 'LOGPLAYERTAKEDAMAGE') -or ($_._T -eq 'LOGPLAYERKILLV2') }
|
||||||
$players = ($winmatches | where-object {$_.stats.winPlace -eq 1}).stats.name
|
$winners = ($winmatches | where-object {$_.stats.winPlace -eq 1}).stats.name
|
||||||
$match_stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$winid" -Method GET -Headers $headers
|
$match_stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$winid" -Method GET -Headers $headers
|
||||||
if($winmatches[0].matchType -eq 'custom'){
|
if($winmatches[0].matchType -eq 'custom'){
|
||||||
$all_winners_of_match = $match_stats.included.attributes.stats
|
$players_to_report = $match_stats.included.attributes.stats
|
||||||
}else{
|
}else{
|
||||||
$all_winners_of_match = ($match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 })
|
$players_to_report = ($match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
send-discord -content ":chicken: :chicken: **WINNER WINNER CHICKEN DINNER!!** :chicken: :chicken:"
|
send-discord -content ":chicken: :chicken: **WINNER WINNER CHICKEN DINNER!!** :chicken: :chicken:"
|
||||||
send-discord -content ":partying_face::partying_face::partying_face: Gefeliciteerd $($players -join ', ') :partying_face::partying_face::partying_face:"
|
send-discord -content ":partying_face::partying_face::partying_face: Gefeliciteerd $($winners -join ', ') :partying_face::partying_face::partying_face:"
|
||||||
$match_settings = @"
|
$match_settings = @"
|
||||||
``````
|
``````
|
||||||
match mode $($winmatches[0].gameMode)
|
match mode $($winmatches[0].gameMode)
|
||||||
|
|
@ -93,16 +93,16 @@ id $($winmatches[0].id)
|
||||||
``````
|
``````
|
||||||
"@
|
"@
|
||||||
send-discord -content $match_settings
|
send-discord -content $match_settings
|
||||||
foreach ($player in $all_winners_of_match.name) {
|
foreach ($player in $players_to_report.name) {
|
||||||
if($null -eq $player){continue}
|
if($null -eq $player){continue}
|
||||||
write-output "creating table for player $player"
|
write-output "creating table for player $player"
|
||||||
$win_stats += [PSCustomObject]@{
|
$win_stats += [PSCustomObject]@{
|
||||||
Name = $player
|
Name = $player
|
||||||
'Human dmg' = "$([math]::Round(($telemetry | Where-Object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and $_.attacker.name -eq $player -and $_.victim.accountId -notlike "ai.*" -and $_.victim.teamId -ne $_.attacker.teamId } | Measure-Object -Property damage -Sum).Sum))"
|
'Human dmg' = "$([math]::Round(($telemetry | Where-Object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and $_.attacker.name -eq $player -and $_.victim.accountId -notlike "ai.*" -and $_.victim.teamId -ne $_.attacker.teamId } | Measure-Object -Property damage -Sum).Sum))"
|
||||||
'Human Kills' = "$(($telemetry | Where-Object { $_._T -eq 'LOGPLAYERKILLV2' -and $_.killer.name -eq $player -and $_.victim.accountId -notlike "ai.*" }).count)"
|
'Human Kills' = "$(($telemetry | Where-Object { $_._T -eq 'LOGPLAYERKILLV2' -and $_.killer.name -eq $player -and $_.victim.accountId -notlike "ai.*" }).count)"
|
||||||
'Dmg' = "$([math]::Round(($all_winners_of_match | Where-Object { $_.name -eq $player }).damageDealt))"
|
'Dmg' = "$([math]::Round(($players_to_report | Where-Object { $_.name -eq $player }).damageDealt))"
|
||||||
'Kills' = "$(($all_winners_of_match | Where-Object { $_.name -eq $player }).kills)"
|
'Kills' = "$(($players_to_report | Where-Object { $_.name -eq $player }).kills)"
|
||||||
'alive' = "$([math]::Round((($all_winners_of_match | Where-Object { $_.name -eq $player }).timeSurvived /60 )))"
|
'alive' = "$([math]::Round((($players_to_report | Where-Object { $_.name -eq $player }).timeSurvived /60 )))"
|
||||||
}
|
}
|
||||||
$teamdmg = $telemetry | Where-Object {
|
$teamdmg = $telemetry | Where-Object {
|
||||||
$_._T -eq 'LOGPLAYERTAKEDAMAGE' -and
|
$_._T -eq 'LOGPLAYERTAKEDAMAGE' -and
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue