Inverted alpha settings for custom counters watching spell charges

For charges, being full is the default state, so we need to treat full the same as health or mana being full. (ticket #231)
Also fixed the "target" variable never getting set on custom counters or custom counter bars because they were overriding the PLAYER_TARGET_CHANGED event that the base class was registering.
Also also fixed numeric display mode for custom counters not using the correct gradient scaling when the number hit 0. It was using the same scaling as graphical mode where 0 displays nothing and needs to be accounted for separately.
This commit is contained in:
Parnic
2016-12-07 23:28:44 -06:00
parent 49f8a6c6b2
commit ce1558a18e
3 changed files with 24 additions and 4 deletions

View File

@ -296,6 +296,11 @@ function IceCustomCount.prototype:Enable(core)
self:UpdateCustomCount()
end
function IceCustomCount.prototype:TargetChanged()
IceCustomCount.super.prototype.TargetChanged(self)
self:UpdateCustomCount()
end
-- 'Protected' methods --------------------------------------------------------
@ -421,6 +426,9 @@ function IceCustomCount.prototype:GetGradientColor(curr)
local r, g, b = self:GetCustomColor()
local mr, mg, mb = self:GetCustomMinColor()
local scale = max > 1 and ((curr-1)/(max-1)) or 1
if self.moduleSettings.countMode == "Numeric" then
scale = max > 1 and (curr/max) or 1
end
r = r * scale + mr * (1-scale)
g = g * scale + mg * (1-scale)
@ -435,7 +443,7 @@ function IceCustomCount.prototype:UpdateCustomCount()
return
end
local points = IceStackCounter_GetCount(self)
local points = IceStackCounter_GetCount(self) or 0
local max = IceStackCounter_GetMaxCount(self)
if max > #self.frame.graphical then