- made alpha settings properly affect non-bar elements (range finder, targetinfo, combo points, etc.)

- something's busted with the rune module if you spawn into the world and that module is at 0% alpha...trying to track that down now, but i gotta go to bed. could be a result of this change, maybe not.
This commit is contained in:
Parnic
2008-10-17 06:46:11 +00:00
parent db690aa956
commit 473e77e2da
8 changed files with 116 additions and 44 deletions

View File

@ -8,10 +8,6 @@ IceBarElement.virtual = true
IceBarElement.BarTextureWidth = 128 IceBarElement.BarTextureWidth = 128
IceBarElement.prototype.barFrame = nil IceBarElement.prototype.barFrame = nil
IceBarElement.prototype.backroundAlpha = nil
IceBarElement.prototype.combat = nil
IceBarElement.prototype.target = nil
IceBarElement.prototype.CurrLerpTime = 0 IceBarElement.prototype.CurrLerpTime = 0
IceBarElement.prototype.LastScale = 1 IceBarElement.prototype.LastScale = 1
@ -37,11 +33,6 @@ end
function IceBarElement.prototype:Enable() function IceBarElement.prototype:Enable()
IceBarElement.super.prototype.Enable(self) IceBarElement.super.prototype.Enable(self)
self:RegisterEvent("PLAYER_REGEN_DISABLED", "InCombat")
self:RegisterEvent("PLAYER_REGEN_ENABLED", "OutCombat")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckCombat")
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
if self.moduleSettings.myTagVersion < IceHUD.CurrTagVersion then if self.moduleSettings.myTagVersion < IceHUD.CurrTagVersion then
local origDefaults = self:GetDefaultSettings() local origDefaults = self:GetDefaultSettings()
@ -467,6 +458,7 @@ function IceBarElement.prototype:Redraw()
self.alpha = self.settings.alphaooc self.alpha = self.settings.alphaooc
self:CreateFrame() self:CreateFrame()
self.frame:SetAlpha(self.alpha) self.frame:SetAlpha(self.alpha)
end end
@ -714,6 +706,11 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha)
self.backgroundAlpha = self.settings.alphaoocbg self.backgroundAlpha = self.settings.alphaoocbg
end end
-- post-process override for the bar alpha to be 1 (ignoring BG alpha for now)
if self.moduleSettings.alwaysFullAlpha then
self.alpha = 1
end
self.frame:SetStatusBarColor(r, g, b, self.backgroundAlpha) self.frame:SetStatusBarColor(r, g, b, self.backgroundAlpha)
self.barFrame:SetStatusBarColor(self:GetColor(color)) self.barFrame:SetStatusBarColor(self:GetColor(color))
@ -843,30 +840,3 @@ end
function IceBarElement.prototype:MyOnUpdate() function IceBarElement.prototype:MyOnUpdate()
self:SetScale(self.barFrame.bar, self.DesiredScale) self:SetScale(self.barFrame.bar, self.DesiredScale)
end end
-- Combat event handlers ------------------------------------------------------
function IceBarElement.prototype:InCombat()
self.combat = true
self:Update(self.unit)
end
function IceBarElement.prototype:OutCombat()
self.combat = false
self:Update(self.unit)
end
function IceBarElement.prototype:CheckCombat()
self.combat = UnitAffectingCombat("player")
self.target = UnitExists("target")
self:Update(self.unit)
end
function IceBarElement.prototype:TargetChanged()
self.target = UnitExists("target")
self:Update(self.unit)
end

View File

