mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
bug http://www.wowace.com/projects/ice-hud/tickets/13-low-health-colour/ - Low Health Colour
- added user-submitted ability to color a bar based on the low threshold. if it's above the threshold, the bar is max health/mana color, below the threshold is min health/mana color - added a toggle to allow specifying whether or not to flash a bar when it falls below the low threshold
This commit is contained in:
@ -53,6 +53,8 @@ function IceUnitBar.prototype:GetDefaultSettings()
|
|||||||
local settings = IceUnitBar.super.prototype.GetDefaultSettings(self)
|
local settings = IceUnitBar.super.prototype.GetDefaultSettings(self)
|
||||||
|
|
||||||
settings["lowThreshold"] = 0
|
settings["lowThreshold"] = 0
|
||||||
|
settings["lowThresholdFlash" ] = true
|
||||||
|
settings["lowThresholdColor"] = false
|
||||||
settings["scaleHealthColor"] = true
|
settings["scaleHealthColor"] = true
|
||||||
settings["scaleManaColor"] = true
|
settings["scaleManaColor"] = true
|
||||||
|
|
||||||
@ -85,6 +87,37 @@ function IceUnitBar.prototype:GetOptions()
|
|||||||
isPercent = true,
|
isPercent = true,
|
||||||
order = 37
|
order = 37
|
||||||
}
|
}
|
||||||
|
opts["lowThresholdFlash"] = {
|
||||||
|
type = 'toggle',
|
||||||
|
name = 'Flash bar below Low Threshold',
|
||||||
|
desc = 'Flashes the bar when it is below the Low Threshold specified above',
|
||||||
|
get = function()
|
||||||
|
return self.moduleSettings.lowThresholdFlash
|
||||||
|
end,
|
||||||
|
set = function(v)
|
||||||
|
self.moduleSettings.lowThresholdFlash = v
|
||||||
|
end,
|
||||||
|
disabled = function()
|
||||||
|
return not self.moduleSettings.enabled
|
||||||
|
end,
|
||||||
|
order = 38
|
||||||
|
}
|
||||||
|
opts["lowThresholdColor"] = {
|
||||||
|
type = "toggle",
|
||||||
|
name = "Low Threshold color",
|
||||||
|
desc = "Colors the bar minColor when % is < lowThreshold (requires scaleColor to be enabled)",
|
||||||
|
get = function()
|
||||||
|
return self.moduleSettings.lowThresholdColor
|
||||||
|
end,
|
||||||
|
set = function(value)
|
||||||
|
self.moduleSettings.lowThresholdColor = value
|
||||||
|
self:Redraw()
|
||||||
|
end,
|
||||||
|
disabled = function()
|
||||||
|
return not self.moduleSettings.enabled or not (self.moduleSettings.scaleHealthColor and self.moduleSettings.scaleManaColor)
|
||||||
|
end,
|
||||||
|
order = 39
|
||||||
|
}
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
end
|
end
|
||||||
@ -197,6 +230,21 @@ function IceUnitBar.prototype:Update()
|
|||||||
|
|
||||||
self.settings.colors["ScaledManaColor"] = self.scaleMPColorInst
|
self.settings.colors["ScaledManaColor"] = self.scaleMPColorInst
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- This looks slightly quirky. Basically the easiest way for me to achieve this is to have lowThresholdColor override
|
||||||
|
-- the scaled color. You'll need to switch them both on to get things to work.
|
||||||
|
if( self.moduleSettings.lowThresholdColor ) then
|
||||||
|
if( self.healthPercentage < self.moduleSettings.lowThreshold ) then
|
||||||
|
self.settings.colors[ "ScaledHealthColor" ] = self.settings.colors[ "MinHealthColor" ]
|
||||||
|
else
|
||||||
|
self.settings.colors[ "ScaledHealthColor" ] = self.settings.colors[ "MaxHealthColor" ]
|
||||||
|
end
|
||||||
|
if( self.manaPercentage < self.moduleSettings.lowThreshold ) then
|
||||||
|
self.settings.colors[ "ScaledManaColor" ] = self.settings.colors[ "MinManaColor" ]
|
||||||
|
else
|
||||||
|
self.settings.colors[ "ScaledManaColor" ] = self.settings.colors[ "MaxManaColor" ]
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -233,6 +281,7 @@ function IceUnitBar.prototype:UpdateBar(scale, color, alpha)
|
|||||||
self.flashFrame:SetStatusBarColor(self:GetColor(color))
|
self.flashFrame:SetStatusBarColor(self:GetColor(color))
|
||||||
|
|
||||||
if (self.moduleSettings.lowThreshold > 0 and
|
if (self.moduleSettings.lowThreshold > 0 and
|
||||||
|
self.moduleSettings.lowThresholdFlash and
|
||||||
self.moduleSettings.lowThreshold >= scale and self.alive and
|
self.moduleSettings.lowThreshold >= scale and self.alive and
|
||||||
not self.noFlash) then
|
not self.noFlash) then
|
||||||
self.flashFrame:SetScript("OnUpdate", function() self:OnFlashUpdate() end)
|
self.flashFrame:SetScript("OnUpdate", function() self:OnFlashUpdate() end)
|
||||||
|
Reference in New Issue
Block a user