From 01c0d021b238ac04a0b72098a0caabe5c06f58ac Mon Sep 17 00:00:00 2001 From: slawkens1 Date: Wed, 3 Jan 2018 21:27:47 +0100 Subject: [PATCH] * added player status to tibiacom top 5 highscores box * fix when there are no changelogs or highscores yet --- system/functions.php | 14 +++++++++++--- system/pages/highscores.php | 6 ++++-- system/templates/changelog.html.twig | 2 +- templates/tibiacom/boxes/highscores.php | 11 ++++++++--- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/system/functions.php b/system/functions.php index a8df4ea5..b675ef56 100644 --- a/system/functions.php +++ b/system/functions.php @@ -973,9 +973,17 @@ function getTopPlayers($limit = 5) { $deleted = 'deleted'; if(fieldExist('deletion', 'players')) $deleted = 'deletion'; - - $players = $db->query('SELECT `id`, `name`, `level`, `experience` FROM `players` WHERE `group_id` < ' . $config['highscores_groups_hidden'] . ' AND `id` NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND `' . $deleted . '` = 0 AND `account_id` != 1 ORDER BY `experience` DESC LIMIT ' . (int)$limit)->fetchAll(); - + + $is_tfs10 = tableExist('players_online'); + $players = $db->query('SELECT `id`, `name`, `level`, `experience`' . ($is_tfs10 ? '' : ', `online`') . ' FROM `players` WHERE `group_id` < ' . $config['highscores_groups_hidden'] . ' AND `id` NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND `' . $deleted . '` = 0 AND `account_id` != 1 ORDER BY `experience` DESC LIMIT ' . (int)$limit)->fetchAll(); + + if($is_tfs10) { + foreach($players as &$player) { + $query = $db->query('SELECT `player_id` FROM `players_online` WHERE `player_id` = ' . $player['id']); + $player['online'] = ($query->rowCount() > 0 ? 1 : 0); + } + } + $i = 0; foreach($players as &$player) { $player['rank'] = ++$i; diff --git a/system/pages/highscores.php b/system/pages/highscores.php index 57f78029..74d612fc 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -228,8 +228,10 @@ echo ' $show_link_to_next_page = true; } -if(!$i) - echo 'No records yet.'; +if(!$i) { + $extra = ($config['highscores_outfit'] ? 1 : 0); + echo 'No records yet.'; +} ?> diff --git a/system/templates/changelog.html.twig b/system/templates/changelog.html.twig index c9e266b8..cc8a516f 100644 --- a/system/templates/changelog.html.twig +++ b/system/templates/changelog.html.twig @@ -23,7 +23,7 @@ {% endfor %} {% else %} - There are no change logs for the moment. + There are no changelogs for the moment. {% endif %} diff --git a/templates/tibiacom/boxes/highscores.php b/templates/tibiacom/boxes/highscores.php index f2e3203b..1145ad5b 100644 --- a/templates/tibiacom/boxes/highscores.php +++ b/templates/tibiacom/boxes/highscores.php @@ -26,12 +26,17 @@ #Topbar a { text-decoration: none; - cursor: auto; + } + .online { + color: #008000; + } + + .offline { + color: #FF0000; } a.topfont { font-family: Verdana, Arial, Helvetica; font-size: 11px; - color: #FF0000; text-decoration: none } a:hover.topfont { @@ -47,7 +52,7 @@ + echo '
    '.$player['rank'].' - '.$player['name'].'
      Level: ('.$player['level'].')