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 ""; + + + echo "
matchTypedurationgameModemapNamecreatedAtid
"; echo ""; echo ""; - echo ""; echo ""; - echo ""; + echo ""; + echo ""; echo ""; echo ""; echo ""; - echo "
matchTypegameModedurationmapNamecreatedAtid
" . htmlspecialchars($matchinfo['matchType']) . "" . htmlspecialchars($matchinfo['duration']) . "" . htmlspecialchars($matchinfo['gameMode']) . "" . htmlspecialchars($matchinfo['mapName']) . "" . htmlspecialchars($matchinfo['duration']) . "" . htmlspecialchars(isset($mapNames[$matchinfo['mapName']]) ? $mapNames[$matchinfo['mapName']] : $matchinfo['mapName']) . "" . htmlspecialchars($matchinfo['createdAt']) . "" . htmlspecialchars($matchdata['id']) . "
"; + + + 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); + $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 ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo "
Player NameKillshumankillsTotal DamageRankDBNOs
" . htmlspecialchars($individualPlayerName) . "" . htmlspecialchars($jsonData_individual_player['stats']['humankills']) . "" . htmlspecialchars($jsonData_individual_player['stats']['kills']) . "" . htmlspecialchars($damageDealt) . "" . htmlspecialchars($rank) . "" . htmlspecialchars($DBNOs) . "
"; + echo ""; echo " @@ -78,7 +140,6 @@ $lastMatches = array_slice($allMatches, 0, 8); "; - foreach ($jsonData['included'] as $includedItem) { if ($includedItem['type'] == "participant") { $playerStats = $includedItem['attributes']['stats'];
Player NameHeadshot Kills Assists