teamkiller
This commit is contained in:
parent
7de21fa8e7
commit
669721ce5d
1 changed files with 45 additions and 29 deletions
|
|
@ -6,8 +6,6 @@ else {
|
||||||
$scriptroot = $PSScriptRoot
|
$scriptroot = $PSScriptRoot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw
|
$fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw
|
||||||
|
|
||||||
# Use regex to match the apiKey value
|
# Use regex to match the apiKey value
|
||||||
|
|
@ -63,13 +61,15 @@ $map_map = @{
|
||||||
|
|
||||||
$player_matches = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100
|
$player_matches = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100
|
||||||
$new_win_matches = $player_matches.new_win_matches
|
$new_win_matches = $player_matches.new_win_matches
|
||||||
$win_stats = @()
|
|
||||||
|
|
||||||
foreach ($winid in $new_win_matches) {
|
foreach ($winid in $new_win_matches) {
|
||||||
|
|
||||||
|
$win_stats = @()
|
||||||
|
$victims = @()
|
||||||
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
|
$telemetry = (invoke-webrequest @($winmatches.telemetry_url)[0]).content | convertfrom-json | where-object { ($_._T -eq 'LOGPLAYERTAKEDAMAGE') -or ($_._T -eq 'LOGPLAYERKILLV2') }
|
||||||
$players = $winmatches.stats.name
|
$players = $winmatches.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
|
||||||
$all_winners_of_match = ($match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 })
|
$all_winners_of_match = ($match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 })
|
||||||
|
|
@ -84,29 +84,47 @@ map $($map_map[$winmatches[0].mapName])
|
||||||
"@
|
"@
|
||||||
send-discord -content $match_settings
|
send-discord -content $match_settings
|
||||||
foreach ($player in $all_winners_of_match.name) {
|
foreach ($player in $all_winners_of_match.name) {
|
||||||
write-output "creating tble for player $player"
|
write-output "creating table for player $player"
|
||||||
$win_stats += [PSCustomObject]@{
|
$win_stats += [PSCustomObject]@{
|
||||||
playername = $player
|
Name = $player
|
||||||
dmg_h = [math]::Round((($telemetry | where-object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' } | where-object { $_.attacker.name -eq $player } | where-object { $_.victim.accountId -notlike "ai.*" } | where-object {$_.victim.teamId -ne $_.attacker.teamId } ).damage | Measure-Object -Sum).Sum, 2)
|
'Human dmg' = "$([math]::Round((($telemetry | where-object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' } | where-object { $_.attacker.name -eq $player } | where-object { $_.victim.accountId -notlike "ai.*" } | where-object {$_.victim.teamId -ne $_.attacker.teamId } ).damage | Measure-Object -Sum).Sum))"
|
||||||
k_h = (($telemetry | where-object { $_._T -eq 'LOGPLAYERKILLV2' } | where-object { $_.killer.name -eq $player } | where-object { $_.victim.accountId -notlike "ai.*" } )).count
|
'Human Kills' = "$((($telemetry | where-object { $_._T -eq 'LOGPLAYERKILLV2' } | where-object { $_.killer.name -eq $player } | where-object { $_.victim.accountId -notlike "ai.*" } )).count)"
|
||||||
dmg = ($all_winners_of_match | Where-Object { $_.name -eq $player }).damageDealt
|
'Dmg' = "$([math]::Round(($all_winners_of_match | Where-Object { $_.name -eq $player }).damageDealt))"
|
||||||
k_a = ($all_winners_of_match | Where-Object { $_.name -eq $player }).kills
|
'Kills' = "$(($all_winners_of_match | Where-Object { $_.name -eq $player }).kills)"
|
||||||
k_t = ($all_winners_of_match | Where-Object { $_.name -eq $player }).teamKills
|
'alive minutes' = "$([math]::Round((($all_winners_of_match | Where-Object { $_.name -eq $player }).timeSurvived /60 )))"
|
||||||
t_serv = ($all_winners_of_match | Where-Object { $_.name -eq $player }).timeSurvived
|
}
|
||||||
|
$teamdmg = $telemetry | where-object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' } | where-object { $_.victim.teamId -eq $_.attacker.teamId } | where-object { $_.victim.accountId -notlike "ai.*" } | where-object { $_.victim.name -ne $_.attacker.name } | where-object { $_.attacker.name -eq $player }
|
||||||
|
if ($teamdmg.count -ge 1) {
|
||||||
|
foreach ($victim in ($teamdmg.victim.name | Select-Object -Unique)) {
|
||||||
|
$victims += [PSCustomObject]@{
|
||||||
|
attacker = $player
|
||||||
|
victim = $victim
|
||||||
|
Damage = "$([math]::Round((($teamdmg | Where-Object { $_.victim.name -eq $victim }).damage | Measure-Object -Sum).Sum))"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$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
|
||||||
|
|
||||||
|
if($victims.count -ge 1){
|
||||||
|
send-discord -content ":skull::skull: Helaas hebben we deze keer ook team killers :skull::skull: "
|
||||||
|
$content_victims = '```' + ($victims | Format-Table | out-string) + '```'
|
||||||
|
send-discord -content $content_victims
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$legenda = '
|
$legenda = '
|
||||||
```
|
```
|
||||||
dmg_h = Schade aangericht aan echte spelers
|
dmg_h = Schade aangericht aan echte spelers
|
||||||
dmg = Totale schade (aan zowel echte spelers als AI)
|
dmg = Totale schade (aan zowel echte spelers als AI)
|
||||||
k_h = Aantal echte spelers die je hebt geelimineerd
|
k_h = Aantal echte spelers die je hebt geelimineerd
|
||||||
K_a = Totale aantal eliminaties (inclusief AI)
|
K_a = Totale aantal eliminaties (inclusief AI)
|
||||||
t_serv = Overleefde tijd (in seconden)
|
t_serv = Overleefde tijd (in minuten)
|
||||||
k_t = Team eliminaties
|
k_t = Team eliminaties
|
||||||
```
|
```
|
||||||
'
|
'
|
||||||
|
|
@ -115,8 +133,6 @@ k_t = Team eliminaties
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($item in $player_matches) {
|
foreach ($item in $player_matches) {
|
||||||
if ($item.PSObject.Properties.Name -contains "new_win_matches") {
|
if ($item.PSObject.Properties.Name -contains "new_win_matches") {
|
||||||
$item.new_win_matches = $null
|
$item.new_win_matches = $null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue