local function createOptionsTable(self) local options = { type = "group", get = function(item) return self.db.profile[item[#item]] end, set = function(item, value) self.db.profile[item[#item]] = value; self:RefreshConfig() end, args = { enabled = { type = "toggle", name = "Enable", }, majorAuras = { type = "group", name = "Major Auras", get = function(item) return self.db.profile.majorAuras[item[#item]] end, set = function(item, value) self.db.profile.majorAuras[item[#item]] = value; self:RefreshConfig() end, args = { auras = { type = "input", name = "Auras", multiline = 10, width = "full", get = function(item) return table.concat(self.db.profile.majorAuras["auras"], "\n"); end, set = function(item, value) local t = {}; for aura in string.gmatch(value, "[^\n]+") do aura = string.gsub(aura, "^%s*(.-)%s$", "%1"); if tonumber(aura) then table.insert(t, tonumber(aura)); else table.insert(t, aura); end end self.db.profile.majorAuras["auras"] = t; self:RefreshConfig(); end, }, max = { type = "range", name = "Number shown", min = 1, max = 10, step = 1, width = "full", }, iconSize = { type = "range", name = "Icon size", min = 1, max = 30, step = 1, width = "full", }, textSize = { type = "range", name = "Text size", min = 1, max = 30, step = 1, width = "full", }, } }, } }; for _, pos in ipairs(self.positions) do options.args[pos] = { type = "group", name = pos, get = function(item) return self.db.profile.indicators[pos][item[#item]]; end, set = function(item, value) self.db.profile.indicators[pos][item[#item]] = value; self:RefreshConfig(); end, args = { auras = { type = "input", name = "Auras", multiline = true, width = "full", get = function(item) return table.concat(self.db.profile.indicators[pos]["auras"], "\n"); end, set = function(item, value) local t = {}; for aura in string.gmatch(value, "[^\n]+") do aura = string.gsub(aura, "^%s*(.-)%s$", "%1"); if tonumber(aura) then table.insert(t, tonumber(aura)); else table.insert(t, aura); end end self.db.profile.indicators[pos]["auras"] = t; self:RefreshConfig(); end, }, mine = { type = "toggle", name = "Only cast by me", }, showText = { type = "toggle", name = "Show remaining time", }, textSize = { type = "range", name = "Text size", min = 1, max = 30, step = 1, width = "full", }, textColor = { type = "color", name = "Text color", get = function(item) return unpack(self.db.profile.indicators[pos]["textColor"]); end, set = function(item, r, g, b, a) self.db.profile.indicators[pos]["textColor"] = {r, g, b, a}; self:RefreshConfig(); end, }, stack = { type = "toggle", name = "Show stacks", }, showIcon = { type = "toggle", name = "Show icon", }, useDefaultIcon = { type = "toggle", name = "Use default icon", disabled = function() return not self.db.profile.indicators[pos]["showIcon"] end, }, iconSize = { type = "range", name = "Icon size", min = 1, max = 30, step = 1, width = "full", }, iconColor = { type = "color", name = "Icon tint", get = function(item) return unpack(self.db.profile.indicators[pos]["iconColor"]); end, set = function(item, r, g, b, a) self.db.profile.indicators[pos]["iconColor"] = {r, g, b, a}; self:RefreshConfig(); end, }, } }; end return options; end local profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(OmaRF.db); local options = createOptionsTable(OmaRF); local config = LibStub("AceConfig-3.0"); config:RegisterOptionsTable("Indicators", options); config:RegisterOptionsTable("Indicators Profiles", profiles); local dialog = LibStub("AceConfigDialog-3.0"); OmaRF.optionsFrames = {}; OmaRF.optionsFrames.Indicators = dialog:AddToBlizOptions("Indicators", "Indicators"); OmaRF.optionsFrames.Profile = dialog:AddToBlizOptions("Indicators Profiles", "Profiles", "Indicators");