--[[ Author: Jarth Filename: CBs_Settings_Data.lua ]] -- ------------------------------------------------------------------------------------------------- -- VARIABLES -- ------------------------------------------------------------------------------------------------- local base = CollectionBars local texts = base.Texts ------------------------------------------------------------------------------------------------- -- FUNCTIONS -- ------------------------------------------------------------------------------------------------- function base.AppendMasterListTypeGeneral(self, listType) self:AppendRow_Checkbox(listType, { name = "Use account settings", tooltip = "When ON the account settings will be used. When OFF character settings will be used", funcGet = function() return base.Saved.UseAccountSettings end, funcSet = function(_, newValue) base.SetAndUpdateAccountSettings(newValue) base.InitializeWithSavedData() base.RestoreFrames() base.RestoreCombineLabels() base.Global.SettingsList:RefreshData() end }) self:AppendRow_Button(listType, { name = "Reset settings", buttonName = "Reset", funcSet = function() base.ResetAccountSettings() base.SetAndUpdateAccountSettings() base.InitializeWithSavedData() base.RestoreFrames() base.RestoreCombineLabels() base.Global.SettingsList:RefreshData() end }) self:AppendRow_Title(listType, {name = "Position and size"}) self:AppendRow_Divider(listType, {}) self:AppendRow_Checkbox(listType, { name = "Unlock movement of bar", tooltipText = "When ON the bar will show the X,Y position of the top left corner, and is draggable", funcGet = function() return base.Global.IsMoveEnabled end, funcSet = function(_, newValue) base.Global.IsMoveEnabled = newValue base.RestoreFrames() end }) self:AppendRow_Slider(listType, { name = "Choose snap size when moving", tooltipText = "Choose snap size when moving", funcGet = function() return base.Saved.SnapSize end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end base.Saved.SnapSize = newValue base.RestoreFrames() end, minValue = 1, maxValue = 10, valueStep = 1, default = base.Default.SnapSize, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Slider(listType, { name = "Choose max bar depth", tooltipText = "Choose max bar depth\n(number of inverse rows/columns)", funcGet = function() return base.Saved.BarDepth end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end base.Saved.BarDepth = newValue base.RestoreFrames() end, minValue = 0, maxValue = base.Global.HighestUnlocked, valueStep = 1, default = base.Default.BarDepth, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Slider(listType, { name = "Choose max bar height", tooltipText = "Choose max bar height\n(number of inverse rows/columns)", funcGet = function() return base.Saved.BarWidth end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end base.Saved.BarWidth = newValue base.RestoreFrames() end, minValue = 0, maxValue = base.Global.HighestUnlocked, valueStep = 1, default = base.Default.BarWidth, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Checkbox(listType, { name = "Show binding's on bar", tooltipText = "When ON the binding's will be shown on the bar", funcGet = function() return base.Saved.ShowBinding end, funcSet = function(_, newValue) base.Saved.ShowBinding = newValue base.RestoreFrames() end }) self:AppendRow_Slider(listType, { name = "Choose button size", tooltipText = "Choose button size", funcGet = function() return base.Saved.ButtonXY end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end base.Saved.ButtonXY = newValue base.RestoreFrames() end, minValue = 1, maxValue = 100, valueStep = 1, default = ZO_GAMEPAD_ACTION_BUTTON_SIZE, valueFormat = texts.Format.Number, showValue = true }) local whenOnTheBar = "When ON the bar will show the bar " self:AppendRow_Title(listType, {name = "Visibility"}) self:AppendRow_Divider(listType, {}) self:AppendRow_Checkbox(listType, { name = "Show bar on main view/hud", tooltipText = string.format("%s on main view/hud", whenOnTheBar), funcGet = function() return base.Saved.ShowBarOnHud end, funcSet = function(_, newValue) base.Saved.ShowBarOnHud = newValue base.UpdateFragments("ShowBarOnHud") end }) self:AppendRow_Checkbox(listType, { name = "Show bar on the main view when an overlay is activated/hudui", tooltipText = string.format("%s on the main view when an overlay is activated/hudui", whenOnTheBar), funcGet = function() return base.Saved.ShowBarOnHudUI end, funcSet = function(_, newValue) base.Saved.ShowBarOnHudUI = newValue base.UpdateFragments("ShowBarOnHudUI") end }) self:AppendRow_Checkbox(listType, { name = "Show bar in menu", tooltipText = string.format("%s in menu", whenOnTheBar), funcGet = function() return base.Saved.ShowBarInMenu end, funcSet = function(_, newValue) base.Saved.ShowBarInMenu = newValue base.UpdateFragments("ShowBarInMenu") end }) self:AppendRow_Checkbox(listType, { name = "Show bar in the inventory", tooltipText = string.format("%s in the inventory", whenOnTheBar), funcGet = function() return base.Saved.ShowBarInInventory end, funcSet = function(_, newValue) base.Saved.ShowBarInInventory = newValue base.UpdateFragments("ShowBarInInventory") end }) self:AppendRow_Checkbox(listType, { name = "Show bar in interactions", tooltipText = string.format("%s in interactions", whenOnTheBar), funcGet = function() return base.Saved.ShowBarInInteract end, funcSet = function(_, newValue) base.Saved.ShowBarInInteract = newValue base.UpdateFragments("ShowBarInInteract") end }) self:AppendRow_Checkbox(listType, { name = "Show bar at a bank", tooltipText = string.format("%s at a bank", whenOnTheBar), funcGet = function() return base.Saved.ShowBarInBank end, funcSet = function(_, newValue) base.Saved.ShowBarInBank = newValue base.UpdateFragments("ShowBarInBank") end }) self:AppendRow_Checkbox(listType, { name = "Show bar at a fence", tooltipText = string.format("%s at a fence", whenOnTheBar), funcGet = function() return base.Saved.ShowBarInFence end, funcSet = function(_, newValue) base.Saved.ShowBarInFence = newValue base.UpdateFragments("ShowBarInFence") end }) self:AppendRow_Checkbox(listType, { name = "Show bar at a store", tooltipText = string.format("%s at a store", whenOnTheBar), funcGet = function() return base.Saved.ShowBarInStore end, funcSet = function(_, newValue) base.Saved.ShowBarInStore = newValue base.UpdateFragments("ShowBarInStore") end }) self:AppendRow_Title(listType, {name = "Active and activation"}) self:AppendRow_Divider(listType, {}) self:AppendRow_Checkbox(listType, { name = "Show active and activation", tooltipText = "When ON the active collectibles will be highlighted, and activation animation will display", funcGet = function() return base.Saved.IsActiveActivationEnabled end, funcSet = function(_, newValue) base.Saved.IsActiveActivationEnabled = newValue base.RestoreFrames() end }) self:AppendRow_Title(listType, {name = "Audio"}) self:AppendRow_Divider(listType, {}) self:AppendRow_Checkbox(listType, { name = "Play hover audio", tooltipText = "When ON hover events on the bar, will play audio", funcGet = function() return base.Saved.IsAudioEnabled end, funcSet = function(_, newValue) base.Saved.IsAudioEnabled = newValue base.RestoreFrames() end }) end function base.AppendMasterListTypeCategories(self, listType) self:AppendRow_Title(listType, {name = "Categories"}) self:AppendRow_Divider(listType, {}) for _, category in ipairs(base.CategoriesOrdered or {}) do local data = { cId = category.Id, icon = category.Icon, name = string.format("Show %s", category.Name), hasChildren = category.HasChildren, parentKey = category.ParentKey, tooltipText = string.format("When ON the collection category: %s will enabled\nPress the 'cog' to display collectible in: 'Collectibles' and 'Collection bar'", category.Name), funcGet = function() return category.Saved.Enabled end, disabledFunc = function() return category.Disabled end, funcSet = function(_, newValue) category.Saved.Enabled = newValue if newValue then base.InitializeCategory(category) else base.RemoveLabel(category) base.RemoveFrame(category) if self.category == category then self.category = nil base.UpdateSettingsType(true, nil) end end if category.Saved.IsCombined then base.RestoreCombineLabels() end base.Global.SettingsList:RefreshData() end, funcCog = function(_) self.category = category base.UpdateSettingsType(true, category) base.Global.SettingsList:RefreshData() end } if category.HasChildren then data.name = category.Name self:AppendRow_Category_Title(listType, data) else self:AppendRow_Category_Checkbox(listType, data) end end end function base.AppendMasterListTypeCombined(self, listType) self:AppendRow_Title(listType, {name = "Display names and labels"}) self:AppendRow_Divider(listType, {}) self:AppendRow_Slider(listType, { name = "Display name offset horizontal", tooltipText = "Display name offset horizontal\n(X)", funcGet = function() return base.Saved.Combine.Label.OffsetX end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end base.Saved.Combine.Label.OffsetX = newValue base.RestoreCombineLabels() end, minValue = -500, maxValue = 500, valueStep = 1, default = base.Default.Combine.Label.OffsetX, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Slider(listType, { name = "Display name offset vertical", tooltipText = "Display name offset vertical\n(Y)", funcGet = function() return base.Saved.Combine.Label.OffsetY end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end base.Saved.Combine.Label.OffsetY = newValue base.RestoreCombineLabels() end, minValue = -500, maxValue = 500, valueStep = 1, default = base.Default.Combine.Label.OffsetY, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Dropdown(listType, { name = "Display name anchor position on button", tooltipText = "Select display name anchor position on the button", funcGet = function() return base.GetLocationText(base.Saved.Combine.Label.PositionTarget) end, choices = base.Global.ChoiceLocations, funcSet = function(_, newValue) base.Saved.Combine.Label.PositionTarget = base.GetLocationValue(newValue) base.RestoreCombineLabels() end }) self:AppendRow_Dropdown(listType, { name = "Display name anchor position on label", tooltipText = "Select display name anchor position on the label", funcGet = function() return base.GetLocationText(base.Saved.Combine.Label.Position) end, choices = base.Global.ChoiceLocations, funcSet = function(_, newValue) base.Saved.Combine.Label.Position = base.GetLocationValue(newValue) base.RestoreCombineLabels() end }) self:AppendRow_Title(listType, {name = "Position and size"}) self:AppendRow_Divider(listType, {}) self:AppendRow_Slider(listType, { name = "Choose default bar depth", tooltipText = "Choose default bar depth\n(number of rows/columns)", funcGet = function() return base.Saved.Combine.BarDepth end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end base.Saved.Combine.BarDepth = newValue base.RestoreFrames() end, minValue = 0, maxValue = base.Global.HighestUnlocked, valueStep = 1, default = base.Default.BarDepth, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Slider(listType, { name = "Choose max bar height", tooltipText = "Choose max bar height\n(number of inverse rows/columns)", funcGet = function() return base.Saved.Combine.BarWidth end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end base.Saved.Combine.BarWidth = newValue base.RestoreFrames() end, minValue = 0, maxValue = base.Global.HighestUnlocked, valueStep = 1, default = base.Default.BarWidth, valueFormat = texts.Format.Number, showValue = true }) end function base.AppendMasterListTypeCollectibles(self, listType) self:AppendRow_Title(listType, {name = texts.Components.Collectibles}) self:AppendRow_Divider(listType, {}) self:AppendRow_Checkbox(listType, { name = string.format("Show disabled %s", self.category.Name), tooltipText = string.format("When ON disabled elements will be shown for %s", self.category.Name), funcGet = function() return self.category.Saved.MenuShowDisabled end, funcSet = function(_, newValue) self.category.Saved.MenuShowDisabled = newValue base.CreateCategory(self.category) base.Global.SettingsList:RefreshData() end }) self:AppendRow_Divider(listType, {}) self:AppendRow_Checkbox(listType, { name = string.format("Select all %s", self.category.Name), tooltipText = string.format("When pressed all %s will either be selected or deselected", self.category.Name), funcGet = function() return base.IsAllSelected(self.category) end, funcSet = function(_, newValue) base.SelectAll(self.category, newValue) base.RestoreFrame(self.category) base.RestoreCombineLabels() base.Global.SettingsList:RefreshData() end }) self:AppendRow_Divider(listType, {}) for _, collectible in ipairs(self.category.CollectionOrdered or {}) do if self.category.Saved.MenuShowDisabled and collectible.Disabled or not collectible.Disabled then self:AppendRow_Checkbox(listType, { cId = collectible.Id, name = string.format("Show %s", collectible.Name), tooltipText = collectible.Tooltip, funcGet = function() return self.category.Saved.Selected[collectible.Id] end, disabledFunc = function() return collectible.Disabled end, funcSet = function(checkBoxControl, newValue) local control = checkBoxControl:GetParent() if not (control.data.disabledFunc and control.data.disabledFunc()) then if newValue == true then self.category.Saved.Selected[control.data.cId] = newValue else self.category.Saved.Selected[control.data.cId] = nil end base.RestoreFrame(self.category) base.RestoreCombineLabels() base.Global.SettingsList:RefreshData() end end }) end end end function base.AppendMasterListTypeCategory(self, listType) local disabledWhenTooltipIsHidden = "Disabled when tooltip is not shown" local disabledWhenLabelIsHidden = "Disabled when label is not shown" local disabledWhenCombined = "Disabled when Collection is included in combine bar" self:AppendRow_Title(listType, {name = "Tooltip"}) self:AppendRow_Divider(listType, {}) self:AppendRow_Checkbox(listType, { name = "Show tooltip", tooltipText = "When ON tooltips will be shown, when hovering buttons on the bar", funcGet = function() return self.category.Saved.Tooltip.Show end, funcSet = function(_, newValue) self.category.Saved.Tooltip.Show = newValue base.SetupButtons(self.category) base.Global.SettingsList:RefreshData() end }) self:AppendRow_Dropdown(listType, { name = "Show tooltip anchor position", tooltipText = string.format("Select tooltip anchor position\n%s", disabledWhenTooltipIsHidden), choices = base.Global.ChoiceLocations, disabledFunc = function() return not self.category.Saved.Tooltip.Show end, funcGet = function() return base.GetLocationText(self.category.Saved.Tooltip.Position) end, funcSet = function(_, newValue) self.category.Saved.Tooltip.Position = base.GetLocationValue(newValue) base.SetupButtons(self.category) end }) self:AppendRow_Title(listType, {name = "Display name and label"}) self:AppendRow_Divider(listType, {}) self:AppendRow_Checkbox(listType, { name = "Include in combine bar", tooltipText = "When ON will be attached to a combined bar", funcGet = function() return self.category.Saved.IsCombined end, funcSet = function(_, newValue) self.category.Saved.IsCombined = newValue base.RestoreFrame(self.category) base.RestoreCombineLabels() base.Global.SettingsList:RefreshData() end }) self:AppendRow_Divider(listType, {}) self:AppendRow_Checkbox(listType, { name = "Enable hide/toggle visibility of the label", tooltipText = string.format("When enabled a +/- at the end of the label indicates if the label is hidden or shown\n%s", disabledWhenCombined), disabledFunc = function() return self.category.Saved.IsCombined end, funcGet = function() return self.category.Saved.IsCombined or self.category.Saved.HideAllEnabled end, funcSet = function(_, newValue) if (not newValue) then self.category.Saved.HideAll = newValue base.RestoreFrame(self.category) end self.category.Saved.HideAllEnabled = newValue self.category.Saved.LabelShow = true base.SetupLabel(self.category) base.RestoreLabel(self.category) base.Global.SettingsList:RefreshData() end }) self:AppendRow_Checkbox(listType, { name = "Show label", tooltipText = string.format("%s or hide/toggle visibility is enabled", disabledWhenCombined), disabledFunc = function() return self.category.Saved.HideAllEnabled or self.category.Saved.IsCombined end, funcGet = function() return self.category.Saved.LabelShow or self.category.Saved.IsCombined end, funcSet = function(_, newValue) self.category.Saved.LabelShow = newValue base.SetupLabel(self.category) base.RestoreLabel(self.category) base.Global.SettingsList:RefreshData() end }) self:AppendRow_Dropdown(listType, { name = "Display name font", tooltipText = string.format("Change display name font\n%s", disabledWhenLabelIsHidden), disabledFunc = function() return not self.category.Saved.LabelShow end, choices = base.Global.AvailableFonts, funcGet = function() return self.category.Saved.Label.Font end, funcSet = function(_, newValue) self.category.Saved.Label.Font = newValue base.RestoreFrame(self.category) base.RestoreCombineLabels() end }) self:AppendRow_Slider(listType, { name = "Display name height", tooltipText = string.format("Change display name height\n%s", disabledWhenLabelIsHidden), disabledFunc = function() return not self.category.Saved.LabelShow end, funcGet = function() return self.category.Saved.Label.Height end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end self.category.Saved.Label.Height = newValue base.RestoreFrame(self.category) base.RestoreCombineLabels() end, minValue = 0, maxValue = 100, valueStep = 1, default = base.Default[self.category.Name].Label.Height, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Slider(listType, { name = "Display name width", tooltipText = string.format("Change display name width\n%s", disabledWhenLabelIsHidden), disabledFunc = function() return not self.category.Saved.LabelShow end, funcGet = function() return self.category.Saved.Label.Width end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end self.category.Saved.Label.Width = newValue base.RestoreFrame(self.category) base.RestoreCombineLabels() end, minValue = 0, maxValue = 500, valueStep = 1, default = base.Default[self.category.Name].Label.Width, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Slider(listType, { name = "Display name offset horizontal", tooltipText = string.format("Display name offset horizontal\n(X)\n%s", disabledWhenLabelIsHidden), disabledFunc = function() return not self.category.Saved.LabelShow end, funcGet = function() return self.category.Saved.Label.OffsetX end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end self.category.Saved.Label.OffsetX = newValue base.RestoreFrame(self.category) base.RestoreCombineLabels() end, minValue = -500, maxValue = 500, valueStep = 1, default = base.Default[self.category.Name].Label.OffsetX, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Slider(listType, { name = "Display name offset vertical", tooltipText = string.format("Display name offset vertical\n(y)\n%s", disabledWhenLabelIsHidden), disabledFunc = function() return not self.category.Saved.LabelShow end, funcGet = function() return self.category.Saved.Label.OffsetY end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end self.category.Saved.Label.OffsetY = newValue base.RestoreFrame(self.category) base.RestoreCombineLabels() end, minValue = -500, maxValue = 500, valueStep = 1, default = base.Default[self.category.Name].Label.OffsetY, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Dropdown(listType, { name = "Display name anchor position on button", tooltipText = string.format("Select display name anchor position on the button\n%s\n or Collection is included in combine bar", disabledWhenLabelIsHidden), disabledFunc = function() return not self.category.Saved.LabelShow or self.category.Saved.IsCombined end, funcGet = function() if self.category.Saved.IsCombined then return base.GetLocationText(base.Saved.Combine.Label.PositionTarget) else return base.GetLocationText(self.category.Saved.Label.PositionTarget) end end, choices = base.Global.ChoiceLocations, funcSet = function(_, newValue) self.category.Saved.Label.PositionTarget = base.GetLocationValue(newValue) base.RestoreFrame(self.category) base.RestoreCombineLabels() end }) self:AppendRow_Dropdown(listType, { name = "Display name anchor position on label", tooltipText = string.format("Select display name anchor position on the label\n%s\n or Collection is included in combine bar", disabledWhenLabelIsHidden), disabledFunc = function() return not self.category.Saved.LabelShow or self.category.Saved.IsCombined end, funcGet = function() if self.category.Saved.IsCombined then return base.GetLocationText(base.Saved.Combine.Label.Position) else return base.GetLocationText(self.category.Saved.Label.Position) end end, choices = base.Global.ChoiceLocations, funcSet = function(_, newValue) self.category.Saved.Label.Position = base.GetLocationValue(newValue) base.RestoreFrame(self.category) base.RestoreCombineLabels() end }) self:AppendRow_Title(listType, {name = "Position and size"}) self:AppendRow_Divider(listType, {}) self:AppendRow_Slider(listType, { name = "Choose bar depth", tooltipText = string.format("Choose bar depth\n(number of rows/columns)\n%s", disabledWhenCombined), disabledFunc = function() return self.category.Saved.IsCombined end, funcGet = function() return self.category.Saved.BarDepth end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end self.category.Saved.BarDepth = newValue base.RestoreFrame(self.category) base.RestoreCombineLabels() end, minValue = 0, maxValue = self.category.Unlocked, valueStep = 1, default = base.Default[self.category.Name].BarDepth, valueFormat = texts.Format.Number, showValue = true }) self:AppendRow_Slider(listType, { name = "Choose max bar height", tooltipText = string.format("Choose bar height\n(number of inverse rows/columns)\n%s", disabledWhenCombined), disabledFunc = function() return self.category.Saved.IsCombined end, funcGet = function() return self.category.Saved.BarWidth end, funcSet = function(sliderControl, newValue) local valueLabel = GetControl(sliderControl:GetParent(), texts.Components.Value .. texts.Components.Label) if valueLabel then valueLabel:SetText(newValue) end self.category.Saved.BarWidth = newValue base.RestoreFrame(self.category) base.RestoreCombineLabels() end, minValue = 0, maxValue = self.category.Unlocked, valueStep = 1, default = base.Default[self.category.Name].BarWidth, showValue = true }) self:AppendRow_Checkbox(listType, { name = "Bar orientation horizontal", tooltipText = string.format("Bar orientation horizontal\n%s", disabledWhenCombined), disabledFunc = function() return self.category.Saved.IsCombined end, funcGet = function() return self.category.Saved.Horizontal end, funcSet = function(_, newValue) self.category.Saved.Horizontal = newValue base.RestoreFrame(self.category) base.RestoreCombineLabels() end }) end function base.AppendMasterListTypeNoCategory(self, listType) self:AppendRow_Title(listType, {name = "Select a category"}) self:AppendRow_Divider(listType, {}) end