Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dreanor authored Jan 13, 2017
1 parent 6e78f11 commit e710511
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 33 deletions.
125 changes: 94 additions & 31 deletions src/HideElements.lua
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -28,36 +31,65 @@ 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",
getFunc = function() return HideElements.savedVariables.showWeaponSwap end,
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)
Expand All @@ -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)
Expand All @@ -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)
4 changes: 2 additions & 2 deletions src/HideElements.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit e710511

Please sign in to comment.