Skip tdm report #179

Merged
OpzekerIT merged 2 commits from dev into main 2024-08-21 12:55:33 +00:00
2 changed files with 26 additions and 13 deletions

View file

@ -85,6 +85,9 @@ foreach ($winid in $new_win_matches) {
$2D_replay_url = $2D_replay_url + "?follow=$($winners[0])" $2D_replay_url = $2D_replay_url + "?follow=$($winners[0])"
$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].gameMode -eq 'tdm' ){
continue
} #skip tdm matches
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
} }

View file

@ -150,17 +150,27 @@ 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
$killstats_only_full_clan_matches = @() $killstats_clan_matches_gt_1 = @()
$killstats_clan_matches_gt_2 = @()
$killstats_clan_matches_gt_3 = @()
$guids = $matchfiles.Name | ForEach-Object { $_.Split("_")[0] } $guids = $matchfiles.Name | ForEach-Object { $_.Split("_")[0] }
$groupedGuids_full_clan_matches = $guids | Group-Object | Where-Object { $_.Count -gt 1 } $groupedGuids_clan_matches_gt_1 = $guids | Group-Object | Where-Object { $_.Count -gt 1 }
$groupedGuids_clan_matches_gt_2 = $guids | Group-Object | Where-Object { $_.Count -gt 2 }
$groupedGuids_clan_matches_gt_3 = $guids | Group-Object | Where-Object { $_.Count -gt 3 }
$last_month = (get-date).AddMonths($monthsback) $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) {
$killstats += $json $killstats += $json
if ($groupedGuids_full_clan_matches.Name -contains $json.matchid) { if ($groupedGuids_clan_matches_gt_1.Name -contains $json.matchid) {
$killstats_only_full_clan_matches += $json $killstats_clan_matches_gt_1 += $json
}
if ($groupedGuids_clan_matches_gt_2.Name -contains $json.matchid) {
$killstats_clan_matches_gt_2 += $json
}
if ($groupedGuids_clan_matches_gt_3.Name -contains $json.matchid) {
$killstats_clan_matches_gt_3 += $json
} }
} }
else { else {
@ -241,7 +251,7 @@ $playerstats_custom = Get-MatchStatsPlayer -MatchType -typemodevalue 'custom' -p
$playerstats_all = Get-MatchStatsPlayer -MatchType -typemodevalue '*' -playernames $all_player_matches.playername -friendlyname 'all' -killstats $killstats -sortstat 'randomkey' $playerstats_all = Get-MatchStatsPlayer -MatchType -typemodevalue '*' -playernames $all_player_matches.playername -friendlyname 'all' -killstats $killstats -sortstat 'randomkey'
$playerstats_ranked = Get-MatchStatsPlayer -MatchType -typemodevalue 'competitive' -playernames $all_player_matches.playername -friendlyname 'Ranked' -killstats $killstats -sortstat 'randomkey' $playerstats_ranked = Get-MatchStatsPlayer -MatchType -typemodevalue 'competitive' -playernames $all_player_matches.playername -friendlyname 'Ranked' -killstats $killstats -sortstat 'randomkey'
$playerstats_airoyale_clan = Get-MatchStatsPlayer -MatchType -typemodevalue 'airoyale' -playernames $all_player_matches.playername -friendlyname 'Casual' -killstats $killstats_only_full_clan_matches -sortstat 'winratio' $playerstats_airoyale_clan_gt_1 = Get-MatchStatsPlayer -MatchType -typemodevalue 'airoyale' -playernames $all_player_matches.playername -friendlyname 'Casual' -killstats $killstats_clan_matches_gt_1 -sortstat 'winratio'
$playerstats_custom = $playerstats_custom | Sort-Object winratio -Descending $playerstats_custom = $playerstats_custom | Sort-Object winratio -Descending
@ -256,14 +266,14 @@ $formattedString = "$currentDateTime - Time Zone: $currentTimezone"
# Output the formatted string # Output the formatted string
$playerstats = [PSCustomObject]@{ $playerstats = [PSCustomObject]@{
all = $playerstats_all all = $playerstats_all
clan_casual = $playerstats_airoyale_clan clan_casual = $playerstats_airoyale_clan_gt_1
Intense = $playerstats_event_ibr Intense = $playerstats_event_ibr
Casual = $playerstats_airoyale Casual = $playerstats_airoyale
official = $playerstats_official official = $playerstats_official
custom = $playerstats_custom custom = $playerstats_custom
updated = $formattedString updated = $formattedString
Ranked = $playerstats_ranked Ranked = $playerstats_ranked
} }