* (fix) TFS 1.x not showing promoted vocations in highscores

This commit is contained in:
slawkens1 2018-01-12 18:13:29 +01:00
parent cb8d8c4173
commit 9dc3d6d8d6

View File

@ -24,7 +24,15 @@ if($config['highscores_vocation_box'] && isset($vocation))
{ {
foreach($config['vocations'] as $id => $name) { foreach($config['vocations'] as $id => $name) {
if(strtolower($name) == $vocation) { if(strtolower($name) == $vocation) {
$add_sql = 'AND ' . $db->fieldName('vocation') . ' = ' . $db->quote($id); $add_vocs = array($id);
$i = $id + $config['vocations_amount'];
while(isset($config['vocations'][$i])) {
$add_vocs[] = $i;
$i += $config['vocations_amount'];
}
$add_sql = 'AND `vocation` IN (' . implode(', ', $add_vocs) . ')';
break; break;
} }
} }
@ -182,7 +190,7 @@ foreach($skills as $player) {
$players[] = $player['id']; $players[] = $player['id'];
} }
if($db->hasTable('players_online')) { if($db->hasTable('players_online') && count($players) > 0) {
$query = $db->query('SELECT `player_id`, 1 FROM `players_online` WHERE `player_id` IN (' . implode(', ', $players) . ')')->fetchAll(); $query = $db->query('SELECT `player_id`, 1 FROM `players_online` WHERE `player_id` IN (' . implode(', ', $players) . ')')->fetchAll();
foreach($query as $t) { foreach($query as $t) {
$is_online[$t['player_id']] = true; $is_online[$t['player_id']] = true;