mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- 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:
@ -8,10 +8,6 @@ IceBarElement.virtual = true
|
||||
IceBarElement.BarTextureWidth = 128
|
||||
|
||||
IceBarElement.prototype.barFrame = nil
|
||||
IceBarElement.prototype.backroundAlpha = nil
|
||||
|
||||
IceBarElement.prototype.combat = nil
|
||||
IceBarElement.prototype.target = nil
|
||||
|
||||
IceBarElement.prototype.CurrLerpTime = 0
|
||||
IceBarElement.prototype.LastScale = 1
|
||||
@ -37,11 +33,6 @@ end
|
||||
function IceBarElement.prototype:Enable()
|
||||
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
|
||||
local origDefaults = self:GetDefaultSettings()
|
||||
|
||||
@ -467,6 +458,7 @@ function IceBarElement.prototype:Redraw()
|
||||
|
||||
self.alpha = self.settings.alphaooc
|
||||
self:CreateFrame()
|
||||
|
||||
self.frame:SetAlpha(self.alpha)
|
||||
end
|
||||
|
||||
@ -714,6 +706,11 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha)
|
||||
self.backgroundAlpha = self.settings.alphaoocbg
|
||||
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.barFrame:SetStatusBarColor(self:GetColor(color))
|
||||
|
||||
@ -843,30 +840,3 @@ end
|
||||
function IceBarElement.prototype:MyOnUpdate()
|
||||
self:SetScale(self.barFrame.bar, self.DesiredScale)
|
||||
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
|
||||
|
@ -13,6 +13,10 @@ IceElement.prototype.frame = nil
|
||||
|
||||
IceElement.prototype.defaultColors = {} -- Shared table for all child classes to save some memory
|
||||
IceElement.prototype.alpha = nil
|
||||
IceElement.prototype.backroundAlpha = nil
|
||||
|
||||
IceElement.prototype.combat = nil
|
||||
IceElement.prototype.target = nil
|
||||
|
||||
IceElement.settings = nil
|
||||
IceElement.moduleSettings = nil
|
||||
@ -78,6 +82,12 @@ function IceElement.prototype:Enable(core)
|
||||
if (not core) then
|
||||
self.moduleSettings.enabled = true
|
||||
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)
|
||||
end
|
||||
|
||||
@ -145,6 +155,25 @@ function IceElement.prototype:GetOptions()
|
||||
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
|
||||
end
|
||||
|
||||
@ -156,6 +185,7 @@ function IceElement.prototype:GetDefaultSettings()
|
||||
local defaults = {}
|
||||
defaults["enabled"] = true
|
||||
defaults["scale"] = 1
|
||||
defaults["alwaysFullAlpha"] = false
|
||||
return defaults
|
||||
end
|
||||
|
||||
@ -170,6 +200,30 @@ function IceElement.prototype:CreateFrame()
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -264,6 +318,16 @@ function IceElement.prototype:FontFactory(size, frame, font, flags)
|
||||
end
|
||||
|
||||
|
||||
function IceElement.prototype:UseTargetAlpha(scale)
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
function IceElement.prototype:Update()
|
||||
self:UpdateAlpha()
|
||||
end
|
||||
|
||||
|
||||
function IceElement.prototype:IsVisible()
|
||||
return self.bIsVisible
|
||||
end
|
||||
@ -292,6 +356,32 @@ function IceElement.prototype:OnCoreLoad()
|
||||
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
|
||||
|
@ -109,6 +109,7 @@ function ComboPoints.prototype:GetDefaultSettings()
|
||||
defaults["comboMode"] = "Numeric"
|
||||
defaults["gradient"] = false
|
||||
defaults["usesDogTagStrings"] = false
|
||||
defaults["alwaysFullAlpha"] = true
|
||||
return defaults
|
||||
end
|
||||
|
||||
|
@ -110,6 +110,7 @@ function LacerateCount.prototype:GetDefaultSettings()
|
||||
defaults["lacerateMode"] = "Numeric"
|
||||
defaults["gradient"] = false
|
||||
defaults["usesDogTagStrings"] = false
|
||||
defaults["alwaysFullAlpha"] = true
|
||||
return defaults
|
||||
end
|
||||
|
||||
|
@ -110,6 +110,7 @@ function SunderCount.prototype:GetDefaultSettings()
|
||||
defaults["sunderMode"] = "Numeric"
|
||||
defaults["gradient"] = false
|
||||
defaults["usesDogTagStrings"] = false
|
||||
defaults["alwaysFullAlpha"] = true
|
||||
return defaults
|
||||
end
|
||||
|
||||
|
@ -18,7 +18,7 @@ TargetInfo.prototype.classLocale = nil
|
||||
TargetInfo.prototype.classEnglish = nil
|
||||
TargetInfo.prototype.leader = nil
|
||||
|
||||
TargetInfo.prototype.combat = nil
|
||||
TargetInfo.prototype.targetCombat = nil
|
||||
TargetInfo.prototype.pvp = nil
|
||||
TargetInfo.prototype.level = nil
|
||||
TargetInfo.prototype.classification = nil
|
||||
@ -48,7 +48,6 @@ end
|
||||
function TargetInfo.prototype:Enable(core)
|
||||
TargetInfo.super.prototype.Enable(self, core)
|
||||
|
||||
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
|
||||
self:RegisterEvent("UNIT_AURA", "AuraChanged")
|
||||
|
||||
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["line3Tag"] = "[Guild:Angle]"
|
||||
defaults["myTagVersion"] = 2
|
||||
defaults["alwaysFullAlpha"] = true
|
||||
|
||||
return defaults
|
||||
end
|
||||
@ -555,8 +555,6 @@ function TargetInfo.prototype:CreateGuildTextFrame()
|
||||
self.frame.targetGuild:SetJustifyH("CENTER")
|
||||
self.frame.targetGuild:SetJustifyV("TOP")
|
||||
|
||||
self.frame.targetGuild:SetAlpha(0.6)
|
||||
|
||||
self.frame.targetGuild:SetPoint("TOP", self.frame, "BOTTOM", 0, 0)
|
||||
self.frame.targetGuild:Show()
|
||||
end
|
||||
@ -870,6 +868,8 @@ end
|
||||
|
||||
|
||||
function TargetInfo.prototype:TargetChanged()
|
||||
TargetInfo.super.prototype.TargetChanged(self)
|
||||
|
||||
if (not UnitExists(target)) then
|
||||
--self.frame:Hide()
|
||||
--self.frame.target:Hide()
|
||||
@ -996,7 +996,7 @@ end
|
||||
function TargetInfo.prototype:TargetFlags(unit)
|
||||
if (unit == target or unit == internal) then
|
||||
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:Update(unit)
|
||||
end
|
||||
@ -1020,7 +1020,7 @@ function TargetInfo.prototype:Update(unit)
|
||||
|
||||
if DogTag == nil or self.moduleSettings.line2Tag == '' then
|
||||
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)
|
||||
end
|
||||
|
||||
@ -1038,6 +1038,8 @@ function TargetInfo.prototype:Update(unit)
|
||||
DogTag:UpdateFontString(self.frame.targetInfo)
|
||||
DogTag:UpdateFontString(self.frame.targetGuild)
|
||||
end
|
||||
|
||||
self:UpdateAlpha()
|
||||
end
|
||||
|
||||
|
||||
|
@ -210,7 +210,6 @@ end
|
||||
function TargetOfTarget.prototype:Enable(core)
|
||||
TargetOfTarget.super.prototype.Enable(self, core)
|
||||
|
||||
self:RegisterEvent("PLAYER_TARGET_CHANGED", "Update")
|
||||
self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.2, self)
|
||||
RegisterUnitWatch(self.frame)
|
||||
|
||||
@ -476,6 +475,8 @@ function TargetOfTarget.prototype:Update()
|
||||
self.frame.bar.texture:SetVertexColor(self:GetColor(unitClass, 0.7))
|
||||
self.frame.bar:SetMinMaxValues(0, maxHealth)
|
||||
self.frame.bar:SetValue(health)
|
||||
|
||||
self:UpdateAlpha()
|
||||
end
|
||||
|
||||
|
||||
|
@ -88,7 +88,6 @@ end
|
||||
function IHUD_Threat.prototype:Enable(core)
|
||||
IHUD_Threat.super.prototype.Enable(self, core)
|
||||
|
||||
self:RegisterEvent("PLAYER_TARGET_CHANGED", "Update")
|
||||
self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.2, self)
|
||||
|
||||
self:Update(self.unit)
|
||||
@ -108,6 +107,11 @@ function IHUD_Threat.prototype:CreateFrame()
|
||||
self:CreateAggroBar()
|
||||
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
|
||||
function IHUD_Threat.prototype:CreateAggroBar()
|
||||
if not (self.aggroBar) then
|
||||
@ -217,6 +221,8 @@ function IHUD_Threat.prototype:Update(unit)
|
||||
|
||||
self.aggroBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, y)
|
||||
end
|
||||
|
||||
self:UpdateAlpha()
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user