new matchparser
This commit is contained in:
parent
6f0c671000
commit
1c50a6ca59
1 changed files with 23 additions and 19 deletions
|
|
@ -84,35 +84,39 @@ foreach ($player in $all_player_matches) {
|
||||||
$j++
|
$j++
|
||||||
write-output "$($player.player_matches.count)/ $j"
|
write-output "$($player.player_matches.count)/ $j"
|
||||||
|
|
||||||
|
if (!(Test-Path -path "$scriptroot/../data/killstats/$($match.id)_$player_name.json" )) {
|
||||||
|
$telemetryfile = "$scriptroot/../data/telemetry_cache/$($match.telemetry_url.split("/")[-1])"
|
||||||
|
if (!(test-path -Path $telemetryfile)) {
|
||||||
|
write-output "Saving $telemetryfile"
|
||||||
|
$telemetry_content = (Invoke-WebRequest -Uri $match.telemetry_url).content
|
||||||
|
$telemetry_content | out-file $telemetryfile
|
||||||
|
$telemetry = $telemetry_content | ConvertFrom-Json
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
write-output "Getting from cache $telemetryfile"
|
||||||
|
$telemetry = get-content $telemetryfile | convertfrom-json
|
||||||
|
}
|
||||||
|
|
||||||
|
write-output "Analyzing for player $player_name telemetry: $($match.telemetry_url)"
|
||||||
|
$killstat = get-killstats -player_name $player_name -telemetry ($telemetry | where-object { $_._T -eq 'LOGPLAYERKILLV2' }) -gameMode $match.gameMode -matchType $match.matchType
|
||||||
|
|
||||||
$telemetryfile = "$scriptroot/../data/telemetry_cache/$($match.telemetry_url.split("/")[-1])"
|
|
||||||
if (!(test-path -Path $telemetryfile)) {
|
|
||||||
write-output "Saving $telemetryfile"
|
|
||||||
$telemetry_content = (Invoke-WebRequest -Uri $match.telemetry_url).content
|
|
||||||
$telemetry_content | out-file $telemetryfile
|
|
||||||
$telemetry = $telemetry_content | ConvertFrom-Json
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
write-output "Getting from cache $telemetryfile"
|
|
||||||
$telemetry = get-content $telemetryfile | convertfrom-json
|
|
||||||
}
|
|
||||||
|
|
||||||
write-output "Analyzing for player $player_name telemetry: $($match.telemetry_url)"
|
|
||||||
$killstat = get-killstats -player_name $player_name -telemetry ($telemetry | where-object { $_._T -eq 'LOGPLAYERKILLV2' }) -gameMode $match.gameMode -matchType $match.matchType
|
|
||||||
$killstats += $killstat
|
|
||||||
if ($true) {
|
|
||||||
$savekillstats = @{
|
$savekillstats = @{
|
||||||
matchid = $match.id
|
matchid = $match.id
|
||||||
created = $match.createdAt
|
created = $match.createdAt
|
||||||
stats = $killstat
|
stats = $killstat
|
||||||
|
winplace = (($all_player_matches | where-object { $_.playername -eq $player_name } ).player_matches | where-object {$_.id -eq $match.id}).stats.winplace
|
||||||
}
|
}
|
||||||
$savekillstats | ConvertTo-Json | out-file "$scriptroot/../data/killstats/$($match.id).json"
|
$savekillstats | ConvertTo-Json | out-file "$scriptroot/../data/killstats/$($match.id)_$player_name.json"
|
||||||
|
$killstats += $killstat
|
||||||
|
} else{
|
||||||
|
write-output "match $($match.id) already in cache"
|
||||||
|
$killstats += (get-content "$scriptroot/../data/killstats/$($match.id)_$player_name.json" | ConvertFrom-Json).stats
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$playerstats_all = @()
|
$playerstats_all = @()
|
||||||
foreach ($player in $all_player_matches.playername) {
|
foreach ($player in $all_player_matches.playername) {
|
||||||
if ($null -eq $player) {
|
if ($null -eq $player) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue