- 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
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()
end
local function xor(val1, val2)
return val1 and not val2 or val2 and not val1
end
-- OVERRIDE
function CastBar.prototype:SpellCastStart(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: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")
else
self.lagBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
@ -453,7 +449,7 @@ function CastBar.prototype:SpellCastStart(unit, spell, rank)
local min_y = 0
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
max_y = 1
end
@ -483,7 +479,7 @@ function CastBar.prototype:SpellCastChannelStart(unit)
return
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
lagTop = not lagTop
end

View File

@ -202,11 +202,13 @@ function IceThreat.prototype:CreateAggroBar()
self.aggroBar = CreateFrame("Frame", nil, self.frame)
end
local aggroTop = not IceHUD:xor(self.moduleSettings.reverse, self.moduleSettings.inverse)
self.aggroBar:SetFrameStrata("BACKGROUND")
self.aggroBar:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
self.aggroBar:SetHeight(self.settings.barHeight)
self.aggroBar:ClearAllPoints()
if not self.moduleSettings.reverse then
if aggroTop then
self.aggroBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
else
self.aggroBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
@ -236,12 +238,12 @@ function IceThreat.prototype:CreateSecondThreatBar()
if not (self.secondThreatBar) then
self.secondThreatBar = CreateFrame("Frame", nil, self.frame)
end
self.secondThreatBar:SetFrameStrata("MEDIUM")
self.secondThreatBar:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
self.secondThreatBar:SetHeight(self.settings.barHeight)
self.secondThreatBar:ClearAllPoints()
if self.moduleSettings.reverse then
if self.moduleSettings.inverse then
self.secondThreatBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
else
self.secondThreatBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
@ -374,14 +376,15 @@ function IceThreat.prototype:Update(unit)
self:UpdateBar( scaledPercentZeroToOne, self.color )
-- 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
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 max_y = pos
if self.moduleSettings.reverse then
if not fromTop then
min_y = 1-pos
max_y = 1
end
@ -399,7 +402,7 @@ function IceThreat.prototype:Update(unit)
end
self.aggroBar:SetHeight(self.settings.barHeight * pos)
end
--end
self:UpdateAlpha()
self:UpdateSecondHighestThreatBar(secondHighestThreat, threatValue)
@ -411,9 +414,13 @@ function IceThreat.prototype:UpdateSecondHighestThreatBar(secondHighestThreat, t
else
local pos = IceHUD:Clamp(secondHighestThreat / threatValue, 0, 1)
if self.moduleSettings.reverse then
pos = 1-pos
end
local min_y = 0
local max_y = pos
if self.moduleSettings.reverse then
if self.moduleSettings.inverse then
min_y = 1-pos
max_y = 1
end