Skip to content

Commit

Permalink
Item/Tooltip
Browse files Browse the repository at this point in the history
 * display hidden/cosmetic spells for staff
  • Loading branch information
Sarjuuk committed Jun 10, 2022
1 parent 47da18b commit df1ba84
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions includes/types/item.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -970,28 +970,31 @@ public function renderTooltip($interactive = false, $subOf = 0, $enhance = [])

if ($itemSpellsAndTrigger)
{
$cooldown = '';

$itemSpells = new SpellList(array(['s.id', array_keys($itemSpellsAndTrigger)]));
foreach ($itemSpells->iterate() as $__)
if ($parsed = $itemSpells->parseText('description', $_reqLvl > 1 ? $_reqLvl : MAX_LEVEL, false, $causesScaling)[0])
foreach ($itemSpells->iterate() as $sId => $__)
{
$parsed = $itemSpells->parseText('description', $_reqLvl > 1 ? $_reqLvl : MAX_LEVEL, false, $causesScaling)[0];
if (!$parsed && User::isInGroup(U_GROUP_EMPLOYEE))
$parsed = '<span style="opacity:.75">&lt;'.$itemSpells->getField('name', true, true).'&gt;</span>';
else if (!$parsed)
continue;

if ($interactive)
{
if ($interactive)
{
$link = '<a href="?spell='.$itemSpells->id.'">%s</a>';
$parsed = preg_replace_callback('/([^;]*)(&nbsp;<small>.*?<\/small>)([^&]*)/i', function($m) use($link) {
$m[1] = $m[1] ? sprintf($link, $m[1]) : '';
$m[3] = $m[3] ? sprintf($link, $m[3]) : '';
return $m[1].$m[2].$m[3];
}, $parsed, -1, $nMatches
);

if (!$nMatches)
$parsed = sprintf($link, $parsed);
}
$link = '<a href="?spell='.$itemSpells->id.'">%s</a>';
$parsed = preg_replace_callback('/([^;]*)(&nbsp;<small>.*?<\/small>)([^&]*)/i', function($m) use($link) {
$m[1] = $m[1] ? sprintf($link, $m[1]) : '';
$m[3] = $m[3] ? sprintf($link, $m[3]) : '';
return $m[1].$m[2].$m[3];
}, $parsed, -1, $nMatches
);

$green[] = Lang::item('trigger', $itemSpellsAndTrigger[$itemSpells->id][0]).$parsed.$itemSpellsAndTrigger[$itemSpells->id][1];
if (!$nMatches)
$parsed = sprintf($link, $parsed);
}

$green[] = Lang::item('trigger', $itemSpellsAndTrigger[$itemSpells->id][0]).$parsed.$itemSpellsAndTrigger[$itemSpells->id][1];
}
}
}

Expand Down

0 comments on commit df1ba84

Please sign in to comment.