diff --git a/matchinfo.php b/matchinfo.php
index cab46ed..85072c7 100644
--- a/matchinfo.php
+++ b/matchinfo.php
@@ -41,30 +41,92 @@ $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'];
$filename = "data/matches/" . $matchId . ".json";
+
// 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'];
- echo "
| matchType | duration | gameMode | mapName | createdAt | id |
";
+
+
+ echo "| matchType | gameMode | duration | mapName | createdAt | id |
";
echo "";
echo "| " . htmlspecialchars($matchinfo['matchType']) . " | ";
- echo "" . htmlspecialchars($matchinfo['duration']) . " | ";
echo "" . htmlspecialchars($matchinfo['gameMode']) . " | ";
- echo "" . htmlspecialchars($matchinfo['mapName']) . " | ";
+ echo "" . htmlspecialchars($matchinfo['duration']) . " | ";
+ echo "" . htmlspecialchars(isset($mapNames[$matchinfo['mapName']]) ? $mapNames[$matchinfo['mapName']] : $matchinfo['mapName']) . " | ";
echo "" . htmlspecialchars($matchinfo['createdAt']) . " | ";
echo "" . htmlspecialchars($matchdata['id']) . " | ";
echo "
";
-
echo "
";
+
+
+ echo "";
+ echo "
+ | Player Name |
+ Kills |
+ humankills |
+ Total Damage |
+ Rank |
+ DBNOs |
+
";
+
+ $directory = 'data/killstats/';
+ $prefix = $matchdata['id'];
+ $files = glob($directory . $prefix . '*');
+
+
+ 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'];
+ $rank = $playerStats['winPlace'];
+ $DBNOs = $playerStats['DBNOs'];
+ break;
+ }
+ }
+ }
+
+ echo "";
+ echo "| " . htmlspecialchars($individualPlayerName) . " | ";
+ echo "" . htmlspecialchars($jsonData_individual_player['stats']['humankills']) . " | ";
+ echo "" . htmlspecialchars($jsonData_individual_player['stats']['kills']) . " | ";
+ echo "" . htmlspecialchars($damageDealt) . " | ";
+ echo "" . htmlspecialchars($rank) . " | ";
+ echo "" . htmlspecialchars($DBNOs) . " | ";
+ echo "
";
+ }
+ echo "
";
+
echo "";
echo "
| Player Name |
@@ -78,7 +140,6 @@ $lastMatches = array_slice($allMatches, 0, 8);
Headshot Kills |
Assists |
";
-
foreach ($jsonData['included'] as $includedItem) {
if ($includedItem['type'] == "participant") {
$playerStats = $includedItem['attributes']['stats'];