From e275f2748cbbb134f2d093ba11e72b0c53d0c44c Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 14 Nov 2023 20:57:45 +0100 Subject: [PATCH] stats --- matchinfo.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index b49d7de..587bcbc 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -17,20 +17,20 @@ if (isset($_GET['matchid'])) { echo "Player NameKillsDamage DealtTime SurvivedRank"; // Loop through the JSON data to extract player stats - foreach ($jsonData['data']['relationships']['rosters']['data'] as $roster) { - foreach ($jsonData['included'] as $includedItem) { - if ($includedItem['type'] === 'participant' && in_array(['type' => 'participant', 'id' => $includedItem['id']], $roster['relationships']['participants']['data'])) { - $playerStats = $includedItem['attributes']['stats']; - echo ""; - echo "" . htmlspecialchars($playerStats['name']) . ""; - echo "" . htmlspecialchars($playerStats['kills']) . ""; - echo "" . htmlspecialchars($playerStats['damageDealt']) . ""; - echo "" . htmlspecialchars($playerStats['timeSurvived']) . ""; - echo "" . htmlspecialchars($playerStats['winPlace']) . ""; - echo ""; - } - } + + foreach ($jsonData['included'] as $includedItem) { + + $playerStats = $includedItem['attributes']['stats']; + echo ""; + echo "" . htmlspecialchars($playerStats['name']) . ""; + echo "" . htmlspecialchars($playerStats['kills']) . ""; + echo "" . htmlspecialchars($playerStats['damageDealt']) . ""; + echo "" . htmlspecialchars($playerStats['timeSurvived']) . ""; + echo "" . htmlspecialchars($playerStats['winPlace']) . ""; + echo ""; + } + echo ""; } else { echo "JSON file not found for the given match ID."; @@ -38,4 +38,4 @@ if (isset($_GET['matchid'])) { } else { echo "No match ID provided."; } -?> +?> \ No newline at end of file