diff --git a/WeakAuras/DefaultOptions.lua b/WeakAuras/DefaultOptions.lua index d542338bd3..96943ae909 100644 --- a/WeakAuras/DefaultOptions.lua +++ b/WeakAuras/DefaultOptions.lua @@ -1,4 +1,50 @@ ---[[ Manual override for the default font and font size until proper options are built ]] +if not WeakAuras.IsLibsOK() then return end +local AddonName, Private = ... + +-- TODO copied from BuffTrigger2 +local function GetOrCreateSubTable(base, next, ...) + if not next then + return base + end + + base[next] = base[next] or {} + return GetOrCreateSubTable(base[next], ...) +end + +local function GetSubTable(base, next, ...) + if not base then + return nil + end + + if not next then + return base + end + + return GetSubTable(base[next], ...) +end + +function Private.SetDefault(namespace, key, property, type, value) + if WeakAurasSaved then + local base = GetOrCreateSubTable(WeakAurasSaved, namespace, key, property) + if type ~= nil then + base.type = type + end + if value ~= nil then + base.value = value + end + Private.callbacks:Fire("DefaultsChanged") + end +end + +function Private.GetDefault(namespace, key, property, default) + if WeakAurasSaved then + local base = GetSubTable(WeakAurasSaved, namespace, key, property) + if base then + return base.type, base.value + else + return nil, default + end + end +end + -WeakAuras.defaultFont = "Friz Quadrata TT" -WeakAuras.defaultFontSize = 12 diff --git a/WeakAuras/Init.lua b/WeakAuras/Init.lua index 3fbb2ebade..9f0128dfa8 100644 --- a/WeakAuras/Init.lua +++ b/WeakAuras/Init.lua @@ -444,7 +444,7 @@ if not WeakAuras.IsLibsOK() then end -- These function stubs are defined here to reduce the number of errors that occur if WeakAuras.lua fails to compile ---- @type fun(regionType: string, createFunction: function, modifyFunction: function, defaults: table, properties: table|function|nil, validate: function?)) +--- @type fun(regionType: string, createFunction: function, modifyFunction: function, defaults: function, properties: table|function|nil, validate: function?)) function WeakAuras.RegisterRegionType(_, _, _ ,_) end diff --git a/WeakAuras/RegionTypes/AuraBar.lua b/WeakAuras/RegionTypes/AuraBar.lua index cbaad168fe..b579ba194e 100644 --- a/WeakAuras/RegionTypes/AuraBar.lua +++ b/WeakAuras/RegionTypes/AuraBar.lua @@ -6,7 +6,7 @@ local SharedMedia = LibStub("LibSharedMedia-3.0"); local L = WeakAuras.L; -- Default settings -local default = { +local baseDefault = { icon = false, desaturate = false, iconSource = -1, @@ -42,8 +42,9 @@ local default = { zoom = 0 }; -WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default); -WeakAuras.regionPrototype.AddAlphaToDefault(default); +WeakAuras.regionPrototype.AddAdjustedDurationToDefault(baseDefault); +WeakAuras.regionPrototype.AddAlphaToDefault(baseDefault); + local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; @@ -152,7 +153,23 @@ local properties = { }, }; -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, baseDefault); + +local mappings = { + normal = { + base = baseDefault, + map = { + [{'region', 'aurabar', 'icon'}] = "icon", + [{'region', 'aurabar', 'texture'}] = "texture", + } + } +} + +local defaultsCache = Private.CreateDefaultsCache(mappings) + +local function default(action) + return defaultsCache:GetDefault(action, "normal") +end local function GetProperties(data) local overlayInfo = Private.GetOverlayInfo(data); diff --git a/WeakAuras/RegionTypes/DefaultsCache.lua b/WeakAuras/RegionTypes/DefaultsCache.lua new file mode 100644 index 0000000000..0fe813c866 --- /dev/null +++ b/WeakAuras/RegionTypes/DefaultsCache.lua @@ -0,0 +1,114 @@ +if not WeakAuras.IsLibsOK() then return end +local AddonName, Private = ... + +-- TODO copied from BuffTrigger2 +local function GetOrCreateSubTable(base, next, ...) + if not next then + return base + end + + base[next] = base[next] or {} + return GetOrCreateSubTable(base[next], ...) +end + +local function GetSubTable(base, next, ...) + if not base then + return nil + end + + if not next then + return base + end + + return GetSubTable(base[next], ...) +end + +local function ApplyDefaults(data, action, mapping) + for defaultPath, settingsPath in pairs(mapping) do + local namespace, key, property = defaultPath[1], defaultPath[2], defaultPath[3] + local savedApplyType, value = Private.GetDefault(namespace, key, property, nil) + + local apply = false + -- TODO template ? + if action == "import" then + apply = savedApplyType == 2 or savedApplyType == 3 + elseif action == "new" then + apply = savedApplyType == 1 or savedApplyType == 3 + elseif action == "validate" then + -- Nothing to do, validation can be done without user templates + end + + if apply then + local tablePath + local property + if type(settingsPath) == "table" then + tablePath = CopyTable(settingsPath) + tablePath[#tablePath] = nil + property = settingsPath[#settingsPath] + else + tablePath = {} + property = settingsPath + end + + local settingsBase = GetOrCreateSubTable(data, unpack(tablePath)) + if type(value) == "table" then + settingsBase[property] = CopyTable(value) + else + settingsBase[property] = value + end + end + end +end + +local funcs = { + ClearCache = function(self) + wipe(self.defaults) + end, + GetDefault = function(self, action, mappingName) + if not self.mappings[mappingName] then + error("DefaultsCache:GetDefault called with a wrong key: " .. mappingName, 1) + return nil + end + + if not action then + error("DefaultsCache:GetDefault no action", 1) + end + + if not self.defaults[action] or not self.defaults[action][mappingName] then + self.defaults[action] = self.defaults[action] or {} + + local mapping = self.mappings[mappingName] + local defaults = CopyTable(mapping.base) + ApplyDefaults(defaults, action, mapping.map) + + self.defaults[action][mappingName] = defaults + end + + return self.defaults[action][mappingName] + end, + AddDefault = function(self, mappingName, mapping) + if not mapping.base or not mapping.map then + error("DefaultsCache: mapping has incorrect format, key: " .. mappingName, 1) + end + self.mappings[mappingName] = mapping + end +} + +local function CreateDefaultsCache(mappings) + local cache = {} + cache.mappings = {} + cache.defaults = {} + + for k, func in pairs(funcs) do + cache[k] = func + end + + for mappingName, mapping in pairs(mappings) do + cache:AddDefault(mappingName, mapping) + end + + Private.callbacks:RegisterCallback("DefaultsChanged", function() cache:ClearCache() end) + return cache +end + +Private.CreateDefaultsCache = CreateDefaultsCache diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index 34428a0e74..cfc458f200 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -6,7 +6,7 @@ local WeakAuras = WeakAuras local L = WeakAuras.L local SharedMedia = LibStub("LibSharedMedia-3.0") -local default = { +local baseDefault = { controlledChildren = {}, border = false, borderColor = {0, 0, 0, 1}, @@ -43,6 +43,10 @@ local default = { columnSpace = 1 } +local function default() + return baseDefault +end + local controlPointFunctions = { ["SetAnchorPoint"] = function(self, point, relativeFrame, relativePoint, offsetX, offsetY) self:ClearAllPoints(); diff --git a/WeakAuras/RegionTypes/Group.lua b/WeakAuras/RegionTypes/Group.lua index 8873c44ffa..e92a30203b 100644 --- a/WeakAuras/RegionTypes/Group.lua +++ b/WeakAuras/RegionTypes/Group.lua @@ -5,7 +5,7 @@ local AddonName, Private = ... local SharedMedia = LibStub("LibSharedMedia-3.0"); -- Default settings -local default = { +local baseDefault = { controlledChildren = {}, anchorPoint = "CENTER", anchorFrameType = "SCREEN", @@ -21,7 +21,11 @@ local default = { borderSize = 2, borderBackdrop = "Blizzard Tooltip", scale = 1, -}; +} + +local function default() + return baseDefault +end -- Called when first creating a new region/display local function create(parent) diff --git a/WeakAuras/RegionTypes/Icon.lua b/WeakAuras/RegionTypes/Icon.lua index 8553665cf2..903acca406 100644 --- a/WeakAuras/RegionTypes/Icon.lua +++ b/WeakAuras/RegionTypes/Icon.lua @@ -11,7 +11,7 @@ end -- WoW API local _G = _G -local default = { +local baseDefault = { icon = true, desaturate = false, iconSource = -1, @@ -34,7 +34,7 @@ local default = { useCooldownModRate = true }; -WeakAuras.regionPrototype.AddAlphaToDefault(default); +WeakAuras.regionPrototype.AddAlphaToDefault(baseDefault); local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; @@ -110,7 +110,24 @@ local properties = { } }; -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, baseDefault); + +local mappings = { + normal = { + base = baseDefault, + map = { + [{'region', 'icon', 'zoom'}] = "zoom", + [{'region', 'icon', 'cooldown'}] = "cooldown", + [{'region', 'icon', 'cooldownTextDisabled'}] = "cooldownTextDisabled", + } + }, +} + +local defaultsCache = Private.CreateDefaultsCache(mappings) + +local function default(action) + return defaultsCache:GetDefault(action, "normal") +end local function GetProperties(data) local result = CopyTable(properties) diff --git a/WeakAuras/RegionTypes/Model.lua b/WeakAuras/RegionTypes/Model.lua index 2bed294112..c3e9ce5d24 100644 --- a/WeakAuras/RegionTypes/Model.lua +++ b/WeakAuras/RegionTypes/Model.lua @@ -6,7 +6,7 @@ local SharedMedia = LibStub("LibSharedMedia-3.0"); local L = WeakAuras.L; -- Default settings -local default = { +local baseDefault = { model_path = "spells/arcanepower_state_chest.m2", -- arthas is not a thing on classic model_fileId = "122968", -- Creature/Arthaslichking/arthaslichking.m2 modelIsUnit = false, @@ -67,7 +67,11 @@ local properties = { }, } -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, baseDefault); + +local function default() + return baseDefault +end local function GetProperties(data) return properties; diff --git a/WeakAuras/RegionTypes/ProgressTexture.lua b/WeakAuras/RegionTypes/ProgressTexture.lua index d5bcead5ce..4cf06c66c0 100644 --- a/WeakAuras/RegionTypes/ProgressTexture.lua +++ b/WeakAuras/RegionTypes/ProgressTexture.lua @@ -4,9 +4,6 @@ local AddonName, Private = ... local L = WeakAuras.L; -local defaultFont = WeakAuras.defaultFont -local defaultFontSize = WeakAuras.defaultFontSize - -- Credit to CommanderSirow for taking the time to properly craft the TransformPoint function -- to the enhance the abilities of Progress Textures. -- Also Credit to Semlar for explaining how circular progress can be shown @@ -22,7 +19,7 @@ local defaultFontSize = WeakAuras.defaultFontSize -- region.scale (1.0) - user defined scaling [1, INF] -- region.full_rotation (false) - Allow full rotation [bool] -local default = { +local baseDefault = { foregroundTexture = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\Aura3", backgroundTexture = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\Aura3", desaturateBackground = false, @@ -51,16 +48,14 @@ local default = { anchorFrameType = "SCREEN", xOffset = 0, yOffset = 0, - font = defaultFont, - fontSize = defaultFontSize, mirror = false, frameStrata = 1, slantMode = "INSIDE" }; -WeakAuras.regionPrototype.AddAlphaToDefault(default); +WeakAuras.regionPrototype.AddAlphaToDefault(baseDefault); -WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default); +WeakAuras.regionPrototype.AddAdjustedDurationToDefault(baseDefault); local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; @@ -139,7 +134,11 @@ local properties = { } } -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, baseDefault); + +local function default() + return baseDefault +end local function GetProperties(data) local overlayInfo = Private.GetOverlayInfo(data); diff --git a/WeakAuras/RegionTypes/RegionPrototype.lua b/WeakAuras/RegionTypes/RegionPrototype.lua index f42976e32a..f01e426690 100644 --- a/WeakAuras/RegionTypes/RegionPrototype.lua +++ b/WeakAuras/RegionTypes/RegionPrototype.lua @@ -425,7 +425,7 @@ end WeakAuras.regionPrototype.AnchorSubRegion = AnchorSubRegion function WeakAuras.regionPrototype.create(region) - local defaultsForRegion = Private.regionTypes[region.regionType] and Private.regionTypes[region.regionType].default; + local defaultsForRegion = Private.GetDefaultsForRegion(region.regionType, "validate") region.SoundPlay = SoundPlay; region.SoundStop = SoundStop; region.SoundRepeatStop = SoundRepeatStop; @@ -474,13 +474,12 @@ end function WeakAuras.regionPrototype.modify(parent, region, data) region.state = nil region.states = nil + local defaultsForRegion = Private.GetDefaultsForRegion(region.regionType, "validate") region.subRegionEvents:ClearSubscribers() region.subRegionEvents:ClearCallbacks() Private.FrameTick:RemoveSubscriber("FrameTick", region) - local defaultsForRegion = Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].default; - - if region.SetRegionAlpha then + if (region.SetRegionAlpha) then region:SetRegionAlpha(data.alpha) end diff --git a/WeakAuras/RegionTypes/StopMotion.lua b/WeakAuras/RegionTypes/StopMotion.lua index a65d90fdd0..a5d89d9391 100644 --- a/WeakAuras/RegionTypes/StopMotion.lua +++ b/WeakAuras/RegionTypes/StopMotion.lua @@ -5,7 +5,7 @@ local AddonName, Private = ... local texture_data = WeakAuras.StopMotion.texture_data; local L = WeakAuras.L; -local default = { +local baseDefault = { foregroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion", backgroundTexture = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\stopmotion", desaturateBackground = false, @@ -83,7 +83,11 @@ local properties = { }, } -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, baseDefault); + +local function default() + return baseDefault +end local function create(parent) local frame = CreateFrame("Frame", nil, UIParent); diff --git a/WeakAuras/RegionTypes/Text.lua b/WeakAuras/RegionTypes/Text.lua index 6ad5730f8b..23a6e01e34 100644 --- a/WeakAuras/RegionTypes/Text.lua +++ b/WeakAuras/RegionTypes/Text.lua @@ -5,10 +5,8 @@ local AddonName, Private = ... local SharedMedia = LibStub("LibSharedMedia-3.0"); local L = WeakAuras.L; -local defaultFont = WeakAuras.defaultFont -local defaultFontSize = WeakAuras.defaultFontSize -local default = { +local baseDefault = { displayText = "%p", outline = "OUTLINE", color = {1, 1, 1, 1}, @@ -18,8 +16,8 @@ local default = { anchorFrameType = "SCREEN", xOffset = 0, yOffset = 0, - font = defaultFont, - fontSize = defaultFontSize, + font = "Friz Quadrata TT", + fontSize = 12, frameStrata = 1, customTextUpdate = "event", automaticWidth = "Auto", @@ -48,7 +46,24 @@ local properties = { } } -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, baseDefault); + +local mappings = { + normal = { + base = baseDefault, + map = { + [{'region', 'text', 'font'}] = "font", + [{'region', 'text', 'fontSize'}] = "fontSize", + [{'region', 'text', 'outline'}] = "outline", + } + } +} + +local defaultsCache = Private.CreateDefaultsCache(mappings) + +local function default(action) + return defaultsCache:GetDefault(action, "normal") +end local function GetProperties(data) return properties; diff --git a/WeakAuras/RegionTypes/Texture.lua b/WeakAuras/RegionTypes/Texture.lua index af83b629b1..aaf240e05f 100644 --- a/WeakAuras/RegionTypes/Texture.lua +++ b/WeakAuras/RegionTypes/Texture.lua @@ -4,7 +4,7 @@ local AddonName, Private = ... local L = WeakAuras.L; -local default = { +local baseDefault = { texture = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\Aura3", desaturate = false, width = 200, @@ -23,7 +23,7 @@ local default = { frameStrata = 1 }; -WeakAuras.regionPrototype.AddAlphaToDefault(default); +WeakAuras.regionPrototype.AddAlphaToDefault(baseDefault); local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20; @@ -72,7 +72,11 @@ local properties = { } } -WeakAuras.regionPrototype.AddProperties(properties, default); +WeakAuras.regionPrototype.AddProperties(properties, baseDefault); + +local function default() + return baseDefault +end local function create(parent) local region = CreateFrame("Frame", nil, UIParent); diff --git a/WeakAuras/SubRegionTypes/Background.lua b/WeakAuras/SubRegionTypes/Background.lua index a496ebecba..918a3c5d1a 100644 --- a/WeakAuras/SubRegionTypes/Background.lua +++ b/WeakAuras/SubRegionTypes/Background.lua @@ -24,7 +24,7 @@ do end WeakAuras.RegisterSubRegionType("subbackground", L["Background"], subSupports, subCreate, subModify, - noop, noop, {}, nil, {}, false) + noop, noop, noop, nil, {}, false) end -- Foreground for aurabar @@ -55,5 +55,5 @@ do end WeakAuras.RegisterSubRegionType("subforeground", L["Foreground"], subSupports, subCreate, subModify, - noop, noop, {}, nil, {}, false) + noop, noop, noop, nil, {}, false) end diff --git a/WeakAuras/SubRegionTypes/Border.lua b/WeakAuras/SubRegionTypes/Border.lua index 7504ddeb2c..9e20ed3588 100644 --- a/WeakAuras/SubRegionTypes/Border.lua +++ b/WeakAuras/SubRegionTypes/Border.lua @@ -5,18 +5,72 @@ local AddonName, Private = ... local SharedMedia = LibStub("LibSharedMedia-3.0"); local L = WeakAuras.L; -local default = function(parentType) - local options = { +local baseDefaults = { + icon = { + ["type"] = "subborder", border_visible = true, border_color = {1, 1, 1, 1}, border_edge = "Square Full White", border_offset = 0, border_size = 2, + }, + aurabar = { + ["type"] = "subborder", + border_visible = true, + border_color = {1, 1, 1, 1}, + border_edge = "Square Full White", + border_offset = 0, + border_size = 2, + border_anchor = "bar" + }, + other = { + ["type"] = "subborder", + border_visible = true, + border_color = {1, 1, 1, 1}, + border_edge = "Square Full White", + border_offset = 0, + border_size = 2, + }, +} + +local mappings = { + icon = { + base = baseDefaults.icon, + map = { + [{'subRegion', 'border', 'icon_border_color'}] = "border_color", + [{'subRegion', 'border', 'icon_border_edge'}] = "border_edge", + [{'subRegion', 'border', 'icon_border_offset'}] = "border_offset", + [{'subRegion', 'border', 'icon_border_size'}] = "border_size", + } + }, + aurabar = { + base = baseDefaults.aurabar, + map = { + [{'subRegion', 'border', 'aurabar_border_color'}] = "border_color", + [{'subRegion', 'border', 'aurabar_border_edge'}] = "border_edge", + [{'subRegion', 'border', 'aurabar_border_offset'}] = "border_offset", + [{'subRegion', 'border', 'aurabar_border_size'}] = "border_size", + } + }, + other = { + base = baseDefaults.other, + map = { + [{'subRegion', 'border', 'other_border_color'}] = "border_color", + [{'subRegion', 'border', 'other_border_edge'}] = "border_edge", + [{'subRegion', 'border', 'other_border_offset'}] = "border_offset", + [{'subRegion', 'border', 'other_border_size'}] = "border_size", + } } - if parentType == "aurabar" then - options["border_anchor"] = "bar" +} + +local defaultsCache = Private.CreateDefaultsCache(mappings) + +local default = function(parentType, action) + if parentType == "icon" or parentType == "aurabar" then + return defaultsCache:GetDefault(action, parentType) + else + return defaultsCache:GetDefault(action, "other") end - return options end local properties = { @@ -82,6 +136,21 @@ local function modify(parent, region, parentData, data, first) region:SetVisible(data.border_visible) end +local function addDefaultsForNewAura(data) + local add = false + if data.regionType == "aurabar" then + add = select(2, Private.GetDefault('subRegion', 'border', 'aurabar_add')) + elseif data.regionType == "icon" then + add = select(2, Private.GetDefault('subRegion', 'border', 'icon_add')) + else + add = select(2, Private.GetDefault('subRegion', 'border', 'other_add')) + end + if add then + local border = CopyTable(default(data.regionType, "new")) + tinsert(data.subRegions, border) + end +end + local function supports(regionType) return regionType == "texture" or regionType == "progresstexture" @@ -90,4 +159,4 @@ local function supports(regionType) end WeakAuras.RegisterSubRegionType("subborder", L["Border"], supports, create, modify, onAcquire, onRelease, - default, nil, properties) + default, addDefaultsForNewAura, properties); diff --git a/WeakAuras/SubRegionTypes/Glow.lua b/WeakAuras/SubRegionTypes/Glow.lua index bd14437d9f..5a25cef24a 100644 --- a/WeakAuras/SubRegionTypes/Glow.lua +++ b/WeakAuras/SubRegionTypes/Glow.lua @@ -7,8 +7,9 @@ local LCG = LibStub("LibCustomGlow-1.0") local MSQ = LibStub("Masque", true) local L = WeakAuras.L -local default = function(parentType) - local options = { +local baseDefaults = { + icon = { + ["type"] = "subglow", glow = false, useGlowColor = false, glowColor = {1, 1, 1, 1}, @@ -21,12 +22,46 @@ local default = function(parentType) glowBorder = false, glowXOffset = 0, glowYOffset = 0, + }, + aurabar = { + ["type"] = "subglow", + glow = false, + useGlowColor = false, + glowColor = {1, 1, 1, 1}, + glowType = "Pixel", + glowLines = 8, + glowFrequency = 0.25, + glowLength = 10, + glowThickness = 1, + glowScale = 1, + glowBorder = false, + glowXOffset = 0, + glowYOffset = 0, + glow_anchor = "bar" + } +} + +local mappings = { + icon = { + base = baseDefaults.icon, + map = { + } + }, + aurabar = { + base = baseDefaults.aurabar, + map = { + } } - if parentType == "aurabar" then - options["glowType"] = "Pixel" - options["glow_anchor"] = "bar" +} + +local defaultsCache = Private.CreateDefaultsCache(mappings) + +local default = function(parentType, action) + if parentType == "icon" then + return defaultsCache:GetDefault(action, "icon") + else + return defaultsCache:GetDefault(action, "aurabar") end - return options end local properties = { @@ -352,44 +387,6 @@ local function modify(parent, region, parentData, data, first) region:SetScript("OnSizeChanged", region.UpdateSize) end --- This is used by the templates to add glow -function Private.getDefaultGlow(regionType) - if regionType == "aurabar" then - return { - ["type"] = "subglow", - glow = false, - useGlowColor = false, - glowColor = {1, 1, 1, 1}, - glowType = "Pixel", - glowLines = 8, - glowFrequency = 0.25, - glowLength = 10, - glowThickness = 1, - glowScale = 1, - glowBorder = false, - glowXOffset = 0, - glowYOffset = 0, - glow_anchor = "bar" - } - elseif regionType == "icon" then - return { - ["type"] = "subglow", - glow = false, - useGlowColor = false, - glowColor = {1, 1, 1, 1}, - glowType = "buttonOverlay", - glowLines = 8, - glowFrequency = 0.25, - glowLength = 10, - glowThickness = 1, - glowScale = 1, - glowBorder = false, - glowXOffset = 0, - glowYOffset = 0, - } - end -end - local function supports(regionType) return regionType == "icon" or regionType == "aurabar" @@ -397,23 +394,13 @@ end local function addDefaultsForNewAura(data) if data.regionType == "icon" then - tinsert(data.subRegions, { - ["type"] = "subglow", - glow = false, - useGlowColor = false, - glowColor = {1, 1, 1, 1}, - glowType = "buttonOverlay", - glowLines = 8, - glowFrequency = 0.25, - glowLength = 10, - glowThickness = 1, - glowScale = 1, - glowBorder = false, - glowXOffset = 0, - glowYOffset = 0, - }) + local glow = CopyTable(default("icon", "new")) + tinsert(data.subRegions, glow) end end +-- TODO createDefaultOptions for glow +-- Glow Type! Glow Settings ? + WeakAuras.RegisterSubRegionType("subglow", L["Glow"], supports, create, modify, onAcquire, onRelease, - default, addDefaultsForNewAura, properties) + default, addDefaultsForNewAura, properties); diff --git a/WeakAuras/SubRegionTypes/Model.lua b/WeakAuras/SubRegionTypes/Model.lua index 087756475e..7f239646ba 100644 --- a/WeakAuras/SubRegionTypes/Model.lua +++ b/WeakAuras/SubRegionTypes/Model.lua @@ -6,8 +6,8 @@ local L = WeakAuras.L; Private.barmodels = {} -local default = function(parentType) - return { +local baseDefaults = { + ["type"] = "subbarmodel", model_visible = true, model_alpha = 1, api = false, @@ -27,7 +27,10 @@ local default = function(parentType) model_fileId = "235338", model_path = "spells/arcanepower_state_chest.m2", bar_model_clip = true - } +} + +local default = function(parentType, action) + return baseDefaults end local properties = { diff --git a/WeakAuras/SubRegionTypes/SubText.lua b/WeakAuras/SubRegionTypes/SubText.lua index bcb9a9fa10..5e9e966f63 100644 --- a/WeakAuras/SubRegionTypes/SubText.lua +++ b/WeakAuras/SubRegionTypes/SubText.lua @@ -7,60 +7,121 @@ local L = WeakAuras.L; local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ceil(GetScreenHeight() / 20) * 20 -local defaultFont = WeakAuras.defaultFont -local defaultFontSize = WeakAuras.defaultFontSize +local baseDefaults = { + -- No Shadow, but Outline + icon = { + ["type"] = "subtext", + text_text = "%p", + text_color = {1, 1, 1, 1}, + text_font = "Friz Quadrata TT", + text_fontSize = 12, + text_fontType = "OUTLINE", + text_visible = true, + text_justify = "CENTER", + + text_selfPoint = "AUTO", + text_anchorPoint = "CENTER", + anchorXOffset = 0, + anchorYOffset = 0, + + text_shadowColor = { 0, 0, 0, 1}, + text_shadowXOffset = 0, + text_shadowYOffset = 0, + rotateText = "NONE", + + text_automaticWidth = "Auto", + text_fixedWidth = 64, + text_wordWrap = "WordWrap", + }, + -- With Shadow, without Outline + aurabar = { + ["type"] = "subtext", + text_text = "%n", + text_color = {1, 1, 1, 1}, + text_font = "Friz Quadrata TT", + text_fontSize = 12, + text_fontType = "None", + text_visible = true, + text_justify = "CENTER", + + text_selfPoint = "AUTO", + text_anchorPoint = "CENTER", + anchorXOffset = 0, + anchorYOffset = 0, + + text_shadowColor = { 0, 0, 0, 1}, + text_shadowXOffset = 1, + text_shadowYOffset = -1, + rotateText = "NONE", + + text_automaticWidth = "Auto", + text_fixedWidth = 64, + text_wordWrap = "WordWrap", + }, + -- With Shadow, without Outline + other = { + ["type"] = "subtext", + text_text = "%n", + text_color = {1, 1, 1, 1}, + text_font = "Friz Quadrata TT", + text_fontSize = 12, + text_fontType = "None", + text_visible = true, + text_justify = "CENTER", + + text_selfPoint = "AUTO", + text_anchorPoint = "BOTTOMLEFT", + anchorXOffset = 0, + anchorYOffset = 0, + + text_shadowColor = { 0, 0, 0, 1}, + text_shadowXOffset = 1, + text_shadowYOffset = -1, + rotateText = "NONE", + + text_automaticWidth = "Auto", + text_fixedWidth = 64, + text_wordWrap = "WordWrap", + } +} -local default = function(parentType) - if parentType == "icon" then - -- No Shadow, but Outline - return { - text_text = "%p", - text_color = {1, 1, 1, 1}, - text_font = defaultFont, - text_fontSize = defaultFontSize, - text_fontType = "OUTLINE", - text_visible = true, - text_justify = "CENTER", - - text_selfPoint = "AUTO", - text_anchorPoint = "CENTER", - anchorXOffset = 0, - anchorYOffset = 0, - - text_shadowColor = { 0, 0, 0, 1}, - text_shadowXOffset = 0, - text_shadowYOffset = 0, - rotateText = "NONE", - - text_automaticWidth = "Auto", - text_fixedWidth = 64, - text_wordWrap = "WordWrap", +local mappings = { + icon = { + base = baseDefaults.icon, + map = { + [{'subRegion', 'subtext', 'icon_text_font'}] = "text_font", + [{'subRegion', 'subtext', 'icon_text_fontSize'}] = "text_fontSize", + [{'subRegion', 'subtext', 'icon_text_fontType'}] = "text_fontType", } - else - -- With Shadow, without Outline - return { - text_text = "%n", - text_color = {1, 1, 1, 1}, - text_font = defaultFont, - text_fontSize = defaultFontSize, - text_fontType = "None", - text_visible = true, - text_justify = "CENTER", - - text_selfPoint = "AUTO", - text_anchorPoint = parentType == "aurabar" and "INNER_RIGHT" or "BOTTOMLEFT", - anchorXOffset = 0, - anchorYOffset = 0, - - text_shadowColor = { 0, 0, 0, 1}, - text_shadowXOffset = 1, - text_shadowYOffset = -1, - rotateText = "NONE", - - text_automaticWidth = "Auto", - text_fixedWidth = 64, - text_wordWrap = "WordWrap", + }, + aurabar = { + base = baseDefaults.aurabar, + map = { + [{'subRegion', 'subtext', 'pb_text_font'}] = "text_font", + [{'subRegion', 'subtext', 'pb_text_fontSize'}] = "text_fontSize", + [{'subRegion', 'subtext', 'pb_text_fontType'}] = "text_fontType", } + }, + other = { + base = baseDefaults.other, + map = { + [{'subRegion', 'subtext', 'other_text_font'}] = "text_font", + [{'subRegion', 'subtext', 'other_text_fontSize'}] = "text_fontSize", + [{'subRegion', 'subtext', 'other_text_fontType'}] = "text_fontType", + } + } +} + +local defaultsCache = Private.CreateDefaultsCache(mappings) + +-- TODO callers need to copy! +local default = function(parentType, action) + if parentType == "icon" then + return defaultsCache:GetDefault(action, "icon") + elseif parentType == "aurabar" then + return defaultsCache:GetDefault(action, "aurabar") + else + return defaultsCache:GetDefault(action, "other") end end @@ -465,73 +526,29 @@ local function modify(parent, region, parentData, data, first) animRotate(text, textDegrees, selfPoint) end +-- TODO 5 ways that defaults ought to be used: +-- New Aura +-- Default Sub Regions on New Aura +-- New Sub Element +-- Import +-- Templates +-- Each needs to ensure that the defaults are applied and that tables are not reused! local function addDefaultsForNewAura(data) if data.regionType == "aurabar" then - tinsert(data.subRegions, { - ["type"] = "subtext", - text_text = "%p", - text_color = {1, 1, 1, 1}, - text_font = defaultFont, - text_fontSize = defaultFontSize, - text_fontType = "None", - text_justify = "CENTER", - text_visible = true, - - text_selfPoint = "AUTO", - text_anchorPoint = "INNER_LEFT", - anchorXOffset = 0, - anchorYOffset = 0, - - text_shadowColor = { 0, 0, 0, 1}, - text_shadowXOffset = 1, - text_shadowYOffset = -1, - - rotateText = "NONE", - }); - - tinsert(data.subRegions, { - ["type"] = "subtext", - text_text = "%n", - text_color = {1, 1, 1, 1}, - text_font = defaultFont, - text_fontSize = defaultFontSize, - text_fontType = "None", - text_justify = "CENTER", - text_visible = true, - - text_selfPoint = "AUTO", - text_anchorPoint = "INNER_RIGHT", - anchorXOffset = 0, - anchorYOffset = 0, - - text_shadowColor = { 0, 0, 0, 1}, - text_shadowXOffset = 1, - text_shadowYOffset = -1, - - rotateText = "NONE", - }); + local text1 = CopyTable(default("aurabar", "new")) + text1.text_text = "%p" + text1.text_anchorPoint = "INNER_LEFT" + tinsert(data.subRegions, text1); + + local text2 = CopyTable(default("aurabar", "new")) + text2.text_text = "%n" + text2.text_anchorPoint = "INNER_RIGHT" + tinsert(data.subRegions, text2); elseif data.regionType == "icon" then - tinsert(data.subRegions, { - ["type"] = "subtext", - text_text = "%s", - text_color = {1, 1, 1, 1}, - text_font = defaultFont, - text_fontSize = defaultFontSize, - text_fontType = "OUTLINE", - text_justify = "CENTER", - text_visible = true, - - text_selfPoint = "AUTO", - text_anchorPoint = "INNER_BOTTOMRIGHT", - anchorXOffset = 0, - anchorYOffset = 0, - - text_shadowColor = { 0, 0, 0, 1}, - text_shadowXOffset = 0, - text_shadowYOffset = 0, - - rotateText = "NONE", - }); + local text = CopyTable(default("icon", "new")) + text.text_text = "%s" + text.text_anchorPoint = "INNER_BOTTOMRIGHT" + tinsert(data.subRegions, text); end end diff --git a/WeakAuras/SubRegionTypes/Tick.lua b/WeakAuras/SubRegionTypes/Tick.lua index 5abd834a02..815d027f1f 100644 --- a/WeakAuras/SubRegionTypes/Tick.lua +++ b/WeakAuras/SubRegionTypes/Tick.lua @@ -4,24 +4,27 @@ local AddonName, Private = ... local L = WeakAuras.L; -local default = function() - return { - tick_visible = true, - tick_color = {1, 1, 1, 1}, - tick_placement_mode = "AtValue", - tick_placement = "50", - automatic_length = true, - tick_thickness = 2, - tick_length = 30, - use_texture = false, - tick_texture = [[Interface\CastingBar\UI-CastingBar-Spark]], - tick_blend_mode = "ADD", - tick_desaturate = false, - tick_rotation = 0, - tick_xOffset = 0, - tick_yOffset = 0, - tick_mirror = false, - } +local baseDefaults = { + ["type"] = "subtick", + tick_visible = true, + tick_color = {1, 1, 1, 1}, + tick_placement_mode = "AtValue", + tick_placement = "50", + automatic_length = true, + tick_thickness = 2, + tick_length = 30, + use_texture = false, + tick_texture = [[Interface\CastingBar\UI-CastingBar-Spark]], + tick_blend_mode = "ADD", + tick_desaturate = false, + tick_rotation = 0, + tick_xOffset = 0, + tick_yOffset = 0, + tick_mirror = false, +} + +local default = function(parentType, action) + return baseDefaults end local properties = { diff --git a/WeakAuras/Types.lua b/WeakAuras/Types.lua index 0f2488f10d..5d3490a665 100644 --- a/WeakAuras/Types.lua +++ b/WeakAuras/Types.lua @@ -3516,6 +3516,29 @@ end Private.item_weapon_types[4 * 256 + 6] = GetItemSubClassInfo(4, 6) WeakAuras.item_weapon_types = Private.item_weapon_types +Private.DefaultsApplyTypes = { + region = { + [0] = "Disabled", + [1] = "New Auras", + [2] = "Imported Auras", + [3] = "New/Imported Auras" + }, + newregion = { + [0] = "Disabled", + [1] = "New Auras", + }, + subregion = { + [0] = "Disabled", + [1] = "New Auras and Sub Elements", + [2] = "Imported Auras and Sub Elements", + [3] = "New/Imported Auras and Sub Elements" + }, + newsubregion = { + [0] = "Disabled", + [1] = "New Auras and Sub Elements", + } +} + WeakAuras.StopMotion = {} WeakAuras.StopMotion.texture_types = { } diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 0ad2a1ddf3..24b8a1d827 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -265,6 +265,9 @@ local regionOptions = Private.regionOptions; Private.subRegionOptions = {} local subRegionOptions = Private.subRegionOptions +-- TODO Also should this be its own table or part of regionTypes/subRegionTypes ? +Private.extraDefaultsOptions = {} + -- Maps from trigger type to trigger system Private.triggerTypes = {}; local triggerTypes = Private.triggerTypes; @@ -386,10 +389,10 @@ function WeakAuras.RegisterRegionType(name, createFunction, modifyFunction, defa error("Improper arguments to WeakAuras.RegisterRegionType - modification function is not a function", 2) elseif not(default) then error("Improper arguments to WeakAuras.RegisterRegionType - default options are not defined", 2); - elseif(type(default) ~= "table") then - error("Improper arguments to WeakAuras.RegisterRegionType - default options are not a table", 2); - elseif(type(default) ~= "table" and type(default) ~= "nil") then - error("Improper arguments to WeakAuras.RegisterRegionType - properties options are not a table", 2); + elseif(type(default) ~= "function") then + error("Improper arguments to WeakAuras.RegisterRegionType - default options is not a function", 2); + elseif(type(properties) ~= "table" and type(properties) ~= "function" and type(properties) ~= "nil") then + error("Improper arguments to WeakAuras.RegisterRegionType - properties options are not a table, function or nil", 2); elseif(regionTypes[name]) then error("Improper arguments to WeakAuras.RegisterRegionType - region type \""..name.."\" already defined", 2); else @@ -434,8 +437,8 @@ function WeakAuras.RegisterSubRegionType(name, displayName, supportFunction, cre error("Improper arguments to WeakAuras.RegisterSubRegionType - onRelease function is not a function", 2) elseif not(default) then error("Improper arguments to WeakAuras.RegisterSubRegionType - default options are not defined", 2); - elseif(type(default) ~= "table" and type(default) ~= "function") then - error("Improper arguments to WeakAuras.RegisterSubRegionType - default options are not a table or a function", 2); + elseif(type(default) ~= "function") then + error("Improper arguments to WeakAuras.RegisterSubRegionType - default options are not a function", 2); elseif(addDefaultsForNewAura and type(addDefaultsForNewAura) ~= "function") then error("Improper arguments to WeakAuras.RegisterSubRegionType - addDefaultsForNewAura function is not nil or a function", 2) elseif(subRegionTypes[name]) then @@ -547,6 +550,28 @@ function WeakAuras.RegisterSubRegionOptions(name, createFunction, description) end end +function WeakAuras.RegisterDefaultsOptions(createFunction) +if not(createFunction) then + error("Improper arguments to WeakAuras.RegisterDefaultsOptions - creation function is not defined", 2); + elseif(type(createFunction) ~= "function") then + error("Improper arguments to WeakAuras.RegisterDefaultsOptions - creation function is not a function", 2); + else + tinsert(Private.extraDefaultsOptions, createFunction) + end +end + +function Private.GetDefaultsForRegion(regionType, action) + if regionTypes[regionType] then + return regionTypes[regionType].default(action) + end +end + +function Private.GetDefaultsForSubRegion(subRegionType, parentType, action) + if subRegionTypes[subRegionType] then + return subRegionTypes[subRegionType].default(parentType, action) + end +end + -- This function is replaced in WeakAurasOptions.lua function WeakAuras.IsOptionsOpen() return false; @@ -1243,12 +1268,11 @@ loadedFrame:SetScript("OnEvent", function(self, event, addon) db.displays = db.displays or {}; db.registered = db.registered or {}; - + db.defaults = db.defaults or {} Private.UpdateCurrentInstanceType(); Private.SyncParentChildRelationships(); local isFirstUIDValidation = db.dbVersion == nil or db.dbVersion < 26; Private.ValidateUniqueDataIds(isFirstUIDValidation); - if db.lastArchiveClear == nil then db.lastArchiveClear = time(); elseif db.lastArchiveClear < time() - 86400 then @@ -2836,7 +2860,7 @@ function WeakAuras.PreAdd(data) Private.validate(data, oldDataStub2) end - local default = data.regionType and Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].default + local default = Private.GetDefaultsForRegion(data.regionType, "validate") if default then Private.validate(data, default) end @@ -2853,10 +2877,7 @@ function WeakAuras.PreAdd(data) local subType = subRegionData.type if subType and Private.subRegionTypes[subType] then if Private.subRegionTypes[subType].supports(data.regionType) then - local default = Private.subRegionTypes[subType].default - if type(default) == "function" then - default = default(data.regionType) - end + local default = Private.GetDefaultsForSubRegion(subType, data.regionType, "validate") if default then Private.validate(subRegionData, default) end @@ -3106,7 +3127,7 @@ function Private.SetRegion(data, cloneId) end region.id = id; region.cloneId = cloneId or ""; - Private.validate(data, regionTypes[regionType].default); + Private.validate(data, Private.GetDefaultsForRegion(regionType, "validate")) local parent = WeakAurasFrame; if(data.parent) then diff --git a/WeakAuras/WeakAuras.toc b/WeakAuras/WeakAuras.toc index 09066893c7..89d1c022a9 100644 --- a/WeakAuras/WeakAuras.toc +++ b/WeakAuras/WeakAuras.toc @@ -59,6 +59,7 @@ SubscribableObject.lua # Region support RegionTypes\SmoothStatusBarMixin.lua +RegionTypes\DefaultsCache.lua RegionTypes\RegionPrototype.lua RegionTypes\ProgressTexture.lua RegionTypes\Texture.lua diff --git a/WeakAurasOptions/CommonOptions.lua b/WeakAurasOptions/CommonOptions.lua index 9d8da1bc42..0ba1282a87 100644 --- a/WeakAurasOptions/CommonOptions.lua +++ b/WeakAurasOptions/CommonOptions.lua @@ -87,7 +87,7 @@ local function setFuncs(option, input) end end -local function addCollapsibleHeader(options, key, input, order, isGroupTab) +local function addCollapsibleHeader(options, key, input, order, isGroupTab, width) if input.__noHeader then return end @@ -121,7 +121,7 @@ local function addCollapsibleHeader(options, key, input, order, isGroupTab) end end - local titleWidth = WeakAuras.doubleWidth - (hasAdd and 0.15 or 0) - (hasDelete and 0.15 or 0) - (hasUp and 0.15 or 0) + local titleWidth = width - (hasAdd and 0.15 or 0) - (hasDelete and 0.15 or 0) - (hasUp and 0.15 or 0) - (hasDown and 0.15 or 0) - (hasDuplicate and 0.15 or 0) - (hasApplyTemplate and 0.15 or 0) options[key .. "collapseSpacer"] = { @@ -278,14 +278,16 @@ local function copyOptionTable(input, orderAdjustment, collapsedFunc) return resultOption; end -local flattenRegionOptions = function(allOptions, isGroupTab) +local flattenRegionOptions = function(allOptions, isGroupTab, width) local result = {}; local base = 1000; + width = width or WeakAuras.doubleWidth + for optionGroup, options in pairs(allOptions) do local groupBase = base * options.__order - local collapsedFunc = addCollapsibleHeader(result, optionGroup, options, groupBase, isGroupTab) + local collapsedFunc = addCollapsibleHeader(result, optionGroup, options, groupBase, isGroupTab, width) for optionName, option in pairs(options) do if not optionName:find("^__") then diff --git a/WeakAurasOptions/DefaultOptions.lua b/WeakAurasOptions/DefaultOptions.lua new file mode 100644 index 0000000000..4e65c804c1 --- /dev/null +++ b/WeakAurasOptions/DefaultOptions.lua @@ -0,0 +1,130 @@ +if not WeakAuras.IsLibsOK() then return end +local AddonName, OptionsPrivate = ... +local flattenRegionOptions = OptionsPrivate.commonOptions.flattenRegionOptions + +local L = WeakAuras.L + +local function GlobalOptions(width) + return { + __title = L["Global"], + __order = 1, + empty = { + type = "description", + name = L["No Global Options, yet!"], + order = 1 + } + } +end + +local function convertOptions(options, width) + width = width / 3 + local result = {} + for id, data in pairs(options) do + if id:sub(1, 2) == "__" then + result[id] = data + elseif data.type == "description" or data.type == "header" then + result[id] = data + else + local namespace, key, property + namespace = data.path[1] + key = data.path[2] + property = data.path[3] + + -- Add label + local order = data.order + local path = data.path + local default = data.default + result[id .. "label"] = { + type = "description", + name = data.name, + order = order + 0.1, + width = width, + fontSize = "medium" + } + + local applyType = data.applyType or "region" + + if applyType ~= "none" then + result[id .. "enabled"] = { + type = "select", + name = L["Apply To"], + order = order + 0.2, + values = OptionsPrivate.Private.DefaultsApplyTypes[applyType], + get = function() + local type = OptionsPrivate.Private.GetDefault(namespace, key, property) + return type or 0 + end, + set = function(info, type) + OptionsPrivate.Private.SetDefault(namespace, key, property, type, nil) + end, + width = width + } + end + + data.applyType = nil + data.path = nil + data.default = nil + data.name = "" + if data.type == "color" then + data.get = function() + local _, value = OptionsPrivate.Private.GetDefault(namespace, key, property) + if value ~= nil and type(value) == "table" then + return unpack(value) + end + return 1, 1, 1, 1 + -- TODO This appears to not work ? + --return type(default) == "table" and unpack(default) + end + data.set = function(info, r, g, b, a) + OptionsPrivate.Private.SetDefault(namespace, key, property, nil, {r, g, b, a}) + end + else + data.get = function() + local type, value = OptionsPrivate.Private.GetDefault(namespace, key, property) + if value ~= nil then + return value + end + return default + end + data.set = function(info, value, ...) + OptionsPrivate.Private.SetDefault(namespace, key, property, nil, value) + end + end + if applyType ~= "none" then + data.disabled = function() + local type = OptionsPrivate.Private.GetDefault(namespace, key, property) + return not type or type == 0 + end + end + data.order = order + 0.3 + result[id] = data + end + end + + return result +end + +local function GetExtraOptions(width) + local extraOptions = {} + local order = 2 + for index, createOptions in ipairs(OptionsPrivate.Private.extraDefaultsOptions) do + extraOptions[index] = convertOptions(createOptions(width / 3), width) + extraOptions[index].__order = order + order = order + 1 + end + return extraOptions +end + +function OptionsPrivate.GetDefaultsOptions(width) + local extraOptions = GetExtraOptions(width) + extraOptions.global = GlobalOptions(width) + + local options = { + type = "group", + name = L["Settings"], + order = 1, + args = flattenRegionOptions(extraOptions, nil, width) + } + + return options +end diff --git a/WeakAurasOptions/DisplayOptions.lua b/WeakAurasOptions/DisplayOptions.lua index 1b8dda3abe..b3632b3b05 100644 --- a/WeakAurasOptions/DisplayOptions.lua +++ b/WeakAurasOptions/DisplayOptions.lua @@ -19,8 +19,7 @@ local function AddSubRegion(data, subRegionName) data.subRegions = data.subRegions or {} if OptionsPrivate.Private.subRegionTypes[subRegionName] and OptionsPrivate.Private.subRegionTypes[subRegionName] then if OptionsPrivate.Private.subRegionTypes[subRegionName].supports(data.regionType) then - local default = OptionsPrivate.Private.subRegionTypes[subRegionName].default - local subRegionData = type(default) == "function" and default(data.regionType) or CopyTable(default) + local subRegionData = CopyTable(OptionsPrivate.Private.GetDefaultsForSubRegion(subRegionName, data.regionType, "new")) subRegionData.type = subRegionName tinsert(data.subRegions, subRegionData) WeakAuras.Add(data) diff --git a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua index 4be3179ae0..435a2d31a7 100644 --- a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua +++ b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua @@ -237,6 +237,7 @@ function OptionsPrivate.CreateFrame() self.texteditor.frame:Hide() self.codereview.frame:Hide() self.debugLog.frame:Hide() + self.settingsview:Hide() if self.newView then self.newView.frame:Hide() end @@ -306,6 +307,7 @@ function OptionsPrivate.CreateFrame() else self.codereview.frame:Hide() end + if self.window == "newView" then OptionsPrivate.SetTitle(L["New Template"]) self.newView.frame:Show() @@ -314,18 +316,27 @@ function OptionsPrivate.CreateFrame() self.newView.frame:Hide() end end + if self.window == "update" then OptionsPrivate.SetTitle(L["Update"]) self.update.frame:Show() else self.update.frame:Hide() end + if self.window == "debuglog" then OptionsPrivate.SetTitle(L["Debug Log"]) self.debugLog.frame:Show() else self.debugLog.frame:Hide() end + + if self.window == "settingsview" then + self.settingsview:Show() + else + self.settingsview:Hide() + end + if self.window == "default" then if self.loadProgessVisible then self.loadProgress:Show() @@ -518,6 +529,7 @@ function OptionsPrivate.CreateFrame() frame.codereview = OptionsPrivate.CodeReview(frame) frame.update = OptionsPrivate.UpdateFrame(frame) frame.debugLog = OptionsPrivate.DebugLog(frame) + frame.settingsview = OptionsPrivate.Settings(frame) frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame) @@ -614,6 +626,19 @@ function OptionsPrivate.CreateFrame() lockButton.frame:Show() lockButton:SetPoint("RIGHT", magnetButton.frame, "LEFT", -10, 0) + local defaultsButton = AceGUI:Create("WeakAurasToolbarButton") + defaultsButton:SetText(L["Settings"]) + defaultsButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\gear") + defaultsButton.frame:SetParent(toolbarContainer) + defaultsButton.frame:Show() + defaultsButton.frame:SetPoint("RIGHT", lockButton.frame, "LEFT", -10, 0) + + defaultsButton:SetCallback("OnClick", function() + OptionsPrivate.OpenSettings() + end) + + frame.toolbarContainer = toolbarContainer + local loadProgress = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") loadProgress:SetPoint("TOP", buttonsContainer.frame, "TOP", 0, -4) loadProgress:SetText(L["Creating options: "].."0/0") @@ -960,7 +985,6 @@ function OptionsPrivate.CreateFrame() OptionsPrivate.commonOptionsCache:Clear() frame:UpdateOptions() - local data if type(self.pickedDisplay) == "string" then data = WeakAuras.GetData(frame.pickedDisplay) @@ -973,6 +997,10 @@ function OptionsPrivate.CreateFrame() container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -10) container:ReleaseChildren() container:SetLayout("Fill") + + + local group = AceGUI:Create("WeakAurasInlineGroup") + tabsWidget = AceGUI:Create("TabGroup") local tabs = { @@ -995,16 +1023,15 @@ function OptionsPrivate.CreateFrame() tabsWidget:SetLayout("Fill") container:AddChild(tabsWidget) - local group = AceGUI:Create("WeakAurasInlineGroup") tabsWidget:AddChild(group) tabsWidget:SetCallback("OnGroupSelected", function(self, event, tab) frame.selectedTab = tab frame:FillOptions() end) + tabsWidget:SetTitle("") AceConfigDialog:Open("WeakAuras", group) - tabsWidget:SetTitle("") if data.controlledChildren and #data.controlledChildren == 0 then WeakAurasOptions:NewAura() diff --git a/WeakAurasOptions/OptionsFrames/SettingsView.lua b/WeakAurasOptions/OptionsFrames/SettingsView.lua new file mode 100644 index 0000000000..e619dad1fc --- /dev/null +++ b/WeakAurasOptions/OptionsFrames/SettingsView.lua @@ -0,0 +1,66 @@ +if not WeakAuras.IsLibsOK() then return end +local AddonName, OptionsPrivate = ... + +local AceGUI = LibStub("AceGUI-3.0") +local AceConfig = LibStub("AceConfig-3.0") +local AceConfigDialog = LibStub("AceConfigDialog-3.0") + +local WeakAuras = WeakAuras +local L = WeakAuras.L + +local funcs = { + Open = function(self) + self:Refill() + + self.parentFrame.window = "settingsview" + self.parentFrame:UpdateFrameVisible() + end, + Refill = function(self) + -- TODO need to check width of margin + -- TODO call refill not on each OnSizeChanged ? + -- TODO work on the ui a lot more + local width = (self.group.frame:GetWidth() - 30) / 170 + local optionTable = OptionsPrivate.GetDefaultsOptions(width) + AceConfig:RegisterOptionsTable("WeakAurasSettings", optionTable) + AceConfigDialog:Open("WeakAurasSettings", self.group) + end, + Close = function(self) + self.parentFrame.window = "default" + self.parentFrame:UpdateFrameVisible() + end +} + +local function ConstructSettings(frame) + local settingsFrame = CreateFrame("Frame", nil, frame) + for k, f in pairs(funcs) do + settingsFrame[k] = f + end + settingsFrame.parentFrame = frame + settingsFrame:SetAllPoints(frame) + settingsFrame:Hide() + + local group = AceGUI:Create("WeakAurasInlineGroup") + settingsFrame.group = group + group.frame:SetParent(settingsFrame) + group.frame:SetPoint("BOTTOMRIGHT", settingsFrame, "BOTTOMRIGHT", -17, 35) + group.frame:SetPoint("TOPLEFT", settingsFrame, "TOPLEFT", 17, -10) + group.frame:SetScript("OnSizeChanged", function() settingsFrame:Refill() end) + + local close = CreateFrame("Button", nil, settingsFrame, "UIPanelButtonTemplate") + close:SetScript("OnClick", function() + settingsFrame:Close() + end) + close:SetPoint("BOTTOMRIGHT", -27, 13) + close:SetFrameLevel(close:GetFrameLevel() + 1) + close:SetHeight(20) + close:SetWidth(100) + close:SetText(L["Ok"]) + + return settingsFrame +end + +local settings +function OptionsPrivate.Settings(frame) + settings = settings or ConstructSettings(frame) + return settings +end diff --git a/WeakAurasOptions/RegionOptions/AuraBar.lua b/WeakAurasOptions/RegionOptions/AuraBar.lua index 33de4c70ce..9494fbef89 100644 --- a/WeakAurasOptions/RegionOptions/AuraBar.lua +++ b/WeakAurasOptions/RegionOptions/AuraBar.lua @@ -824,5 +824,36 @@ local function GetAnchors(data) return anchorPoints; end +local function createDefaultOptions(width) + local options = { + __title = L["Progress Bar Default Options"], + + icon = { + name = L["Show Icon"], + path = {'region', 'aurabar', 'icon'}, + applyType = "newregion", + default = false, + type = "toggle", + width = width, + order = 2, + }, + texture = { + name = L["Bar Texture"], + path = {'region', 'aurabar', 'texture'}, + applyType = "region", + default = "Blizzard", + + type = "select", + dialogControl = "LSM30_Statusbar", + width = width, + order = 3, + values = AceGUIWidgetLSMlists.statusbar + }, + } + return options +end + +WeakAuras.RegisterDefaultsOptions(createDefaultOptions) + -- Register new region type options with WeakAuras WeakAuras.RegisterRegionOptions("aurabar", createOptions, createIcon, L["Progress Bar"], createThumbnail, modifyThumbnail, L["Shows a progress bar with name, timer, and icon"], templates, GetAnchors); diff --git a/WeakAurasOptions/RegionOptions/Icon.lua b/WeakAurasOptions/RegionOptions/Icon.lua index cb07a402fa..42c0732101 100644 --- a/WeakAurasOptions/RegionOptions/Icon.lua +++ b/WeakAurasOptions/RegionOptions/Icon.lua @@ -518,7 +518,49 @@ local function GetAnchors(data) return anchorPoints; end +local function createDefaultOptions(width) + local options = { + __title = L["Icon Default Options"], + + zoom = { + name = L["Zoom"], + path = {'region', 'icon', 'zoom'}, + applyType = "region", + default = 0, + type = "range", + width = width, + order = 2, + min = 0, + max = 1, + step = 0.01, + isPercent = true + }, + cooldown = { + name = L["Cooldown"], + path = {'region', 'icon', 'cooldown'}, + applyType = "newregion", + default = false, + + type = "toggle", + width = width, + order = 3, + }, + cooldownTextDisabled = { + name = L["Cooldown Text Disabled"], + path = {'region', 'icon', 'cooldownTextDisabled'}, + applyType = "newregion", + default = false, + + type = "toggle", + width = width, + order = 4, + }, + } + return options +end + +WeakAuras.RegisterDefaultsOptions(createDefaultOptions) + WeakAuras.RegisterRegionOptions("icon", createOptions, "interface\\icons\\spell_holy_sealofsalvation.blp", L["Icon"], createThumbnail, modifyThumbnail, - L["Shows a spell icon with an optional cooldown overlay"], - templates, GetAnchors); + L["Shows a spell icon with an optional cooldown overlay"], templates, GetAnchors) diff --git a/WeakAurasOptions/RegionOptions/Text.lua b/WeakAurasOptions/RegionOptions/Text.lua index 979ebfee94..dcef8dc7ec 100644 --- a/WeakAurasOptions/RegionOptions/Text.lua +++ b/WeakAurasOptions/RegionOptions/Text.lua @@ -428,4 +428,55 @@ local templates = { } } +local function createDefaultOptions(width) + local options = { + __title = L["Text Region Default Options"], + + text_header_line = { + type = "header", + name = "", + order = 1, + }, + + font = { + name = L["Font"], + path = {'region', 'text', 'font'}, + applyType = "region", + default = "Friz Quadrata TT", + type = "select", + width = width, + dialogControl = "LSM30_Font", + values = AceGUIWidgetLSMlists.font, + order = 2, + }, + fontSize = { + name = L["Size"], + path = {'region', 'text', 'fontSize'}, + applyType = "region", + default = 12, + + type = "range", + width = width, + min = 6, + softMax = 72, + step = 1, + order = 3, + }, + fontType = { + name = L["Font Flags"], + path = {'region', 'text', 'outline'}, + applyType = "region", + default = "None", + + type = "select", + width = width, + values = OptionsPrivate.Private.font_flags, + order = 4, + }, + } + return options +end + +WeakAuras.RegisterDefaultsOptions(createDefaultOptions) + WeakAuras.RegisterRegionOptions("text", createOptions, createIcon, L["Text"], createThumbnail, modifyThumbnail, L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"], templates); diff --git a/WeakAurasOptions/SubRegionOptions/Border.lua b/WeakAurasOptions/SubRegionOptions/Border.lua index fd126371a6..97aa01f922 100644 --- a/WeakAurasOptions/SubRegionOptions/Border.lua +++ b/WeakAurasOptions/SubRegionOptions/Border.lua @@ -63,4 +63,212 @@ local function createOptions(parentData, data, index, subIndex) return options end +local function createDefaultOptions(width) + local options = { + __title = L["Border Sub Element Default Options"], + -- Icon + subborder_icon_header = { + type = "description", + name = L["Icon"], + order = 1, + fontSize = "large" + }, + + subborder_icon_default = { + name = L["Automatically add to new Icons"], + type = "toggle", + path = {'subRegion', 'border', 'icon_add'}, + applyType = "none", + default = false, + order = 2, + width = width * 2 + }, + + subborder_icon_size = { + name = L["Size"], + type = "range", + path = {'subRegion', 'border', 'icon_border_size'}, + applyType = "newsubregion", + default = 2, + order = 3, + width = width, + min = 1, + softMax = 64, + bigStep = 1, + }, + + subborder_icon_edge = { + name = L["Style"], + type = "select", + path = {'subRegion', 'border', 'icon_border_edge'}, + applyType = "newsubregion", + default = "Square Full White", + width = width, + dialogControl = "LSM30_Border", + order = 4, + values = AceGUIWidgetLSMlists.border, + }, + + subborder_icon_color = { + name = L["Color"], + type = "color", + path = {'subRegion', 'border', 'icon_border_color'}, + applyType = "newsubregion", + default = {1, 1, 1, 1}, + width = width, + hasAlpha = true, + order = 5, + }, + + subborder_icon_offset = { + name = L["Border Offset"], + type = "range", + path = {'subRegion', 'border', 'icon_border_offset'}, + applyType = "newsubregion", + default = 0, + order = 6, + width = width, + softMin = 0, + softMax = 32, + bigStep = 1, + }, + + -- Aurabar + subborder_aurabar_header = { + name = L["Progress Bar"], + type = "description", + order = 20, + fontSize = "large" + }, + + subborder_aurabar_default = { + name = L["Add to new Progress Bars"], + type = "toggle", + path = {'subRegion', 'border', 'aurabar_add'}, + applyType = "none", + default = false, + order = 21, + width = width * 2 + }, + + subborder_aurabar_size = { + name = L["Size"], + type = "range", + path = {'subRegion', 'border', 'aurabar_border_size'}, + applyType = "newsubregion", + default = 2, + order = 23, + width = width, + min = 1, + softMax = 64, + bigStep = 1, + }, + + subborder_aurabar_edge = { + name = L["Style"], + type = "select", + path = {'subRegion', 'border', 'aurabar_border_edge'}, + applyType = "newsubregion", + default = "Square Full White", + width = width, + dialogControl = "LSM30_Border", + order = 24, + values = AceGUIWidgetLSMlists.border, + }, + + subborder_aurabar_color = { + name = L["Color"], + type = "color", + path = {'subRegion', 'border', 'aurabar_border_color'}, + applyType = "newsubregion", + default = {1, 1, 1, 1}, + width = width, + hasAlpha = true, + order = 25, + }, + + subborder_aurabar_offset = { + name = L["Border Offset"], + type = "range", + path = {'subRegion', 'border', 'aurabar_border_offset'}, + applyType = "newsubregion", + default = 0, + order = 26, + width = width, + softMin = 0, + softMax = 32, + bigStep = 1, + }, + --- Other + subborder_other_header = { + name = L["Other"], + type = "description", + order = 30, + fontSize = "large" + }, + + subborder_other_default = { + name = L["Add to new Progress Bars"], + type = "toggle", + path = {'subRegion', 'border', 'other_add'}, + applyType = "none", + default = false, + order = 31, + width = width * 2 + }, + + subborder_other_size = { + name = L["Size"], + type = "range", + path = {'subRegion', 'border', 'other_border_size'}, + applyType = "newsubregion", + default = 2, + order = 33, + width = width, + min = 1, + softMax = 64, + bigStep = 1, + }, + + subborder_other_edge = { + name = L["Style"], + type = "select", + path = {'subRegion', 'border', 'other_border_edge'}, + applyType = "newsubregion", + default = "Square Full White", + width = width, + dialogControl = "LSM30_Border", + order = 34, + values = AceGUIWidgetLSMlists.border, + }, + + subborder_other_color = { + name = L["Color"], + type = "color", + path = {'subRegion', 'border', 'other_border_color'}, + applyType = "newsubregion", + default = {1, 1, 1, 1}, + width = width, + hasAlpha = true, + order = 35, + }, + + subborder_other_offset = { + name = L["Border Offset"], + type = "range", + path = {'subRegion', 'border', 'other_border_offset'}, + applyType = "newsubregion", + default = 0, + order = 36, + width = width, + softMin = 0, + softMax = 32, + bigStep = 1, + } + } + return options +end + +WeakAuras.RegisterDefaultsOptions(createDefaultOptions) + WeakAuras.RegisterSubRegionOptions("subborder", createOptions, L["Shows a border"]); diff --git a/WeakAurasOptions/SubRegionOptions/SubText.lua b/WeakAurasOptions/SubRegionOptions/SubText.lua index ab0e994dbf..bb627801d5 100644 --- a/WeakAurasOptions/SubRegionOptions/SubText.lua +++ b/WeakAurasOptions/SubRegionOptions/SubText.lua @@ -525,5 +525,160 @@ local function createOptions(parentData, data, index, subIndex) return options, commonTextOptions end +local function createDefaultOptions(width) + local options = { + __title = L["Text Sub Element Default Options"], + + subtext_pb_header_line = { + type = "header", + name = "", + order = 1, + }, + + subtext_pb_header = { + type = "description", + name = L["Progress Bar"], + order = 1.1, + fontSize = "large" + }, + + subtext_pb_font = { + name = L["Font"], + path = {'subRegion', 'subtext', 'pb_text_font'}, + applyType = "subregion", + default = "Friz Quadrata TT", + type = "select", + width = width, + dialogControl = "LSM30_Font", + values = AceGUIWidgetLSMlists.font, + order = 2, + }, + subtext_pb_fontSize = { + name = L["Size"], + path = {'subRegion', 'subtext', 'pb_text_fontSize'}, + applyType = "subregion", + default = 12, + + type = "range", + width = width, + min = 6, + softMax = 72, + step = 1, + order = 3, + }, + subtext_pb_fontType = { + name = L["Font Flags"], + path = {'subRegion', 'subtext', 'pb_text_fontType'}, + applyType = "subregion", + default = "None", + + type = "select", + width = width, + values = OptionsPrivate.Private.font_flags, + order = 4, + }, + + subtext_icon_header_line = { + type = "header", + name = "", + order = 5, + }, + + subtext_icon_header = { + type = "description", + name = L["Icon"], + order = 5.1, + fontSize = "large" + }, + + subtext_icon_font = { + name = L["Font"], + path = {'subRegion', 'subtext', 'icon_text_font'}, + applyType = "subregion", + default = "Friz Quadrata TT", + type = "select", + width = width, + dialogControl = "LSM30_Font", + values = AceGUIWidgetLSMlists.font, + order = 6, + }, + subtext_icon_fontSize = { + name = L["Size"], + path = {'subRegion', 'subtext', 'icon_text_fontSize'}, + applyType = "subregion", + default = 12, + + type = "range", + width = width, + min = 6, + softMax = 72, + step = 1, + order = 7, + }, + subtext_icon_fontType = { + name = L["Font Flags"], + path = {'subRegion', 'subtext', 'icon_text_fontType'}, + applyType = "subregion", + default = "None", + + type = "select", + width = width, + values = OptionsPrivate.Private.font_flags, + order = 8, + }, + + subtext_other_header_line = { + type = "header", + name = "", + order = 9, + }, + + subtext_other_header = { + type = "description", + name = L["Other"], + order = 9.1, + fontSize = "large" + }, + + subtext_other_font = { + name = L["Font"], + path = {'subRegion', 'subtext', 'other_text_font'}, + applyType = "subregion", + default = "Friz Quadrata TT", + type = "select", + width = width, + dialogControl = "LSM30_Font", + values = AceGUIWidgetLSMlists.font, + order = 10, + }, + subtext_other_fontSize = { + name = L["Size"], + path = {'subRegion', 'subtext', 'other_text_fontSize'}, + applyType = "subregion", + default = 12, + + type = "range", + width = width, + min = 6, + softMax = 72, + step = 1, + order = 11, + }, + subtext_other_fontType = { + name = L["Font Flags"], + path = {'subRegion', 'subtext', 'other_text_fontType'}, + applyType = "subregion", + default = "None", + + type = "select", + width = width, + values = OptionsPrivate.Private.font_flags, + order = 12, + } + } + return options +end + +WeakAuras.RegisterDefaultsOptions(createDefaultOptions) WeakAuras.RegisterSubRegionOptions("subtext", createOptions, - L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"]) + L["Shows one or more lines of text, which can include dynamic information such as progress or stacks"]) diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index d905ee053d..0b14d00800 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -892,6 +892,10 @@ function OptionsPrivate.OpenUpdate(data, children, target, sender, callbackFunc) return frame.update:Open(data, children, target, sender, callbackFunc) end +function OptionsPrivate.OpenSettings() + frame.settingsview:Open() +end + function OptionsPrivate.ConvertDisplay(data, newType) local id = data.id; local visibility = displayButtons[id]:GetVisibility(); @@ -1655,7 +1659,7 @@ function WeakAuras.NewAura(sourceData, regionType, targetId) WeakAuras.DeepMixin(data, sourceData); end data.internalVersion = WeakAuras.InternalVersion(); - OptionsPrivate.Private.validate(data, OptionsPrivate.Private.regionTypes[regionType].default); + OptionsPrivate.Private.validate(data, OptionsPrivate.Private.GetDefaultsForRegion(regionType, "new")) AddDefaultSubRegions(data) diff --git a/WeakAurasOptions/WeakAurasOptions.toc b/WeakAurasOptions/WeakAurasOptions.toc index 12ab1fc52f..e55c8b0b38 100644 --- a/WeakAurasOptions/WeakAurasOptions.toc +++ b/WeakAurasOptions/WeakAurasOptions.toc @@ -47,6 +47,7 @@ LoadOptions.lua ActionOptions.lua AnimationOptions.lua InformationOptions.lua +DefaultOptions.lua BuffTrigger2.lua GenericTrigger.lua @@ -66,6 +67,7 @@ OptionsFrames\TextEditor.lua OptionsFrames\TexturePicker.lua OptionsFrames\Update.lua OptionsFrames\DebugLogFrame.lua +OptionsFrames\SettingsView.lua # Misc frames OptionsFrames\MoverSizer.lua diff --git a/WeakAurasTemplates/TriggerTemplates.lua b/WeakAurasTemplates/TriggerTemplates.lua index d25c6c1109..3da9d07bab 100644 --- a/WeakAurasTemplates/TriggerTemplates.lua +++ b/WeakAurasTemplates/TriggerTemplates.lua @@ -54,7 +54,11 @@ local function changes(property, regionType) value = true, property = "sub."..subregionPos..".glow" }; - elseif TemplatePrivate.Private.regionTypes[regionType].default[property] == nil then + end + + -- TODO check that templates filtering condition changes work + local defaults = TemplatePrivate.Private.GetDefaultsForRegion(regionType, "template") + if defaults[property] == nil then return nil; elseif property == "cooldownSwipe" then return { @@ -530,7 +534,7 @@ local function subTypesFor(item, regionType) local dataGlow = {} if regionType == "aurabar" then dataGlow.subRegions = { - [1] = TemplatePrivate.Private.getDefaultGlow(regionType) + [1] = TemplatePrivate.Private.GetDefaultsForSubRegion("glow", regionType, "template") } end if (item.type == "ability") then @@ -1214,17 +1218,7 @@ function WeakAuras.CreateTemplateView(Private, frame) TemplatePrivate.Private = Private -- Enrich Display templates with default values - for regionType, regionData in pairs(TemplatePrivate.Private.regionOptions) do - if (regionData.templates) then - for _, item in ipairs(regionData.templates) do - for k, v in pairs(TemplatePrivate.Private.regionTypes[regionType].default) do - if (item.data[k] == nil) then - item.data[k] = v - end - end - end - end - end + -- TODO needs to happen on aura creation local newView = AceGUI:Create("InlineGroup"); newView.frame:SetParent(frame); diff --git a/WeakAurasTemplates/TriggerTemplatesData.lua b/WeakAurasTemplates/TriggerTemplatesData.lua index 73bd4639b9..c03ef9ba8c 100644 --- a/WeakAurasTemplates/TriggerTemplatesData.lua +++ b/WeakAurasTemplates/TriggerTemplatesData.lua @@ -5448,4 +5448,5 @@ itemInfoReceived:SetScript("OnEvent", function() end end); + TemplatePrivate.triggerTemplates = templates diff --git a/WeakAurasTemplates/TriggerTemplatesDataClassicEra.lua b/WeakAurasTemplates/TriggerTemplatesDataClassicEra.lua index 7d33ea35f8..eca3738c23 100644 --- a/WeakAurasTemplates/TriggerTemplatesDataClassicEra.lua +++ b/WeakAurasTemplates/TriggerTemplatesDataClassicEra.lua @@ -1060,5 +1060,4 @@ itemInfoReceived:SetScript("OnEvent", function() end end); - TemplatePrivate.triggerTemplates = templates