From 81a01c0093e1ff5c2bcb5ba0a196df59adb44012 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Thu, 21 Sep 2023 20:31:29 +0200 Subject: [PATCH] top% --- includes/navigation.php | 2 ++ topstatsavg.php | 74 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 topstatsavg.php diff --git a/includes/navigation.php b/includes/navigation.php index 1896e67..6c80753 100644 --- a/includes/navigation.php +++ b/includes/navigation.php @@ -4,5 +4,7 @@
  • Clan Stats
  • User Stats
  • Top10
  • +
  • Match % T10
  • + diff --git a/topstatsavg.php b/topstatsavg.php new file mode 100644 index 0000000..ba3bbd0 --- /dev/null +++ b/topstatsavg.php @@ -0,0 +1,74 @@ + + + + + + + + + DTCH - PUBG Clan - Average User Stats + + + + + + +
    +
    +

    Average User Stats

    + + + + +
    "; + + $metrics = [ + 'Kills' => 'kills', + 'Damage' => 'damageDealt', + 'Headshots' => 'headshotKills', + 'Wins' => 'wins', + 'Top10s' => 'top10s' + ]; + + echo ""; + echo ""; + foreach ($metrics as $display => $metric) { + echo ""; + } + echo ""; + + foreach ($players_data[$selected_mode] as $player_name => $player_details) { + $account_id = array_key_first($player_details); + $stats = $player_details[$account_id]; + $totalGames = $stats['wins'] + $stats['losses']; // Wins + Losses + + echo ""; + foreach ($metrics as $metric) { + $averageValue = ($totalGames > 0) ? round($stats[$metric] / $totalGames, 2) : 0; + echo ""; + } + echo ""; + } + + echo "
    PlayerAverage $display
    $player_name$averageValue

    "; + echo "Last update " ; + echo $players_data['updated']; + ?> +
    +
    + + + + + -- 2.49.1