tibiacom: Reduce queries count from highscores box

This commit is contained in:
slawkens
2026-04-24 16:32:53 +02:00
parent c16f95f8d2
commit e4a947cabb
2 changed files with 9 additions and 11 deletions

View File

@@ -1,15 +1,13 @@
<?php
$topPlayers = getTopPlayers(5);
foreach($topPlayers as &$player) {
$outfit_url = '';
if (setting('core.online_outfit')) {
$outfit_url = setting('core.outfit_images_url') . '?id=' . $player['looktype'] . (!empty
($player['lookaddons']) ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'];
$player['outfit'] = $outfit_url;
$topPlayers = Cache::remember('tibiacom_highscores_top_players', 10 * 60, function() {
$topPlayers = getTopPlayers(5);
foreach($topPlayers as &$player) {
$player['outfit'] = $player['outfit_url'];
$player['link'] = getPlayerLink($player['id'], false);
}
}
return $topPlayers;
});
$twig->display('highscores.html.twig', array(
'topPlayers' => $topPlayers

View File

@@ -44,7 +44,7 @@
<div id="Topbar" class="Themebox" style="background-image:url({{ template_path }}/images/themeboxes/highscores/highscores.png);">
<div class="top_level" style="background:url({{ template_path }}/images/themeboxes/bg_top.png)" align=" ">
{% for player in topPlayers %}
<div style="text-align:left"><a href="{{ getPlayerLink(player['name'], false) }} " class="topfont {% if player['online'] %}online{% else %}offline{% endif %}">
<div style="text-align:left"><a href="{{ player['link'] }} " class="topfont {% if player['online'] %}online{% else %}offline{% endif %}">
{% if setting('core.online_outfit') %}
<img style="position:absolute;margin-top:-45px;margin-left:-25px;" src="{{ player.outfit }}" alt="player outfit"/>
{% endif %}