diff --git a/src/HideElements.lua b/src/HideElements.lua index 3d06b23..9c21c69 100644 --- a/src/HideElements.lua +++ b/src/HideElements.lua @@ -1,15 +1,18 @@ HideElements = {} HideElements.name = "HideElements" -HideElements.configVersion = "1" +HideElements.configVersion = "2" HideElements.defaults = { showWeaponSwap = true, showCompass = true, - showCompassPins = true + showCompassPins = true, + showBossBar = true, + showBossBarBrackets = true, + showBossBarText = true } function HideElements.Initialize() --Load settings - HideElements.savedVariables = ZO_SavedVars:NewAccountWide("HideElementsVars", HideElements.configVersion, nil, HideElements.defaults) + HideElements.savedVariables = ZO_SavedVars:NewAccountWide("HideElementsVars", HideElements.configVersion, nil, HideElements.defaults) HideElements.CreateOptions() HideElements.Refresh() @@ -28,6 +31,10 @@ function HideElements.CreateOptions() controlData = { [1] = { + type = "header", + name = "General", + }, + [2] = { type = "checkbox", name = "Show Weapon Swap", tooltip = "Show Weapon Swap Icon near the Action bar", @@ -35,29 +42,54 @@ function HideElements.CreateOptions() setFunc = function(newValue) HideElements.savedVariables.showWeaponSwap = newValue; HideElements.ChangeWeaponSwap() end, default = HideElements.defaults.showWeaponSwap, }, - [2] = { - type = "submenu", + [3] = { + type = "header", name = "Compass", - tooltip = "Compass options", - controls = { - [1] = { - type = "checkbox", - name = "Show Compass", - tooltip = "Show the Compass", - getFunc = function() return HideElements.savedVariables.showCompass end, - setFunc = function(newValue) HideElements.savedVariables.showCompass = newValue; HideElements.ChangeCompass() end, - default = HideElements.defaults.showCompass, - }, - [2] = { - type = "checkbox", - name = "Show Pins", - tooltip = "Show Pins of the Compass", - getFunc = function() return HideElements.savedVariables.showCompassPins end, - setFunc = function(newValue) HideElements.savedVariables.showCompassPins = newValue; HideElements.ChangeCompass() end, - default = HideElements.defaults.showCompassPins, - }, - }, }, + [4] = { + type = "checkbox", + name = "Show Compass", + tooltip = "Show the Compass", + getFunc = function() return HideElements.savedVariables.showCompass end, + setFunc = function(newValue) HideElements.savedVariables.showCompass = newValue; HideElements.HideCompass() end, + default = HideElements.defaults.showCompass, + }, + [5] = { + type = "checkbox", + name = "Show Pins", + tooltip = "Show Pins of the Compass, auto hides compass", + getFunc = function() return HideElements.savedVariables.showCompassPins end, + setFunc = function(newValue) HideElements.savedVariables.showCompassPins = newValue; HideElements.HidePins() end, + default = HideElements.defaults.showCompassPins, + }, + [6] = { + type = "header", + name = "Boss Bar", + }, + [7] = { + type = "checkbox", + name = "Show Boss Bar", + tooltip = "Show Boss Bar, auto hides brackets and text", + getFunc = function() return HideElements.savedVariables.showBossBar end, + setFunc = function(newValue) HideElements.savedVariables.showBossBar = newValue; HideElements.HideBossBar() end, + default = HideElements.defaults.showBossBar, + }, + [8] = { + type = "checkbox", + name = "Show Brackets", + tooltip = "Show left and right brackets", + getFunc = function() return HideElements.savedVariables.showBossBarBrackets end, + setFunc = function(newValue) HideElements.savedVariables.showBossBarBrackets = newValue; HideElements.HideBossBarBrackets() end, + default = HideElements.defaults.showBossBarBrackets, + }, + [9] = { + type = "checkbox", + name = "Show Text", + tooltip = "Show Text", + getFunc = function() return HideElements.savedVariables.showBossBarText end, + setFunc = function(newValue) HideElements.savedVariables.showBossBarText = newValue; HideElements.HideBossBarText() end, + default = HideElements.defaults.showBossBarText, + }, } LAM:RegisterOptionControls(HideElements.name.."Config", controlData) @@ -67,24 +99,55 @@ function HideElements.ChangeWeaponSwap() ZO_WeaponSwap_SetPermanentlyHidden(ZO_ActionBar1:GetNamedChild("WeaponSwap"), not HideElements.savedVariables.showWeaponSwap) end -function HideElements.ChangeCompass() +function HideElements.HidePins() + -- pins + local compassPins = WINDOW_MANAGER:GetControlByName("ZO_Compass", "Container") + compassPins:SetHidden(not HideElements.savedVariables.showCompassPins) + + HideElements.savedVariables.showCompass = HideElements.savedVariables.showCompassPins; + HideElements.HideCompass() +end + +function HideElements.HideCompass() local hideCompass = not HideElements.savedVariables.showCompass - --compass local compassCenter = WINDOW_MANAGER:GetControlByName("ZO_CompassFrame", "Center") local compassLeft = WINDOW_MANAGER:GetControlByName("ZO_CompassFrame", "Left") local compassRight = WINDOW_MANAGER:GetControlByName("ZO_CompassFrame", "Right") compassCenter:SetHidden(hideCompass) compassLeft:SetHidden(hideCompass) compassRight:SetHidden(hideCompass) +end - -- pins - local compassPins = WINDOW_MANAGER:GetControlByName("ZO_Compass", "Container") - compassPins:SetHidden(not HideElements.savedVariables.showCompassPins) +function HideElements.HideBossBar() + local hideBossBar = not HideElements.savedVariables.showBossBar + local barLeft = WINDOW_MANAGER:GetControlByName("ZO_BossBar", "HealthBarLeft") + local barRight = WINDOW_MANAGER:GetControlByName("ZO_BossBar", "HealthBarRight") + barLeft:SetHidden(hideBossBar) + barRight:SetHidden(hideBossBar) + + HideElements.savedVariables.showBossBarBrackets = HideElements.savedVariables.showBossBar; + HideElements.savedVariables.showBossBarText = HideElements.savedVariables.showBossBar; + HideElements.HideBossBarBrackets() + HideElements.HideBossBarText() +end + +function HideElements.HideBossBarBrackets() + local hideBrackets = not HideElements.savedVariables.showBossBarBrackets + local bracketRight = WINDOW_MANAGER:GetControlByName("ZO_BossBar", "BracketRight") + local bracketLeft = WINDOW_MANAGER:GetControlByName("ZO_BossBar", "BracketLeft") + bracketRight:SetHidden(hideBrackets) + bracketLeft:SetHidden(hideBrackets) +end + +function HideElements.HideBossBarText() + local text = WINDOW_MANAGER:GetControlByName("ZO_BossBar", "HealthText") + text:SetHidden(not HideElements.savedVariables.showBossBarText) end function HideElements.Refresh() HideElements.ChangeWeaponSwap() - HideElements.ChangeCompass() + HideElements.HideCompass() + HideElements.HideBossBar() end function HideElements.OnAddOnLoaded(event, addonName) @@ -93,4 +156,4 @@ function HideElements.OnAddOnLoaded(event, addonName) end end -EVENT_MANAGER:RegisterForEvent(HideElements.name, EVENT_ADD_ON_LOADED, HideElements.OnAddOnLoaded) +EVENT_MANAGER:RegisterForEvent(HideElements.name, EVENT_ADD_ON_LOADED, HideElements.OnAddOnLoaded) \ No newline at end of file diff --git a/src/HideElements.txt b/src/HideElements.txt index 2d53242..b5dca74 100644 --- a/src/HideElements.txt +++ b/src/HideElements.txt @@ -1,8 +1,8 @@ ## Description: Displays different elements from the UI that can be made invisible. -## Title: Hide Elements 1.0.1 +## Title: Hide Elements 1.1.0 ## OptionalDependsOn: LibAddonMenu-2.0 ## Author: NoPantsuNoLife -## Version: 1.100017.0.1 +## Version: 1.100017.1.0 ## APIVersion: 100017 ## SavedVariables: HideElementsVars