Spells/Tooltips

* fixed text-parsing for spells with a combat rating in the tooltip, that is inside a formula (e.g. spell 24574)
  * fixed client tooltip updates when modifying level for affected tooltips
  * fixed spell-links on item tooltips with multiple combat ratings
This commit is contained in:
Sarjuuk
2015-07-18 01:47:22 +02:00
parent c1f5d2ea9b
commit 111e53aaef
4 changed files with 167 additions and 156 deletions

View File

@@ -1458,13 +1458,25 @@ $WH.g_setTooltipLevel = function(tooltip, level) {
});
// Rating to percent
nMatch = [];
tooltip = tooltip.replace(/(<!--rtg%(\d+)-->)([\.0-9]+)/g, function(_all, prefix, ratingId, percent) {
/* sarjuuk: fix tooltips with multiple occurences of the same rating
_ = tooltip.match(new RegExp('<!--rtg' + ratingId + '-->(\\d+)'));
if (!_) {
return _all;
}
return prefix + Math.round($WH.g_convertRatingToPercent(level, ratingId, _[1]) * 100) / 100;
*/
if (!nMatch[ratingId])
nMatch[ratingId] = 0;
_ = tooltip.match(new RegExp('<!--rtg' + ratingId + '-->(\\d+)', 'g'))[nMatch[ratingId]++];
if (!_) {
return _all;
}
return prefix + Math.round($WH.g_convertRatingToPercent(level, ratingId, _.split('>')[1]) * 100) / 100;
});
// Level