- mana modules animate regardless of 'predictedPower' setting now

- fixed occasional flickering in the cast bar and threat bar when they are first displayed
- minor code cleanup
This commit is contained in:
Parnic
2010-11-06 03:03:46 +00:00
parent 74b9ace21d
commit fa8b895214
6 changed files with 24 additions and 19 deletions

View File

@ -35,8 +35,6 @@ end
function IceBarElement.prototype:Enable() function IceBarElement.prototype:Enable()
IceBarElement.super.prototype.Enable(self) IceBarElement.super.prototype.Enable(self)
-- never register the OnUpdate for the mirror bar since it's handled internally
-- in addition, do not register OnUpdate if predictedPower is set and this is the player mana or target mana bar
self:ConditionalSetupUpdate() self:ConditionalSetupUpdate()
if IceHUD.IceCore:ShouldUseDogTags() then if IceHUD.IceCore:ShouldUseDogTags() then
@ -940,8 +938,7 @@ function IceBarElement.prototype:ConditionalSetupUpdate()
return return
end end
if not string.find(self.elementName, "MirrorBar") if not string.find(self.elementName, "MirrorBar") and not string.find(self.elementName, "PlayerMana") then
and ((IceHUD.WowVer < 30000 or not GetCVarBool("predictedPower")) or (not string.find(self.elementName, "PlayerMana"))) then
IceHUD.IceCore:RequestUpdates(self, self.MyOnUpdateFunc) IceHUD.IceCore:RequestUpdates(self, self.MyOnUpdateFunc)
end end
end end
@ -1167,11 +1164,16 @@ function IceBarElement.prototype:SetBarCoord(barFrame, scale, top)
end end
end end
function IceBarElement.prototype:SetScale(inScale, force) function IceBarElement.prototype:SetScale(inScale, force, skipLerp)
local oldScale = self.CurrScale local oldScale = self.CurrScale
local min_y, max_y; local min_y, max_y;
self.CurrScale = IceHUD:Clamp(self:LerpScale(inScale), 0, 1) if not skipLerp then
self.CurrScale = self:LerpScale(inScale)
else
self.CurrScale = inScale
end
self.CurrScale = IceHUD:Clamp(self.CurrScale, 0, 1)
if force or oldScale ~= self.CurrScale then if force or oldScale ~= self.CurrScale then
local scale = self.CurrScale local scale = self.CurrScale

View File

@ -276,16 +276,12 @@ function IceCastBar.prototype:MyOnUpdate()
scale = self.actionDuration ~= 0 and remainingTime / self.actionDuration or 0 scale = self.actionDuration ~= 0 and remainingTime / self.actionDuration or 0
end end
if (remainingTime < 0) then self:UpdateBar(IceHUD:Clamp(scale, 0, 1), self:GetCurrentCastingColor())
if (remainingTime <= 0) then
self:StopBar() self:StopBar()
end end
-- sanity check to make sure the bar doesn't over/underfill
scale = scale > 1 and 1 or scale
scale = scale < 0 and 0 or scale
self:UpdateBar(scale, self:GetCurrentCastingColor())
local timeString = self.moduleSettings.showCastTime and string.format("%.1fs ", remainingTime) or "" local timeString = self.moduleSettings.showCastTime and string.format("%.1fs ", remainingTime) or ""
self:SetBottomText1(timeString .. self.actionMessage) self:SetBottomText1(timeString .. self.actionMessage)
@ -396,6 +392,8 @@ function IceCastBar.prototype:StopBar()
self.actionStartTime = nil self.actionStartTime = nil
self.actionDuration = nil self.actionDuration = nil
self:SetBottomText1()
self:SetScale(0)
self:Show(false) self:Show(false)
end end

View File

@ -163,5 +163,6 @@ function IceCustomHealth.prototype:SetUnit(unit)
end end
function IceCustomHealth.prototype:OnShow() function IceCustomHealth.prototype:OnShow()
IceCustomHealth.super.prototype.OnShow(self)
self:Update(self.unit) self:Update(self.unit)
end end

View File

@ -148,7 +148,7 @@ function PetMana.prototype:Update(unit)
if (self.manaPercentage == 1 and self.manaType ~= SPELL_POWER_RAGE and self.manaType ~= SPELL_POWER_RUNIC_POWER) if (self.manaPercentage == 1 and self.manaType ~= SPELL_POWER_RAGE and self.manaType ~= SPELL_POWER_RUNIC_POWER)
or (self.manaPercentage == 0 and (self.manaType == SPELL_POWER_RAGE or self.manaType == SPELL_POWER_RUNIC_POWER)) then or (self.manaPercentage == 0 and (self.manaType == SPELL_POWER_RAGE or self.manaType == SPELL_POWER_RUNIC_POWER)) then
self:SetupOnUpdate(false) self:SetupOnUpdate(false)
elseif GetCVarBool("predictedPower") then else
self:SetupOnUpdate(true) self:SetupOnUpdate(true)
end end

View File

@ -126,10 +126,7 @@ function PlayerMana.prototype:Enable(core)
self.CustomOnUpdate = function() self:Update(self.unit) end self.CustomOnUpdate = function() self:Update(self.unit) end
end end
-- allow new 'predicted power' stuff to show the power updates constantly instead of ticking
if GetCVarBool("predictedPower") then
self:SetupOnUpdate(true) self:SetupOnUpdate(true)
end
self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType") self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType")
@ -293,7 +290,7 @@ function PlayerMana.prototype:Update(unit, powertype)
if (self.manaPercentage == 1 and self.manaType ~= SPELL_POWER_RAGE and self.manaType ~= SPELL_POWER_RUNIC_POWER) if (self.manaPercentage == 1 and self.manaType ~= SPELL_POWER_RAGE and self.manaType ~= SPELL_POWER_RUNIC_POWER)
or (self.manaPercentage == 0 and (self.manaType == SPELL_POWER_RAGE or self.manaType == SPELL_POWER_RUNIC_POWER)) then or (self.manaPercentage == 0 and (self.manaType == SPELL_POWER_RAGE or self.manaType == SPELL_POWER_RUNIC_POWER)) then
self:SetupOnUpdate(false) self:SetupOnUpdate(false)
elseif GetCVarBool("predictedPower") then else
self:SetupOnUpdate(true) self:SetupOnUpdate(true)
end end

View File

@ -176,6 +176,7 @@ function IceThreat.prototype:Enable(core)
self.scheduledEvent = self:ScheduleRepeatingTimer("Update", 0.2) self.scheduledEvent = self:ScheduleRepeatingTimer("Update", 0.2)
self:SetScale(0, true, true)
self:Update(self.unit) self:Update(self.unit)
end end
@ -391,6 +392,12 @@ function IceThreat.prototype:GetSecondHighestThreat()
return secondHighestThreat return secondHighestThreat
end end
function IceThreat.prototype:Show(bShouldShow)
IceThreat.super.prototype.Show(self, bShouldShow)
if not bShouldShow then
self:SetScale(0, true, true)
end
end
-- Load us up -- Load us up
IceHUD.IceThreat = IceThreat:new() IceHUD.IceThreat = IceThreat:new()