Items/Tooltips

* fix scaling string in item tooltips for scaling & non-interactive tooltips
This commit is contained in:
Sarjuuk
2025-02-26 01:22:11 +01:00
parent 9abe9b0d56
commit 6660125154
2 changed files with 24 additions and 24 deletions

View File

@@ -995,11 +995,11 @@ class ItemList extends BaseType
else if (!$parsed)
continue;
if ($interactive)
{
if ($scaling)
$causesScaling = true;
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]) : '';
@@ -1204,24 +1204,24 @@ class ItemList extends BaseType
// tooltip scaling
if (!isset($xCraft))
{
$link = [$subOf ? $subOf : $this->id, 1]; // itemId, scaleMinLevel
if (isset($this->ssd[$this->id])) // is heirloom
{
array_push($link,
$this->ssd[$this->id]['maxLevel'], // scaleMaxLevel
$this->ssd[$this->id]['maxLevel'], // scaleCurLevel
$this->curTpl['scalingStatDistribution'], // scaleDist
$this->curTpl['scalingStatValue'] // scaleFlags
);
}
else // may still use level dependent ratings
{
array_push($link,
$causesScaling ? MAX_LEVEL : 1, // scaleMaxLevel
$_reqLvl > 1 ? $_reqLvl : MAX_LEVEL // scaleCurLevel
);
}
$x .= '<!--?'.implode(':', $link).'-->';
$itemId = $subOf ?: $this->id;
$x .= '<!--?';
// itemId
$x .= $itemId;
// scaleMinLevel
$x .= ':1';
// scaleMaxLevel
$x .= ':' . ($this->ssd[$itemId]['maxLevel'] ?? ($causesScaling ? MAX_LEVEL : 1));
// scaleCurLevel
$x .= ':' . ($this->ssd[$itemId]['maxLevel'] ?? ($_reqLvl ?: MAX_LEVEL));
// scaleDist
if ($this->curTpl['scalingStatDistribution'])
$x .= ':' . $this->curTpl['scalingStatDistribution'];
// scaleFlags
if ($this->curTpl['scalingStatValue'])
$x .= ':' . $this->curTpl['scalingStatValue'];
$x .= '-->';
}
return $x;

View File

@@ -1517,7 +1517,7 @@ $WH.g_setTooltipLevel = function(tooltip, level) {
// Rating to percent
nMatch = [];
tooltip = tooltip.replace(/(<!--rtg%(\d+)-->)([\.0-9]+)/g, function(_all, prefix, ratingId, percent) {
/* aowow: fix tooltips with multiple occurences of the same rating
/* aowow: fix tooltips with multiple occurences of the same rating (see item: 19948)
_ = tooltip.match(new RegExp('<!--rtg' + ratingId + '-->(\\d+)'));
if (!_) {
return _all;