commit
8f333ae9c7
2 changed files with 37 additions and 28 deletions
|
|
@ -81,11 +81,13 @@ foreach ($winid in $new_win_matches) {
|
||||||
$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') {
|
||||||
$players_to_report = $match_stats.included.attributes.stats
|
$players_to_report = $match_stats.included.attributes.stats
|
||||||
}else{
|
}
|
||||||
|
else {
|
||||||
$players_to_report = ($match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 })
|
$players_to_report = ($match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($new_win_matches.count -le 10) {
|
||||||
|
#fail safe
|
||||||
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 $($winners -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 = @"
|
||||||
|
|
@ -97,7 +99,10 @@ id $($winmatches[0].id)
|
||||||
``````
|
``````
|
||||||
"@
|
"@
|
||||||
send-discord -content $match_settings
|
send-discord -content $match_settings
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
write-output "Something went wrong (more then 10 matches to report)"
|
||||||
|
}
|
||||||
foreach ($player in $players_to_report.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"
|
||||||
|
|
@ -130,7 +135,7 @@ id $($winmatches[0].id)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($new_win_matches.count -le 10) {
|
||||||
$content_winstats = '```' + ($win_stats | Format-Table | out-string) + '```'
|
$content_winstats = '```' + ($win_stats | Format-Table | out-string) + '```'
|
||||||
send-discord -content $content_winstats
|
send-discord -content $content_winstats
|
||||||
|
|
||||||
|
|
@ -141,7 +146,10 @@ id $($winmatches[0].id)
|
||||||
}
|
}
|
||||||
|
|
||||||
send-discord -content "[2D replay](<$2D_replay_url>)"
|
send-discord -content "[2D replay](<$2D_replay_url>)"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
write-output "Something went wrong (more then 10 matches to report)"
|
||||||
|
}
|
||||||
$legenda = '
|
$legenda = '
|
||||||
```
|
```
|
||||||
dmg_h = Schade aangericht aan echte spelers
|
dmg_h = Schade aangericht aan echte spelers
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,9 @@ else {
|
||||||
|
|
||||||
. $scriptroot\..\includes\ps1\lockfile.ps1
|
. $scriptroot\..\includes\ps1\lockfile.ps1
|
||||||
new-lock
|
new-lock
|
||||||
|
##SETTINGS
|
||||||
|
$monthsback = -1 # how many months back to look for matches
|
||||||
|
##END OF SETTINGS
|
||||||
function Get-Change {
|
function Get-Change {
|
||||||
param (
|
param (
|
||||||
[double]$OldWinRatio,
|
[double]$OldWinRatio,
|
||||||
|
|
@ -142,7 +143,7 @@ foreach ($player in $all_player_matches) {
|
||||||
|
|
||||||
$killstats = @()
|
$killstats = @()
|
||||||
$matchfiles = Get-ChildItem "$scriptroot/../data/killstats/" -File -Filter *.json
|
$matchfiles = Get-ChildItem "$scriptroot/../data/killstats/" -File -Filter *.json
|
||||||
$last_month = (get-date).AddMonths(-1)
|
$last_month = (get-date).AddMonths($monthsback)
|
||||||
foreach ($file in $matchfiles) {
|
foreach ($file in $matchfiles) {
|
||||||
$json = get-content $file | ConvertFrom-Json
|
$json = get-content $file | ConvertFrom-Json
|
||||||
if ($json.created -gt $last_month) {
|
if ($json.created -gt $last_month) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue