From eb50b88b6d7ea6ff71d86a9344ee67671151f69a Mon Sep 17 00:00:00 2001 From: Plancke Date: Wed, 8 May 2019 06:18:35 +0200 Subject: [PATCH] dont count legacy achievements --- src/responses/player/Player.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/responses/player/Player.php b/src/responses/player/Player.php index 101de84..8208008 100644 --- a/src/responses/player/Player.php +++ b/src/responses/player/Player.php @@ -49,16 +49,13 @@ public function getAchievementPoints($force_update = false) { $oneTime = $this->getArray('achievementsOneTime'); $this->getHypixelPHP()->getLogger()->log('Starting OneTime Achievements'); foreach ($oneTime as $dbName) { - if (!is_string($dbName)) { - continue; - } + if (!is_string($dbName)) continue; $game = strtolower(substr($dbName, 0, strpos($dbName, "_"))); $dbName = strtoupper(substr($dbName, strpos($dbName, "_") + 1)); - if (!in_array($game, $games)) { - continue; - } + if (!in_array($game, $games)) continue; $this->getHypixelPHP()->getLogger()->log('Achievement: ' . strtoupper(substr($dbName, strpos($dbName, "_")))); if (in_array($dbName, array_keys($achievements[$game]['one_time']))) { + if (array_key_exists("legacy", $achievements[$game]['one_time'][$dbName]) && $achievements[$game]['one_time'][$dbName]["legacy"]) continue; $this->getHypixelPHP()->getLogger()->log('Achievement: ' . $dbName . ' - ' . $achievements[$game]['one_time'][$dbName]['points']); $total += $achievements[$game]['one_time'][$dbName]['points']; } @@ -68,11 +65,10 @@ public function getAchievementPoints($force_update = false) { foreach ($tiered as $dbName => $value) { $game = strtolower(substr($dbName, 0, strpos($dbName, "_"))); $dbName = strtoupper(substr($dbName, strpos($dbName, "_") + 1)); - if (!in_array($game, $games)) { - continue; - } + if (!in_array($game, $games)) continue; $this->getHypixelPHP()->getLogger()->log('Achievement: ' . $dbName); if (in_array($dbName, array_keys($achievements[$game]['tiered']))) { + if (array_key_exists("legacy", $achievements[$game]['tiered'][$dbName]) && $achievements[$game]['tiered'][$dbName]["legacy"]) continue; $tierTotal = 0; foreach ($achievements[$game]['tiered'][$dbName]['tiers'] as $tier) { if ($value >= $tier['amount']) {