- moved the xor method out to IceHUD instead of being a CastBar local function

- made second threat bar and aggro bar behave properly with new invert/reverse
This commit is contained in:
Parnic
2010-07-20 03:17:49 +00:00
parent c6dbacc5fa
commit ecb71c9abc
3 changed files with 21 additions and 14 deletions

View File

@ -883,3 +883,7 @@ function IceHUD:ShouldSwapToVehicle(...)
return true return true
end end
end end
function IceHUD:xor(val1, val2)
return val1 and not val2 or val2 and not val1
end

View File

@ -422,10 +422,6 @@ function CastBar.prototype:SpellCastSent(unit, spell, rank, target)
self.spellCastSent = GetTime() self.spellCastSent = GetTime()
end end
local function xor(val1, val2)
return val1 and not val2 or val2 and not val1
end
-- OVERRIDE -- OVERRIDE
function CastBar.prototype:SpellCastStart(unit, spell, rank) function CastBar.prototype:SpellCastStart(unit, spell, rank)
CastBar.super.prototype.SpellCastStart(self, unit, spell, rank) CastBar.super.prototype.SpellCastStart(self, unit, spell, rank)
@ -437,7 +433,7 @@ function CastBar.prototype:SpellCastStart(unit, spell, rank)
self.lagBar:SetFrameStrata("BACKGROUND") self.lagBar:SetFrameStrata("BACKGROUND")
self.lagBar:ClearAllPoints() self.lagBar:ClearAllPoints()
if not xor(self.moduleSettings.reverse, self.moduleSettings.inverse) then if not IceHUD:xor(self.moduleSettings.reverse, self.moduleSettings.inverse) then
self.lagBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT") self.lagBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
else else
self.lagBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT") self.lagBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
@ -453,7 +449,7 @@ function CastBar.prototype:SpellCastStart(unit, spell, rank)
local min_y = 0 local min_y = 0
local max_y = pos local max_y = pos
if xor(self.moduleSettings.reverse, self.moduleSettings.inverse) then if IceHUD:xor(self.moduleSettings.reverse, self.moduleSettings.inverse) then
min_y = 1-pos min_y = 1-pos
max_y = 1 max_y = 1
end end
@ -483,7 +479,7 @@ function CastBar.prototype:SpellCastChannelStart(unit)
return return
end end
local lagTop = not xor(self.moduleSettings.reverse, self.moduleSettings.inverse) local lagTop = not IceHUD:xor(self.moduleSettings.reverse, self.moduleSettings.inverse)
if self.moduleSettings.reverseChannel then if self.moduleSettings.reverseChannel then
lagTop = not lagTop lagTop = not lagTop
end end

View File

@ -202,11 +202,13 @@ function IceThreat.prototype:CreateAggroBar()
self.aggroBar = CreateFrame("Frame", nil, self.frame) self.aggroBar = CreateFrame("Frame", nil, self.frame)
end end
local aggroTop = not IceHUD:xor(self.moduleSettings.reverse, self.moduleSettings.inverse)
self.aggroBar:SetFrameStrata("BACKGROUND") self.aggroBar:SetFrameStrata("BACKGROUND")
self.aggroBar:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0)) self.aggroBar:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
self.aggroBar:SetHeight(self.settings.barHeight) self.aggroBar:SetHeight(self.settings.barHeight)
self.aggroBar:ClearAllPoints() self.aggroBar:ClearAllPoints()
if not self.moduleSettings.reverse then if aggroTop then
self.aggroBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT") self.aggroBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
else else
self.aggroBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT") self.aggroBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
@ -241,7 +243,7 @@ function IceThreat.prototype:CreateSecondThreatBar()
self.secondThreatBar:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0)) self.secondThreatBar:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
self.secondThreatBar:SetHeight(self.settings.barHeight) self.secondThreatBar:SetHeight(self.settings.barHeight)
self.secondThreatBar:ClearAllPoints() self.secondThreatBar:ClearAllPoints()
if self.moduleSettings.reverse then if self.moduleSettings.inverse then
self.secondThreatBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT") self.secondThreatBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
else else
self.secondThreatBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT") self.secondThreatBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
@ -374,14 +376,15 @@ function IceThreat.prototype:Update(unit)
self:UpdateBar( scaledPercentZeroToOne, self.color ) self:UpdateBar( scaledPercentZeroToOne, self.color )
-- do the aggro indicator bar stuff, but only if it has changed -- do the aggro indicator bar stuff, but only if it has changed
if ( self.aggroBarMulti ~= rangeMulti ) then --if ( self.aggroBarMulti ~= rangeMulti ) then
self.aggroBarMulti = rangeMulti self.aggroBarMulti = rangeMulti
local pos = IceHUD:Clamp(1 - (1 / rangeMulti), 0, 1) local pos = IceHUD:Clamp(1 - (1 / rangeMulti), 0, 1)
local fromTop = not IceHUD:xor(self.moduleSettings.reverse, self.moduleSettings.inverse)
local min_y = 0 local min_y = 0
local max_y = pos local max_y = pos
if self.moduleSettings.reverse then if not fromTop then
min_y = 1-pos min_y = 1-pos
max_y = 1 max_y = 1
end end
@ -399,7 +402,7 @@ function IceThreat.prototype:Update(unit)
end end
self.aggroBar:SetHeight(self.settings.barHeight * pos) self.aggroBar:SetHeight(self.settings.barHeight * pos)
end --end
self:UpdateAlpha() self:UpdateAlpha()
self:UpdateSecondHighestThreatBar(secondHighestThreat, threatValue) self:UpdateSecondHighestThreatBar(secondHighestThreat, threatValue)
@ -411,9 +414,13 @@ function IceThreat.prototype:UpdateSecondHighestThreatBar(secondHighestThreat, t
else else
local pos = IceHUD:Clamp(secondHighestThreat / threatValue, 0, 1) local pos = IceHUD:Clamp(secondHighestThreat / threatValue, 0, 1)
if self.moduleSettings.reverse then
pos = 1-pos
end
local min_y = 0 local min_y = 0
local max_y = pos local max_y = pos
if self.moduleSettings.reverse then if self.moduleSettings.inverse then
min_y = 1-pos min_y = 1-pos
max_y = 1 max_y = 1
end end