diff --git a/endpoints/quest/quest.php b/endpoints/quest/quest.php index 9d3809e4..f253e85a 100644 --- a/endpoints/quest/quest.php +++ b/endpoints/quest/quest.php @@ -335,11 +335,11 @@ class QuestBaseResponse extends TemplateResponse implements ICache if (!$olItemData->getEntry($itemId)) { - $this->objectiveList[] = [0, new IconElement(0, 0, Util::ucFirst(Lang::game('item')).' #'.$itemId, $qty > 1 ? $qty : '', size: IconElement::SIZE_SMALL, extraText: $provided ? Lang::quest('provided') : null)]; + $this->objectiveList[] = new IconElement(0, 0, Util::ucFirst(Lang::game('item')).' #'.$itemId, $qty > 1 ? $qty : '', size: IconElement::SIZE_SMALL, extraText: $provided ? Lang::quest('provided') : null); continue; } - $this->objectiveList[] = [0, new IconElement( + $this->objectiveList[] = new IconElement( Type::ITEM, $itemId, Lang::unescapeUISequences($olItemData->json[$itemId]['name'], Lang::FMT_HTML), @@ -348,7 +348,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache size: IconElement::SIZE_SMALL, element: 'iconlist-icon', extraText: $provided ? Lang::quest('provided') : null - )]; + ); } // if providd item is not required by quest, list it below other requirements @@ -414,17 +414,17 @@ class QuestBaseResponse extends TemplateResponse implements ICache array_slice($proxies, ceil(count($proxies) / 2), null, true) ); - $this->objectiveList[] = [2, array( + $this->objectiveList[] = array( 'id' => $i, 'text' => ($altText ?: Util::localizedString($olNPCData->getEntry($i), 'name')) . ((($_specialFlags & QUEST_FLAG_SPECIAL_SPELLCAST) || $altText) ? '' : ' '.Lang::achievement('slain')), 'qty' => $qty > 1 ? $qty : 0, 'proxy' => array_filter($proxies) - )]; + ); } else if (!$olNPCData->getEntry($i)) - $this->objectiveList[] = [0, new IconElement(0, 0, Util::ucFirst(Lang::game('npc')).' #'.$i, $qty > 1 ? $qty : '')]; + $this->objectiveList[] = new IconElement(0, 0, Util::ucFirst(Lang::game('npc')).' #'.$i, $qty > 1 ? $qty : ''); else - $this->objectiveList[] = [0, new IconElement( + $this->objectiveList[] = new IconElement( Type::NPC, $i, $altText ?: Util::localizedString($olNPCData->getEntry($i), 'name'), @@ -432,7 +432,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache size: IconElement::SIZE_SMALL, element: 'iconlist-icon', extraText: (($_specialFlags & QUEST_FLAG_SPECIAL_SPELLCAST) || $altText) ? '' : Lang::achievement('slain'), - )]; + ); } } @@ -448,16 +448,16 @@ class QuestBaseResponse extends TemplateResponse implements ICache continue; if (!$olGOData->getEntry($i)) - $this->objectiveList[] = [0, new IconElement(0, 0, Util::ucFirst(Lang::game('object')).' #'.$i, $qty > 1 ? $qty : '', size: IconElement::SIZE_SMALL)]; + $this->objectiveList[] = new IconElement(0, 0, Util::ucFirst(Lang::game('object')).' #'.$i, $qty > 1 ? $qty : '', size: IconElement::SIZE_SMALL); else - $this->objectiveList[] = [0, new IconElement( + $this->objectiveList[] = new IconElement( Type::OBJECT, $i, $altText ?: Lang::unescapeUISequences(Util::localizedString($olGOData->getEntry($i), 'name'), Lang::FMT_HTML), $qty > 1 ? $qty : '', size: IconElement::SIZE_SMALL, element: 'iconlist-icon', - )]; + ); } } @@ -482,14 +482,14 @@ class QuestBaseResponse extends TemplateResponse implements ICache if (!$i || !in_array($i, $olFactionsData->getFoundIDs())) continue; - $this->objectiveList[] = [0, new IconElement( + $this->objectiveList[] = new IconElement( Type::FACTION, $i, Util::localizedString($olFactionsData->getEntry($i), 'name'), size: IconElement::SIZE_SMALL, element: 'iconlist-icon', extraText: sprintf(Util::$dfnString, $val.' '.Lang::achievement('points'), '('.Lang::getReputationLevelForPoints($val).')') - )]; + ); } } @@ -497,16 +497,16 @@ class QuestBaseResponse extends TemplateResponse implements ICache if ($_ = $this->subject->getField('sourceSpellId')) { $this->extendGlobalIds(Type::SPELL, $_); - $this->objectiveList[] = [0, new IconElement(Type::SPELL, $_, SpellList::getName($_), extraText: Lang::quest('provided'), element: 'iconlist-icon', size: IconElement::SIZE_SMALL)]; + $this->objectiveList[] = new IconElement(Type::SPELL, $_, SpellList::getName($_), extraText: Lang::quest('provided'), element: 'iconlist-icon', size: IconElement::SIZE_SMALL); } // required money if ($this->subject->getField('rewardOrReqMoney') < 0) - $this->objectiveList[] = [1, Lang::quest('reqMoney', [Util::formatMoney(abs($this->subject->getField('rewardOrReqMoney')))])]; + $this->objectiveList[] = Lang::quest('reqMoney', [Util::formatMoney(abs($this->subject->getField('rewardOrReqMoney')))]); // required pvp kills if ($_ = $this->subject->getField('reqPlayerKills')) - $this->objectiveList[] = [1, Lang::quest('playerSlain', [$_])]; + $this->objectiveList[] = Lang::quest('playerSlain', [$_]); /**********/ diff --git a/template/pages/quest.tpl.php b/template/pages/quest.tpl.php index 95c1a2d7..e8d65178 100644 --- a/template/pages/quest.tpl.php +++ b/template/pages/quest.tpl.php @@ -43,26 +43,23 @@ if ($this->end || $this->objectiveList): ?> objectiveList as [$type, $data]): - switch ($type): - case 1: // just text line - echo ' \n"; - break; - case 2: // proxy npc data - ['id' => $id, 'text' => $text, 'qty' => $qty, 'proxy' => $proxies] = $data; - echo ' \n"; + elseif (is_array($objective)): // proxy npc data + ['id' => $id, 'text' => $text, 'qty' => $qty, 'proxy' => $proxies] = $objective; + echo ' \n"; + elseif (is_object($objective)): // has icon set (spell / item / ...) or unordered linked list + echo $objective?->renderContainer(20, $iconOffset, true); + endif; endforeach; if ($this->end): @@ -77,8 +74,8 @@ if ($this->end || $this->objectiveList):

 

'.$data."

 

'.$text.''.($qty ? ' ('.$qty.')' : '').'
\n"; - foreach ($proxies as $block): - echo "
\n"; - foreach ($block as $pId => $pName): - echo ' \n"; - endforeach; - echo "
  •  
'.$pName."
\n"; + foreach ($this->objectiveList as $objective): + if (is_string($objective)): // just text line + echo '

 

'.$objective."

 

'.$text.''.($qty ? ' ('.$qty.')' : '').'
\n"; + foreach ($proxies as $block): + echo "
\n"; + foreach ($block as $pId => $pName): + echo ' \n"; endforeach; - echo " \n"; - break; - default: // has icon set (spell / item / ...) or unordered linked list - echo $data->renderContainer(20, $iconOffset, true); - endswitch; + echo "
  •  
'.$pName."
\n"; + endforeach; + echo "