--[[ Author: Jarth Filename: SummonAssistant_Menu.lua ]] -- ------------------------------------------------------------------------------------------------- -- Libraries -- ------------------------------------------------------------------------------------------------- local LAM2 = LibStub:GetLibrary("LibAddonMenu-2.0") ------------------------------------------------------------------------------------------------- -- VARIABLES -- ------------------------------------------------------------------------------------------------- local SummonAssistant = SummonAssistant ------------------------------------------------------------------------------------------------- -- Menu Functions -- ------------------------------------------------------------------------------------------------- function SummonAssistant:CreateSettingsWindow() local panelData = { type = "panel", name = SummonAssistant.Addon.DisplayName, displayName = SummonAssistant.Addon.DisplayName, author = SummonAssistant.Addon.Author, version = SummonAssistant:GetVersion(true), slashCommand = SummonAssistant.Addon.SlashCommand, registerForRefresh = true, registerForDefaults = true } local cntrlOptionsPanel = LAM2:RegisterAddonPanel(SummonAssistant.Addon.Name, panelData) local optionsData = { [1] = { type = "header", name = SummonAssistant.Addon.DisplayName .. " Settings" }, [2] = { type = "description", text = string.format("Here you can setup %s.\nSlash command: %s", SummonAssistant.Addon.DisplayName, SummonAssistant.Addon.SlashCommand) }, [3] = { type = "checkbox", name = "Use account settings", tooltip = "When ON the account settings will be used. When OFF character settings will be used.", default = SummonAssistant.Default.UseAccountSettings, getFunc = function() return SummonAssistant.Saved.UseAccountSettings end, setFunc = function(newValue) SummonAssistant.Saved.UseAccountSettings = newValue if newValue then SummonAssistant.Saved = ZO_SavedVars:NewAccountWide("SummonAssistant_Account", SummonAssistant.Addon.Version, nil, SummonAssistant.Default) else SummonAssistant.Saved = ZO_SavedVars:New("SummonAssistant_Character", SummonAssistant.Addon.Version, nil, SummonAssistant.Default) end SummonAssistant.Saved.UseAccountSettings = newValue SummonAssistant:RestorePanel() end }, [4] = { type = "submenu", name = "Assistants", tooltip = "Allows you to choose what assistant buttons you wants to see.", controls = { [1] = { type = "description", text = "Choose what assistant buttons you want to see." } } }, [5] = { type = "submenu", name = "Position and size", tooltip = "Setup position and size.", controls = { [1] = { type = "description", text = "Here you can setup position and size \n(Unlock to move the bar)." }, [2] = { type = "checkbox", name = "Unlock bar", tooltip = "When ON the bar will show the X,Y position of the top left corner, when the mouse enters and drags the panel around.", disabled = function() local count = 0 if IsCollectibleUnlocked(267) and SummonAssistant.Saved.ShowAssistants[267] then count = count + 1 end if IsCollectibleUnlocked(300) and SummonAssistant.Saved.ShowAssistants[300] then count = count + 1 end if IsCollectibleUnlocked(301) and SummonAssistant.Saved.ShowAssistants[301] then count = count + 1 end return count == 0 end, default = function() return SummonAssistant.Global.IsMoveEnabled end, getFunc = function() return SummonAssistant.Global.IsMoveEnabled end, setFunc = function(newValue) SummonAssistant.Global.IsMoveEnabled = newValue SummonAssistant:RestorePanel() end }, [3] = { type = "checkbox", name = "Bar orientation horizontal", tooltip = "When ON the bar will orientate horizontally.", default = SummonAssistant.Default.Horizontal, getFunc = function() return SummonAssistant.Saved.Horizontal end, setFunc = function(newValue) SummonAssistant.Saved.Horizontal = newValue SummonAssistant:RestorePanel() end }, [4] = { type = "slider", name = "Choose button margin", tooltip = "It is at this time, 'not possible' to move/drag the frame, when the margin is set to 0", default = SummonAssistant.Default.Margin, getFunc = function() return SummonAssistant.Saved.Margin end, setFunc = function(value) SummonAssistant.Saved.Margin = value SummonAssistant:RestorePanel() end, min = 1, max = 50 }, [5] = { type = "slider", name = "Choose button height", default = SummonAssistant.Default.Height, getFunc = function() return SummonAssistant.Saved.Height end, setFunc = function(value) SummonAssistant.Saved.Height = value SummonAssistant:RestorePanel() end, min = 1, max = 100 }, [6] = { type = "slider", name = "Choose button width", default = SummonAssistant.Default.Width, getFunc = function() return SummonAssistant.Saved.Width end, setFunc = function(value) SummonAssistant.Saved.Width = value SummonAssistant:RestorePanel() end, min = 1, max = 100 }, [7] = { type = "slider", name = "Choose snap size when moving", default = SummonAssistant.Default.SnapSize, getFunc = function() return SummonAssistant.Saved.SnapSize end, setFunc = function(value) SummonAssistant.Saved.SnapSize = value SummonAssistant:RestorePanel() end, min = 1, max = 10 }, [8] = { type = "checkbox", name = "Show hotkey's on bar", tooltip = "When ON the hotkey's will be shown on the bar.", default = SummonAssistant.Default.ShowKeyBinding, getFunc = function() return SummonAssistant.Saved.ShowKeyBinding end, setFunc = function(newValue) SummonAssistant.Saved.ShowKeyBinding = newValue SummonAssistant:RestorePanel() end, width = "half" }, [9] = { type = "dropdown", name = "Hotkey label location", tooltip = "Select hotkey label location", choices = SummonAssistant.Global.ChoisesKeyBindingLocation, default = SummonAssistant.Default.KeyBindingLocation, disabled = function() return not SummonAssistant.Saved.ShowKeyBinding end, getFunc = function() return SummonAssistant:HotKeyGetLocationText(SummonAssistant.Saved.KeyBindingLocation) end, setFunc = function(value) SummonAssistant.Saved.KeyBindingLocation = SummonAssistant:HotKeyGetLocationValue(value) SummonAssistant:RestorePanel() end, width = "half" } } }, [6] = { type = "submenu", name = "Colors", tooltip = "Setup button and frame font colors.", controls = { [1] = { type = "description", text = "Here you can setup the button and frame font colors." }, [2] = { type = "colorpicker", name = "Button background Color", tooltip = "Changes the background color of the buttons.", default = function() return SummonAssistant.Default.CenterColor end, getFunc = function() return SummonAssistant.Saved.CenterColor.r, SummonAssistant.Saved.CenterColor.g, SummonAssistant.Saved.CenterColor.b, SummonAssistant.Saved.CenterColor.a end, setFunc = function(r, g, b, a) SummonAssistant.Saved.CenterColor = {r = r, g = g, b = b, a = a} SummonAssistant:RestorePanel() end, width = "half" }, [3] = { type = "colorpicker", name = "Button edge Color", tooltip = "Changes the edgecolor of the buttons.", default = function() return SummonAssistant.Default.EdgeColor end, getFunc = function() return SummonAssistant.Saved.EdgeColor.r, SummonAssistant.Saved.EdgeColor.g, SummonAssistant.Saved.EdgeColor.b, SummonAssistant.Saved.EdgeColor.a end, setFunc = function(r, g, b, a) SummonAssistant.Saved.EdgeColor = {r = r, g = g, b = b, a = a} SummonAssistant:RestorePanel() end, width = "half" }, [4] = { type = "colorpicker", name = "Button highlight Color", tooltip = "Changes the highlight color of the buttons.", default = function() return SummonAssistant.Default.HighlightColor end, getFunc = function() return SummonAssistant.Saved.HighlightColor.r, SummonAssistant.Saved.HighlightColor.g, SummonAssistant.Saved.HighlightColor.b, SummonAssistant.Saved.HighlightColor.a end, setFunc = function(r, g, b, a) SummonAssistant.Saved.HighlightColor = {r = r, g = g, b = b, a = a} SummonAssistant:RestorePanel() end, width = "half" }, [5] = { type = "colorpicker", name = "Frame font color", default = SummonAssistant.Default.FontColor, tooltip = "Changes of the frame font color.", getFunc = function() return SummonAssistant.Saved.FontColor.r, SummonAssistant.Saved.FontColor.g, SummonAssistant.Saved.FontColor.b, SummonAssistant.Saved.FontColor.a end, setFunc = function(r, g, b, a) SummonAssistant.Saved.FontColor = {r = r, g = g, b = b, a = a} SummonAssistant:RestorePanel() end, width = "half" } } }, [7] = { type = "submenu", name = "Audio", tooltip = "Setup audio.", controls = { [1] = { type = "description", text = "Here you can setup the audio." }, [2] = { type = "checkbox", name = "Play hover audio", tooltip = "When ON hover events on the bar, will play audio.", default = function() return SummonAssistant.Global.IsAudioEnabled end, getFunc = function() return SummonAssistant.Saved.IsAudioEnabled end, setFunc = function(newValue) SummonAssistant.Saved.IsAudioEnabled = newValue end } } }, [8] = { type = "submenu", name = "Visibility", tooltip = "Setup visibility", controls = { [1] = { type = "checkbox", name = "Show bar " .. "on main view/hud", tooltip = "When ON the bar will show the bar " .. "on main view/hud", default = SummonAssistant.Default.ShowBarOnHud, getFunc = function() return SummonAssistant.Saved.ShowBarOnHud end, setFunc = function(newValue) SummonAssistant.Saved.ShowBarOnHud = newValue SummonAssistant:SetFragmentBehaviour() end }, [2] = { type = "checkbox", name = "Show bar " .. "on the main view when an overlay is activated/hudui", tooltip = "When ON the bar will show the bar " .. "on the main view when an overlay is activated/hudui", default = SummonAssistant.Default.ShowBarOnHudUI, getFunc = function() return SummonAssistant.Saved.ShowBarOnHudUI end, setFunc = function(newValue) SummonAssistant.Saved.ShowBarOnHudUI = newValue SummonAssistant:SetFragmentBehaviour() end }, [3] = { type = "checkbox", name = "Show bar " .. "in menu", tooltip = "When ON the bar will show the bar " .. "in menu", default = SummonAssistant.Default.ShowBarInMenu, getFunc = function() return SummonAssistant.Saved.ShowBarInMenu end, setFunc = function(newValue) SummonAssistant.Saved.ShowBarInMenu = newValue SummonAssistant:SetFragmentBehaviour() end }, [4] = { type = "checkbox", name = "Show bar " .. "in the inventory", tooltip = "When ON the bar will show the bar " .. "in the inventory", default = SummonAssistant.Default.ShowBarInInventory, getFunc = function() return SummonAssistant.Saved.ShowBarInInventory end, setFunc = function(newValue) SummonAssistant.Saved.ShowBarInInventory = newValue SummonAssistant:SetFragmentBehaviour() end }, [5] = { type = "checkbox", name = "Show bar " .. "in a store", tooltip = "When ON the bar will show the bar " .. "in a store", default = SummonAssistant.Default.ShowBarInStore, getFunc = function() return SummonAssistant.Saved.ShowBarInStore end, setFunc = function(newValue) SummonAssistant.Saved.ShowBarInStore = newValue SummonAssistant:SetFragmentBehaviour() end } } } } for index, _type in ipairs(SummonAssistant.OrderedTypes) do local line = { type = "checkbox", name = "Show " .. _type.name, tooltip = _type.Tooltip, default = not _type.Disabled, disabled = _type.Disabled, getFunc = function() return SummonAssistant.Saved.ShowAssistants[_type.Id] end, setFunc = function(newValue) SummonAssistant.Saved.ShowAssistants[_type.Id] = newValue SummonAssistant:RestorePanel() end } table.insert(optionsData[4].controls, index + 1, line) end LAM2:RegisterOptionControls(SummonAssistant.Addon.Name, optionsData) end