Item/Tooltip

* display hidden/cosmetic spells for staff
This commit is contained in:
Sarjuuk
2022-06-10 16:58:18 +02:00
parent 47da18b717
commit df1ba841c5

View File

@@ -970,28 +970,31 @@ class ItemList extends BaseType
if ($itemSpellsAndTrigger) if ($itemSpellsAndTrigger)
{ {
$cooldown = '';
$itemSpells = new SpellList(array(['s.id', array_keys($itemSpellsAndTrigger)])); $itemSpells = new SpellList(array(['s.id', array_keys($itemSpellsAndTrigger)]));
foreach ($itemSpells->iterate() as $__) foreach ($itemSpells->iterate() as $sId => $__)
if ($parsed = $itemSpells->parseText('description', $_reqLvl > 1 ? $_reqLvl : MAX_LEVEL, false, $causesScaling)[0]) {
$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) {
$link = '<a href="?spell='.$itemSpells->id.'">%s</a>'; $m[1] = $m[1] ? sprintf($link, $m[1]) : '';
$parsed = preg_replace_callback('/([^;]*)(&nbsp;<small>.*?<\/small>)([^&]*)/i', function($m) use($link) { $m[3] = $m[3] ? sprintf($link, $m[3]) : '';
$m[1] = $m[1] ? sprintf($link, $m[1]) : ''; return $m[1].$m[2].$m[3];
$m[3] = $m[3] ? sprintf($link, $m[3]) : ''; }, $parsed, -1, $nMatches
return $m[1].$m[2].$m[3]; );
}, $parsed, -1, $nMatches
);
if (!$nMatches) if (!$nMatches)
$parsed = sprintf($link, $parsed); $parsed = sprintf($link, $parsed);
}
$green[] = Lang::item('trigger', $itemSpellsAndTrigger[$itemSpells->id][0]).$parsed.$itemSpellsAndTrigger[$itemSpells->id][1];
} }
$green[] = Lang::item('trigger', $itemSpellsAndTrigger[$itemSpells->id][0]).$parsed.$itemSpellsAndTrigger[$itemSpells->id][1];
}
} }
} }