From 57ad861da765a7e6c8e99c2579786b3a2b6d9398 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Thu, 22 Aug 2024 01:40:03 +0200 Subject: [PATCH] Items/Arena * changed logic to not display required arena rating in tooltip or infobox if there are sources that don't require it. * also, should there be a difference in sources, display lowest required rating, not not highest. --- includes/types/item.class.php | 12 +++++++++--- pages/item.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/includes/types/item.class.php b/includes/types/item.class.php index fb70a59d..37bc21f2 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -263,8 +263,14 @@ class ItemList extends BaseType } // reqRating ins't really a cost .. so pass it by ref instead of return - // use highest total value - if (isset($data[$npcId]) && $costs['reqRating'] && (!$reqRating || $reqRating[0] < $costs['reqRating'])) + // data was invalid and deleted or some source doesn't require arena rating + if (!isset($data[$npcId]) || ($reqRating && !$reqRating[0])) + continue; + + // use lowest total value + if (!$costs['reqRating']) + $reqRating = [0, 2]; + else if ($costs['reqRating'] && (!$reqRating || $reqRating[0] > $costs['reqRating'])) $reqRating = [$costs['reqRating'], $costs['reqBracket']]; } } @@ -914,7 +920,7 @@ class ItemList extends BaseType $x .= sprintf(Lang::item('reqMinLevel'), $_reqLvl).'
'; // required arena team rating / personal rating / todo (low): sort out what kind of rating - if (!empty($this->getExtendedCost([], $reqRating)[$this->id]) && $reqRating) + if (!empty($this->getExtendedCost([], $reqRating)[$this->id]) && $reqRating && $reqRating[0]) $x .= sprintf(Lang::item('reqRating', $reqRating[1]), $reqRating[0]).'
'; // item level diff --git a/pages/item.php b/pages/item.php index 3f48d54e..89fc4af6 100644 --- a/pages/item.php +++ b/pages/item.php @@ -293,7 +293,7 @@ class ItemPage extends genericPage else if (count($costList) > 1) $infobox[] = Lang::item('cost').$each.Lang::main('colon').'[ul][li]'.implode('[/li][li]', $costList).'[/li][/ul]'; - if ($_reqRating) + if ($_reqRating && $_reqRating[0]) { $text = str_replace('
', ' ', Lang::item('reqRating', $_reqRating[1], [$_reqRating[0]])); $infobox[] = Lang::breakTextClean($text, 30, LANG::FMT_MARKUP);