From 0907f12d98f36eba529af64d00c547ad6f0fdcda Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 16:04:24 +0100 Subject: [PATCH 1/2] s --- matchinfo.php | 67 +++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index 85072c7..e0e0f4e 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -80,11 +80,19 @@ $lastMatches = array_slice($allMatches, 0, 8); echo ""; echo ""; + $directory = 'data/killstats/'; + $prefix = $matchdata['id']; + $files = glob($directory . $prefix . '*'); + + if (count($files) == 0) { + echo "No individual player data available (yet) check back in half hour."; + } else { - echo ""; - echo " + + echo "
"; + echo " @@ -93,40 +101,35 @@ $lastMatches = array_slice($allMatches, 0, 8); "; - $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']; - - 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; + // 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 Name Kills humankillsDBNOs
" . htmlspecialchars($individualPlayerName) . "" . htmlspecialchars($jsonData_individual_player['stats']['humankills']) . "" . htmlspecialchars($jsonData_individual_player['stats']['kills']) . "" . htmlspecialchars($damageDealt) . "" . htmlspecialchars($rank) . "" . htmlspecialchars($DBNOs) . "
"; + 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 " -- 2.49.1 From 5f90198320cddfa2674b075d7b065f089b5cfb9b Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 15 Nov 2023 16:06:03 +0100 Subject: [PATCH 2/2] himan kills reverse --- matchinfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matchinfo.php b/matchinfo.php index e0e0f4e..2cb2182 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -94,8 +94,8 @@ $lastMatches = array_slice($allMatches, 0, 8); echo "
Player Name
"; echo " - + -- 2.49.1
Player NameKills humankillsKills Total Damage Rank DBNOs