mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Items/Tooltips
* fix scaling string in item tooltips for scaling & non-interactive tooltips
This commit is contained in:
@@ -995,11 +995,11 @@ class ItemList extends BaseType
|
|||||||
else if (!$parsed)
|
else if (!$parsed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if ($scaling)
|
||||||
|
$causesScaling = true;
|
||||||
|
|
||||||
if ($interactive)
|
if ($interactive)
|
||||||
{
|
{
|
||||||
if ($scaling)
|
|
||||||
$causesScaling = true;
|
|
||||||
|
|
||||||
$link = '<a href="?spell='.$itemSpells->id.'">%s</a>';
|
$link = '<a href="?spell='.$itemSpells->id.'">%s</a>';
|
||||||
$parsed = preg_replace_callback('/([^;]*)( <small>.*?<\/small>)([^&]*)/i', function($m) use($link) {
|
$parsed = preg_replace_callback('/([^;]*)( <small>.*?<\/small>)([^&]*)/i', function($m) use($link) {
|
||||||
$m[1] = $m[1] ? sprintf($link, $m[1]) : '';
|
$m[1] = $m[1] ? sprintf($link, $m[1]) : '';
|
||||||
@@ -1204,24 +1204,24 @@ class ItemList extends BaseType
|
|||||||
// tooltip scaling
|
// tooltip scaling
|
||||||
if (!isset($xCraft))
|
if (!isset($xCraft))
|
||||||
{
|
{
|
||||||
$link = [$subOf ? $subOf : $this->id, 1]; // itemId, scaleMinLevel
|
$itemId = $subOf ?: $this->id;
|
||||||
if (isset($this->ssd[$this->id])) // is heirloom
|
|
||||||
{
|
$x .= '<!--?';
|
||||||
array_push($link,
|
// itemId
|
||||||
$this->ssd[$this->id]['maxLevel'], // scaleMaxLevel
|
$x .= $itemId;
|
||||||
$this->ssd[$this->id]['maxLevel'], // scaleCurLevel
|
// scaleMinLevel
|
||||||
$this->curTpl['scalingStatDistribution'], // scaleDist
|
$x .= ':1';
|
||||||
$this->curTpl['scalingStatValue'] // scaleFlags
|
// scaleMaxLevel
|
||||||
);
|
$x .= ':' . ($this->ssd[$itemId]['maxLevel'] ?? ($causesScaling ? MAX_LEVEL : 1));
|
||||||
}
|
// scaleCurLevel
|
||||||
else // may still use level dependent ratings
|
$x .= ':' . ($this->ssd[$itemId]['maxLevel'] ?? ($_reqLvl ?: MAX_LEVEL));
|
||||||
{
|
// scaleDist
|
||||||
array_push($link,
|
if ($this->curTpl['scalingStatDistribution'])
|
||||||
$causesScaling ? MAX_LEVEL : 1, // scaleMaxLevel
|
$x .= ':' . $this->curTpl['scalingStatDistribution'];
|
||||||
$_reqLvl > 1 ? $_reqLvl : MAX_LEVEL // scaleCurLevel
|
// scaleFlags
|
||||||
);
|
if ($this->curTpl['scalingStatValue'])
|
||||||
}
|
$x .= ':' . $this->curTpl['scalingStatValue'];
|
||||||
$x .= '<!--?'.implode(':', $link).'-->';
|
$x .= '-->';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $x;
|
return $x;
|
||||||
|
|||||||
@@ -1517,7 +1517,7 @@ $WH.g_setTooltipLevel = function(tooltip, level) {
|
|||||||
// Rating to percent
|
// Rating to percent
|
||||||
nMatch = [];
|
nMatch = [];
|
||||||
tooltip = tooltip.replace(/(<!--rtg%(\d+)-->)([\.0-9]+)/g, function(_all, prefix, ratingId, percent) {
|
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+)'));
|
_ = tooltip.match(new RegExp('<!--rtg' + ratingId + '-->(\\d+)'));
|
||||||
if (!_) {
|
if (!_) {
|
||||||
return _all;
|
return _all;
|
||||||
@@ -1525,8 +1525,8 @@ $WH.g_setTooltipLevel = function(tooltip, level) {
|
|||||||
|
|
||||||
return prefix + Math.round($WH.g_convertRatingToPercent(level, ratingId, _[1]) * 100) / 100;
|
return prefix + Math.round($WH.g_convertRatingToPercent(level, ratingId, _[1]) * 100) / 100;
|
||||||
*/
|
*/
|
||||||
if (!nMatch[ratingId])
|
if (!nMatch[ratingId])
|
||||||
nMatch[ratingId] = 0;
|
nMatch[ratingId] = 0;
|
||||||
|
|
||||||
_ = tooltip.match(new RegExp('<!--rtg' + ratingId + '-->(\\d+)', 'g'))[nMatch[ratingId]++];
|
_ = tooltip.match(new RegExp('<!--rtg' + ratingId + '-->(\\d+)', 'g'))[nMatch[ratingId]++];
|
||||||
if (!_) {
|
if (!_) {
|
||||||
|
|||||||
Reference in New Issue
Block a user