discord
This commit is contained in:
parent
ef28512bd3
commit
84ffa96568
7 changed files with 3752 additions and 1758 deletions
|
|
@ -34,10 +34,10 @@ $headers = @{
|
|||
'accept' = 'application/vnd.api+json'
|
||||
'Authorization' = "$apiKey"
|
||||
}
|
||||
|
||||
$player_matches = @()
|
||||
$player_data = get-content "$scriptroot/../data/player_data.json" | convertfrom-json -Depth 100
|
||||
|
||||
$player_matches = @()
|
||||
|
||||
foreach ($player in $player_data) {
|
||||
$lastMatches = $player.relationships.matches.data.id #| Select-Object -First 10
|
||||
$playermatches = @()
|
||||
|
|
@ -45,13 +45,13 @@ foreach ($player in $player_data) {
|
|||
Write-Host "Getting match for $($player.attributes.name) match: $match "
|
||||
$stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$match" -Method GET -Headers $headers
|
||||
$playermatches += [PSCustomObject]@{
|
||||
stats = $stats.included.ATTRIBUTES.stats | where-object {$_.name -eq $player.attributes.name}
|
||||
matchType = $stats.data.attributes.matchtype
|
||||
gameMode = $stats.data.attributes.gameMode
|
||||
createdAt = $stats.data.attributes.createdAt
|
||||
mapName = $stats.data.attributes.mapName
|
||||
winPlace = $stats.data.attributes.winPlace
|
||||
telemetry_url = ($stats.included.attributes | Where-Object {$_.name -eq 'telemetry'}).URL
|
||||
stats = $stats.included.ATTRIBUTES.stats | where-object { $_.name -eq $player.attributes.name }
|
||||
matchType = $stats.data.attributes.matchtype
|
||||
gameMode = $stats.data.attributes.gameMode
|
||||
createdAt = $stats.data.attributes.createdAt
|
||||
mapName = $stats.data.attributes.mapName
|
||||
telemetry_url = ($stats.included.attributes | Where-Object { $_.name -eq 'telemetry' }).URL
|
||||
id = $stats.data.id
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -66,6 +66,20 @@ foreach ($player in $player_data) {
|
|||
|
||||
}
|
||||
|
||||
if (test-path "$scriptroot/../data/player_matches.json") {
|
||||
$old_player_data = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100
|
||||
$new_ids = ($player_matches.player_matches | where-object {$_.stats.winplace -eq 1}).id
|
||||
$old_ids = ($old_player_data.player_matches | where-object {$_.stats.winplace -eq 1}).id
|
||||
$new_win_matches = ((Compare-Object -ReferenceObject $old_ids -DifferenceObject $new_ids) | Where-Object { $_.SideIndicator -eq '=>' }).InputObject | Select-Object -Unique
|
||||
$new_win_matches = $old_player_data.new_win_matches + $new_win_matches | Select-Object -Unique
|
||||
$player_matches += [PSCustomObject]@{
|
||||
new_win_matches = $new_win_matches
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$currentDateTime = Get-Date
|
||||
|
||||
# Get current timezone
|
||||
|
|
@ -74,9 +88,8 @@ $currentTimezone = (Get-TimeZone).Id
|
|||
# Format and parse the information into a string
|
||||
$formattedString = "$currentDateTime - Time Zone: $currentTimezone"
|
||||
# Output the formatted string
|
||||
|
||||
|
||||
|
||||
$player_matches| Add-Member -Name "updated" -MemberType NoteProperty -Value $formattedString
|
||||
$playermatches += [PSCustomObject]@{
|
||||
updated = $formattedString
|
||||
}
|
||||
|
||||
$player_matches | convertto-json -Depth 100 | out-file "$scriptroot/../data/player_matches.json"
|
||||
Loading…
Add table
Add a link
Reference in a new issue