Dev #177
2 changed files with 43 additions and 23 deletions
|
|
@ -15,7 +15,7 @@ $ogDescription = "Explore detailed player statistics over the past month includi
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<section>
|
<section>
|
||||||
<h2>Player Stats past month</h2>
|
<h2>Player Stats past Quarter</h2>
|
||||||
<?php
|
<?php
|
||||||
include './config/config.php';
|
include './config/config.php';
|
||||||
|
|
||||||
|
|
@ -33,6 +33,9 @@ $ogDescription = "Explore detailed player statistics over the past month includi
|
||||||
// if ($key == 'all') {
|
// if ($key == 'all') {
|
||||||
// echo "Stats for $key (minimal 20 matches)";
|
// echo "Stats for $key (minimal 20 matches)";
|
||||||
// }
|
// }
|
||||||
|
if ($key == 'clan_4_casual') {
|
||||||
|
echo "Stats for $key (minimal 4 matches)";
|
||||||
|
}
|
||||||
if ($key == 'Intense') {
|
if ($key == 'Intense') {
|
||||||
echo "Stats for $key (minimal 8 matches)";
|
echo "Stats for $key (minimal 8 matches)";
|
||||||
}
|
}
|
||||||
|
|
@ -71,6 +74,9 @@ $ogDescription = "Explore detailed player statistics over the past month includi
|
||||||
if ($key == 'all' && $player_data['matches'] < 20) {
|
if ($key == 'all' && $player_data['matches'] < 20) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ($key == 'clan_4_casual' && $player_data['matches'] < 4) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ($key == 'Intense' && $player_data['matches'] < 8) {
|
if ($key == 'Intense' && $player_data['matches'] < 8) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ else {
|
||||||
. $scriptroot\..\includes\ps1\lockfile.ps1
|
. $scriptroot\..\includes\ps1\lockfile.ps1
|
||||||
new-lock -by "matchparser"
|
new-lock -by "matchparser"
|
||||||
##SETTINGS
|
##SETTINGS
|
||||||
$monthsback = -1 # how many months back to look for matches
|
$monthsback = -3 # how many months back to look for matches
|
||||||
##END OF SETTINGS
|
##END OF SETTINGS
|
||||||
function Get-Change {
|
function Get-Change {
|
||||||
param (
|
param (
|
||||||
|
|
@ -149,26 +149,36 @@ 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 = @()
|
||||||
|
$guids = $matchfiles.Name | ForEach-Object { $_.Split("_")[0] }
|
||||||
|
$groupedGuids_full_clan_matches = $guids | Group-Object | Where-Object { $_.Count -eq 4 }
|
||||||
|
|
||||||
$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) {
|
||||||
|
$killstats_only_full_clan_matches += $json
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
write-output "Archiving $($file.name)"
|
write-output "Archiving $($file.name)"
|
||||||
Move-Item -Path $file.FullName -Destination "$scriptroot/../data/killstats/archive" -Force
|
Move-Item -Path $file.FullName -Destination "$scriptroot/../data/killstats/archive/" -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function Get-MatchStatsPlayer {
|
function Get-MatchStatsPlayer {
|
||||||
param (
|
param (
|
||||||
[switch] $GameMode,
|
[switch] $GameMode,
|
||||||
[switch] $MatchType,
|
[switch] $MatchType,
|
||||||
[string] $typemodevalue,
|
[string] $typemodevalue,
|
||||||
[array] $playernames,
|
[array] $playernames,
|
||||||
[string] $friendlyname
|
[string] $friendlyname,
|
||||||
|
[array] $killstats,
|
||||||
|
[string] $sortstat
|
||||||
|
|
||||||
)
|
)
|
||||||
$MatchStatsPlayer = @()
|
$MatchStatsPlayer = @()
|
||||||
foreach ($player in $playernames) {
|
foreach ($player in $playernames) {
|
||||||
|
|
@ -214,22 +224,24 @@ function Get-MatchStatsPlayer {
|
||||||
change = $change
|
change = $change
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $MatchStatsPlayer | ForEach-Object {
|
$MatchStatsPlayer_sorted = $MatchStatsPlayer | ForEach-Object {
|
||||||
$_ | Add-Member -NotePropertyName RandomKey -NotePropertyValue (Get-Random) -PassThru
|
$_ | Add-Member -NotePropertyName RandomKey -NotePropertyValue (Get-Random) -PassThru
|
||||||
} | Sort-Object -Property RandomKey | Select-Object -Property * -ExcludeProperty RandomKey #randomize the order
|
} | Sort-Object -Property $sortstat -Descending | Select-Object -Property * -ExcludeProperty RandomKey #randomize the order
|
||||||
|
|
||||||
|
return $MatchStatsPlayer_sorted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$playerstats_event_ibr = Get-MatchStatsPlayer -GameMode -typemodevalue 'ibr' -playernames $all_player_matches.playername -friendlyname 'Intense'
|
$playerstats_event_ibr = Get-MatchStatsPlayer -GameMode -typemodevalue 'ibr' -playernames $all_player_matches.playername -friendlyname 'Intense' -killstats $killstats -sortstat 'randomkey'
|
||||||
$playerstats_airoyale = Get-MatchStatsPlayer -MatchType -typemodevalue 'airoyale' -playernames $all_player_matches.playername -friendlyname 'Casual'
|
$playerstats_airoyale = Get-MatchStatsPlayer -MatchType -typemodevalue 'airoyale' -playernames $all_player_matches.playername -friendlyname 'Casual' -killstats $killstats -sortstat 'randomkey'
|
||||||
$playerstats_official = Get-MatchStatsPlayer -MatchType -typemodevalue 'official' -playernames $all_player_matches.playername -friendlyname 'official'
|
$playerstats_official = Get-MatchStatsPlayer -MatchType -typemodevalue 'official' -playernames $all_player_matches.playername -friendlyname 'official' -killstats $killstats -sortstat 'randomkey'
|
||||||
$playerstats_custom = Get-MatchStatsPlayer -MatchType -typemodevalue 'custom' -playernames $all_player_matches.playername -friendlyname 'custom'
|
$playerstats_custom = Get-MatchStatsPlayer -MatchType -typemodevalue 'custom' -playernames $all_player_matches.playername -friendlyname 'custom' -killstats $killstats -sortstat 'randomkey'
|
||||||
$playerstats_all = Get-MatchStatsPlayer -MatchType -typemodevalue '*' -playernames $all_player_matches.playername -friendlyname 'all'
|
$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'
|
$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_custom = $playerstats_custom | Sort-Object winratio -Descending
|
$playerstats_custom = $playerstats_custom | Sort-Object winratio -Descending
|
||||||
|
|
||||||
|
|
@ -245,12 +257,14 @@ $formattedString = "$currentDateTime - Time Zone: $currentTimezone"
|
||||||
|
|
||||||
$playerstats = [PSCustomObject]@{
|
$playerstats = [PSCustomObject]@{
|
||||||
all = $playerstats_all
|
all = $playerstats_all
|
||||||
|
clan_4_casual = $playerstats_airoyale_clan
|
||||||
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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
write-output "Writing file"
|
write-output "Writing file"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue