diff --git a/IceStackCounter.lua b/IceStackCounter.lua index 38a60b9..b73cf3c 100644 --- a/IceStackCounter.lua +++ b/IceStackCounter.lua @@ -130,7 +130,6 @@ function IceStackCounter_Enable(frame) frame:RegisterEvent("UNIT_PET", "UpdateCustomCount") frame:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomCount") frame:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateCustomCount") - frame:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateCustomCount") frame:RegisterEvent("PLAYER_DEAD", "UpdateCustomCount") frame:RegisterEvent("SPELL_UPDATE_CHARGES", "UpdateCustomCount") @@ -171,5 +170,9 @@ function IceStackCounter_GetCount(frame) end function IceStackCounter_UseTargetAlpha(frame) - return frame.lastPoints ~= nil and frame.lastPoints > 0 + if frame.moduleSettings.auraType == "charges" then + return IceStackCounter_GetCount(frame) ~= IceStackCounter_GetMaxCount(frame) or frame.target or frame.combat + else + return frame.lastPoints ~= nil and frame.lastPoints > 0 + end end diff --git a/modules/CustomCount.lua b/modules/CustomCount.lua index fa0c70d..ac5363e 100644 --- a/modules/CustomCount.lua +++ b/modules/CustomCount.lua @@ -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 diff --git a/modules/CustomCounterBar.lua b/modules/CustomCounterBar.lua index e08a76b..c494820 100644 --- a/modules/CustomCounterBar.lua +++ b/modules/CustomCounterBar.lua @@ -250,6 +250,11 @@ function IceCustomCounterBar.prototype:Enable(core) IceStackCounter_Enable(self) end +function IceCustomCounterBar.prototype:TargetChanged() + IceCustomCount.super.prototype.TargetChanged(self) + self:UpdateCustomCount() +end + function IceCustomCounterBar.prototype:Redraw() IceCustomCounterBar.super.prototype.Redraw(self) @@ -319,7 +324,7 @@ function IceCustomCounterBar.prototype:UpdateCustomCount() self.barFrame.icon:Show() end - if points == nil or points == 0 then + if (points == nil or points == 0) and self.moduleSettings.auraType ~= "charges" then self:Show(false) self:UpdateBar(0, "undef") else @@ -343,3 +348,7 @@ end function IceCustomCounterBar.prototype:Update() self:UpdateCustomCount() end + +function IceCustomCounterBar.prototype:UseTargetAlpha(scale) + return IceStackCounter_UseTargetAlpha(self) +end