From 08318d286c759a2fb8a78e251876d0ba6e89c4a2 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Thu, 29 Jan 2026 21:30:57 +0100 Subject: [PATCH] Objects/SpellFocus * link from spellfocus in objects and spell infobox to objects filter if able * closes #491 --- endpoints/object/object.php | 10 +++++++++- endpoints/spell/spell.php | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/endpoints/object/object.php b/endpoints/object/object.php index 5892e005..9480de5b 100644 --- a/endpoints/object/object.php +++ b/endpoints/object/object.php @@ -175,8 +175,16 @@ class ObjectBaseResponse extends TemplateResponse implements ICache // SpellFocus if ($_ = $this->subject->getField('spellFocusId')) + { if ($sfo = DB::Aowow()->selectRow('SELECT * FROM ?_spellfocusobject WHERE `id` = ?d', $_)) - $infobox[] = '[tooltip name=focus]'.Lang::gameObject('focusDesc').'[/tooltip][span class=tip tooltip=focus]'.Lang::gameObject('focus').Lang::main('colon').Util::localizedString($sfo, 'name').'[/span]'; + { + $n = Util::localizedString($sfo, 'name'); + if (!is_null(GameObjectListFilter::getCriteriaIndex(50, $_))) + $n = '[url=?objects&filter=cr=50;crs='.$_.';crv=0]'.$n.'[/url]'; + + $infobox[] = '[tooltip name=focus]'.Lang::gameObject('focusDesc').'[/tooltip][span class=tip tooltip=focus]'.Lang::gameObject('focus').Lang::main('colon').$n.'[/span]'; + } + } // lootinfo: [min, max, restock] if (([$min, $max, $restock] = $this->subject->getField('lootStack')) && $min) diff --git a/endpoints/spell/spell.php b/endpoints/spell/spell.php index de96a363..6f0cfcd9 100644 --- a/endpoints/spell/spell.php +++ b/endpoints/spell/spell.php @@ -2403,7 +2403,9 @@ class SpellBaseResponse extends TemplateResponse implements ICache if ($sfObj = DB::Aowow()->selectRow('SELECT * FROM ?_spellfocusobject WHERE `id` = ?d', $_)) { $n = Util::localizedString($sfObj, 'name'); - if ($objId = DB::Aowow()->selectCell('SELECT `id` FROM ?_objects WHERE `spellFocusId` = ?d', $_)) + if (!is_null(GameObjectListFilter::getCriteriaIndex(50, $_))) + $n = '[url=?objects&filter=cr=50;crs='.$_.';crv=0]'.$n.'[/url]'; + else if ($objId = DB::Aowow()->selectCell('SELECT `id` FROM ?_objects WHERE `spellFocusId` = ?d', $_)) $n = '[url=?object='.$objId.']'.$n.'[/url]'; $infobox[] = Lang::game('requires2').' '.$n;