diff --git a/IceBarElement.lua b/IceBarElement.lua index 24ea18e..c83aecb 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -73,7 +73,10 @@ function IceBarElement.prototype:GetOptions() end self:Redraw() end, - validate = { "Left", "Right" }, + validate = { "Left", "Right" }, + disabled = function() + return not self.moduleSettings.enabled + end, order = 30 } @@ -92,6 +95,9 @@ function IceBarElement.prototype:GetOptions() self.moduleSettings.offset = value self:Redraw() end, + disabled = function() + return not self.moduleSettings.enabled + end, order = 31 } @@ -101,6 +107,9 @@ function IceBarElement.prototype:GetOptions() name = '|c' .. self.configColor .. 'Text Settings|r', desc = 'Settings related to texts', order = 32, + disabled = function() + return not self.moduleSettings.enabled + end, args = { fontsize = { type = 'range', @@ -368,8 +377,6 @@ function IceBarElement.prototype:SetScale(texture, scale) else texture:SetTexCoord(0, 1, 1-scale, 1) end - - self.full = (scale == 1) end @@ -385,7 +392,7 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha) if (self.combat) then self.alpha = self.settings.alphaic self.backgroundAlpha = self.settings.alphaicbg - elseif (self.target or (scale < 1)) then + elseif (self.target or self:UseTargetAlpha(scale)) then self.alpha = self.settings.alphaTarget self.backgroundAlpha = self.settings.alphaTargetbg else @@ -400,6 +407,10 @@ function IceBarElement.prototype:UpdateBar(scale, color, alpha) end +function IceBarElement.prototype:UseTargetAlpha(scale) + return (scale and (scale < 1)) +end + -- Bottom line 1 function IceBarElement.prototype:SetBottomText1(text, color) diff --git a/IceCore.lua b/IceCore.lua index 6bced5e..e086463 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -72,18 +72,17 @@ end function IceCore.prototype:Enable() self.settings = self.db.account - - IceElement.Alpha = self.settings.bar + self:DrawFrame() for i = 1, table.getn(self.elements) do self.elements[i]:SetDatabase(self.settings) self.elements[i]:Create(self.IceHUDFrame) if (self.elements[i]:IsEnabled()) then - self.elements[i]:Enable() + self.elements[i]:Enable(true) end end - + self.enabled = true end @@ -91,7 +90,7 @@ end function IceCore.prototype:Disable() for i = 1, table.getn(self.elements) do if (self.elements[i]:IsEnabled()) then - self.elements[i]:Disable() + self.elements[i]:Disable(true) end end diff --git a/IceElement.lua b/IceElement.lua index 6512915..3c007b1 100644 --- a/IceElement.lua +++ b/IceElement.lua @@ -71,17 +71,24 @@ function IceElement.prototype:IsEnabled() end -function IceElement.prototype:Enable() +function IceElement.prototype:Enable(core) + if (not core) then + self.moduleSettings.enabled = true + end self.frame:Show() end -function IceElement.prototype:Disable() +function IceElement.prototype:Disable(core) + if (not core) then + self.moduleSettings.enabled = false + end self.frame:Hide() self:UnregisterAllEvents() end + -- inherting classes should override this and provide -- make sure they refresh any changes made to them function IceElement.prototype:Redraw() @@ -104,7 +111,7 @@ function IceElement.prototype:GetOptions() set = function(value) self.moduleSettings.enabled = value if (value) then - self:Enable() + self:Enable(true) else self:Disable() end @@ -129,6 +136,9 @@ function IceElement.prototype:GetOptions() self.moduleSettings.scale = value self:Redraw() end, + disabled = function() + return not self.moduleSettings.enabled + end, order = 21 } @@ -155,7 +165,7 @@ function IceElement.prototype:CreateFrame() if not (self.frame) then self.frame = CreateFrame("Frame", "IceHUD_"..self.name, self.parent) end - + self.frame:SetScale(self.moduleSettings.scale) end diff --git a/IceHUD.toc b/IceHUD.toc index faa8fb9..cbe45e9 100644 --- a/IceHUD.toc +++ b/IceHUD.toc @@ -1,4 +1,4 @@ -## Interface: 11100 +## Interface: 11200 ## Author: Iceroth ## Name: IceHUD ## Title: IceHUD |cff7fff7f -Ace2-|r diff --git a/modules/CastBar.lua b/modules/CastBar.lua index be92b21..fb38d27 100644 --- a/modules/CastBar.lua +++ b/modules/CastBar.lua @@ -42,8 +42,8 @@ end -function CastBar.prototype:Enable() - CastBar.super.prototype.Enable(self) +function CastBar.prototype:Enable(core) + CastBar.super.prototype.Enable(self, core) self:RegisterEvent("SPELLCAST_START", "CastStart") self:RegisterEvent("SPELLCAST_STOP", "CastStop") @@ -63,8 +63,8 @@ function CastBar.prototype:Enable() end -function CastBar.prototype:Disable() - CastBar.super.prototype.Disable(self) +function CastBar.prototype:Disable(core) + CastBar.super.prototype.Disable(self, core) CastingBarFrame:RegisterEvent("SPELLCAST_START"); CastingBarFrame:RegisterEvent("SPELLCAST_STOP"); diff --git a/modules/ComboPoints.lua b/modules/ComboPoints.lua index 505528b..902466f 100644 --- a/modules/ComboPoints.lua +++ b/modules/ComboPoints.lua @@ -35,6 +35,9 @@ function ComboPoints.prototype:GetOptions() min = -300, max = 200, step = 10, + disabled = function() + return not self.moduleSettings.enabled + end, order = 31 } @@ -52,6 +55,9 @@ function ComboPoints.prototype:GetOptions() min = 10, max = 40, step = 1, + disabled = function() + return not self.moduleSettings.enabled + end, order = 32 } @@ -67,6 +73,9 @@ function ComboPoints.prototype:GetOptions() self:Redraw() end, validate = { "Numeric", "Graphical" }, + disabled = function() + return not self.moduleSettings.enabled + end, order = 33 } @@ -94,8 +103,8 @@ end -- OVERRIDE -function ComboPoints.prototype:Enable() - ComboPoints.super.prototype.Enable(self) +function ComboPoints.prototype:Enable(core) + ComboPoints.super.prototype.Enable(self, core) self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateComboPoints") self:RegisterEvent("PLAYER_COMBO_POINTS", "UpdateComboPoints") @@ -149,7 +158,7 @@ function ComboPoints.prototype:CreateComboFrame() self.frame.graphicalBG[i]:SetWidth(self.comboSize) self.frame.graphicalBG[i]:SetHeight(self.comboSize) self.frame.graphicalBG[i]:SetPoint("TOPLEFT", (i-1) * (self.comboSize-5) + (i-1), 0) - self.frame.graphicalBG[i]:SetAlpha(0.3) + self.frame.graphicalBG[i]:SetAlpha(0.15) self.frame.graphicalBG[i]:SetStatusBarColor(self:GetColor("combo")) self.frame.graphicalBG[i]:Hide() @@ -164,9 +173,7 @@ function ComboPoints.prototype:CreateComboFrame() self.frame.graphical[i]:SetFrameStrata("BACKGROUND") self.frame.graphical[i]:SetAllPoints(self.frame.graphicalBG[i]) - local r, g, b = self:GetColor("combo") - g = g - (0.15*i) - self.frame.graphical[i]:SetStatusBarColor(r, g, b) + self.frame.graphical[i]:SetStatusBarColor(self:GetColor("combo")) self.frame.graphical[i]:Hide() end diff --git a/modules/DruidMana.lua b/modules/DruidMana.lua index fa20386..49e492c 100644 --- a/modules/DruidMana.lua +++ b/modules/DruidMana.lua @@ -27,8 +27,8 @@ function DruidMana.prototype:GetDefaultSettings() end -function DruidMana.prototype:Enable() - DruidMana.super.prototype.Enable(self) +function DruidMana.prototype:Enable(core) + DruidMana.super.prototype.Enable(self, core) if (IsAddOnLoaded("SoleManax")) then self.mode = "SoleManax" @@ -47,8 +47,8 @@ function DruidMana.prototype:Enable() end -function DruidMana.prototype:Disable() - DruidMana.super.prototype.Disable(self) +function DruidMana.prototype:Disable(core) + DruidMana.super.prototype.Disable(self, core) if (IsAddOnLoaded("SoleManax")) then SoleManax.DelUser(self.UpdateSoleManax) diff --git a/modules/MirrorBar.lua b/modules/MirrorBar.lua index aceaf61..430a644 100644 --- a/modules/MirrorBar.lua +++ b/modules/MirrorBar.lua @@ -38,8 +38,8 @@ function MirrorBar.prototype:UpdatePosition(side, offset) end -function MirrorBar.prototype:Enable() - MirrorBar.super.prototype.Enable(self) +function MirrorBar.prototype:Enable(core) + MirrorBar.super.prototype.Enable(self, core) self.frame.bottomUpperText:SetWidth(200) self.frame.bottomLowerText:SetWidth(200) @@ -316,8 +316,8 @@ function MirrorBarHandler.prototype:GetOptions() end -function MirrorBarHandler.prototype:Enable() - MirrorBarHandler.super.prototype.Enable(self) +function MirrorBarHandler.prototype:Enable(core) + MirrorBarHandler.super.prototype.Enable(self, core) self:RegisterEvent("MIRROR_TIMER_START", "MirrorStart") self:RegisterEvent("MIRROR_TIMER_STOP", "MirrorStop") self:RegisterEvent("MIRROR_TIMER_PAUSE", "MirrorPause") @@ -327,8 +327,8 @@ function MirrorBarHandler.prototype:Enable() end -function MirrorBarHandler.prototype:Disable() - MirrorBarHandler.super.prototype.Disable(self) +function MirrorBarHandler.prototype:Disable(core) + MirrorBarHandler.super.prototype.Disable(self, core) UIParent:RegisterEvent("MIRROR_TIMER_START"); end diff --git a/modules/PetHealth.lua b/modules/PetHealth.lua index 6c04522..58c3b11 100644 --- a/modules/PetHealth.lua +++ b/modules/PetHealth.lua @@ -38,8 +38,8 @@ function PetHealth.prototype:CreateFrame() end -function PetHealth.prototype:Enable() - PetHealth.super.prototype.Enable(self) +function PetHealth.prototype:Enable(core) + PetHealth.super.prototype.Enable(self, core) self:RegisterEvent("PET_UI_UPDATE", "CheckPet"); self:RegisterEvent("PLAYER_PET_CHANGED", "CheckPet"); diff --git a/modules/PetMana.lua b/modules/PetMana.lua index 6b36747..46d4734 100644 --- a/modules/PetMana.lua +++ b/modules/PetMana.lua @@ -41,8 +41,8 @@ function PetMana.prototype:CreateFrame() end -function PetMana.prototype:Enable() - PetMana.super.prototype.Enable(self) +function PetMana.prototype:Enable(core) + PetMana.super.prototype.Enable(self, core) self:RegisterEvent("PET_UI_UPDATE", "CheckPet"); self:RegisterEvent("PLAYER_PET_CHANGED", "CheckPet"); diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua index e415114..dd47fc3 100644 --- a/modules/PlayerHealth.lua +++ b/modules/PlayerHealth.lua @@ -18,9 +18,9 @@ function PlayerHealth.prototype:GetDefaultSettings() end -function PlayerHealth.prototype:Enable() - PlayerHealth.super.prototype.Enable(self) - +function PlayerHealth.prototype:Enable(core) + PlayerHealth.super.prototype.Enable(self, core) + self:RegisterEvent("UNIT_HEALTH", "Update") self:RegisterEvent("UNIT_MAXHEALTH", "Update") diff --git a/modules/PlayerMana.lua b/modules/PlayerMana.lua index 58465c7..3924700 100644 --- a/modules/PlayerMana.lua +++ b/modules/PlayerMana.lua @@ -42,6 +42,9 @@ function PlayerMana.prototype:GetOptions() self.moduleSettings.tickerEnabled = value self:ManaType(self.unit) end, + disabled = function() + return not self.moduleSettings.enabled + end, order = 51 } @@ -60,6 +63,9 @@ function PlayerMana.prototype:GetOptions() self.moduleSettings.tickerAlpha = value self.tickerFrame:SetStatusBarColor(self:GetColor("playerEnergy", self.moduleSettings.tickerAlpha)) end, + disabled = function() + return not self.moduleSettings.enabled + end, order = 52 } @@ -67,8 +73,8 @@ function PlayerMana.prototype:GetOptions() end -function PlayerMana.prototype:Enable() - PlayerMana.super.prototype.Enable(self) +function PlayerMana.prototype:Enable(core) + PlayerMana.super.prototype.Enable(self, core) self:CreateTickerFrame() @@ -88,11 +94,21 @@ end -- OVERRIDE function PlayerMana.prototype:Redraw() PlayerMana.super.prototype.Redraw(self) - + self:CreateTickerFrame() end +-- OVERRIDE +function PlayerMana.prototype:UseTargetAlpha(scale) + if (self.manaType == 1) then + return (scale and (scale > 0)) + else + return PlayerMana.super.prototype.UseTargetAlpha(self, scale) + end +end + + function PlayerMana.prototype:ManaType(unit) if (unit ~= self.unit) then return diff --git a/modules/TargetHealth.lua b/modules/TargetHealth.lua index d311811..3c8c2b5 100644 --- a/modules/TargetHealth.lua +++ b/modules/TargetHealth.lua @@ -42,6 +42,9 @@ function TargetHealth.prototype:GetOptions() disabled = function() return (MobHealth3 == nil) end, + disabled = function() + return not self.moduleSettings.enabled + end, order = 40 } @@ -49,8 +52,8 @@ function TargetHealth.prototype:GetOptions() end -function TargetHealth.prototype:Enable() - TargetHealth.super.prototype.Enable(self) +function TargetHealth.prototype:Enable(core) + TargetHealth.super.prototype.Enable(self, core) self:RegisterEvent("UNIT_HEALTH", "Update") self:RegisterEvent("UNIT_MAXHEALTH", "Update") @@ -59,8 +62,8 @@ function TargetHealth.prototype:Enable() end -function TargetHealth.prototype:Disable() - TargetHealth.super.prototype.Disable(self) +function TargetHealth.prototype:Disable(core) + TargetHealth.super.prototype.Disable(self, core) end diff --git a/modules/TargetInfo.lua b/modules/TargetInfo.lua index dd2e221..92d029a 100644 --- a/modules/TargetInfo.lua +++ b/modules/TargetInfo.lua @@ -38,6 +38,9 @@ function TargetInfo.prototype:GetOptions() min = -300, max = 300, step = 10, + disabled = function() + return not self.moduleSettings.enabled + end, order = 31 } @@ -55,6 +58,9 @@ function TargetInfo.prototype:GetOptions() min = 8, max = 20, step = 1, + disabled = function() + return not self.moduleSettings.enabled + end, order = 32 } @@ -79,8 +85,8 @@ function TargetInfo.prototype:Redraw() end -function TargetInfo.prototype:Enable() - TargetInfo.super.prototype.Enable(self) +function TargetInfo.prototype:Enable(core) + TargetInfo.super.prototype.Enable(self, core) self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged") self:RegisterEvent("UNIT_AURA", "AuraChanged") diff --git a/modules/TargetMana.lua b/modules/TargetMana.lua index 263ebda..7f92692 100644 --- a/modules/TargetMana.lua +++ b/modules/TargetMana.lua @@ -22,8 +22,8 @@ function TargetMana.prototype:GetDefaultSettings() end -function TargetMana.prototype:Enable() - TargetMana.super.prototype.Enable(self) +function TargetMana.prototype:Enable(core) + TargetMana.super.prototype.Enable(self, core) self:RegisterEvent("UNIT_MANA", "Update") self:RegisterEvent("UNIT_MAXMANA", "Update") diff --git a/modules/TargetOfTarget.lua b/modules/TargetOfTarget.lua index 69df680..11f6aad 100644 --- a/modules/TargetOfTarget.lua +++ b/modules/TargetOfTarget.lua @@ -39,6 +39,9 @@ function TargetOfTarget.prototype:GetOptions() min = -300, max = 300, step = 10, + disabled = function() + return not self.moduleSettings.enabled + end, order = 31 } @@ -53,6 +56,9 @@ function TargetOfTarget.prototype:GetOptions() self.moduleSettings.showDebuffs = value self:UpdateBuffs() end, + disabled = function() + return not self.moduleSettings.enabled + end, order = 32 } @@ -70,6 +76,9 @@ function TargetOfTarget.prototype:GetOptions() min = 8, max = 20, step = 1, + disabled = function() + return not self.moduleSettings.enabled + end, order = 33 } @@ -95,8 +104,8 @@ function TargetOfTarget.prototype:Redraw() end -function TargetOfTarget.prototype:Enable() - TargetOfTarget.super.prototype.Enable(self) +function TargetOfTarget.prototype:Enable(core) + TargetOfTarget.super.prototype.Enable(self, core) self:RegisterEvent("PLAYER_TARGET_CHANGED", "Update") @@ -107,8 +116,8 @@ function TargetOfTarget.prototype:Enable() end -function TargetOfTarget.prototype:Disable() - TargetOfTarget.super.prototype.Disable(self) +function TargetOfTarget.prototype:Disable(core) + TargetOfTarget.super.prototype.Disable(self, core) self:UnregisterMetro(self.name) end diff --git a/modules/TimerBar.lua b/modules/TimerBar.lua index bf31dce..3df7950 100644 --- a/modules/TimerBar.lua +++ b/modules/TimerBar.lua @@ -22,18 +22,18 @@ function TimerBar.prototype:GetDefaultSettings() end -function TimerBar.prototype:Enable() - TimerBar.super.prototype.Enable(self) - +function TimerBar.prototype:Enable(core) + TimerBar.super.prototype.Enable(self, core) + self.frame.bottomUpperText:SetWidth(180) self.frame:Hide() - + self:Hook(ToFu, "OnTextUpdate") end -function TimerBar.prototype:Disable() - TimerBar.super.prototype.Disable(self) +function TimerBar.prototype:Disable(core) + TimerBar.super.prototype.Disable(self, core) self:Unhook(ToFu, "OnTextUpdate") end diff --git a/textures/RoundBar.blp b/textures/RoundBar.blp index fee1cff..afbc2e9 100644 Binary files a/textures/RoundBar.blp and b/textures/RoundBar.blp differ diff --git a/textures/RoundBarBG.blp b/textures/RoundBarBG.blp index 7020076..ddaa90d 100644 Binary files a/textures/RoundBarBG.blp and b/textures/RoundBarBG.blp differ