mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Fix online status + vocation for TFS 0.x
This commit is contained in:
parent
d2a4748a59
commit
ea51ad27c3
@ -1107,10 +1107,6 @@ function getTopPlayers($limit = 5, $skill = 'level') {
|
||||
$columns[] = 'lookaddons';
|
||||
}
|
||||
|
||||
if ($db->hasColumn('players', 'online')) {
|
||||
$columns[] = 'online';
|
||||
}
|
||||
|
||||
return Player::query()
|
||||
->select($columns)
|
||||
->withOnlineStatus()
|
||||
|
@ -234,10 +234,6 @@ foreach($highscores as $id => &$player)
|
||||
$player['experience'] = number_format($player['experience']);
|
||||
}
|
||||
|
||||
if(!$settingHighscoresVocation) {
|
||||
unset($player['vocation']);
|
||||
}
|
||||
|
||||
$player['link'] = getPlayerLink($player['name'], false);
|
||||
$player['flag'] = getFlagImage($player['country']);
|
||||
if($settingHighscoresOutfit) {
|
||||
|
@ -49,8 +49,8 @@ class Player extends Model {
|
||||
public function getVocationNameAttribute()
|
||||
{
|
||||
$vocation = $this->vocation;
|
||||
if (isset($this->promotion)) {
|
||||
$vocation *= $this->promotion;
|
||||
if (isset($this->promotion) && $this->promotion > 0) {
|
||||
$vocation += ($this->promotion * setting('core.vocations_amount'));
|
||||
}
|
||||
|
||||
return config('vocations')[$vocation] ?? 'Unknown';
|
||||
@ -80,11 +80,17 @@ class Player extends Model {
|
||||
$query->where($column, 0);
|
||||
}
|
||||
|
||||
public function scopeWithOnlineStatus($query) {
|
||||
public function scopeWithOnlineStatus($query)
|
||||
{
|
||||
global $db;
|
||||
$query->when($db->hasTable('players_online'), function ($query) {
|
||||
$query->with('onlineTable');
|
||||
});
|
||||
if ($db->hasColumn('players', 'online')) {
|
||||
$query->addSelect('online');
|
||||
}
|
||||
else {
|
||||
$query->when($db->hasTable('players_online'), function ($query) {
|
||||
$query->with('onlineTable');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function getOutfitUrlAttribute() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user