@ -13,6 +13,10 @@ IceElement.prototype.frame = nil
IceElement.prototype.defaultColors = {} -- Shared table for all child classes to save some memory IceElement.prototype.defaultColors = {} -- Shared table for all child classes to save some memory
IceElement.prototype.alpha = nil IceElement.prototype.alpha = nil
IceElement.prototype.backroundAlpha = nil
IceElement.prototype.combat = nil
IceElement.prototype.target = nil
IceElement.settings = nil IceElement.settings = nil
IceElement.moduleSettings = nil IceElement.moduleSettings = nil
@ -78,6 +82,12 @@ function IceElement.prototype:Enable(core)
if (not core) then if (not core) then
self.moduleSettings.enabled = true self.moduleSettings.enabled = true
end end
self:RegisterEvent("PLAYER_REGEN_DISABLED", "InCombat")
self:RegisterEvent("PLAYER_REGEN_ENABLED", "OutCombat")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckCombat")
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
self:Show(true) self:Show(true)
end end
@ -145,6 +155,25 @@ function IceElement.prototype:GetOptions()
order = 21 order = 21
} }
opts["alwaysFullAlpha"] =
{
type = 'toggle',
name = 'Always show at 100% alpha',
desc = 'Whether to always show this module at 100% alpha or not',
get = function()
return self.moduleSettings.alwaysFullAlpha
end,
set = function(value)
self.moduleSettings.alwaysFullAlpha = value
self:Update(self.unit)
self:Redraw()
end,
disabled = function()
return not self.moduleSettings.enabled
end,
order = 22
}
return opts return opts
end end
@ -156,6 +185,7 @@ function IceElement.prototype:GetDefaultSettings()
local defaults = {} local defaults = {}
defaults["enabled"] = true defaults["enabled"] = true
defaults["scale"] = 1 defaults["scale"] = 1
defaults["alwaysFullAlpha"] = false
return defaults return defaults
end end
@ -170,6 +200,30 @@ function IceElement.prototype:CreateFrame()
end end
self.frame:SetScale(self.moduleSettings.scale) self.frame:SetScale(self.moduleSettings.scale)
self:UpdateAlpha()
end
function IceElement.prototype:UpdateAlpha()
if self.moduleSettings.alwaysFullAlpha then
self.frame:SetAlpha(1)
return
end
self.alpha = self.settings.alphaooc
if (self.combat) then
self.alpha = self.settings.alphaic
self.backgroundAlpha = self.settings.alphaicbg
elseif (self.target or self:UseTargetAlpha(scale)) then
self.alpha = self.settings.alphaTarget
self.backgroundAlpha = self.settings.alphaTargetbg
else
self.alpha = self.settings.alphaooc
self.backgroundAlpha = self.settings.alphaoocbg
end
self.frame:SetAlpha(self.alpha)
end end
@ -264,6 +318,16 @@ function IceElement.prototype:FontFactory(size, frame, font, flags)
end end
function IceElement.prototype:UseTargetAlpha(scale)
return false
end
function IceElement.prototype:Update()
self:UpdateAlpha()
end
function IceElement.prototype:IsVisible() function IceElement.prototype:IsVisible()
return self.bIsVisible return self.bIsVisible
end end
@ -292,6 +356,32 @@ function IceElement.prototype:OnCoreLoad()
end end
-- Combat event handlers ------------------------------------------------------
function IceElement.prototype:InCombat()
self.combat = true
self:Update(self.unit)
end
function IceElement.prototype:OutCombat()
self.combat = false
self:Update(self.unit)
end
function IceElement.prototype:CheckCombat()
self.combat = UnitAffectingCombat("player")
self.target = UnitExists("target")
self:Update(self.unit)
end
function IceElement.prototype:TargetChanged()
self.target = UnitExists("target")
self:Update(self.unit)
end
-- Inherited classes should just instantiate themselves and let -- Inherited classes should just instantiate themselves and let

View File

@ -109,6 +109,7 @@ function ComboPoints.prototype:GetDefaultSettings()
defaults["comboMode"] = "Numeric" defaults["comboMode"] = "Numeric"
defaults["gradient"] = false defaults["gradient"] = false
defaults["usesDogTagStrings"] = false defaults["usesDogTagStrings"] = false
defaults["alwaysFullAlpha"] = true
return defaults return defaults
end end

View File

