diff --git a/Locales/enUS/base.lua b/Locales/enUS/base.lua
index c3d82c2..c9900b4 100644
--- a/Locales/enUS/base.lua
+++ b/Locales/enUS/base.lua
@@ -101,8 +101,9 @@ L["WARN_UNREC_GEMID"] = "WeightsWatcher: Warning: Unrecognized GemId: %d"
L["WARN_UNREC_SOCKET_COLOR"] = "WeightsWatcher: Warning: Unrecognized socket color: %s"
L["WARN_UNHAND_GEMID"] = "WeightsWatcher: Unhandled GemId: %d"
L["WEIGHT_CLASS_FORMAT"] = "%s - %s"
+L["DURATION_COOLDOWN_FORMAT"] = " %d s. duration, %d s. cooldown"
L["EFFECT_STAT_FORMAT"] = " %d %s"
-L["DURATION_COOLDOWN_FORMAT"] = "%d/%d"
+L["EFFECT_STACKS_FORMAT"] = "%d stacks"
L["TRIGGER_FORMAT"] = " on %s"
L["INDENTED_STRING_FORMAT"] = " %s"
L["DOUBLY_INDENTED_STRING_FORMAT"] = " %s"
diff --git a/Locales/enUS/patterns-cooldown-use-effects.lua b/Locales/enUS/patterns-cooldown-use-effects.lua
index ab38ba3..1008158 100644
--- a/Locales/enUS/patterns-cooldown-use-effects.lua
+++ b/Locales/enUS/patterns-cooldown-use-effects.lua
@@ -29,8 +29,27 @@ local CooldownUseAffixes = {
"^maximum +",
}
-local function cooldownUseEffect(text)
- local stat = WeightsWatcher.useEffect(text)
+local function useEffect(text, section)
+ local start, _, stat, duration, cooldown = string.find(text, "^(%a+ ?%a+ ?%a+ ?%a+ ?%a* ?%a* by [+-]?%d+) for (%d+ %a+ ?%d* ?%a*)%. +%((%d+ %a+ ?%d* ?%a*) cooldown%)$")
+ if not start then
+ start, _, stat, duration, cooldown = string.find(text, "^([+-]?%d+ %a+ ?%a+ ?%a+ ?%a+ ?%a* ?%a*) for (%d+ %a+ ?%d* ?%a*)%. +%((%d+ %a+ ?%d* ?%a*) cooldown%)$")
+ end
+ if start then
+ cooldown = WeightsWatcher.convertToSeconds(cooldown)
+ duration = WeightsWatcher.convertToSeconds(duration)
+ stats = WeightsWatcher.parseStats(stat, section)
+ if stats and stats.stats then
+ return {
+ stats = stats.stats,
+ duration = duration,
+ cooldown = cooldown,
+ }
+ end
+ end
+end
+
+local function cooldownUseEffect(text, section)
+ local stat = useEffect(text, section)
if stat then
return {useEffect = stat}
diff --git a/Locales/enUS/patterns.lua b/Locales/enUS/patterns.lua
index 71c4775..8c14551 100644
--- a/Locales/enUS/patterns.lua
+++ b/Locales/enUS/patterns.lua
@@ -70,23 +70,6 @@ function WeightsWatcher.convertToSeconds(duration)
end
end
-function WeightsWatcher.useEffect(text)
- local start, _, stat, value, duration, cooldown = string.find(text, "^(%a+ ?%a+ ?%a+ ?%a+) by ([+-]?%d+) for (%d+ %a+ ?%d* ?%a*)%. +%((%d+ %a+ ?%d* ?%a*) cooldown%)$")
- if not start then
- start, _, value, stat, duration, cooldown = string.find(text, "^([+-]?%d+) (%a+ ?%a+ ?%a+ ?%a+) for (%d+ %a+ ?%d* ?%a*)%. +%((%d+ %a+ ?%d* ?%a*) cooldown%)$")
- end
- if start then
- cooldown = WeightsWatcher.convertToSeconds(cooldown)
- duration = WeightsWatcher.convertToSeconds(duration)
- return {
- stat = stat,
- value = value,
- duration = duration,
- cooldown = cooldown,
- }
- end
-end
-
ww_Preprocess = {
{"|c[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]([^|]+)|r", "%1"},
{" +$", ""},
diff --git a/Regexps.lua b/Regexps.lua
index 5995b7a..8f5f90f 100644
--- a/Regexps.lua
+++ b/Regexps.lua
@@ -9,6 +9,7 @@ local patternCategories = {
"generic",
"socketBonus",
"useEffect",
+ "cooldownUseEffect",
"stackingEquipEffect",
}
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index 15df2ff..9d36085 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -626,13 +626,17 @@ function WeightsWatcher.displayItemStats(tooltip, ttname)
if #(bareItemInfo.useEffects) > 0 then
tooltip:AddLine(L["Use effects:"])
for _, useEffect in pairs(bareItemInfo.useEffects) do
- tooltip:AddDoubleLine(string.format(L["EFFECT_STAT_FORMAT"], useEffect.value, ww_statDisplayNames[useEffect.stat]), string.format(L["DURATION_COOLDOWN_FORMAT"], useEffect.duration, useEffect.cooldown))
+ tooltip:AddLine(string.format(L["DURATION_COOLDOWN_FORMAT"], useEffect.duration, useEffect.cooldown))
+ tooltip:AddLine(string.format(L["INDENTED_STRING_FORMAT"], "Stats:"))
+ for stat, value in pairs(useEffect.stats) do
+ tooltip:AddDoubleLine(string.format(L["DOUBLY_INDENTED_STRING_FORMAT"], ww_statDisplayNames[stat]), value)
+ end
end
end
if #(bareItemInfo.stackingEquipEffects) > 0 then
tooltip:AddLine(L["Stacking equip effects:"])
for _, effect in pairs(bareItemInfo.stackingEquipEffects) do
- tooltip:AddDoubleLine(string.format(L["EFFECT_STAT_FORMAT"], effect.value, ww_statDisplayNames[effect.stat]), effect.numStacks)
+ tooltip:AddDoubleLine(string.format(L["EFFECT_STAT_FORMAT"], effect.value, ww_statDisplayNames[effect.stat]), string.format(L["EFFECT_STACKS_FORMAT"], effect.numStacks))
for trigger in pairs(effect.triggers) do
tooltip:AddLine(string.format(L["TRIGGER_FORMAT"], ww_triggerDisplayNames[trigger]))
end
@@ -903,7 +907,10 @@ function WeightsWatcher.calculateWeight(bareItemStats, itemStats, weightsScale)
end
if bareItemStats.useEffects then
for _, useEffect in pairs(bareItemStats.useEffects) do
- weight = weight + WeightsWatcher.getWeight(ww_englishStats[useEffect.stat], useEffect.value * useEffect.duration / useEffect.cooldown * ww_vars.options.useEffects.uptimeRatio, weightsScale)
+ local factor = useEffect.duration / useEffect.cooldown * ww_vars.options.useEffects.uptimeRatio
+ for stat, value in pairs(useEffect.stats) do
+ weight = weight + WeightsWatcher.getWeight(ww_englishStats[stat], value * factor, weightsScale)
+ end
end
end
if bareItemStats.stackingEquipEffects then
@@ -1073,8 +1080,10 @@ function WeightsWatcher.parseLine(textL, textR, link)
end
end
if stats.useEffect then
- if not ww_statDisplayNames[stats.useEffect.stat] and not ww_ignoredInvalidStats[ww_englishStats[stats.useEffect.stat]] then
- return
+ for stat, value in pairs(stats.useEffect.stats) do
+ if not ww_statDisplayNames[stat] and not ww_ignoredInvalidStats[ww_englishStats[stat]] then
+ return
+ end
end
end
if stats.stackingEquipEffects then