Merge pull request #130 from OpzekerIT/dev

Ranked+Refactor matchparser+logo800x800+competitive table + per table minimal matchec adjustable
This commit is contained in:
Lanta 2023-11-20 11:23:39 +01:00 committed by GitHub
commit 986073d07e
6 changed files with 95 additions and 193 deletions

View file

@ -25,7 +25,7 @@ jobs:
- name: Sync Files from ${{ github.ref }}
uses: SamKirkland/web-deploy@v1
with:
target-server: lanta.eu
target-server: 86.93.122.67
remote-user: stats
private-ssh-key: ${{ secrets.SSH_KEY }}
destination-path: ${{ env.DESTINATION }}

BIN
images/logo800x800.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 KiB

View file

@ -15,6 +15,8 @@
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
<meta property="og:title" content="DTCH CLAN">
<meta property="og:description" content="DTCH CLAN STATS">
<meta property="og:image" content="https://dtch.online/images/logo.png">
<meta property="og:image:width" content="800">
<meta property="og:image:height" content="800">
<meta property="og:image" content="https://dtch.online/images/logo800x800.png" >
<script defer src="./lib/sorttable.js"></script>
</head>

View file

@ -14,7 +14,7 @@ error_reporting(E_ALL);
<?php
include './includes/navigation.php';
include './includes/header.php';
?>
?>
<main>
<section>
@ -30,11 +30,24 @@ error_reporting(E_ALL);
}
echo "<br>";
if($key == 'all'){
echo "Stats for $key (minimal 20 matches)";
}else{
if ($key == 'all') {
echo "Stats for $key (minimal 20 matches)";
}
if ($key == 'Intense') {
echo "Stats for $key (minimal 8 matches)";
}
if ($key == 'Casual') {
echo "Stats for $key (minimal 8 matches)";
}
if ($key == 'official') {
echo "Stats for $key (minimal 8 matches)";
}
if ($key == 'custom') {
echo "Stats for $key (minimal 8 matches)";
}
if ($key == 'Ranked') {
echo "Stats for $key (minimal 5 matches)";
}
echo "<table border='1' class='sortable'>";
echo "<tr>
<th>Player</th>
@ -54,10 +67,23 @@ error_reporting(E_ALL);
if (!isset($player_data['playername']) || is_null($player_data['playername'])) {
continue; // Skip this iteration and move to the next
}
if ($player_data['matches'] < 8){
if ($key == 'all' && $player_data['matches'] < 20) {
continue;
}
if ($key == 'all' && $player_data['matches'] < 20) {
if ($key == 'Intense' && $player_data['matches'] < 8) {
continue;
}
if ($key == 'Casual' && $player_data['matches'] < 8) {
continue;
}
if ($key == 'official' && $player_data['matches'] < 8) {
continue;
}
if ($key == 'custom' && $player_data['matches'] < 8) {
continue;
}
if ($key == 'Ranked' && $player_data['matches'] < 5) {
continue;
}

View file

@ -1 +1,2 @@
sup?
#

View file

@ -154,195 +154,67 @@ foreach ($file in $matchfiles) {
}
}
$playerstats_all = @()
foreach ($player in $all_player_matches.playername) {
if ($null -eq $player) {
continue
}
$deaths = (($killstats.stats | where-object { $_.playername -eq $player }).deaths | Measure-Object -sum).sum
$kills = (($killstats.stats | where-object { $_.playername -eq $player }).kills | Measure-Object -sum).sum
$dbno = (($killstats.stats | where-object { $_.playername -eq $player }).dbno | Measure-Object -sum).sum
$humankills = (($killstats.stats | where-object { $_.playername -eq $player }).humankills | Measure-Object -sum).sum
$player_matches = ($killstats.stats | where-object { $_.playername -eq $player }).count
$player_wins = ($killstats | where-object { $_.stats.playername -eq $player -and $_.winplace -eq 1 }).count
$winratio_old = (($oldstats.all | Where-Object { $_.playername -eq $player }).winratio)
$winratio = Get-winratio -player_wins $player_wins -player_matches $player_matches
$change = get-change -OldWinRatio $winratio_old -NewWinRatio $winratio
write-output 'all'
write-output "Calculating for player $player"
write-output "new winratio $winratio"
write-output "Old winratio $winratio_old"
write-output $change
$playerstats_all += [PSCustomObject]@{
playername = $player
deaths = $deaths
kills = $kills
humankills = $humankills
matches = $player_matches
KD_H = $humankills / $deaths
KD_ALL = $kills / $deaths
winratio = $winratio
wins = $player_wins
dbno = $dbno
change = $change
function Get-MatchStatsPlayer {
param (
[switch] $GameMode,
[switch] $MatchType,
[string] $typemodevalue,
[array] $playernames
)
$MatchStatsPlayer = @()
foreach ($player in $playernames) {
if ($null -eq $player) {
continue
}
if($GameMode){
$filterProperty = 'gameMode'
}
if($MatchType){
$filterProperty = 'matchType'
}
$deaths = (($killstats.stats | where-object { $_.playername -eq $player -and $_.$filterProperty -like $typemodevalue }).deaths | Measure-Object -sum).sum
$kills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.$filterProperty -like $typemodevalue }).kills | Measure-Object -sum).sum
$dbno = (($killstats.stats | where-object { $_.playername -eq $player -and $_.$filterProperty -like $typemodevalue }).dbno | Measure-Object -sum).sum
$humankills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.$filterProperty -like $typemodevalue }).humankills | Measure-Object -sum).sum
$player_matches = ($killstats.stats | where-object { $_.playername -eq $player -and $_.$filterProperty -like $typemodevalue }).count
$player_wins = ($killstats | where-object { $_.stats.playername -eq $player -and $_.winplace -eq 1 -and $_.stats.$filterProperty -like $typemodevalue }).count
$winratio_old = (($oldstats.Intense | Where-Object { $_.playername -eq $player }).winratio)
$winratio = Get-winratio -player_wins $player_wins -player_matches $player_matches
$change = get-change -OldWinRatio $winratio_old -NewWinRatio $winratio
write-host 'event'
write-host "Calculating for player $player"
write-host "new winratio $winratio"
write-host "Old winratio $winratio_old"
write-host $change
$MatchStatsPlayer += [PSCustomObject]@{
playername = $player
deaths = $deaths
kills = $kills
humankills = $humankills
matches = $player_matches
KD_H = $humankills / $deaths
KD_ALL = $kills / $deaths
winratio = $winratio
wins = $player_wins
dbno = $dbno
change = $change
}
}
return $MatchStatsPlayer | Sort-Object winratio -Descending
}
$playerstats_all = $playerstats_all | Sort-Object winratio -Descending
##IBR
$playerstats_event_ibr = @()
foreach ($player in $all_player_matches.playername) {
if ($null -eq $player) {
continue
}
$deaths = (($killstats.stats | where-object { $_.playername -eq $player -and $_.gameMode -eq 'ibr' -and $_.matchType -eq 'event' }).deaths | Measure-Object -sum).sum
$kills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.gameMode -eq 'ibr' -and $_.matchType -eq 'event' }).kills | Measure-Object -sum).sum
$dbno = (($killstats.stats | where-object { $_.playername -eq $player -and $_.gameMode -eq 'ibr' -and $_.matchType -eq 'event' }).dbno | Measure-Object -sum).sum
$humankills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.gameMode -eq 'ibr' -and $_.matchType -eq 'event' }).humankills | Measure-Object -sum).sum
$player_matches = ($killstats.stats | where-object { $_.playername -eq $player -and $_.gameMode -eq 'ibr' -and $_.matchType -eq 'event' }).count
$player_wins = ($killstats | where-object { $_.stats.playername -eq $player -and $_.winplace -eq 1 -and $_.stats.gameMode -eq 'ibr' -and $_.stats.matchType -eq 'event' }).count
$winratio_old = (($oldstats.Intense | Where-Object { $_.playername -eq $player }).winratio)
$winratio = Get-winratio -player_wins $player_wins -player_matches $player_matches
$change = get-change -OldWinRatio $winratio_old -NewWinRatio $winratio
write-output 'event'
write-output "Calculating for player $player"
write-output "new winratio $winratio"
write-output "Old winratio $winratio_old"
write-output $change
$playerstats_event_ibr += [PSCustomObject]@{
playername = $player
deaths = $deaths
kills = $kills
humankills = $humankills
matches = $player_matches
KD_H = $humankills / $deaths
KD_ALL = $kills / $deaths
winratio = $winratio
wins = $player_wins
dbno = $dbno
change = $change
}
}
$playerstats_event_ibr = $playerstats_event_ibr | Sort-Object winratio -Descending
##airoyale
$playerstats_airoyale = @()
foreach ($player in $all_player_matches.playername) {
if ($null -eq $player) {
continue
}
$deaths = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'airoyale' }).deaths | Measure-Object -sum).sum
$kills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'airoyale' }).kills | Measure-Object -sum).sum
$dbno = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'airoyale' }).dbno | Measure-Object -sum).sum
$humankills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'airoyale' }).humankills | Measure-Object -sum).sum
$player_matches = ($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'airoyale' }).count
$player_wins = ($killstats | where-object { $_.stats.playername -eq $player -and $_.winplace -eq 1 -and $_.stats.matchType -eq 'airoyale' }).count
$winratio_old = (($oldstats.Casual | Where-Object { $_.playername -eq $player }).winratio)
$winratio = Get-winratio -player_wins $player_wins -player_matches $player_matches
$change = get-change -OldWinRatio $winratio_old -NewWinRatio $winratio
write-output 'airoyale'
write-output "Calculating for player $player"
write-output "new winratio $winratio"
write-output "Old winratio $winratio_old"
write-output $change
$playerstats_airoyale += [PSCustomObject]@{
playername = $player
deaths = $deaths
kills = $kills
humankills = $humankills
matches = $player_matches
KD_H = $humankills / $deaths
KD_ALL = $kills / $deaths
winratio = $winratio
wins = $player_wins
dbno = $dbno
change = $change
}
}
$playerstats_airoyale = $playerstats_airoyale | Sort-Object winratio -Descending
$playerstats_event_ibr = Get-MatchStatsPlayer -GameMode -typemodevalue 'ibr' -playernames $all_player_matches.playername
$playerstats_airoyale = Get-MatchStatsPlayer -MatchType -typemodevalue 'airoyale' -playernames $all_player_matches.playername
$playerstats_official = Get-MatchStatsPlayer -MatchType -typemodevalue 'official' -playernames $all_player_matches.playername
$playerstats_custom = Get-MatchStatsPlayer -MatchType -typemodevalue 'custom' -playernames $all_player_matches.playername
$playerstats_all = Get-MatchStatsPlayer -MatchType -typemodevalue '*' -playernames $all_player_matches.playername
$playerstats_ranked = Get-MatchStatsPlayer -MatchType -typemodevalue 'competitive' -playernames $all_player_matches.playername
$playerstats_official = @()
foreach ($player in $all_player_matches.playername) {
if ($null -eq $player) {
continue
}
$deaths = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'official' }).deaths | Measure-Object -sum).sum
$kills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'official' }).kills | Measure-Object -sum).sum
$dbno = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'official' }).dbno | Measure-Object -sum).sum
$humankills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'official' }).humankills | Measure-Object -sum).sum
$player_matches = ($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'official' }).count
$player_wins = ($killstats | where-object { $_.stats.playername -eq $player -and $_.winplace -eq 1 -and $_.stats.matchType -eq 'official' }).count
$winratio_old = (($oldstats.official | Where-Object { $_.playername -eq $player }).winratio)
$winratio = Get-winratio -player_wins $player_wins -player_matches $player_matches
$change = get-change -OldWinRatio $winratio_old -NewWinRatio $winratio
write-output 'official'
write-output "Calculating for player $player"
write-output "new winratio $winratio"
write-output "Old winratio $winratio_old"
write-output $change
$playerstats_official += [PSCustomObject]@{
playername = $player
deaths = $deaths
kills = $kills
humankills = $humankills
matches = $player_matches
KD_H = $humankills / $deaths
KD_ALL = $kills / $deaths
winratio = $winratio
wins = $player_wins
dbno = $dbno
change = $change
}
}
$playerstats_official = $playerstats_official | Sort-Object winratio -Descending
##CUSTOM GAMES
$playerstats_custom = @()
foreach ($player in $all_player_matches.playername) {
if ($null -eq $player) {
continue
}
$deaths = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'custom' }).deaths | Measure-Object -sum).sum
$kills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'custom' }).kills | Measure-Object -sum).sum
$dbno = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'custom' }).dbno | Measure-Object -sum).sum
$humankills = (($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'custom' }).humankills | Measure-Object -sum).sum
$player_matches = ($killstats.stats | where-object { $_.playername -eq $player -and $_.matchType -eq 'custom' }).count
$player_wins = ($killstats | where-object { $_.stats.playername -eq $player -and $_.winplace -eq 1 -and $_.stats.matchType -eq 'custom' }).count
$winratio_old = (($oldstats.custom | Where-Object { $_.playername -eq $player }).winratio)
$winratio = Get-winratio -player_wins $player_wins -player_matches $player_matches
$change = get-change -OldWinRatio $winratio_old -NewWinRatio $winratio
write-output 'custom'
write-output "Calculating for player $player"
write-output "new winratio $winratio"
write-output "Old winratio $winratio_old"
write-output $change
$playerstats_custom += [PSCustomObject]@{
playername = $player
deaths = $deaths
kills = $kills
humankills = $humankills
matches = $player_matches
KD_H = $humankills / $deaths
KD_ALL = $kills / $deaths
winratio = $winratio
wins = $player_wins
dbno = $dbno
change = $change
}
}
$playerstats_custom = $playerstats_custom | Sort-Object winratio -Descending
$currentDateTime = Get-Date
@ -362,6 +234,7 @@ $playerstats = [PSCustomObject]@{
official = $playerstats_official
custom = $playerstats_custom
updated = $formattedString
Ranked = $playerstats_ranked
}
write-output "Writing file"