Fix several issues with low thresholds

This addresses a user-reported issue where Low Threshold was not usable with Color By Health/Mana % disabled, due to some internal technical reasons. This was exacerbated by the recent fix that allowed Low Threshold and Color By Health % to work together.

This also fixes the low threshold flash to apply immediately when changing the option, and fixes the Low Threshold % slider to be usable without the Low Flash option set.

Finally, it hides the Low Flash option for bars that don't support it (right now that's just PlayerMana, I think because it only sets the low threshold to the Min Mana Color even if the class uses a different power type...something for future me...).

Fixes wowace ticket #334
This commit is contained in:
Parnic
2022-12-13 20:48:02 -06:00
parent 59f2792ce8
commit c5c44edf64
14 changed files with 36 additions and 2 deletions

View File

@ -87,7 +87,7 @@ function IceUnitBar.prototype:GetOptions()
self:Redraw() self:Redraw()
end, end,
disabled = function() disabled = function()
return not self.moduleSettings.enabled or not self.moduleSettings.lowThresholdFlash return not self.moduleSettings.enabled or not (self.moduleSettings.lowThresholdFlash or self.moduleSettings.lowThresholdColor)
end, end,
min = 0, min = 0,
max = 1, max = 1,
@ -105,10 +105,14 @@ function IceUnitBar.prototype:GetOptions()
end, end,
set = function(info, v) set = function(info, v)
self.moduleSettings.lowThresholdFlash = v self.moduleSettings.lowThresholdFlash = v
self:Redraw()
end, end,
disabled = function() disabled = function()
return not self.moduleSettings.enabled return not self.moduleSettings.enabled
end, end,
hidden = function()
return self.noFlash
end,
order = 30.092 order = 30.092
} }
opts["lowThresholdColor"] = { opts["lowThresholdColor"] = {
@ -123,7 +127,7 @@ function IceUnitBar.prototype:GetOptions()
self:Redraw() self:Redraw()
end, end,
disabled = function() disabled = function()
return not self.moduleSettings.enabled or not (self.moduleSettings.scaleHealthColor and self.moduleSettings.scaleManaColor) return not self.moduleSettings.enabled
end, end,
order = 30.093 order = 30.093
} }

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
v1.14.9:
- Fix Low Threshold to be usable even when Color By Health/Mana % is disabled. (ticket #334)
v1.14.8: v1.14.8:
- Fix Color By Health % to work with Low Threshold Color option. Previously, if Low Threshold was set, the color was always either MaxHealth/MaxMana or MinHealth/MinMana, it would never be colored by health %. Now if both are set, it will scale by health % until it reaches the low threshold, at which point it will switch to the Min color. - Fix Color By Health % to work with Low Threshold Color option. Previously, if Low Threshold was set, the color was always either MaxHealth/MaxMana or MinHealth/MinMana, it would never be colored by health %. Now if both are set, it will scale by health % until it reaches the low threshold, at which point it will switch to the Min color.

View File

@ -144,6 +144,8 @@ function IceCustomHealth.prototype:Update(unit)
if (self.moduleSettings.scaleHealthColor) then if (self.moduleSettings.scaleHealthColor) then
self.color = "ScaledHealthColor" self.color = "ScaledHealthColor"
elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then
self.color = "ScaledHealthColor"
end end
if (self.tapped) then if (self.tapped) then

View File

@ -364,6 +364,8 @@ function FocusHealth.prototype:Update(unit)
if (self.moduleSettings.scaleHealthColor) then if (self.moduleSettings.scaleHealthColor) then
self.color = "ScaledHealthColor" self.color = "ScaledHealthColor"
elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then
self.color = "ScaledHealthColor"
end end
if (self.tapped) then if (self.tapped) then

View File

@ -88,6 +88,8 @@ function FocusMana.prototype:Update(unit)
local color = "FocusMana" local color = "FocusMana"
if (self.moduleSettings.scaleManaColor) then if (self.moduleSettings.scaleManaColor) then
color = "ScaledManaColor" color = "ScaledManaColor"
elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then
color = "ScaledManaColor"
end end
if (manaType == SPELL_POWER_RAGE) then if (manaType == SPELL_POWER_RAGE) then
color = "FocusRage" color = "FocusRage"

View File

@ -93,6 +93,8 @@ function PetHealth.prototype:Update(unit)
if (self.moduleSettings.scaleHealthColor) then if (self.moduleSettings.scaleHealthColor) then
color = "ScaledHealthColor" color = "ScaledHealthColor"
elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then
color = "ScaledHealthColor"
end end
if not (self.alive) then if not (self.alive) then

View File

@ -173,6 +173,8 @@ function PetMana.prototype:Update(unit)
local color = "PetMana" local color = "PetMana"
if (self.moduleSettings.scaleManaColor) then if (self.moduleSettings.scaleManaColor) then
color = "ScaledManaColor" color = "ScaledManaColor"
elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then
color = "ScaledManaColor"
end end
if not (self.alive) then if not (self.alive) then
color = "Dead" color = "Dead"

View File

@ -1276,6 +1276,8 @@ function PlayerHealth.prototype:Update(unit)
if (self.moduleSettings.scaleHealthColor) then if (self.moduleSettings.scaleHealthColor) then
color = "ScaledHealthColor" color = "ScaledHealthColor"
elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then
color = "ScaledHealthColor"
end end
if not (self.alive) then if not (self.alive) then

View File

@ -344,6 +344,8 @@ function PlayerMana.prototype:Update(unit, powertype)
color = "Dead" color = "Dead"
elseif (self.moduleSettings.scaleManaColor and (UnitPowerType(self.unit) == SPELL_POWER_MANA or self.moduleSettings.scaleManaColorForAll)) then elseif (self.moduleSettings.scaleManaColor and (UnitPowerType(self.unit) == SPELL_POWER_MANA or self.moduleSettings.scaleManaColorForAll)) then
color = "ScaledManaColor" color = "ScaledManaColor"
elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then
color = "ScaledManaColor"
else else
if (self.manaType == SPELL_POWER_RAGE) then if (self.manaType == SPELL_POWER_RAGE) then
color = "PlayerRage" color = "PlayerRage"

View File

@ -841,6 +841,8 @@ function IceTargetHealth.prototype:Update(unit)
if (self.moduleSettings.scaleHealthColor) then if (self.moduleSettings.scaleHealthColor) then
self.color = "ScaledHealthColor" self.color = "ScaledHealthColor"
elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then
self.color = "ScaledHealthColor"
end end
if (self.tapped) then if (self.tapped) then

View File

@ -125,6 +125,8 @@ function IceTargetMana.prototype:Update(unit)
if (self.moduleSettings.scaleManaColor) then if (self.moduleSettings.scaleManaColor) then
self.color = "ScaledManaColor" self.color = "ScaledManaColor"
elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then
self.color = "ScaledManaColor"
end end
if (manaType == SPELL_POWER_RAGE) then if (manaType == SPELL_POWER_RAGE) then

View File

@ -136,6 +136,8 @@ function TargetTargetHealth.prototype:Update(unit)
if (self.moduleSettings.scaleHealthColor) then if (self.moduleSettings.scaleHealthColor) then
self.color = "ScaledHealthColor" self.color = "ScaledHealthColor"
elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then
self.color = "ScaledHealthColor"
end end
if (self.tapped) then if (self.tapped) then

View File

@ -83,6 +83,8 @@ function TargetTargetMana.prototype:Update(unit)
if (self.moduleSettings.scaleManaColor) then if (self.moduleSettings.scaleManaColor) then
self.color = "ScaledManaColor" self.color = "ScaledManaColor"
elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then
self.color = "ScaledManaColor"
end end
if (manaType == 1) then if (manaType == 1) then

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
v1.14.9:
- Fix Low Threshold to be usable even when Color By Health/Mana % is disabled. (ticket #334)
v1.14.8: v1.14.8:
- Fix Color By Health % to work with Low Threshold Color option. Previously, if Low Threshold was set, the color was always either MaxHealth/MaxMana or MinHealth/MinMana, it would never be colored by health %. Now if both are set, it will scale by health % until it reaches the low threshold, at which point it will switch to the Min color. - Fix Color By Health % to work with Low Threshold Color option. Previously, if Low Threshold was set, the color was always either MaxHealth/MaxMana or MinHealth/MinMana, it would never be colored by health %. Now if both are set, it will scale by health % until it reaches the low threshold, at which point it will switch to the Min color.