@ -110,6 +110,7 @@ function LacerateCount.prototype:GetDefaultSettings()
defaults["lacerateMode"] = "Numeric" defaults["lacerateMode"] = "Numeric"
defaults["gradient"] = false defaults["gradient"] = false
defaults["usesDogTagStrings"] = false defaults["usesDogTagStrings"] = false
defaults["alwaysFullAlpha"] = true
return defaults return defaults
end end

View File

@ -110,6 +110,7 @@ function SunderCount.prototype:GetDefaultSettings()
defaults["sunderMode"] = "Numeric" defaults["sunderMode"] = "Numeric"
defaults["gradient"] = false defaults["gradient"] = false
defaults["usesDogTagStrings"] = false defaults["usesDogTagStrings"] = false
defaults["alwaysFullAlpha"] = true
return defaults return defaults
end end

View File

@ -18,7 +18,7 @@ TargetInfo.prototype.classLocale = nil
TargetInfo.prototype.classEnglish = nil TargetInfo.prototype.classEnglish = nil
TargetInfo.prototype.leader = nil TargetInfo.prototype.leader = nil
TargetInfo.prototype.combat = nil TargetInfo.prototype.targetCombat = nil
TargetInfo.prototype.pvp = nil TargetInfo.prototype.pvp = nil
TargetInfo.prototype.level = nil TargetInfo.prototype.level = nil
TargetInfo.prototype.classification = nil TargetInfo.prototype.classification = nil
@ -48,7 +48,6 @@ end
function TargetInfo.prototype:Enable(core) function TargetInfo.prototype:Enable(core)
TargetInfo.super.prototype.Enable(self, core) TargetInfo.super.prototype.Enable(self, core)
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
self:RegisterEvent("UNIT_AURA", "AuraChanged") self:RegisterEvent("UNIT_AURA", "AuraChanged")
self:RegisterEvent("UNIT_NAME_UPDATE", "TargetName") self:RegisterEvent("UNIT_NAME_UPDATE", "TargetName")
@ -386,6 +385,7 @@ function TargetInfo.prototype:GetDefaultSettings()
defaults["line2Tag"] = "[Level:DifficultyColor] [SmartRace:ClassColor] [SmartClass:ClassColor] [PvPIcon] [IsLeader ? 'Leader':Yellow] [InCombat ? 'Combat':Red] [Classification]" defaults["line2Tag"] = "[Level:DifficultyColor] [SmartRace:ClassColor] [SmartClass:ClassColor] [PvPIcon] [IsLeader ? 'Leader':Yellow] [InCombat ? 'Combat':Red] [Classification]"
defaults["line3Tag"] = "[Guild:Angle]" defaults["line3Tag"] = "[Guild:Angle]"
defaults["myTagVersion"] = 2 defaults["myTagVersion"] = 2
defaults["alwaysFullAlpha"] = true
return defaults return defaults
end end
@ -555,8 +555,6 @@ function TargetInfo.prototype:CreateGuildTextFrame()
self.frame.targetGuild:SetJustifyH("CENTER") self.frame.targetGuild:SetJustifyH("CENTER")
self.frame.targetGuild:SetJustifyV("TOP") self.frame.targetGuild:SetJustifyV("TOP")
self.frame.targetGuild:SetAlpha(0.6)
self.frame.targetGuild:SetPoint("TOP", self.frame, "BOTTOM", 0, 0) self.frame.targetGuild:SetPoint("TOP", self.frame, "BOTTOM", 0, 0)
self.frame.targetGuild:Show() self.frame.targetGuild:Show()
end end
@ -870,6 +868,8 @@ end
function TargetInfo.prototype:TargetChanged() function TargetInfo.prototype:TargetChanged()
TargetInfo.super.prototype.TargetChanged(self)
if (not UnitExists(target)) then if (not UnitExists(target)) then
--self.frame:Hide() --self.frame:Hide()
--self.frame.target:Hide() --self.frame.target:Hide()
@ -996,7 +996,7 @@ end
function TargetInfo.prototype:TargetFlags(unit) function TargetInfo.prototype:TargetFlags(unit)
if (unit == target or unit == internal) then if (unit == target or unit == internal) then
self.tapped = UnitIsTapped(target) and (not UnitIsTappedByPlayer(target)) self.tapped = UnitIsTapped(target) and (not UnitIsTappedByPlayer(target))
self.combat = UnitAffectingCombat(target) and " |cffee4030Combat|r" or "" self.targetCombat = UnitAffectingCombat(target) and " |cffee4030Combat|r" or ""
self:UpdateBuffs() self:UpdateBuffs()
self:Update(unit) self:Update(unit)
end end
@ -1020,7 +1020,7 @@ function TargetInfo.prototype:Update(unit)
if DogTag == nil or self.moduleSettings.line2Tag == '' then if DogTag == nil or self.moduleSettings.line2Tag == '' then
local line2 = string.format("%s %s%s%s%s%s", local line2 = string.format("%s %s%s%s%s%s",
self.level or '', self.classLocale or '', self.pvp or '', self.leader or '', self.classification or '', self.combat or '') self.level or '', self.classLocale or '', self.pvp or '', self.leader or '', self.classification or '', self.targetCombat or '')
self.frame.targetInfo:SetText(line2) self.frame.targetInfo:SetText(line2)
end end
@ -1038,6 +1038,8 @@ function TargetInfo.prototype:Update(unit)
DogTag:UpdateFontString(self.frame.targetInfo) DogTag:UpdateFontString(self.frame.targetInfo)
DogTag:UpdateFontString(self.frame.targetGuild) DogTag:UpdateFontString(self.frame.targetGuild)
end end
self:UpdateAlpha()
end end

