Add player->outfit_url attribute

This commit is contained in:
slawkens 2025-01-09 22:41:34 +01:00
parent c769962e39
commit 3b5be1a8db
3 changed files with 7 additions and 1 deletions

View File

@ -1125,6 +1125,7 @@ function getTopPlayers($limit = 5, $skill = 'level') {
$row = $e->toArray(); $row = $e->toArray();
$row['online'] = $e->online_status; $row['online'] = $e->online_status;
$row['rank'] = $i + 1; $row['rank'] = $i + 1;
$row['outfit_url'] = $e->outfit_url;
unset($row['online_table']); unset($row['online_table']);

View File

@ -207,6 +207,7 @@ if (empty($highscores)) {
$tmp = $row->toArray(); $tmp = $row->toArray();
$tmp['online'] = $row->online_status; $tmp['online'] = $row->online_status;
$tmp['vocation'] = $row->vocation_name; $tmp['vocation'] = $row->vocation_name;
$tmp['outfit_url'] = $row->outfit_url;
unset($tmp['online_table']); unset($tmp['online_table']);
return $tmp; return $tmp;
@ -240,7 +241,7 @@ foreach($highscores as $id => &$player)
$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) {
$player['outfit'] = '<img style="position:absolute;margin-top:' . (in_array($player['looktype'], setting('core.outfit_images_wrong_looktypes')) ? '-15px;margin-left:5px' : '-45px;margin-left:-25px') . ';" src="' . setting('core.outfit_images_url') . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . '" alt="" />'; $player['outfit'] = '<img style="position:absolute;margin-top:' . (in_array($player['looktype'], setting('core.outfit_images_wrong_looktypes')) ? '-15px;margin-left:5px' : '-45px;margin-left:-25px') . ';" src="' . $player['outfit_url'] . '" alt="" />';
} }
$player['rank'] = $offset + $i; $player['rank'] = $offset + $i;
} }

View File

@ -80,6 +80,10 @@ class Player extends Model {
}); });
} }
public function getOutfitUrlAttribute() {
return setting('core.outfit_images_url') . '?id=' . $this->looktype . (!empty($this->lookaddons) ? '&addons=' . $this->lookaddons : '') . '&head=' . $this->lookhead . '&body=' . $this->lookbody . '&legs=' . $this->looklegs . '&feet=' . $this->lookfeet;
}
public function getOnlineStatusAttribute() public function getOnlineStatusAttribute()
{ {
global $db; global $db;