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';
|
$columns[] = 'lookaddons';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($db->hasColumn('players', 'online')) {
|
|
||||||
$columns[] = 'online';
|
|
||||||
}
|
|
||||||
|
|
||||||
return Player::query()
|
return Player::query()
|
||||||
->select($columns)
|
->select($columns)
|
||||||
->withOnlineStatus()
|
->withOnlineStatus()
|
||||||
|
@ -234,10 +234,6 @@ foreach($highscores as $id => &$player)
|
|||||||
$player['experience'] = number_format($player['experience']);
|
$player['experience'] = number_format($player['experience']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$settingHighscoresVocation) {
|
|
||||||
unset($player['vocation']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$player['link'] = getPlayerLink($player['name'], false);
|
$player['link'] = getPlayerLink($player['name'], false);
|
||||||
$player['flag'] = getFlagImage($player['country']);
|
$player['flag'] = getFlagImage($player['country']);
|
||||||
if($settingHighscoresOutfit) {
|
if($settingHighscoresOutfit) {
|
||||||
|
@ -49,8 +49,8 @@ class Player extends Model {
|
|||||||
public function getVocationNameAttribute()
|
public function getVocationNameAttribute()
|
||||||
{
|
{
|
||||||
$vocation = $this->vocation;
|
$vocation = $this->vocation;
|
||||||
if (isset($this->promotion)) {
|
if (isset($this->promotion) && $this->promotion > 0) {
|
||||||
$vocation *= $this->promotion;
|
$vocation += ($this->promotion * setting('core.vocations_amount'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return config('vocations')[$vocation] ?? 'Unknown';
|
return config('vocations')[$vocation] ?? 'Unknown';
|
||||||
@ -80,11 +80,17 @@ class Player extends Model {
|
|||||||
$query->where($column, 0);
|
$query->where($column, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeWithOnlineStatus($query) {
|
public function scopeWithOnlineStatus($query)
|
||||||
|
{
|
||||||
global $db;
|
global $db;
|
||||||
$query->when($db->hasTable('players_online'), function ($query) {
|
if ($db->hasColumn('players', 'online')) {
|
||||||
$query->with('onlineTable');
|
$query->addSelect('online');
|
||||||
});
|
}
|
||||||
|
else {
|
||||||
|
$query->when($db->hasTable('players_online'), function ($query) {
|
||||||
|
$query->with('onlineTable');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOutfitUrlAttribute() {
|
public function getOutfitUrlAttribute() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user