View File

@ -210,7 +210,6 @@ end
function TargetOfTarget.prototype:Enable(core) function TargetOfTarget.prototype:Enable(core)
TargetOfTarget.super.prototype.Enable(self, core) TargetOfTarget.super.prototype.Enable(self, core)
self:RegisterEvent("PLAYER_TARGET_CHANGED", "Update")
self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.2, self) self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.2, self)
RegisterUnitWatch(self.frame) RegisterUnitWatch(self.frame)
@ -476,6 +475,8 @@ function TargetOfTarget.prototype:Update()
self.frame.bar.texture:SetVertexColor(self:GetColor(unitClass, 0.7)) self.frame.bar.texture:SetVertexColor(self:GetColor(unitClass, 0.7))
self.frame.bar:SetMinMaxValues(0, maxHealth) self.frame.bar:SetMinMaxValues(0, maxHealth)
self.frame.bar:SetValue(health) self.frame.bar:SetValue(health)
self:UpdateAlpha()
end end

View File

@ -88,7 +88,6 @@ end
function IHUD_Threat.prototype:Enable(core) function IHUD_Threat.prototype:Enable(core)
IHUD_Threat.super.prototype.Enable(self, core) IHUD_Threat.super.prototype.Enable(self, core)
self:RegisterEvent("PLAYER_TARGET_CHANGED", "Update")
self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.2, self) self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.2, self)
self:Update(self.unit) self:Update(self.unit)
@ -108,6 +107,11 @@ function IHUD_Threat.prototype:CreateFrame()
self:CreateAggroBar() self:CreateAggroBar()
end end
-- needs to be inverted for threat bar
function IHUD_Threat.prototype:UseTargetAlpha(scale)
return (scale and (scale > 0))
end
-- create the aggro range indicator bar -- create the aggro range indicator bar
function IHUD_Threat.prototype:CreateAggroBar() function IHUD_Threat.prototype:CreateAggroBar()
if not (self.aggroBar) then if not (self.aggroBar) then
@ -217,6 +221,8 @@ function IHUD_Threat.prototype:Update(unit)
self.aggroBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, y) self.aggroBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, y)
end end
self:UpdateAlpha()
end end