Fix highscores error

This commit is contained in:
slawkens 2023-11-09 20:32:20 +01:00
parent 9d119b6279
commit a04fbde607

View File

@ -135,6 +135,7 @@ if($settingHighscoresOutfit) {
$configHighscoresPerPage = setting('core.highscores_per_page');
$limit = $configHighscoresPerPage + 1;
$highscores = [];
$needReCache = true;
$cacheKey = 'highscores_' . $skill . '_' . $vocation . '_' . $page . '_' . $configHighscoresPerPage;
@ -158,7 +159,7 @@ $query->join('accounts', 'accounts.id', '=', 'players.account_id')
->selectRaw('accounts.country, players.id, players.name, players.account_id, players.level, players.vocation' . $outfit . $promotion)
->orderByDesc('value');
if (!isset($highscores) || empty($highscores)) {
if (empty($highscores)) {
if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
$skill_ids = array(
@ -201,7 +202,6 @@ if (!isset($highscores) || empty($highscores)) {
$list = 'experience';
}
}
}
$highscores = $query->get()->map(function($row) {
$tmp = $row->toArray();
@ -211,6 +211,7 @@ $highscores = $query->get()->map(function($row) {
return $tmp;
})->toArray();
}
if ($cache->enabled() && $needReCache) {
$cache->set($cacheKey, serialize($highscores), setting('core.highscores_cache_ttl') * 60);