From 9b591e7a3a167cf253ec9f542045a201b56f9ae5 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 21 Oct 2025 23:31:53 +0200 Subject: [PATCH] Items/Tooltips * fix itemId to scientific notation conversion, when itemId was joined by an enchantmentId (1234e56 => 1.234e53), breaking tooltip display. --- includes/components/frontend/tooltip.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/components/frontend/tooltip.class.php b/includes/components/frontend/tooltip.class.php index 78118900..0042c417 100644 --- a/includes/components/frontend/tooltip.class.php +++ b/includes/components/frontend/tooltip.class.php @@ -19,8 +19,11 @@ class Tooltip implements \JsonSerializable private ?string $buff = null; private ?array $buffspells = null; - public function __construct(private string $__powerTpl, private string $__subject, array $opts = []) + public function __construct(private string $__powerTpl, private int|string $__subject, array $opts = []) { + if (!is_int($this->__subject)) + $this->__subject = Util::toJSON($this->__subject, JSON_UNESCAPED_UNICODE); + foreach ($opts as $k => $v) { if (property_exists($this, $k)) @@ -54,7 +57,7 @@ class Tooltip implements \JsonSerializable public function __toString() : string { - return sprintf($this->__powerTpl, Util::toJSON($this->__subject, JSON_AOWOW_POWER), Lang::getLocale()->value, Util::toJSON($this, JSON_AOWOW_POWER))."\n"; + return sprintf($this->__powerTpl, $this->__subject, Lang::getLocale()->value, Util::toJSON($this, JSON_AOWOW_POWER))."\n"; } }