From d5b3af94803b6d7634a15ccda6051c613b27a9fb Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 13:56:53 +0100 Subject: [PATCH 01/14] mapname --- matchinfo.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/matchinfo.php b/matchinfo.php index cab46ed..dd323c3 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -41,6 +41,20 @@ $lastMatches = array_slice($allMatches, 0, 8); "Erangel", + "Chimera_Main" => "Paramo", + "Desert_Main" => "Miramar", + "DihorOtok_Main" => "Vikendi", + "Erangel_Main" => "Erangel", + "Heaven_Main" => "Haven", + "Kiki_Main" => "Deston", + "Range_Main" => "Camp Jackal", + "Savage_Main" => "Sanhok", + "Summerland_Main" => "Karakin", + "Tiger_Main" => "Taego" + ); // Check if a match ID is provided in the GET request if (isset($_GET['matchid'])) { $matchId = $_GET['matchid']; @@ -52,9 +66,10 @@ $lastMatches = array_slice($allMatches, 0, 8); $jsonData = json_decode(file_get_contents($filename), true); $matchinfo = $jsonData['data']['attributes']; $matchdata = $jsonData['data']; - echo ""; + echo "
matchTypedurationgameModemapNamecreatedAtid
"; echo ""; echo ""; + echo ""; echo ""; echo ""; echo ""; -- 2.49.1 From 51974ac4f9f8cfa8a855921f7e2252b81be61742 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 13:57:48 +0100 Subject: [PATCH 02/14] mapname --- matchinfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index dd323c3..ab0bd6f 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -72,11 +72,11 @@ $lastMatches = array_slice($allMatches, 0, 8); echo ""; echo ""; echo ""; - echo ""; + echo ""; echo ""; echo ""; echo ""; - + isset($mapNames[$match['mapName']]) ? $mapNames[$match['mapName']] : $match['mapName']; echo "
matchTypegameModedurationgameModemapNamecreatedAtid
" . htmlspecialchars($matchinfo['matchType']) . "" . htmlspecialchars($matchinfo['gameMode']) . "" . htmlspecialchars($matchinfo['duration']) . "" . htmlspecialchars($matchinfo['gameMode']) . "" . htmlspecialchars($matchinfo['mapName']) . "" . htmlspecialchars($matchinfo['gameMode']) . "" . htmlspecialchars($matchinfo['duration']) . "" . htmlspecialchars($matchinfo['gameMode']) . "" . htmlspecialchars($matchinfo['mapName']) . "" . htmlspecialchars(isset($mapNames[$matchinfo['mapName']]) ? $mapNames[$matchinfo['mapName']] : $matchinfo['mapName']) . "" . htmlspecialchars($matchinfo['createdAt']) . "" . htmlspecialchars($matchdata['id']) . "
"; -- 2.49.1 From a6c251872c5a6d346aea44116e820ce273ee35af Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 13:58:22 +0100 Subject: [PATCH 03/14] oops --- matchinfo.php | 1 - 1 file changed, 1 deletion(-) diff --git a/matchinfo.php b/matchinfo.php index ab0bd6f..55aa52b 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -76,7 +76,6 @@ $lastMatches = array_slice($allMatches, 0, 8); echo "" . htmlspecialchars($matchinfo['createdAt']) . ""; echo "" . htmlspecialchars($matchdata['id']) . ""; echo ""; - isset($mapNames[$match['mapName']]) ? $mapNames[$match['mapName']] : $match['mapName']; echo ""; -- 2.49.1 From c80e935a0a737c5a0aaedef2c8502d1b4596a61f Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 14:00:47 +0100 Subject: [PATCH 04/14] th --- matchinfo.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index 55aa52b..adf189d 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -66,12 +66,11 @@ $lastMatches = array_slice($allMatches, 0, 8); $jsonData = json_decode(file_get_contents($filename), true); $matchinfo = $jsonData['data']['attributes']; $matchdata = $jsonData['data']; - echo ""; + echo "
matchTypegameModedurationgameModemapNamecreatedAtid
"; echo ""; echo ""; echo ""; echo ""; - echo ""; echo ""; echo ""; echo ""; -- 2.49.1 From 6ca22a72caeea50d059974d48366cf4a7aec784f Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 14:03:32 +0100 Subject: [PATCH 05/14] test --- matchinfo.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/matchinfo.php b/matchinfo.php index adf189d..b395a0d 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -59,7 +59,12 @@ $lastMatches = array_slice($allMatches, 0, 8); if (isset($_GET['matchid'])) { $matchId = $_GET['matchid']; $filename = "data/matches/" . $matchId . ".json"; - + $directory = 'killstats/'; + $prefix = $matchdata['id']; + $files = glob($directory . $prefix . '*'); + foreach ($files as $file) { + echo $file . "\n"; + } // Check if the JSON file for the given match ID exists if (file_exists($filename)) { // Read and decode the JSON file -- 2.49.1 From 3e5c4314be6b6e5490bdc479aaf02194cee96e53 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 14:08:30 +0100 Subject: [PATCH 06/14] data --- matchinfo.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/matchinfo.php b/matchinfo.php index b395a0d..2a3828e 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -59,9 +59,13 @@ $lastMatches = array_slice($allMatches, 0, 8); if (isset($_GET['matchid'])) { $matchId = $_GET['matchid']; $filename = "data/matches/" . $matchId . ".json"; - $directory = 'killstats/'; + + $directory = 'data/killstats/'; $prefix = $matchdata['id']; $files = glob($directory . $prefix . '*'); + echo $prefix; + echo $directory; + echo $files foreach ($files as $file) { echo $file . "\n"; } -- 2.49.1 From f5bd52c9eeee5aac0c079ccb62c714a55da49cdd Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 14:08:51 +0100 Subject: [PATCH 07/14] ; --- matchinfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matchinfo.php b/matchinfo.php index 2a3828e..2f8565f 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -65,7 +65,7 @@ $lastMatches = array_slice($allMatches, 0, 8); $files = glob($directory . $prefix . '*'); echo $prefix; echo $directory; - echo $files + echo $files; foreach ($files as $file) { echo $file . "\n"; } -- 2.49.1 From 8f5adf5d7f091873aebccb5f509f7ce5c7ff73d1 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 14:10:50 +0100 Subject: [PATCH 08/14] test --- matchinfo.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index 2f8565f..e92afbc 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -60,21 +60,21 @@ $lastMatches = array_slice($allMatches, 0, 8); $matchId = $_GET['matchid']; $filename = "data/matches/" . $matchId . ".json"; - $directory = 'data/killstats/'; - $prefix = $matchdata['id']; - $files = glob($directory . $prefix . '*'); - echo $prefix; - echo $directory; - echo $files; - foreach ($files as $file) { - echo $file . "\n"; - } + // Check if the JSON file for the given match ID exists if (file_exists($filename)) { // Read and decode the JSON file $jsonData = json_decode(file_get_contents($filename), true); $matchinfo = $jsonData['data']['attributes']; $matchdata = $jsonData['data']; + + $directory = 'data/killstats/'; + $prefix = $matchdata['id']; + $files = glob($directory . $prefix . '*'); + foreach ($files as $file) { + echo $file . "\n"; + } + echo "
matchTypegameModedurationmapNamecreatedAtid
" . htmlspecialchars($matchinfo['matchType']) . "" . htmlspecialchars($matchinfo['gameMode']) . "" . htmlspecialchars($matchinfo['duration']) . "" . htmlspecialchars($matchinfo['gameMode']) . "" . htmlspecialchars(isset($mapNames[$matchinfo['mapName']]) ? $mapNames[$matchinfo['mapName']] : $matchinfo['mapName']) . "" . htmlspecialchars($matchinfo['createdAt']) . "" . htmlspecialchars($matchdata['id']) . "
"; echo ""; echo ""; -- 2.49.1 From 659d0bbcb59488543e6e164b3d1806ad053b0d45 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 14:13:37 +0100 Subject: [PATCH 09/14] kill --- matchinfo.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/matchinfo.php b/matchinfo.php index e92afbc..393aa10 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -75,6 +75,13 @@ $lastMatches = array_slice($allMatches, 0, 8); echo $file . "\n"; } + foreach($file as $files){ + $jsonData_individual_player = json_decode(file_get_contents($file), true); + echo $jsonData_individual_player['stats']['humankills']; + echo $jsonData_individual_player['stats']['kills']; + + } + echo "
matchTypegameModedurationmapNamecreatedAtid
" . htmlspecialchars($matchinfo['matchType']) . "
"; echo ""; echo ""; -- 2.49.1 From de4f96693c065ce6893e0712cc4f1dd8d512d3d0 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 15:42:19 +0100 Subject: [PATCH 10/14] file --- matchinfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index 393aa10..7024885 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -75,11 +75,11 @@ $lastMatches = array_slice($allMatches, 0, 8); echo $file . "\n"; } - foreach($file as $files){ + foreach($files as $file){ $jsonData_individual_player = json_decode(file_get_contents($file), true); echo $jsonData_individual_player['stats']['humankills']; echo $jsonData_individual_player['stats']['kills']; - + } echo "
matchTypegameModedurationmapNamecreatedAtid
" . htmlspecialchars($matchinfo['matchType']) . "
"; -- 2.49.1 From 8b4d5c7607d62265fcaa7fa5e7eea9f2900bda4f Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 15:45:50 +0100 Subject: [PATCH 11/14] table per player --- matchinfo.php | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index 7024885..02b4497 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -59,7 +59,7 @@ $lastMatches = array_slice($allMatches, 0, 8); if (isset($_GET['matchid'])) { $matchId = $_GET['matchid']; $filename = "data/matches/" . $matchId . ".json"; - + // Check if the JSON file for the given match ID exists if (file_exists($filename)) { @@ -67,20 +67,7 @@ $lastMatches = array_slice($allMatches, 0, 8); $jsonData = json_decode(file_get_contents($filename), true); $matchinfo = $jsonData['data']['attributes']; $matchdata = $jsonData['data']; - - $directory = 'data/killstats/'; - $prefix = $matchdata['id']; - $files = glob($directory . $prefix . '*'); - foreach ($files as $file) { - echo $file . "\n"; - } - foreach($files as $file){ - $jsonData_individual_player = json_decode(file_get_contents($file), true); - echo $jsonData_individual_player['stats']['humankills']; - echo $jsonData_individual_player['stats']['kills']; - - } echo "
matchTypegameModedurationmapNamecreatedAtid
"; echo ""; @@ -94,6 +81,31 @@ $lastMatches = array_slice($allMatches, 0, 8); echo "
matchTypegameModedurationmapNamecreatedAtid
"; + + + echo ""; + echo " + + + + + "; + + $directory = 'data/killstats/'; + $prefix = $matchdata['id']; + $files = glob($directory . $prefix . '*'); + + + foreach ($files as $file) { + $jsonData_individual_player = json_decode(file_get_contents($file), true); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo "
Player NameKillshumankills
" . htmlspecialchars($jsonData_individual_player['stats']['playername']) . "" . htmlspecialchars($jsonData_individual_player['stats']['humankills']) . "" . htmlspecialchars($jsonData_individual_player['stats']['kills']) . "
"; + echo ""; echo " @@ -107,7 +119,6 @@ $lastMatches = array_slice($allMatches, 0, 8); "; - foreach ($jsonData['included'] as $includedItem) { if ($includedItem['type'] == "participant") { $playerStats = $includedItem['attributes']['stats']; -- 2.49.1 From 2d03accfdbfd484760dd5e58210d9310c29bfe55 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 15:49:37 +0100 Subject: [PATCH 12/14] dmg dealthj --- matchinfo.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/matchinfo.php b/matchinfo.php index 02b4497..4a6b9a9 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -98,10 +98,25 @@ $lastMatches = array_slice($allMatches, 0, 8); foreach ($files as $file) { $jsonData_individual_player = json_decode(file_get_contents($file), true); + $individualPlayerName = $jsonData_individual_player['stats']['playername']; + + // Search for the player in $jsonData['included'] to find damageDealt + $damageDealt = 0; + foreach ($jsonData['included'] as $includedItem) { + if ($includedItem['type'] == "participant") { + $playerStats = $includedItem['attributes']['stats']; + if ($individualPlayerName == $playerStats['name']) { + $damageDealt = $playerStats['damageDealt']; + break; // Stop searching once the player is found + } + } + } + echo ""; - echo ""; + echo ""; echo ""; echo ""; + echo ""; // Display damageDealt here echo ""; } echo "
Player NameHeadshot Kills Assists
" . htmlspecialchars($jsonData_individual_player['stats']['playername']) . "" . htmlspecialchars($individualPlayerName) . "" . htmlspecialchars($jsonData_individual_player['stats']['humankills']) . "" . htmlspecialchars($jsonData_individual_player['stats']['kills']) . "" . htmlspecialchars($damageDealt) . "
"; -- 2.49.1 From 41cb8939e743c909356a7a84cd84941b1ce3b968 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 15:50:20 +0100 Subject: [PATCH 13/14] s --- matchinfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matchinfo.php b/matchinfo.php index 4a6b9a9..26d160b 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -88,7 +88,7 @@ $lastMatches = array_slice($allMatches, 0, 8); Player Name Kills humankills - + Total Damage "; $directory = 'data/killstats/'; -- 2.49.1 From 30c25bcc484d1ad51ef247f3d1d66f3df468d19e Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 15:52:18 +0100 Subject: [PATCH 14/14] more infro individual player --- matchinfo.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index 26d160b..85072c7 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -89,6 +89,8 @@ $lastMatches = array_slice($allMatches, 0, 8); Kills humankills Total Damage + Rank + DBNOs "; $directory = 'data/killstats/'; @@ -107,7 +109,9 @@ $lastMatches = array_slice($allMatches, 0, 8); $playerStats = $includedItem['attributes']['stats']; if ($individualPlayerName == $playerStats['name']) { $damageDealt = $playerStats['damageDealt']; - break; // Stop searching once the player is found + $rank = $playerStats['winPlace']; + $DBNOs = $playerStats['DBNOs']; + break; } } } @@ -116,7 +120,9 @@ $lastMatches = array_slice($allMatches, 0, 8); echo "" . htmlspecialchars($individualPlayerName) . ""; echo "" . htmlspecialchars($jsonData_individual_player['stats']['humankills']) . ""; echo "" . htmlspecialchars($jsonData_individual_player['stats']['kills']) . ""; - echo "" . htmlspecialchars($damageDealt) . ""; // Display damageDealt here + echo "" . htmlspecialchars($damageDealt) . ""; + echo "" . htmlspecialchars($rank) . ""; + echo "" . htmlspecialchars($DBNOs) . ""; echo ""; } echo ""; -- 2.49.1