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.
This commit is contained in:
Sarjuuk
2024-08-22 01:40:03 +02:00
parent d2e109d818
commit 57ad861da7
2 changed files with 10 additions and 4 deletions

View File

@@ -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).'<br />';
// 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]).'<br />';
// item level

View File

@@ -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('<br />', ' ', Lang::item('reqRating', $_reqRating[1], [$_reqRating[0]]));
$infobox[] = Lang::breakTextClean($text, 30, LANG::FMT_MARKUP);