* added player status to tibiacom top 5 highscores box

* fix when there are no changelogs or highscores yet
This commit is contained in:
slawkens1
2018-01-03 21:27:47 +01:00
parent 3e49ef42a2
commit 01c0d021b2
4 changed files with 24 additions and 9 deletions

View File

@@ -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;

View File

@@ -228,8 +228,10 @@ echo '
$show_link_to_next_page = true;
}
if(!$i)
echo '<tr bgcolor="' . $config['darkborder'] . '"><td colspan="' . ($skill == POT::SKILL__LEVEL ? 5 : 4) . '">No records yet.</td></tr>';
if(!$i) {
$extra = ($config['highscores_outfit'] ? 1 : 0);
echo '<tr bgcolor="' . $config['darkborder'] . '"><td colspan="' . ($skill == POT::SKILL__LEVEL ? 5 + $extra : 4 + $extra) . '">No records yet.</td></tr>';
}
?>
</table>

View File

@@ -23,7 +23,7 @@
{% endfor %}
{% else %}
<tr>
<td bgcolor="{{ config.lightborder }}">There are no change logs for the moment.</td>
<td colspan="4" bgcolor="{{ config.darkborder }}">There are no changelogs for the moment.</td>
</tr>
{% endif %}