last stats
This commit is contained in:
parent
76a4165d8a
commit
fc182750ca
5 changed files with 185 additions and 2 deletions
77
data/player_last_stats.json
Normal file
77
data/player_last_stats.json
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"playername": "Lanta01",
|
||||||
|
"deaths": 56.0,
|
||||||
|
"kills": 215.0,
|
||||||
|
"humankills": 66.0,
|
||||||
|
"matches": 68,
|
||||||
|
"KD_H": 1.1785714285714286,
|
||||||
|
"KD_ALL": 3.8392857142857144
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"playername": "Petje1972",
|
||||||
|
"deaths": 42.0,
|
||||||
|
"kills": 251.0,
|
||||||
|
"humankills": 54.0,
|
||||||
|
"matches": 48,
|
||||||
|
"KD_H": 1.2857142857142858,
|
||||||
|
"KD_ALL": 5.976190476190476
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"playername": "TaGMoM",
|
||||||
|
"deaths": 13.0,
|
||||||
|
"kills": 42.0,
|
||||||
|
"humankills": 1.0,
|
||||||
|
"matches": 14,
|
||||||
|
"KD_H": 0.07692307692307693,
|
||||||
|
"KD_ALL": 3.230769230769231
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"playername": "r00tger",
|
||||||
|
"deaths": 0.0,
|
||||||
|
"kills": 6.0,
|
||||||
|
"humankills": 2.0,
|
||||||
|
"matches": 4,
|
||||||
|
"KD_H": "Infinity",
|
||||||
|
"KD_ALL": "Infinity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"playername": "Masistuta",
|
||||||
|
"deaths": 31.0,
|
||||||
|
"kills": 139.0,
|
||||||
|
"humankills": 17.0,
|
||||||
|
"matches": 42,
|
||||||
|
"KD_H": 0.5483870967741935,
|
||||||
|
"KD_ALL": 4.483870967741935
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"playername": "RalphNorris",
|
||||||
|
"deaths": 42.0,
|
||||||
|
"kills": 80.0,
|
||||||
|
"humankills": 10.0,
|
||||||
|
"matches": 47,
|
||||||
|
"KD_H": 0.23809523809523808,
|
||||||
|
"KD_ALL": 1.9047619047619047
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"playername": "Jimbo_The_One",
|
||||||
|
"deaths": 34.0,
|
||||||
|
"kills": 38.0,
|
||||||
|
"humankills": 20.0,
|
||||||
|
"matches": 43,
|
||||||
|
"KD_H": 0.5882352941176471,
|
||||||
|
"KD_ALL": 1.1176470588235294
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"playername": "Shepherders",
|
||||||
|
"deaths": 3.0,
|
||||||
|
"kills": 4.0,
|
||||||
|
"humankills": 0.0,
|
||||||
|
"matches": 3,
|
||||||
|
"KD_H": 0.0,
|
||||||
|
"KD_ALL": 1.3333333333333333
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"updated": "09/25/2023 13:52:33 - Time Zone: W. Europe Standard Time"
|
||||||
|
}
|
||||||
|
]
|
||||||
79
last_stats.php
Normal file
79
last_stats.php
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>DTCH - PUBG Clan - Match Stats</title>
|
||||||
|
<link rel="stylesheet" href="./includes/styles.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<?php include './includes/navigation.php'; ?>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<section>
|
||||||
|
<h2>Player Stats</h2>
|
||||||
|
<?php
|
||||||
|
include './config/config.php';
|
||||||
|
|
||||||
|
$players_matches = json_decode(file_get_contents('./data/player_last_stats.json'), true);
|
||||||
|
|
||||||
|
echo "<table border='1'>";
|
||||||
|
echo "<tr>
|
||||||
|
<th>Playername</th>
|
||||||
|
<th>Deaths</th>
|
||||||
|
<th>Kills</th>
|
||||||
|
<th>Human Kills</th>
|
||||||
|
<th>Matches</th>
|
||||||
|
<th>K/D (Human)</th>
|
||||||
|
<th>K/D (All)</th>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
foreach ($players_matches as $player_data) {
|
||||||
|
if (isset($player_data['updated'])) {
|
||||||
|
continue; // Skip this iteration and move to the next
|
||||||
|
}
|
||||||
|
$player_name = $player_data['playername'];
|
||||||
|
$deaths = number_format($player_data['deaths'], 2, ',', '');
|
||||||
|
$kills = number_format($player_data['kills'], 2, ',', '');
|
||||||
|
$humankills = number_format($player_data['humankills'], 2, ',', '');
|
||||||
|
$matches = $player_data['matches'];
|
||||||
|
$KD_H = ($player_data['KD_H'] == "Infinity") ? "∞" : number_format($player_data['KD_H'], 2, ',', '');
|
||||||
|
$KD_ALL = ($player_data['KD_ALL'] == "Infinity") ? "∞" : number_format($player_data['KD_ALL'], 2, ',', '');
|
||||||
|
|
||||||
|
echo "<tr>
|
||||||
|
<td>$player_name</td>
|
||||||
|
<td>$deaths</td>
|
||||||
|
<td>$kills</td>
|
||||||
|
<td>$humankills</td>
|
||||||
|
<td>$matches</td>
|
||||||
|
<td>$KD_H</td>
|
||||||
|
<td>$KD_ALL</td>
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
echo "</table>";
|
||||||
|
echo "Last update: ";
|
||||||
|
foreach ($players_matches as $player_data) {
|
||||||
|
if (isset($player_data['updated'])) {
|
||||||
|
echo $player_data['updated'];
|
||||||
|
break; // Once found, exit the loop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<?php include './includes/footer.php'; ?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -12,6 +12,7 @@ error_reporting(E_ALL);
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>DTCH - PUBG Clan - Match Stats</title>
|
<title>DTCH - PUBG Clan - Match Stats</title>
|
||||||
<link rel="stylesheet" href="./includes/styles.css">
|
<link rel="stylesheet" href="./includes/styles.css">
|
||||||
|
<script src="./lib/sorttable.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
@ -39,7 +40,7 @@ error_reporting(E_ALL);
|
||||||
foreach ($players_matches as $player_data) {
|
foreach ($players_matches as $player_data) {
|
||||||
if ($player_data['playername'] === $selected_player) {
|
if ($player_data['playername'] === $selected_player) {
|
||||||
echo "<h2>Recent Matches for $selected_player</h2>";
|
echo "<h2>Recent Matches for $selected_player</h2>";
|
||||||
echo "<table border='1'>";
|
echo "<table border='1' class='sortable'>";
|
||||||
echo "<tr><th>Match Date</th><th>Game Mode</th><th>MatchType</th><th>Map</th><th>Kills</th><th>Damage Dealt</th><th>Time Survived</th><th>winPlace</th></tr>";
|
echo "<tr><th>Match Date</th><th>Game Mode</th><th>MatchType</th><th>Map</th><th>Kills</th><th>Damage Dealt</th><th>Time Survived</th><th>winPlace</th></tr>";
|
||||||
foreach ($player_data['player_matches'] as $match) {
|
foreach ($player_data['player_matches'] as $match) {
|
||||||
$date = new DateTime($match['createdAt']);
|
$date = new DateTime($match['createdAt']);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ error_reporting(E_ALL);
|
||||||
$selected_mode = isset($_POST['game_mode']) ? $_POST['game_mode'] : 'squad';
|
$selected_mode = isset($_POST['game_mode']) ? $_POST['game_mode'] : 'squad';
|
||||||
|
|
||||||
// Form to select game mode
|
// Form to select game mode
|
||||||
echo "<form method='post' action='' class='sortable'>
|
echo "<form method='post' action=''>
|
||||||
<input type='submit' name='game_mode' value='solo' class='btn'>
|
<input type='submit' name='game_mode' value='solo' class='btn'>
|
||||||
<input type='submit' name='game_mode' value='duo' class='btn'>
|
<input type='submit' name='game_mode' value='duo' class='btn'>
|
||||||
<input type='submit' name='game_mode' value='squad' class='btn'>
|
<input type='submit' name='game_mode' value='squad' class='btn'>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
|
|
||||||
|
if($PSScriptRoot.length -eq 0){
|
||||||
|
$scriptroot = Get-Location
|
||||||
|
}else{
|
||||||
|
$scriptroot = $PSScriptRoot
|
||||||
|
}
|
||||||
|
|
||||||
function get-killstats {
|
function get-killstats {
|
||||||
param (
|
param (
|
||||||
$player_name,
|
$player_name,
|
||||||
|
|
@ -69,3 +76,22 @@ foreach ($player in $all_player_matches.playername) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$currentDateTime = Get-Date
|
||||||
|
|
||||||
|
# Get current timezone
|
||||||
|
$currentTimezone = (Get-TimeZone).Id
|
||||||
|
|
||||||
|
# Format and parse the information into a string
|
||||||
|
$formattedString = "$currentDateTime - Time Zone: $currentTimezone"
|
||||||
|
|
||||||
|
# Output the formatted string
|
||||||
|
$playerstats += [PSCustomObject]@{
|
||||||
|
updated = $formattedString
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
($playerstats | convertto-json) | out-file "$scriptroot/../data/player_last_stats.json"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue