From c5c44edf646f26f4be5f30b9c46f7555776f7eb3 Mon Sep 17 00:00:00 2001 From: Parnic Date: Tue, 13 Dec 2022 20:48:02 -0600 Subject: [PATCH] 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 --- IceUnitBar.lua | 8 ++++++-- changelog.md | 4 ++++ modules/CustomHealth.lua | 2 ++ modules/FocusHealth.lua | 2 ++ modules/FocusMana.lua | 2 ++ modules/PetHealth.lua | 2 ++ modules/PetMana.lua | 2 ++ modules/PlayerHealth.lua | 2 ++ modules/PlayerMana.lua | 2 ++ modules/TargetHealth.lua | 2 ++ modules/TargetMana.lua | 2 ++ modules/TargetOfTargetHealth.lua | 2 ++ modules/TargetOfTargetMana.lua | 2 ++ this_version.md | 4 ++++ 14 files changed, 36 insertions(+), 2 deletions(-) diff --git a/IceUnitBar.lua b/IceUnitBar.lua index c9132bf..7728895 100644 --- a/IceUnitBar.lua +++ b/IceUnitBar.lua @@ -87,7 +87,7 @@ function IceUnitBar.prototype:GetOptions() self:Redraw() end, 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, min = 0, max = 1, @@ -105,10 +105,14 @@ function IceUnitBar.prototype:GetOptions() end, set = function(info, v) self.moduleSettings.lowThresholdFlash = v + self:Redraw() end, disabled = function() return not self.moduleSettings.enabled end, + hidden = function() + return self.noFlash + end, order = 30.092 } opts["lowThresholdColor"] = { @@ -123,7 +127,7 @@ function IceUnitBar.prototype:GetOptions() self:Redraw() end, disabled = function() - return not self.moduleSettings.enabled or not (self.moduleSettings.scaleHealthColor and self.moduleSettings.scaleManaColor) + return not self.moduleSettings.enabled end, order = 30.093 } diff --git a/changelog.md b/changelog.md index 9a17743..d372f5f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +v1.14.9: + +- Fix Low Threshold to be usable even when Color By Health/Mana % is disabled. (ticket #334) + 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. diff --git a/modules/CustomHealth.lua b/modules/CustomHealth.lua index fafc1cc..09faf4b 100644 --- a/modules/CustomHealth.lua +++ b/modules/CustomHealth.lua @@ -144,6 +144,8 @@ function IceCustomHealth.prototype:Update(unit) if (self.moduleSettings.scaleHealthColor) then self.color = "ScaledHealthColor" + elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then + self.color = "ScaledHealthColor" end if (self.tapped) then diff --git a/modules/FocusHealth.lua b/modules/FocusHealth.lua index fb61007..0b89bcf 100644 --- a/modules/FocusHealth.lua +++ b/modules/FocusHealth.lua @@ -364,6 +364,8 @@ function FocusHealth.prototype:Update(unit) if (self.moduleSettings.scaleHealthColor) then self.color = "ScaledHealthColor" + elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then + self.color = "ScaledHealthColor" end if (self.tapped) then diff --git a/modules/FocusMana.lua b/modules/FocusMana.lua index 1e90ec1..f51ad68 100644 --- a/modules/FocusMana.lua +++ b/modules/FocusMana.lua @@ -88,6 +88,8 @@ function FocusMana.prototype:Update(unit) local color = "FocusMana" if (self.moduleSettings.scaleManaColor) then color = "ScaledManaColor" + elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then + color = "ScaledManaColor" end if (manaType == SPELL_POWER_RAGE) then color = "FocusRage" diff --git a/modules/PetHealth.lua b/modules/PetHealth.lua index 4b4686c..675c018 100644 --- a/modules/PetHealth.lua +++ b/modules/PetHealth.lua @@ -93,6 +93,8 @@ function PetHealth.prototype:Update(unit) if (self.moduleSettings.scaleHealthColor) then color = "ScaledHealthColor" + elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then + color = "ScaledHealthColor" end if not (self.alive) then diff --git a/modules/PetMana.lua b/modules/PetMana.lua index 44b7109..87e5669 100644 --- a/modules/PetMana.lua +++ b/modules/PetMana.lua @@ -173,6 +173,8 @@ function PetMana.prototype:Update(unit) local color = "PetMana" if (self.moduleSettings.scaleManaColor) then color = "ScaledManaColor" + elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then + color = "ScaledManaColor" end if not (self.alive) then color = "Dead" diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua index 7a4f77f..c9a51da 100644 --- a/modules/PlayerHealth.lua +++ b/modules/PlayerHealth.lua @@ -1276,6 +1276,8 @@ function PlayerHealth.prototype:Update(unit) if (self.moduleSettings.scaleHealthColor) then color = "ScaledHealthColor" + elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then + color = "ScaledHealthColor" end if not (self.alive) then diff --git a/modules/PlayerMana.lua b/modules/PlayerMana.lua index 0ab0bce..d0f1586 100644 --- a/modules/PlayerMana.lua +++ b/modules/PlayerMana.lua @@ -344,6 +344,8 @@ function PlayerMana.prototype:Update(unit, powertype) color = "Dead" elseif (self.moduleSettings.scaleManaColor and (UnitPowerType(self.unit) == SPELL_POWER_MANA or self.moduleSettings.scaleManaColorForAll)) then color = "ScaledManaColor" + elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then + color = "ScaledManaColor" else if (self.manaType == SPELL_POWER_RAGE) then color = "PlayerRage" diff --git a/modules/TargetHealth.lua b/modules/TargetHealth.lua index 08b02aa..b1f53f2 100644 --- a/modules/TargetHealth.lua +++ b/modules/TargetHealth.lua @@ -841,6 +841,8 @@ function IceTargetHealth.prototype:Update(unit) if (self.moduleSettings.scaleHealthColor) then self.color = "ScaledHealthColor" + elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then + self.color = "ScaledHealthColor" end if (self.tapped) then diff --git a/modules/TargetMana.lua b/modules/TargetMana.lua index c39aac1..8c7d1c9 100644 --- a/modules/TargetMana.lua +++ b/modules/TargetMana.lua @@ -125,6 +125,8 @@ function IceTargetMana.prototype:Update(unit) if (self.moduleSettings.scaleManaColor) then self.color = "ScaledManaColor" + elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then + self.color = "ScaledManaColor" end if (manaType == SPELL_POWER_RAGE) then diff --git a/modules/TargetOfTargetHealth.lua b/modules/TargetOfTargetHealth.lua index f501dbd..a4de879 100644 --- a/modules/TargetOfTargetHealth.lua +++ b/modules/TargetOfTargetHealth.lua @@ -136,6 +136,8 @@ function TargetTargetHealth.prototype:Update(unit) if (self.moduleSettings.scaleHealthColor) then self.color = "ScaledHealthColor" + elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then + self.color = "ScaledHealthColor" end if (self.tapped) then diff --git a/modules/TargetOfTargetMana.lua b/modules/TargetOfTargetMana.lua index 9d6d7f3..89bbf2f 100644 --- a/modules/TargetOfTargetMana.lua +++ b/modules/TargetOfTargetMana.lua @@ -83,6 +83,8 @@ function TargetTargetMana.prototype:Update(unit) if (self.moduleSettings.scaleManaColor) then self.color = "ScaledManaColor" + elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then + self.color = "ScaledManaColor" end if (manaType == 1) then diff --git a/this_version.md b/this_version.md index 7136cf3..d1e8328 100644 --- a/this_version.md +++ b/this_version.md @@ -1,5 +1,9 @@ # Changelog +v1.14.9: + +- Fix Low Threshold to be usable even when Color By Health/Mana % is disabled. (ticket #334) + 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.