local Defaults = {} function CreateDefaults() Defaults.profile = { indicatorFont = "Arial Narrow", showIcons = true, enabled = true, }; for i = 1, 5 do Defaults.profile["auras"..i] = ""; Defaults.profile["textSize"..i] = 10; Defaults.profile["color"..i] = {r = 1, g = 1, b = 1, a = 1,}; Defaults.profile["mine"..i] = false; Defaults.profile["stack"..i] = true; Defaults.profile["debuffColor"..i] = false; Defaults.profile["showText"..i] = true; Defaults.profile["showIcon"..i] = true; Defaults.profile["useDefaultIcon"..i] = true; Defaults.profile["iconSize"..i] = 10; end end local Options = {} function CreateOptions () Options = { type = 'group', childGroups = 'tree', get = function(item) return Indicators.db.profile[item[#item]] end, set = function(item, value) Indicators.db.profile[item[#item]] = value; Indicators:RefreshConfig() end, args = { indicatorFont = { type = 'select', dialogControl = "LSM30_Font", name = "Indicator Font", desc = "Adjust the font used for the indicators", values = AceGUIWidgetLSMlists.font, order = 17, }, enabled = { type = "toggle", name = "Enabled", desc = "Enable/Disable indicators", order = 18, set = function(item, value) Indicators.db.profile[item[#item]] = value if value == true then Indicators:OnEnable() else Indicators:OnDisable() end end, } } } --- Add options for each indicator local indicatorNames = {"Top Left", "Top Right", "Center", "Bottom Left", "Bottom Right"} for i = 1, 5 do Options.args["i"..i] = {} Options.args["i"..i].type = 'group' Options.args["i"..i].name = indicatorNames[i] Options.args["i"..i].order = i*10+10 Options.args["i"..i].args = {} Options.args["i"..i].args["auras"..i] = { type = "input", name = "Buffs/Debuffs", desc = "The buffs/debuffs to show in this indicator. Put each buff/debuff on a separate line. You can use 'Magic/Poison/Curse/Disease' to show any debuff of that type.", multiline = true, order = 1, width = "full", } Options.args["i"..i].args["mine"..i] = { type = "toggle", name = "Mine only", desc = "Only show buffs/debuffs cast by me", order = 10, } Options.args["i"..i].args.textHeader = { type = "header", name = "Text Counter", order = 100, } Options.args["i"..i].args["showText"..i] = { type = "toggle", name = "Show text counter", desc = "Show a text counter specifying the time left of the buff/debuff", order = 110, } Options.args["i"..i].args["textSize"..i] = { type = "range", name = "Size", desc = "Text size", min = 1, max = 30, step = 1, order = 120, width = "full", } Options.args["i"..i].args.coloringHeader = { type = "header", name = "Color", order = 150, } Options.args["i"..i].args["debuffColor"..i] = { type = "toggle", name = "Color by debuff type", desc = "Color the text depending on the debuff type, will override any other coloring (poison = green, magic = blue etc)", order = 165, } Options.args["i"..i].args["color"..i] = { type = "color", name = "Default color", desc = "Default color of the indicator", get = function(item) local t = Indicators.db.profile[item[#item]] return t.r, t.g, t.b, t.a end, set = function(item, r, g, b, a) local t = Indicators.db.profile[item[#item]] t.r, t.g, t.b, t.a = r, g, b, a Indicators:RefreshConfig() end, order = 170, } Options.args["i"..i].args.stackHeader = { type = "header", name = "Stack Size", order = 200, } Options.args["i"..i].args["stack"..i] = { type = "toggle", name = "Show stack size", desc = "Show stack size for buffs/debuffs that stack", order = 210, } Options.args["i"..i].args.iconHeader = { type = "header", name = "Icon", order = 300, } Options.args["i"..i].args["showIcon"..i] = { type = "toggle", name = "Show icon", desc = "Show an icon if the buff/debuff are on the unit", order = 310, } Options.args["i"..i].args["useDefaultIcon"..i] = { type = "toggle", name = "Use default icon", desc = "Show default icon instead of the ability's.", disabled = function () return not Indicators.db.profile["showIcon"..i] end, order = 315, } Options.args["i"..i].args["iconSize"..i] = { type = "range", name = "Icon size", desc = "Icon size", min = 1, max = 30, step = 1, order = 320, width = "full", } end end local SlashCommands = { type = "group", args = { enable = { type = "execute", name = "enable", desc = "Enable indicators", func = function() Indicators.db.profile.enabled = true; Indicators:OnEnable() end, }, disable = { type = "execute", name = "disable", desc = "Disable indicators", func = function() Indicators.db.profile.enabled = false; Indicators:OnDisable() end, }, config = { type = "execute", name = "config", desc = "Show config", func = function() Indicators:ShowConfig() end, }, } } function Indicators:ShowConfig() InterfaceOptionsFrame_OpenToCategory(self.optionsFrames.Profile) InterfaceOptionsFrame_OpenToCategory(self.optionsFrames.Indicators) end function Indicators:SetupOptions() -- Set up defaults CreateDefaults() self.db = LibStub("AceDB-3.0"):New("IndicatorsDB", Defaults) -- Profile handling local profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) -- Get the config up CreateOptions() local config = LibStub("AceConfig-3.0") config:RegisterOptionsTable("Raid Frame Indicators", Options) config:RegisterOptionsTable("Raid Frame Indicators Profiles", profiles) -- Register slash commands config:RegisterOptionsTable("Raid Frame Indicators Options", SlashCommands, {"indicators", "raidframeindicators"}) -- Add to Blizz option pane local dialog = LibStub("AceConfigDialog-3.0") self.optionsFrames = {} self.optionsFrames.Indicators = dialog:AddToBlizOptions("Raid Frame Indicators","Raid Frame Indicators") self.optionsFrames.Profile = dialog:AddToBlizOptions("Raid Frame Indicators Profiles","Profiles", "Raid Frame Indicators") end