diff --git a/phpstan.neon b/phpstan.neon index 68e1aa6a..05778a86 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -31,8 +31,6 @@ parameters: - '#Call to an undefined method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_]+\(\)#' - '#Call to an undefined static method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_]+\(\)#' # system/pages/highscores.php - - '#Access to an undefined property Illuminate\\Database\\Eloquent\\Model::\$online_status#' - - '#Access to an undefined property Illuminate\\Database\\Eloquent\\Model::\$vocation_name#' - message: '#Variable \$tmp in empty\(\) always exists and is always falsy#' path: templates\kathrine\javascript.php diff --git a/system/pages/highscores.php b/system/pages/highscores.php index 0e5fcf2f..4774c84b 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -207,10 +207,14 @@ if (empty($highscores)) { } $highscores = $query->get()->map(function($row) { + /** + * @var Player $row + */ $tmp = $row->toArray(); $tmp['online'] = $row->online_status; $tmp['vocation'] = $row->vocation_name; - $tmp['outfit_url'] = $row->outfit_url; // @phpstan-ignore-line + $tmp['outfit_url'] = $row->outfit_url; + $tmp['link'] = getPlayerLink($row->name, false); unset($tmp['online_table']); return $tmp; @@ -244,7 +248,6 @@ foreach($highscores as $id => &$player) $player['experience'] = number_format($player['experience']); } - $player['link'] = getPlayerLink($player['name'], false); $player['flag'] = getFlagImage($player['country']); $player['outfit'] = ''; diff --git a/system/src/Models/Player.php b/system/src/Models/Player.php index 949b07a7..9aacba15 100644 --- a/system/src/Models/Player.php +++ b/system/src/Models/Player.php @@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasOne; /** + * @property string $name * @property int $level * @property int $vocation * @property int $online @@ -14,6 +15,9 @@ use Illuminate\Database\Eloquent\Relations\HasOne; * @property int $looklegs * @property int $lookfeet * @property int $lookaddons + * @property int $promotion + * @property bool $online_status + * @property string $vocation_name * @property string $outfit_url * @property hasOne $onlineTable */ diff --git a/system/src/Plugins.php b/system/src/Plugins.php index 9484ea0d..8e4b0a39 100644 --- a/system/src/Plugins.php +++ b/system/src/Plugins.php @@ -890,7 +890,11 @@ class Plugins { global $hooks; foreach($plugin_info['hooks'] ?? [] as $name => $info) { - $hooks->unregister($name, $info['type'], $info['file']); + if (str_contains($info['type'], 'HOOK_')) { + $info['type'] = str_replace('HOOK_', '', $info['type']); + } + + $hooks->unregister($name, 'HOOK_' . $info['type'], $info['file']); } clearCache(); diff --git a/templates/tibiacom/boxes/highscores.php b/templates/tibiacom/boxes/highscores.php index a2f371fa..4b347da9 100644 --- a/templates/tibiacom/boxes/highscores.php +++ b/templates/tibiacom/boxes/highscores.php @@ -1,15 +1,13 @@ display('highscores.html.twig', array( 'topPlayers' => $topPlayers diff --git a/templates/tibiacom/boxes/templates/highscores.html.twig b/templates/tibiacom/boxes/templates/highscores.html.twig index c1f8f1d6..bc20a135 100644 --- a/templates/tibiacom/boxes/templates/highscores.html.twig +++ b/templates/tibiacom/boxes/templates/highscores.html.twig @@ -44,7 +44,7 @@
{% for player in topPlayers %} -
+
{% if setting('core.online_outfit') %} player outfit {% endif %}