From a5dbbd264066e1a360f021affb85745e0ccd7857 Mon Sep 17 00:00:00 2001 From: NoM0Re Date: Thu, 9 Jan 2025 15:14:12 +0100 Subject: [PATCH] Clean up WeakAuras table and remove members that no one should touch --- WeakAuras/Animations.lua | 2 +- WeakAuras/AuraEnvironment.lua | 147 ++++++++---- WeakAuras/AuraWarnings.lua | 15 +- WeakAuras/BuffTrigger2.lua | 16 +- WeakAuras/Conditions.lua | 92 ++++---- WeakAuras/GenericTrigger.lua | 61 +++-- WeakAuras/Init.lua | 4 +- WeakAuras/Profiling.lua | 2 +- WeakAuras/Prototypes.lua | 168 +++++++------- WeakAuras/RegionTypes/DynamicGroup.lua | 6 +- WeakAuras/RegionTypes/Group.lua | 2 +- WeakAuras/RegionTypes/Model.lua | 2 +- WeakAuras/RegionTypes/RegionPrototype.lua | 12 +- WeakAuras/RegionTypes/Text.lua | 8 +- WeakAuras/SubRegionTypes/Glow.lua | 2 +- WeakAuras/Types.lua | 2 +- WeakAuras/WeakAuras.lua | 213 +++++++++--------- .../AceGUIWidget-WeakAurasDisplayButton.lua | 48 ++-- .../AceGUIWidget-WeakAurasNewButton.lua | 5 +- ...UIWidget-WeakAurasPendingInstallButton.lua | 6 +- ...GUIWidget-WeakAurasPendingUpdateButton.lua | 6 +- WeakAurasOptions/AnimationOptions.lua | 12 +- WeakAurasOptions/CommonOptions.lua | 3 +- WeakAurasOptions/DisplayOptions.lua | 9 +- WeakAurasOptions/GroupOptions.lua | 5 +- .../OptionsFrames/FrameChooser.lua | 4 +- WeakAurasOptions/OptionsFrames/MoverSizer.lua | 2 +- .../OptionsFrames/OptionsFrame.lua | 21 +- WeakAurasOptions/OptionsFrames/Update.lua | 14 +- WeakAurasOptions/RegionOptions/Model.lua | 2 +- WeakAurasOptions/RegionOptions/StopMotion.lua | 2 +- .../SubRegionOptions/SubRegionCommon.lua | 4 +- WeakAurasOptions/WeakAurasOptions.lua | 99 ++++---- 33 files changed, 529 insertions(+), 467 deletions(-) diff --git a/WeakAuras/Animations.lua b/WeakAuras/Animations.lua index 59a10a2..9c8db06 100644 --- a/WeakAuras/Animations.lua +++ b/WeakAuras/Animations.lua @@ -9,7 +9,7 @@ local anim_function_strings = Private.anim_function_strings; local function noopErrorHandler() end -local frame = WeakAuras.frames["WeakAuras Main Frame"] +local frame = Private.frames["WeakAuras Main Frame"] local updatingAnimations; local last_update = GetTime(); diff --git a/WeakAuras/AuraEnvironment.lua b/WeakAuras/AuraEnvironment.lua index 50abe3b..6175036 100644 --- a/WeakAuras/AuraEnvironment.lua +++ b/WeakAuras/AuraEnvironment.lua @@ -379,18 +379,29 @@ local function MakeReadOnly(input, options) }) end +--- Wraps a table, so that accessing any key in it creates a deprecated warning +local function MakeDeprecated(input, name, warningMsg) + return setmetatable({}, + { + __index = function(t, k) + Private.AuraWarnings.UpdateWarning(current_uid, "Deprecated_" .. name, "warning", warningMsg) + return input[k] + end, + __metatable = false + }) +end + local FakeWeakAurasMixin = { blockedFunctions = { -- Other addons might use these, so before moving them to the Private space, we need -- to discuss these. But Auras have no purpose for calling these Add = true, - AddMany = true, Delete = true, HideOptions = true, Rename = true, NewAura = true, - OptionsFrame = true, - RegisterDisplay = true, + Import = true, + PreAdd = true, RegisterRegionOptions = true, RegisterSubRegionOptions = true, RegisterSubRegionType = true, @@ -400,39 +411,34 @@ local FakeWeakAurasMixin = { ShowOptions = true, -- Note these shouldn't exist in the WeakAuras namespace, but moving them takes a bit of effort, -- so for now just block them and clean them up later + createSpinner = true, ClearAndUpdateOptions = true, - CloseImportExport = true, CreateTemplateView = true, FillOptions = true, - FindUnusedId = true, GetMoverSizerId = true, - GetDisplayButton = true, - Import = true, + GetNameAndIcon = true, + GetTriggerCategoryFor = true, NewDisplayButton = true, + OpenOptions = true, PickDisplay = true, + setTile = true, SetMoverSizer = true, + SetModel = true, + Toggle = true, ToggleOptions = true, UpdateGroupOrders = true, UpdateThumbnail = true, - validate = true, - getDefaultGlow = true, }, blockedTables = { - AuraWarnings = true, ModelPaths = true, regionPrototype = true, + RealTimeProfilingWindow = true, -- Note these shouldn't exist in the WeakAuras namespace, but moving them takes a bit of effort, -- so for now just block them and clean them up later - data_stub = true, - displayButtons = true, - regionTypes = true, - regionOptions = true, + genericTriggerTypes = true, + newFeatureString = true, spellCache = true, - triggerTemplates = true, - frames = true, - loadFrame = true, - unitLoadFrame = true, - loaded = true + StopMotion = true, }, override = { me = UnitName("player"), @@ -445,7 +451,11 @@ local FakeWeakAurasMixin = { L["This aura calls GetData a lot, which is a slow function."]) end return CopyTable(WeakAuras.GetData(id)) - end + end, + clones = MakeDeprecated(Private.clones, "clones", + L["Using WeakAuras.clones is deprecated. Use WeakAuras.GetRegion(id, cloneId) instead."]), + regions = MakeDeprecated(Private.regions, "regions", + L["Using WeakAuras.regions is deprecated. Use WeakAuras.GetRegion(id) instead."]) }, blocked = blocked, setBlocked = function() @@ -468,14 +478,14 @@ local overridden = { WeakAuras = FakeWeakAuras } -local env_getglobal -local exec_env = setmetatable({}, +local env_getglobal_custom +local exec_env_custom = setmetatable({}, { __index = function(t, k) if k == "_G" then return t elseif k == "getglobal" then - return env_getglobal + return env_getglobal_custom elseif k == "aura_env" then return current_aura_env elseif k == "DebugPrint" then @@ -502,29 +512,88 @@ local exec_env = setmetatable({}, __metatable = false }) -function env_getglobal(k) - return exec_env[k] +function env_getglobal_custom(k) + return exec_env_custom[k] end -local function_cache = {} -function WeakAuras.LoadFunction(string) - if function_cache[string] then - return function_cache[string] - else - local loadedFunction, errorString = loadstring(string) - if errorString then - print(errorString) +local PrivateForBuiltIn = { + ExecEnv = Private.ExecEnv +} +local env_getglobal_builtin +local exec_env_builtin = setmetatable({}, +{ + __index = function(t, k) + if k == "_G" then + return t + elseif k == "getglobal" then + return env_getglobal_builtin + elseif k == "aura_env" then + return current_aura_env + elseif k == "DebugPrint" then + return DebugPrint + elseif k == "Private" then + -- Built in code has access to Private.ExecEnv + -- Which contains a bunch of internal helpers + return PrivateForBuiltIn + elseif blockedFunctions[k] then + blocked(k) + return function() end + elseif blockedTables[k] then + blocked(k) + return {} + elseif overridden[k] then + return overridden[k] else - setfenv(loadedFunction, exec_env) - local success, func = pcall(assert(loadedFunction)) - if success then - function_cache[string] = func - return func + return _G[k] + end + end, + __newindex = function(table, key, value) + if _G[key] then + Private.AuraWarnings.UpdateWarning(current_uid, "OverridingGlobal", "warning", + string.format(L["The aura has overwritten the global '%s', this might affect other auras."], key)) + end + rawset(table, key, value) + end, + __metatable = false +}) + +function env_getglobal_builtin(k) + return exec_env_builtin[k] +end + +local function CreateFunctionCache(exec_env) + local cache = {} + cache.Load = function(self, string) + if self[string] then + return self[string] + else + local loadedFunction, errorString = loadstring(string) + if errorString then + print(errorString) + else + setfenv(loadedFunction, exec_env) + local success, func = pcall(assert(loadedFunction)) + if success then + self[string] = func + return func + end end end end + return cache +end + +local function_cache_custom = CreateFunctionCache(exec_env_custom) +local function_cache_builtin = CreateFunctionCache(exec_env_builtin) + +function WeakAuras.LoadFunction(string) + return function_cache_custom:Load(string) +end + +function Private.LoadFunction(string) + return function_cache_builtin:Load(string) end function Private.GetSanitizedGlobal(key) - return exec_env[key] + return exec_env_custom[key] end diff --git a/WeakAuras/AuraWarnings.lua b/WeakAuras/AuraWarnings.lua index ec193e0..7561ef1 100644 --- a/WeakAuras/AuraWarnings.lua +++ b/WeakAuras/AuraWarnings.lua @@ -4,7 +4,6 @@ local AddonName, Private = ... local WeakAuras = WeakAuras local L = WeakAuras.L --- keyed on uid, key, { severity, message } local warnings = {} local printedWarnings = {} @@ -14,8 +13,9 @@ local function OnDelete(event, uid) end Private.callbacks:RegisterCallback("Delete", OnDelete) +Private.AuraWarnings = {} -local function UpdateWarning(uid, key, severity, message, printOnConsole) +function Private.AuraWarnings.UpdateWarning(uid, key, severity, message, printOnConsole) if not uid then WeakAuras.prettyPrint(L["Warning for unknown aura:"], message) return @@ -64,7 +64,7 @@ local titles = { info = L["Information"], sound = L["Sound"], warning = L["Warning"], - error = L["Error"] + error = L["Error"], } local function AddMessages(result, messages, icon, mixedSeverity) @@ -89,7 +89,7 @@ local function AddMessages(result, messages, icon, mixedSeverity) return result end -local function FormatWarnings(uid) +function Private.AuraWarnings.FormatWarnings(uid) if not warnings[uid] then return end @@ -123,7 +123,7 @@ local function FormatWarnings(uid) return icons[maxSeverity], titles[maxSeverity], result end -local function GetAllWarnings(uid) +function Private.AuraWarnings.GetAllWarnings(uid) local results = {} local thisWarnings local data = Private.GetDataByUID(uid) @@ -163,8 +163,3 @@ local function GetAllWarnings(uid) end return results end - -Private.AuraWarnings = {} -Private.AuraWarnings.UpdateWarning = UpdateWarning -Private.AuraWarnings.FormatWarnings = FormatWarnings -Private.AuraWarnings.GetAllWarnings = GetAllWarnings diff --git a/WeakAuras/BuffTrigger2.lua b/WeakAuras/BuffTrigger2.lua index 68416b4..3688f18 100644 --- a/WeakAuras/BuffTrigger2.lua +++ b/WeakAuras/BuffTrigger2.lua @@ -1723,7 +1723,7 @@ local function RecheckActiveForUnitType(unitType, unit, unitsToRemoveScan) end local Buff2Frame = CreateFrame("Frame") -WeakAuras.frames["WeakAuras Buff2 Frame"] = Buff2Frame +Private.frames["WeakAuras Buff2 Frame"] = Buff2Frame local function EventHandler(frame, event, arg1, arg2, ...) @@ -2340,7 +2340,7 @@ function BuffTrigger.Add(data) local remFunc if trigger.unit ~= "multi" and CanHaveMatchCheck(trigger) and trigger.useRem then local remFuncStr = Private.function_strings.count:format(trigger.remOperator or ">=", tonumber(trigger.rem) or 0) - remFunc = WeakAuras.LoadFunction(remFuncStr) + remFunc = Private.LoadFunction(remFuncStr) end local names @@ -2370,14 +2370,14 @@ function BuffTrigger.Add(data) else group_countFuncStr = Private.function_strings.count:format(">", 0) end - groupCountFunc = WeakAuras.LoadFunction(group_countFuncStr) + groupCountFunc = Private.LoadFunction(group_countFuncStr) end local matchCountFunc if HasMatchCount(trigger) and trigger.match_countOperator and trigger.match_count and tonumber(trigger.match_count) then local count = tonumber(trigger.match_count) local match_countFuncStr = Private.function_strings.count:format(trigger.match_countOperator, count) - matchCountFunc = WeakAuras.LoadFunction(match_countFuncStr) + matchCountFunc = Private.LoadFunction(match_countFuncStr) elseif IsGroupTrigger(trigger) then if trigger.showClones and not trigger.combinePerUnit then matchCountFunc = GreaterEqualOne @@ -2395,7 +2395,7 @@ function BuffTrigger.Add(data) and tonumber(trigger.matchPerUnit_count) and trigger.matchPerUnit_countOperator then local count = tonumber(trigger.matchPerUnit_count) local match_countFuncStr = Private.function_strings.count:format(trigger.matchPerUnit_countOperator, count) - matchPerUnitCountFunc = WeakAuras.LoadFunction(match_countFuncStr) + matchPerUnitCountFunc = Private.LoadFunction(match_countFuncStr) end local groupTrigger = trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" @@ -2407,7 +2407,7 @@ function BuffTrigger.Add(data) local effectiveIgnoreInvisible = groupTrigger and trigger.ignoreInvisible local effectiveHostility = trigger.unit == "nameplate" and trigger.useHostility and trigger.hostility local effectiveNameCheck = groupTrigger and trigger.useUnitName and trigger.unitName - local effectiveNpcId = trigger.unit == "nameplate" and trigger.useNpcId and WeakAuras.ParseStringCheck(trigger.npcId) + local effectiveNpcId = trigger.unit == "nameplate" and trigger.useNpcId and Private.ExecEnv.ParseStringCheck(trigger.npcId) if trigger.unit == "multi" then BuffTrigger.InitMultiAura() @@ -2471,7 +2471,7 @@ function BuffTrigger.Add(data) matchPerUnitCountFunc = matchPerUnitCountFunc, useAffected = unit == "group" and trigger.useAffected, isMulti = trigger.unit == "multi", - nameChecker = effectiveNameCheck and WeakAuras.ParseNameCheck(trigger.unitName), + nameChecker = effectiveNameCheck and Private.ExecEnv.ParseNameCheck(trigger.unitName), includePets = trigger.use_includePets and trigger.includePets or nil, npcId = effectiveNpcId } @@ -3310,7 +3310,7 @@ function BuffTrigger.InitMultiAura() end multiAuraFrame:RegisterEvent("PLAYER_LEAVING_WORLD") multiAuraFrame:SetScript("OnEvent", BuffTrigger.HandleMultiEvent) - WeakAuras.frames["Multi-target 2 Aura Trigger Handler"] = multiAuraFrame + Private.frames["Multi-target 2 Aura Trigger Handler"] = multiAuraFrame end end diff --git a/WeakAuras/Conditions.lua b/WeakAuras/Conditions.lua index 0250c26..d1396dd 100644 --- a/WeakAuras/Conditions.lua +++ b/WeakAuras/Conditions.lua @@ -125,7 +125,7 @@ end -function WeakAuras.scheduleConditionCheck(time, uid, cloneId) +function Private.ExecEnv.ScheduleConditionCheck(time, uid, cloneId) conditionChecksTimers.recheckTime[uid] = conditionChecksTimers.recheckTime[uid] or {} conditionChecksTimers.recheckHandle[uid] = conditionChecksTimers.recheckHandle[uid] or {}; @@ -148,8 +148,8 @@ function WeakAuras.scheduleConditionCheck(time, uid, cloneId) end end -function WeakAuras.CallCustomConditionTest(uid, testFunctionNumber, ...) - local ok, result = pcall(WeakAuras.conditionHelpers[uid].customTestFunctions[testFunctionNumber], ...) +function Private.ExecEnv.CallCustomConditionTest(uid, testFunctionNumber, ...) + local ok, result = pcall(Private.ExecEnv.conditionHelpers[uid].customTestFunctions[testFunctionNumber], ...) if not ok then Private.GetErrorHandlerUid(uid, L["Condition Custom Text"]) elseif (ok) then @@ -203,34 +203,34 @@ local function CreateTestForCondition(uid, input, allConditionsTemplate, usedSta local preambleString if preamble then - WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {} - WeakAuras.conditionHelpers[uid].preambles = WeakAuras.conditionHelpers[uid].preambles or {} - tinsert(WeakAuras.conditionHelpers[uid].preambles, preamble(value) or ""); - local preambleNumber = #WeakAuras.conditionHelpers[uid].preambles - preambleString = string.format("WeakAuras.conditionHelpers[%q].preambles[%s]", uid, preambleNumber) + Private.ExecEnv.conditionHelpers[uid] = Private.ExecEnv.conditionHelpers[uid] or {} + Private.ExecEnv.conditionHelpers[uid].preambles = Private.ExecEnv.conditionHelpers[uid].preambles or {} + tinsert(Private.ExecEnv.conditionHelpers[uid].preambles, preamble(value) or ""); + local preambleNumber = #Private.ExecEnv.conditionHelpers[uid].preambles + preambleString = string.format("Private.ExecEnv.conditionHelpers[%q].preambles[%s]", uid, preambleNumber) end if (test) then if (value) then - WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {} - WeakAuras.conditionHelpers[uid].customTestFunctions = WeakAuras.conditionHelpers[uid].customTestFunctions or {} - tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, test); - local testFunctionNumber = #(WeakAuras.conditionHelpers[uid].customTestFunctions); + Private.ExecEnv.conditionHelpers[uid] = Private.ExecEnv.conditionHelpers[uid] or {} + Private.ExecEnv.conditionHelpers[uid].customTestFunctions = Private.ExecEnv.conditionHelpers[uid].customTestFunctions or {} + tinsert(Private.ExecEnv.conditionHelpers[uid].customTestFunctions, test); + local testFunctionNumber = #(Private.ExecEnv.conditionHelpers[uid].customTestFunctions); local valueString = type(value) == "string" and string.format("%q", value) or value; local opString = type(op) == "string" and string.format("%q", op) or op; - check = string.format("state and WeakAuras.CallCustomConditionTest(%q, %s, state[%s], %s, %s, %s)", + check = string.format("state and Private.ExecEnv.CallCustomConditionTest(%q, %s, state[%s], %s, %s, %s)", uid, testFunctionNumber, trigger, valueString, (opString or "nil"), preambleString or "nil"); end elseif (cType == "customcheck") then if value then local customCheck = WeakAuras.LoadFunction("return " .. value) if customCheck then - WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {} - WeakAuras.conditionHelpers[uid].customTestFunctions = WeakAuras.conditionHelpers[uid].customTestFunctions or {} - tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, customCheck); - local testFunctionNumber = #(WeakAuras.conditionHelpers[uid].customTestFunctions); + Private.ExecEnv.conditionHelpers[uid] = Private.ExecEnv.conditionHelpers[uid] or {} + Private.ExecEnv.conditionHelpers[uid].customTestFunctions = Private.ExecEnv.conditionHelpers[uid].customTestFunctions or {} + tinsert(Private.ExecEnv.conditionHelpers[uid].customTestFunctions, customCheck); + local testFunctionNumber = #(Private.ExecEnv.conditionHelpers[uid].customTestFunctions); - check = string.format("state and WeakAuras.CallCustomConditionTest(%q, %s, state)", + check = string.format("state and Private.ExecEnv.CallCustomConditionTest(%q, %s, state)", uid, testFunctionNumber, trigger); end end @@ -297,12 +297,12 @@ local function CreateTestForCondition(uid, input, allConditionsTemplate, usedSta if fn then local customCheck = WeakAuras.LoadFunction(fn) if customCheck then - WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {} - WeakAuras.conditionHelpers[uid].customTestFunctions = WeakAuras.conditionHelpers[uid].customTestFunctions or {} - tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, customCheck); - local testFunctionNumber = #(WeakAuras.conditionHelpers[uid].customTestFunctions); + Private.ExecEnv.conditionHelpers[uid] = Private.ExecEnv.conditionHelpers[uid] or {} + Private.ExecEnv.conditionHelpers[uid].customTestFunctions = Private.ExecEnv.conditionHelpers[uid].customTestFunctions or {} + tinsert(Private.ExecEnv.conditionHelpers[uid].customTestFunctions, customCheck); + local testFunctionNumber = #(Private.ExecEnv.conditionHelpers[uid].customTestFunctions); - check = string.format("state and WeakAuras.CallCustomConditionTest(%q, %s, state)", + check = string.format("state and Private.ExecEnv.CallCustomConditionTest(%q, %s, state)", uid, testFunctionNumber, trigger); end end @@ -423,17 +423,17 @@ local function CreateActivateCondition(ret, id, condition, conditionNumber, prop elseif (propertyData.action) then local pathToCustomFunction = "nil"; local pathToFormatter = "nil" - if (WeakAuras.customConditionsFunctions[id] - and WeakAuras.customConditionsFunctions[id][conditionNumber] - and WeakAuras.customConditionsFunctions[id][conditionNumber].changes - and WeakAuras.customConditionsFunctions[id][conditionNumber].changes[changeNum]) then - pathToCustomFunction = string.format("WeakAuras.customConditionsFunctions[%q][%s].changes[%s]", id, conditionNumber, changeNum); + if (Private.ExecEnv.customConditionsFunctions[id] + and Private.ExecEnv.customConditionsFunctions[id][conditionNumber] + and Private.ExecEnv.customConditionsFunctions[id][conditionNumber].changes + and Private.ExecEnv.customConditionsFunctions[id][conditionNumber].changes[changeNum]) then + pathToCustomFunction = string.format("Private.ExecEnv.customConditionsFunctions[%q][%s].changes[%s]", id, conditionNumber, changeNum); end - if WeakAuras.conditionTextFormatters[id] - and WeakAuras.conditionTextFormatters[id][conditionNumber] - and WeakAuras.conditionTextFormatters[id][conditionNumber].changes - and WeakAuras.conditionTextFormatters[id][conditionNumber].changes[changeNum] then - pathToFormatter = string.format("WeakAuras.conditionTextFormatters[%q][%s].changes[%s]", id, conditionNumber, changeNum); + if Private.ExecEnv.conditionTextFormatters[id] + and Private.ExecEnv.conditionTextFormatters[id][conditionNumber] + and Private.ExecEnv.conditionTextFormatters[id][conditionNumber].changes + and Private.ExecEnv.conditionTextFormatters[id][conditionNumber].changes[changeNum] then + pathToFormatter = string.format("Private.ExecEnv.conditionTextFormatters[%q][%s].changes[%s]", id, conditionNumber, changeNum); end ret = ret .. " region:" .. propertyData.action .. "(" .. formatValueForAssignment(propertyData.type, change.value, pathToCustomFunction, pathToFormatter) .. ")" .. "\n"; if (debug) then ret = ret .. " print('# " .. propertyData.action .. "(" .. formatValueForAssignment(propertyData.type, change.value, pathToCustomFunction, pathToFormatter) .. "')\n"; end @@ -489,7 +489,7 @@ end function Private.GetProperties(data) local properties; - local propertiesFunction = WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].properties; + local propertiesFunction = Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].properties; if (type(propertiesFunction) == "function") then properties = propertiesFunction(data); elseif propertiesFunction then @@ -505,7 +505,7 @@ end function Private.LoadConditionPropertyFunctions(data) local id = data.id; if (data.conditions) then - WeakAuras.customConditionsFunctions[id] = {}; + Private.ExecEnv.customConditionsFunctions[id] = {}; for conditionNumber, condition in ipairs(data.conditions) do if (condition.changes) then for changeIndex, change in ipairs(condition.changes) do @@ -519,9 +519,9 @@ function Private.LoadConditionPropertyFunctions(data) end local customFunc = WeakAuras.LoadFunction(prefix .. custom .. suffix); if (customFunc) then - WeakAuras.customConditionsFunctions[id][conditionNumber] = WeakAuras.customConditionsFunctions[id][conditionNumber] or {}; - WeakAuras.customConditionsFunctions[id][conditionNumber].changes = WeakAuras.customConditionsFunctions[id][conditionNumber].changes or {}; - WeakAuras.customConditionsFunctions[id][conditionNumber].changes[changeIndex] = customFunc; + Private.ExecEnv.customConditionsFunctions[id][conditionNumber] = Private.ExecEnv.customConditionsFunctions[id][conditionNumber] or {}; + Private.ExecEnv.customConditionsFunctions[id][conditionNumber].changes = Private.ExecEnv.customConditionsFunctions[id][conditionNumber].changes or {}; + Private.ExecEnv.customConditionsFunctions[id][conditionNumber].changes[changeIndex] = customFunc; end end if change.property == "chat" then @@ -533,10 +533,10 @@ function Private.LoadConditionPropertyFunctions(data) return change.value[fullKey] end local formatters = change.value and Private.CreateFormatters(change.value.message, getter, true) - WeakAuras.conditionTextFormatters[id] = WeakAuras.conditionTextFormatters[id] or {} - WeakAuras.conditionTextFormatters[id][conditionNumber] = WeakAuras.conditionTextFormatters[id][conditionNumber] or {}; - WeakAuras.conditionTextFormatters[id][conditionNumber].changes = WeakAuras.conditionTextFormatters[id][conditionNumber].changes or {}; - WeakAuras.conditionTextFormatters[id][conditionNumber].changes[changeIndex] = formatters; + Private.ExecEnv.conditionTextFormatters[id] = Private.ExecEnv.conditionTextFormatters[id] or {} + Private.ExecEnv.conditionTextFormatters[id][conditionNumber] = Private.ExecEnv.conditionTextFormatters[id][conditionNumber] or {}; + Private.ExecEnv.conditionTextFormatters[id][conditionNumber].changes = Private.ExecEnv.conditionTextFormatters[id][conditionNumber].changes or {}; + Private.ExecEnv.conditionTextFormatters[id][conditionNumber].changes[changeIndex] = formatters; end end end @@ -620,7 +620,7 @@ local function ConstructConditionFunction(data) ret = ret .. " if (not hideRegion) then\n" local recheckCode = "" if (data.conditions) then - WeakAuras.conditionHelpers[data.uid] = nil + Private.ExecEnv.conditionHelpers[data.uid] = nil for conditionNumber, condition in ipairs(data.conditions) do local nextIsLinked = data.conditions[conditionNumber + 1] and data.conditions[conditionNumber + 1].linked local additionalRecheckCode @@ -634,7 +634,7 @@ local function ConstructConditionFunction(data) ret = ret .. " end\n"; ret = ret .. " if (recheckTime) then\n" - ret = ret .. " WeakAuras.scheduleConditionCheck(recheckTime, uid, cloneId);\n" + ret = ret .. " Private.ExecEnv.ScheduleConditionCheck(recheckTime, uid, cloneId);\n" ret = ret .. " end\n" local properties = Private.GetProperties(data); @@ -697,7 +697,7 @@ function Private.LoadConditionFunction(data) CancelTimers(data.uid) local checkConditionsFuncStr = ConstructConditionFunction(data); - local checkCondtionsFunc = checkConditionsFuncStr and WeakAuras.LoadFunction(checkConditionsFuncStr); + local checkCondtionsFunc = checkConditionsFuncStr and Private.LoadFunction(checkConditionsFuncStr) checkConditions[data.uid] = checkCondtionsFunc; end @@ -845,7 +845,7 @@ function Private.RegisterForGlobalConditions(uid) dynamicConditionsFrame = CreateFrame("Frame"); dynamicConditionsFrame:SetScript("OnEvent", handleDynamicConditions); dynamicConditionsFrame.units = {} - WeakAuras.frames["Rerun Conditions Frame"] = dynamicConditionsFrame + Private.frames["Rerun Conditions Frame"] = dynamicConditionsFrame end for event in pairs(register) do diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index f914fb9..ea58ce8 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -74,7 +74,6 @@ local loaded_events = {} local loaded_unit_events = {}; local watched_trigger_events = Private.watched_trigger_events local loaded_auras = {}; -- id to bool map -local timers = WeakAuras.timers; -- Local functions local LoadEvent, HandleEvent, HandleUnitEvent, TestForTriState, TestForToggle, TestForLongString, TestForMultiSelect @@ -1089,7 +1088,7 @@ local genericTriggerRegisteredEvents = {}; local genericTriggerRegisteredUnitEvents = {}; local frame = CreateFrame("Frame"); frame.unitFrames = {}; -WeakAuras.frames["WeakAuras Generic Trigger Frame"] = frame; +Private.frames["WeakAuras Generic Trigger Frame"] = frame; frame:RegisterEvent("PLAYER_ENTERING_WORLD"); genericTriggerRegisteredEvents["PLAYER_ENTERING_WORLD"] = true; if WeakAuras.isAwesomeEnabled() then @@ -1392,7 +1391,7 @@ function GenericTrigger.Add(data, region) triggerFuncStr = ConstructFunction(prototype, trigger); statesParameter = prototype.statesParameter; - triggerFunc = WeakAuras.LoadFunction(triggerFuncStr); + triggerFunc = Private.LoadFunction(triggerFuncStr); durationFunc = prototype.durationFunc; nameFunc = prototype.nameFunc; @@ -1623,7 +1622,7 @@ do local update_clients = {}; local update_clients_num = 0; local update_frame = nil - WeakAuras.frames["Custom Trigger Every Frame Updater"] = update_frame; + Private.frames["Custom Trigger Every Frame Updater"] = update_frame; local updating = false; function Private.RegisterEveryFrameUpdate(id) @@ -2084,9 +2083,9 @@ do local spellDetails = {} - function WeakAuras.InitCooldownReady() + function Private.InitCooldownReady() cdReadyFrame = CreateFrame("Frame"); - WeakAuras.frames["Cooldown Trigger Handler"] = cdReadyFrame + Private.frames["Cooldown Trigger Handler"] = cdReadyFrame cdReadyFrame:RegisterEvent("RUNE_POWER_UPDATE"); cdReadyFrame:RegisterEvent("RUNE_TYPE_UPDATE"); cdReadyFrame:RegisterEvent("PLAYER_TALENT_UPDATE"); @@ -2504,13 +2503,13 @@ do function WeakAuras.WatchGCD() if not(cdReadyFrame) then - WeakAuras.InitCooldownReady(); + Private.InitCooldownReady(); end end function WeakAuras.WatchRuneCooldown(id) if not(cdReadyFrame) then - WeakAuras.InitCooldownReady(); + Private.InitCooldownReady(); end if not id or id == 0 then return end @@ -2538,7 +2537,7 @@ do function WeakAuras.WatchSpellCooldown(id, ignoreRunes) if not(cdReadyFrame) then - WeakAuras.InitCooldownReady(); + Private.InitCooldownReady(); end if not id or id == 0 then return end @@ -2570,7 +2569,7 @@ do function WeakAuras.WatchItemCooldown(id) if not(cdReadyFrame) then - WeakAuras.InitCooldownReady(); + Private.InitCooldownReady(); end if not id or id == 0 then return end @@ -2599,7 +2598,7 @@ do function WeakAuras.WatchItemSlotCooldown(id) if not(cdReadyFrame) then - WeakAuras.InitCooldownReady(); + Private.InitCooldownReady(); end if not id or id == 0 then return end @@ -2644,7 +2643,7 @@ function WeakAuras.WatchUnitChange(unit) watchUnitChange.nameplateFaction = {} watchUnitChange.raidmark = {} - WeakAuras.frames["Unit Change Frame"] = watchUnitChange; + Private.frames["Unit Change Frame"] = watchUnitChange; watchUnitChange:RegisterEvent("PLAYER_TARGET_CHANGED") watchUnitChange:RegisterEvent("PLAYER_FOCUS_CHANGED"); watchUnitChange:RegisterEvent("PLAYER_ROLES_ASSIGNED"); @@ -2916,7 +2915,7 @@ do end end - function WeakAuras.DBMTimerMatches(timerId, id, message, operator, spellId, dbmType, count) + function Private.ExecEnv.DBMTimerMatches(timerId, id, message, operator, spellId, dbmType, count) if not bars[timerId] then return false end @@ -2967,7 +2966,7 @@ do function WeakAuras.GetDBMTimer(id, message, operator, spellId, extendTimer, dbmType, count) local bestMatch for timerId, bar in pairs(bars) do - if WeakAuras.DBMTimerMatches(timerId, id, message, operator, spellId, dbmType, count) + if Private.ExecEnv.DBMTimerMatches(timerId, id, message, operator, spellId, dbmType, count) and (bestMatch == nil or bar.expirationTime < bestMatch.expirationTime) and bar.expirationTime + extendTimer > GetTime() then @@ -2977,7 +2976,7 @@ do return bestMatch end - function WeakAuras.CopyBarToState(bar, states, id, extendTimer) + function Private.ExecEnv.CopyBarToState(bar, states, id, extendTimer) extendTimer = extendTimer or 0 if extendTimer + bar.duration < 0 then return end states[id] = states[id] or {} @@ -3021,7 +3020,7 @@ do scheduled_scans[fireTime] = nil WeakAuras.ScanEvents("DBM_TimerUpdate") end - function WeakAuras.ScheduleDbmCheck(fireTime) + function Private.ExecEnv.ScheduleDbmCheck(fireTime) if not scheduled_scans[fireTime] then scheduled_scans[fireTime] = timer:ScheduleTimer(doDbmScan, fireTime - GetTime() + 0.1, fireTime) end @@ -3126,7 +3125,7 @@ do WeakAuras.RegisterBigWigsCallback("BigWigs_OnBossDisable") end - function WeakAuras.CopyBigWigsTimerToState(bar, states, id, extendTimer) + function Private.ExecEnv.CopyBigWigsTimerToState(bar, states, id, extendTimer) extendTimer = extendTimer or 0 if extendTimer + bar.duration < 0 then return end states[id] = states[id] or {} @@ -3153,7 +3152,7 @@ do end end - function WeakAuras.BigWigsTimerMatches(id, message, operator, spellId, emphasized, count, cast) + function Private.ExecEnv.BigWigsTimerMatches(id, message, operator, spellId, emphasized, count, cast) if not bars[id] then return false end @@ -3201,7 +3200,7 @@ do function WeakAuras.GetBigWigsTimer(text, operator, spellId, extendTimer, emphasized, count, cast) local bestMatch for id, bar in pairs(bars) do - if WeakAuras.BigWigsTimerMatches(id, text, operator, spellId, emphasized, count, cast) + if Private.ExecEnv.BigWigsTimerMatches(id, text, operator, spellId, emphasized, count, cast) and (bestMatch == nil or bar.expirationTime < bestMatch.expirationTime) and bar.expirationTime + extendTimer > GetTime() then @@ -3218,14 +3217,14 @@ do WeakAuras.ScanEvents("BigWigs_Timer_Update") end - function WeakAuras.ScheduleBigWigsCheck(fireTime) + function Private.ExecEnv.ScheduleBigWigsCheck(fireTime) if not scheduled_scans[fireTime] then scheduled_scans[fireTime] = timer:ScheduleTimer(doBigWigsScan, fireTime - GetTime() + 0.1, fireTime) end end end -function WeakAuras.CheckTotemName(totemName, triggerTotemName, triggerTotemPattern, triggerTotemOperator) +function Private.ExecEnv.CheckTotemName(totemName, triggerTotemName, triggerTotemPattern, triggerTotemOperator) if not totemName or totemName == "" then return false end @@ -3265,7 +3264,7 @@ do local oh_icon = GetInventoryItemTexture("player", oh); local tenchFrame = nil - WeakAuras.frames["Temporary Enchant Handler"] = tenchFrame; + Private.frames["Temporary Enchant Handler"] = tenchFrame; local tenchTip; function WeakAuras.TenchInit() @@ -3347,7 +3346,7 @@ end -- Pets do local petFrame = nil - WeakAuras.frames["Pet Use Handler"] = petFrame; + Private.frames["Pet Use Handler"] = petFrame; function WeakAuras.WatchForPetDeath() if not(petFrame) then petFrame = CreateFrame("Frame"); @@ -3365,7 +3364,7 @@ end -- Cast Latency do local castLatencyFrame = nil - WeakAuras.frames["Cast Latency Handler"] = castLatencyFrame + Private.frames["Cast Latency Handler"] = castLatencyFrame function WeakAuras.WatchForCastLatency() if not castLatencyFrame then castLatencyFrame = CreateFrame("Frame") @@ -3431,7 +3430,7 @@ if WeakAuras.isAwesomeEnabled() then end end - WeakAuras.frames["Nameplate Target Handler"] = nameplateTargetFrame + Private.frames["Nameplate Target Handler"] = nameplateTargetFrame function WeakAuras.WatchForNameplateTargetChange() if not nameplateTargetFrame then nameplateTargetFrame = CreateFrame("Frame") @@ -3468,7 +3467,7 @@ do function WeakAuras.WatchForMounts() if not(mountedFrame) then mountedFrame = CreateFrame("Frame"); - WeakAuras.frames["Mount Use Handler"] = mountedFrame; + Private.frames["Mount Use Handler"] = mountedFrame; mountedFrame:RegisterEvent("COMPANION_UPDATE"); mountedFrame:SetScript("OnEvent", function() elapsed = 0; @@ -3495,7 +3494,7 @@ do function WeakAuras.WatchPlayerMoveSpeed() if not (playerMovingFrame) then playerMovingFrame = CreateFrame("Frame"); - WeakAuras.frames["Player Moving Frame"] = playerMovingFrame; + Private.frames["Player Moving Frame"] = playerMovingFrame; end playerMovingFrame.speed = GetUnitSpeed("player") playerMovingFrame:SetScript("OnUpdate", PlayerMoveSpeedUpdate) @@ -3579,7 +3578,7 @@ do function WeakAuras.WatchNamePlates() if not(watchNameplates) then watchNameplates = CreateFrame("Frame") - WeakAuras.frames["Watch NamePlates Frames"] = watchNameplates + Private.frames["Watch NamePlates Frames"] = watchNameplates end watchNameplates:SetScript("OnUpdate", nameplatesUpdate) end @@ -3627,7 +3626,7 @@ do function WeakAuras.WatchQueuedAction() if not(queuedActionFrame) then queuedActionFrame = CreateFrame("Frame"); - WeakAuras.frames["Queued Action Frame"] = queuedActionFrame + Private.frames["Queued Action Frame"] = queuedActionFrame for slotID = 1, 120 do local spellID = GetActionSpellID(slotID) if spellID then @@ -3663,7 +3662,7 @@ do scheduled_scans[event][fireTime] = nil; WeakAuras.ScanEvents(event); end - function WeakAuras.ScheduleScan(fireTime, event) + function Private.ExecEnv.ScheduleScan(fireTime, event) event = event or "COOLDOWN_REMAINING_CHECK" scheduled_scans[event] = scheduled_scans[event] or {} if not(scheduled_scans[event][fireTime]) then @@ -3684,7 +3683,7 @@ do WeakAuras.ScanEvents("CAST_REMAINING_CHECK_" .. string.lower(unit), unit); end end - function WeakAuras.ScheduleCastCheck(fireTime, unit) + function Private.ExecEnv.ScheduleCastCheck(fireTime, unit) scheduled_scans[unit] = scheduled_scans[unit] or {} if not(scheduled_scans[unit][fireTime]) then scheduled_scans[unit][fireTime] = timer:ScheduleTimer(doCastScan, fireTime - GetTime() + 0.1, fireTime, unit); diff --git a/WeakAuras/Init.lua b/WeakAuras/Init.lua index d80616e..2cb6bb3 100644 --- a/WeakAuras/Init.lua +++ b/WeakAuras/Init.lua @@ -1,7 +1,7 @@ local AddonName, Private = ... WeakAuras = {} WeakAuras.L = {} -WeakAuras.frames = {} +Private.frames = {} WeakAuras.normalWidth = 1.3 WeakAuras.halfWidth = WeakAuras.normalWidth / 2 @@ -117,6 +117,8 @@ end function Private.StopProfileUID() end +Private.ExecEnv = {} + -- If WeakAuras shuts down due to being installed on the wrong target, keep the bindings from erroring function WeakAuras.StartProfile() end diff --git a/WeakAuras/Profiling.lua b/WeakAuras/Profiling.lua index 224f46a..89d12be 100644 --- a/WeakAuras/Profiling.lua +++ b/WeakAuras/Profiling.lua @@ -13,7 +13,7 @@ profileData.auras = {} local currentProfileState, ProfilingTimer local RealTimeProfilingWindow = CreateFrame("Button", nil, UIParent) -WeakAuras.frames["RealTime Profiling Window"] = RealTimeProfilingWindow +Private.frames["RealTime Profiling Window"] = RealTimeProfilingWindow RealTimeProfilingWindow.width = 500 RealTimeProfilingWindow.height = 300 RealTimeProfilingWindow.barHeight = 20 diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index b05f89c..c443777 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -644,7 +644,7 @@ function WeakAuras.ValidateNumericOrPercent(info, val) return true end -function WeakAuras.CheckGroupMemberType(loadSetting, currentFlags) +function Private.ExecEnv.CheckGroupMemberType(loadSetting, currentFlags) if loadSetting == "LEADER" then return bit.band(currentFlags, 1) == 1 elseif loadSetting == "ASSIST" then @@ -654,13 +654,13 @@ function WeakAuras.CheckGroupMemberType(loadSetting, currentFlags) end end -function WeakAuras.CheckChargesDirection(direction, triggerDirection) +function Private.ExecEnv.CheckChargesDirection(direction, triggerDirection) return triggerDirection == "CHANGED" or (triggerDirection == "GAINED" and direction > 0) or (triggerDirection == "LOST" and direction < 0) end -function WeakAuras.CheckCombatLogFlags(flags, flagToCheck) +function Private.ExecEnv.CheckCombatLogFlags(flags, flagToCheck) if type(flags) ~= "number" then return end if(flagToCheck == "Mine") then return bit.band(flags, COMBATLOG_OBJECT_AFFILIATION_MINE) > 0 @@ -673,7 +673,7 @@ function WeakAuras.CheckCombatLogFlags(flags, flagToCheck) end end -function WeakAuras.CheckCombatLogFlagsReaction(flags, flagToCheck) +function Private.ExecEnv.CheckCombatLogFlagsReaction(flags, flagToCheck) if type(flags) ~= "number" then return end if (flagToCheck == "Hostile") then return bit.band(flags, 64) ~= 0; @@ -692,14 +692,14 @@ local objectTypeToBit = { Player = 1024, } -function WeakAuras.CheckCombatLogFlagsObjectType(flags, flagToCheck) +function Private.ExecEnv.CheckCombatLogFlagsObjectType(flags, flagToCheck) if type(flags) ~= "number" then return end local bitToCheck = objectTypeToBit[flagToCheck] if not bitToCheck then return end return bit.band(flags, bitToCheck) ~= 0; end -function WeakAuras.CheckRaidFlags(flags, flagToCheck) +function Private.ExecEnv.CheckRaidFlags(flags, flagToCheck) flagToCheck = tonumber(flagToCheck) if not flagToCheck or not flags then return end --bailout if flagToCheck == 0 then --no raid mark @@ -893,7 +893,7 @@ Private.load_prototype = { type = "string", multiline = true, test = "nameRealmChecker:Check(player, realm)", - preamble = "local nameRealmChecker = WeakAuras.ParseNameCheck(%q)", + preamble = "local nameRealmChecker = Private.ExecEnv.ParseNameCheck(%q)", desc = constants.nameRealmFilterDesc, }, { @@ -902,7 +902,7 @@ Private.load_prototype = { type = "string", multiline = true, test = "not nameRealmIgnoreChecker:Check(player, realm)", - preamble = "local nameRealmIgnoreChecker = WeakAuras.ParseNameCheck(%q)", + preamble = "local nameRealmIgnoreChecker = Private.ExecEnv.ParseNameCheck(%q)", desc = constants.nameRealmFilterDesc, }, { @@ -1014,7 +1014,7 @@ Private.load_prototype = { init = "arg", events = {"PARTY_LEADER_CHANGED", "RAID_ROSTER_UPDATE"}, values = "group_member_types", - test = "WeakAuras.CheckGroupMemberType(%s, group_leader)", + test = "Private.ExecEnv.CheckGroupMemberType(%s, group_leader)", optional = true, }, { @@ -1028,7 +1028,7 @@ Private.load_prototype = { type = "string", multiline = true, init = "arg", - preamble = "local zoneChecker = WeakAuras.ParseStringCheck(%q)", + preamble = "local zoneChecker = Private.ExecEnv.ParseStringCheck(%q)", test = "zoneChecker:Check(zone)", events = {"ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "VEHICLE_UPDATE", "WA_DELAYED_PLAYER_ENTERING_WORLD" }, desc = function() @@ -1055,7 +1055,7 @@ Private.load_prototype = { type = "string", multiline = true, init = "arg", - preamble = "local subzoneChecker = WeakAuras.ParseStringCheck(%q)", + preamble = "local subzoneChecker = Private.ExecEnv.ParseStringCheck(%q)", test = "subzoneChecker:Check(subzone)", events = { "ZONE_CHANGED", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED_NEW_AREA", "VEHICLE_UPDATE", "WA_DELAYED_PLAYER_ENTERING_WORLD" }, desc = function() @@ -1427,11 +1427,11 @@ Private.event_prototypes = { desc = constants.nameRealmFilterDesc, type = "string", multiline = true, - preamble = "local nameRealmChecker = WeakAuras.ParseNameCheck(%q)", + preamble = "local nameRealmChecker = Private.ExecEnv.ParseNameCheck(%q)", test = "nameRealmChecker:Check(name, realm)", conditionType = "string", conditionPreamble = function(input) - return WeakAuras.ParseNameCheck(input) + return Private.ExecEnv.ParseNameCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.name, state.realm) @@ -1553,10 +1553,10 @@ Private.event_prototypes = { store = true, init = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '')", conditionType = "string", - preamble = "local npcIdChecker = WeakAuras.ParseStringCheck(%q)", + preamble = "local npcIdChecker = Private.ExecEnv.ParseStringCheck(%q)", test = "npcIdChecker:Check(npcId)", conditionPreamble = function(input) - return WeakAuras.ParseStringCheck(input) + return Private.ExecEnv.ParseStringCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.npcId) @@ -1895,11 +1895,11 @@ Private.event_prototypes = { display = L["Unit Name/Realm"], type = "string", multiline = true, - preamble = "local nameRealmChecker = WeakAuras.ParseNameCheck(%q)", + preamble = "local nameRealmChecker = Private.ExecEnv.ParseNameCheck(%q)", test = "nameRealmChecker:Check(name, realm)", conditionType = "string", conditionPreamble = function(input) - return WeakAuras.ParseNameCheck(input) + return Private.ExecEnv.ParseNameCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.name, state.realm) @@ -1915,10 +1915,10 @@ Private.event_prototypes = { store = true, init = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '')", conditionType = "string", - preamble = "local npcIdChecker = WeakAuras.ParseStringCheck(%q)", + preamble = "local npcIdChecker = Private.ExecEnv.ParseStringCheck(%q)", test = "npcIdChecker:Check(npcId)", conditionPreamble = function(input) - return WeakAuras.ParseStringCheck(input) + return Private.ExecEnv.ParseStringCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.npcId) @@ -2235,11 +2235,11 @@ Private.event_prototypes = { display = L["Unit Name/Realm"], type = "string", multiline = true, - preamble = "local nameRealmChecker = WeakAuras.ParseNameCheck(%q)", + preamble = "local nameRealmChecker = Private.ExecEnv.ParseNameCheck(%q)", test = "nameRealmChecker:Check(name, realm)", conditionType = "string", conditionPreamble = function(input) - return WeakAuras.ParseNameCheck(input) + return Private.ExecEnv.ParseNameCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.name, state.realm) @@ -2255,10 +2255,10 @@ Private.event_prototypes = { store = true, init = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '')", conditionType = "string", - preamble = "local npcIdChecker = WeakAuras.ParseStringCheck(%q)", + preamble = "local npcIdChecker = Private.ExecEnv.ParseStringCheck(%q)", test = "npcIdChecker:Check(npcId)", conditionPreamble = function(input) - return WeakAuras.ParseStringCheck(input) + return Private.ExecEnv.ParseStringCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.npcId) @@ -2424,7 +2424,7 @@ Private.event_prototypes = { init = "arg", store = true, conditionType = "string", - preamble = "local sourceNameChecker = WeakAuras.ParseStringCheck(%q)", + preamble = "local sourceNameChecker = Private.ExecEnv.ParseStringCheck(%q)", test = "sourceNameChecker:Check(sourceName)", desc = L["Supports multiple entries, separated by commas"], }, @@ -2436,10 +2436,10 @@ Private.event_prototypes = { init = "tostring(tonumber(string.sub(sourceGUID or '', 8, 12), 16) or '')", store = true, conditionType = "string", - preamble = "local sourceNpcIdChecker = WeakAuras.ParseStringCheck(%q)", + preamble = "local sourceNpcIdChecker = Private.ExecEnv.ParseStringCheck(%q)", test = "sourceNpcIdChecker:Check(sourceNpcId)", conditionPreamble = function(input) - return WeakAuras.ParseStringCheck(input) + return Private.ExecEnv.ParseStringCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.sourceNpcId) @@ -2457,10 +2457,10 @@ Private.event_prototypes = { values = "combatlog_flags_check_type", init = "arg", store = true, - test = "WeakAuras.CheckCombatLogFlags(sourceFlags, %q)", + test = "Private.ExecEnv.CheckCombatLogFlags(sourceFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlags(state.sourceFlags, needle); + return state and state.show and Private.ExecEnv.CheckCombatLogFlags(state.sourceFlags, needle); end }, { @@ -2468,10 +2468,10 @@ Private.event_prototypes = { display = L["Source Reaction"], type = "select", values = "combatlog_flags_check_reaction", - test = "WeakAuras.CheckCombatLogFlagsReaction(sourceFlags, %q)", + test = "Private.ExecEnv.CheckCombatLogFlagsReaction(sourceFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlagsReaction(state.sourceFlags, needle); + return state and state.show and Private.ExecEnv.CheckCombatLogFlagsReaction(state.sourceFlags, needle); end }, { @@ -2479,10 +2479,10 @@ Private.event_prototypes = { display = L["Source Object Type"], type = "select", values = "combatlog_flags_check_object_type", - test = "WeakAuras.CheckCombatLogFlagsObjectType(sourceFlags, %q)", + test = "Private.ExecEnv.CheckCombatLogFlagsObjectType(sourceFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlagsObjectType(state.sourceFlags, needle); + return state and state.show and Private.ExecEnv.CheckCombatLogFlagsObjectType(state.sourceFlags, needle); end }, { @@ -2492,10 +2492,10 @@ Private.event_prototypes = { values = "combatlog_raid_mark_check_type", init = "arg", store = true, - test = "WeakAuras.CheckRaidFlags(sourceRaidFlags, %q)", + test = "Private.ExecEnv.CheckRaidFlags(sourceRaidFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckRaidFlags(state.sourceRaidFlags, needle); + return state and state.show and Private.ExecEnv.CheckRaidFlags(state.sourceRaidFlags, needle); end }, { @@ -2553,7 +2553,7 @@ Private.event_prototypes = { init = "arg", store = true, conditionType = "string", - preamble = "local destNameChecker = WeakAuras.ParseStringCheck(%q)", + preamble = "local destNameChecker = Private.ExecEnv.ParseStringCheck(%q)", test = "destNameChecker:Check(destName)", desc = L["Supports multiple entries, separated by commas"], enable = function(trigger) @@ -2568,10 +2568,10 @@ Private.event_prototypes = { init = "tostring(tonumber(string.sub(destGUID or '', 8, 12), 16) or '')", store = true, conditionType = "string", - preamble = "local destNpcIdChecker = WeakAuras.ParseStringCheck(%q)", + preamble = "local destNpcIdChecker = Private.ExecEnv.ParseStringCheck(%q)", test = "destNpcIdChecker:Check(destNpcId)", conditionPreamble = function(input) - return WeakAuras.ParseStringCheck(input) + return Private.ExecEnv.ParseStringCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.destNpcId) @@ -2594,10 +2594,10 @@ Private.event_prototypes = { values = "combatlog_flags_check_type", init = "arg", store = true, - test = "WeakAuras.CheckCombatLogFlags(destFlags, %q)", + test = "Private.ExecEnv.CheckCombatLogFlags(destFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlags(state.destFlags, needle); + return state and state.show and Private.ExecEnv.CheckCombatLogFlags(state.destFlags, needle); end, enable = function(trigger) return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); @@ -2608,10 +2608,10 @@ Private.event_prototypes = { display = L["Destination Reaction"], type = "select", values = "combatlog_flags_check_reaction", - test = "WeakAuras.CheckCombatLogFlagsReaction(destFlags, %q)", + test = "Private.ExecEnv.CheckCombatLogFlagsReaction(destFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlagsReaction(state.destFlags, needle); + return state and state.show and Private.ExecEnv.CheckCombatLogFlagsReaction(state.destFlags, needle); end, enable = function(trigger) return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); @@ -2622,10 +2622,10 @@ Private.event_prototypes = { display = L["Destination Object Type"], type = "select", values = "combatlog_flags_check_object_type", - test = "WeakAuras.CheckCombatLogFlagsObjectType(destFlags, %q)", + test = "Private.ExecEnv.CheckCombatLogFlagsObjectType(destFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckCombatLogFlagsObjectType(state.destFlags, needle); + return state and state.show and Private.ExecEnv.CheckCombatLogFlagsObjectType(state.destFlags, needle); end, enable = function(trigger) return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); @@ -2643,10 +2643,10 @@ Private.event_prototypes = { values = "combatlog_raid_mark_check_type", init = "arg", store = true, - test = "WeakAuras.CheckRaidFlags(destRaidFlags, %q)", + test = "Private.ExecEnv.CheckRaidFlags(destRaidFlags, %q)", conditionType = "select", conditionTest = function(state, needle) - return state and state.show and WeakAuras.CheckRaidFlags(state.destRaidFlags, needle); + return state and state.show and Private.ExecEnv.CheckRaidFlags(state.destRaidFlags, needle); end, enable = function(trigger) return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START"); @@ -3087,7 +3087,7 @@ Private.event_prototypes = { remaining = expirationTime - GetTime(); local remainingCheck = %s; if(remaining >= remainingCheck and remaining > 0) then - WeakAuras.ScheduleScan(expirationTime - remainingCheck); + Private.ExecEnv.ScheduleScan(expirationTime - remainingCheck); end end ]]; @@ -3390,12 +3390,12 @@ Private.event_prototypes = { type = "select", values = "charges_change_type", init = "arg", - test = "WeakAuras.CheckChargesDirection(direction, %q)", + test = "Private.ExecEnv.CheckChargesDirection(direction, %q)", store = true, conditionType = "select", conditionValues = "charges_change_condition_type"; conditionTest = function(state, needle) - return state and state.show and state.direction and WeakAuras.CheckChargesDirection(state.direction, needle) + return state and state.show and state.direction and Private.ExecEnv.CheckChargesDirection(state.direction, needle) end, }, { @@ -3471,7 +3471,7 @@ Private.event_prototypes = { local remaining = expirationTime > 0 and (expirationTime - GetTime()) or 0; local remainingCheck = %s; if(remaining >= remainingCheck and remaining > 0) then - WeakAuras.ScheduleScan(expirationTime - remainingCheck); + Private.ExecEnv.ScheduleScan(expirationTime - remainingCheck); end ]]; ret = ret..ret2:format(tonumber(trigger.remaining or 0) or 0); @@ -3639,7 +3639,7 @@ Private.event_prototypes = { local remaining = expirationTime > 0 and (expirationTime - GetTime()) or 0; local remainingCheck = %s; if(remaining >= remainingCheck and remaining > 0) then - WeakAuras.ScheduleScan(expirationTime - remainingCheck); + Private.ExecEnv.ScheduleScan(expirationTime - remainingCheck); end ]]; ret = ret..ret2:format(tonumber(trigger.remaining or 0) or 0); @@ -3946,7 +3946,7 @@ Private.event_prototypes = { if triggerUseRemaining then local remainingTime = bar.expirationTime - GetTime() + extendTimer if remainingTime %s triggerRemaining then - WeakAuras.CopyBarToState(bar, states, cloneId, extendTimer) + Private.ExecEnv.CopyBarToState(bar, states, cloneId, extendTimer) else local state = states[cloneId] if state and state.show then @@ -3955,16 +3955,16 @@ Private.event_prototypes = { end end if remainingTime >= triggerRemaining then - WeakAuras.ScheduleDbmCheck(bar.expirationTime - triggerRemaining + extendTimer) + Private.ExecEnv.ScheduleDbmCheck(bar.expirationTime - triggerRemaining + extendTimer) end else - WeakAuras.CopyBarToState(bar, states, cloneId, extendTimer) + Private.ExecEnv.CopyBarToState(bar, states, cloneId, extendTimer) end end if useClone then if event == "DBM_TimerStart" then - if WeakAuras.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then + if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then local bar = WeakAuras.GetDBMTimerById(id) if bar then copyOrSchedule(bar, cloneId) @@ -3978,7 +3978,7 @@ Private.event_prototypes = { end elseif event == "DBM_TimerUpdate" then for id, bar in pairs(WeakAuras.GetAllDBMTimers()) do - if WeakAuras.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then + if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then copyOrSchedule(bar, id) else local state = states[id] @@ -3994,7 +3994,7 @@ Private.event_prototypes = { elseif event == "DBM_TimerForce" then wipe(states) for id, bar in pairs(WeakAuras.GetAllDBMTimers()) do - if WeakAuras.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then + if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then copyOrSchedule(bar, cloneId) end end @@ -4002,9 +4002,9 @@ Private.event_prototypes = { else if event == "DBM_TimerStart" or event == "DBM_TimerUpdate" then if extendTimer ~= 0 then - if WeakAuras.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then + if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, triggerCount) then local bar = WeakAuras.GetDBMTimerById(id) - WeakAuras.ScheduleDbmCheck(bar.expirationTime + extendTimer) + Private.ExecEnv.ScheduleDbmCheck(bar.expirationTime + extendTimer) end end end @@ -4188,7 +4188,7 @@ Private.event_prototypes = { if triggerUseRemaining then local remainingTime = bar.expirationTime - GetTime() + extendTimer if remainingTime %s triggerRemaining then - WeakAuras.CopyBigWigsTimerToState(bar, states, cloneId, extendTimer) + Private.ExecEnv.CopyBigWigsTimerToState(bar, states, cloneId, extendTimer) else local state = states[cloneId] if state and state.show then @@ -4197,16 +4197,16 @@ Private.event_prototypes = { end end if remainingTime >= triggerRemaining then - WeakAuras.ScheduleBigWigsCheck(bar.expirationTime - triggerRemaining + extendTimer) + Private.ExecEnv.ScheduleBigWigsCheck(bar.expirationTime - triggerRemaining + extendTimer) end else - WeakAuras.CopyBigWigsTimerToState(bar, states, cloneId, extendTimer) + Private.ExecEnv.CopyBigWigsTimerToState(bar, states, cloneId, extendTimer) end end if useClone then if event == "BigWigs_StartBar" then - if WeakAuras.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then + if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then local bar = WeakAuras.GetBigWigsTimerById(id) if bar then copyOrSchedule(bar, cloneId) @@ -4220,14 +4220,14 @@ Private.event_prototypes = { end elseif event == "BigWigs_Timer_Update" then for id, bar in pairs(WeakAuras.GetAllBigWigsTimers()) do - if WeakAuras.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then + if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then copyOrSchedule(bar, id) end end elseif event == "BigWigs_Timer_Force" then wipe(states) for id, bar in pairs(WeakAuras.GetAllBigWigsTimers()) do - if WeakAuras.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then + if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then copyOrSchedule(bar, id) end end @@ -4235,9 +4235,9 @@ Private.event_prototypes = { else if event == "BigWigs_StartBar" then if extendTimer ~= 0 then - if WeakAuras.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then + if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, triggerCount, triggerCast) then local bar = WeakAuras.GetBigWigsTimerById(id) - WeakAuras.ScheduleBigWigsCheck(bar.expirationTime + extendTimer) + Private.ExecEnv.ScheduleBigWigsCheck(bar.expirationTime + extendTimer) end end end @@ -4410,7 +4410,7 @@ Private.event_prototypes = { local remainingCheck = not triggerRemaining or remaining and remaining %s triggerRemaining if triggerRemaining and remaining and remaining >= triggerRemaining and remaining > 0 then - WeakAuras.ScheduleScan(expirationTime - triggerRemaining, "SWING_TIMER_UPDATE") + Private.ExecEnv.ScheduleScan(expirationTime - triggerRemaining, "SWING_TIMER_UPDATE") end ]=]; return ret:format( @@ -4773,7 +4773,7 @@ Private.event_prototypes = { local _, totemName, startTime, duration, icon = GetTotemInfo(totemType); active = (startTime and startTime ~= 0); - if not WeakAuras.CheckTotemName(totemName, triggerTotemName, triggerTotemPattern, triggerTotemPatternOperator) then + if not Private.ExecEnv.CheckTotemName(totemName, triggerTotemName, triggerTotemPattern, triggerTotemPatternOperator) then active = false; end @@ -4786,7 +4786,7 @@ Private.event_prototypes = { local expirationTime = startTime and (startTime + duration) or 0; local remainingTime = expirationTime - GetTime() if (remainingTime >= remainingCheck) then - WeakAuras.ScheduleScan(expirationTime - remainingCheck); + Private.ExecEnv.ScheduleScan(expirationTime - remainingCheck); end active = checkActive(remainingTime); end @@ -4807,7 +4807,7 @@ Private.event_prototypes = { for i = 1, 4 do local _, totemName, startTime, duration, icon = GetTotemInfo(i); if ((startTime and startTime ~= 0) and - WeakAuras.CheckTotemName(totemName, triggerTotemName, triggerTotemPattern, triggerTotemPatternOperator) + Private.ExecEnv.CheckTotemName(totemName, triggerTotemName, triggerTotemPattern, triggerTotemPatternOperator) ) then found = true; end @@ -4827,14 +4827,14 @@ Private.event_prototypes = { local _, totemName, startTime, duration, icon = GetTotemInfo(i); active = (startTime and startTime ~= 0); - if not WeakAuras.CheckTotemName(totemName, triggerTotemName, triggerTotemPattern, triggerTotemPatternOperator) then + if not Private.ExecEnv.CheckTotemName(totemName, triggerTotemName, triggerTotemPattern, triggerTotemPatternOperator) then active = false; end if (active and remainingCheck) then local expirationTime = startTime and (startTime + duration) or 0; local remainingTime = expirationTime - GetTime() if (remainingTime >= remainingCheck) then - WeakAuras.ScheduleScan(expirationTime - remainingCheck); + Private.ExecEnv.ScheduleScan(expirationTime - remainingCheck); end active = checkActive(remainingTime); end @@ -5115,7 +5115,7 @@ Private.event_prototypes = { local found = expirationTime and nameCheck and stackCheck and remainingCheck if(triggerRemaining and remaining and remaining >= triggerRemaining and remaining > 0) then - WeakAuras.ScheduleScan(expirationTime - triggerRemaining, "TENCH_UPDATE"); + Private.ExecEnv.ScheduleScan(expirationTime - triggerRemaining, "TENCH_UPDATE"); end if not found then @@ -5406,7 +5406,7 @@ Private.event_prototypes = { local remaining = expirationTime - GetTime(); local remainingCheck = %s; if(remaining >= remainingCheck and remaining > 0) then - WeakAuras.ScheduleScan(expirationTime - remainingCheck); + Private.ExecEnv.ScheduleScan(expirationTime - remainingCheck); end ]]; ret = ret..ret2:format(tonumber(trigger.remaining) or 0); @@ -5878,7 +5878,7 @@ Private.event_prototypes = { remaining = expirationTime - GetTime() if remainingCheck and remaining >= remainingCheck and remaining > 0 then - WeakAuras.ScheduleCastCheck(expirationTime - remainingCheck, unit) + Private.ExecEnv.ScheduleCastCheck(expirationTime - remainingCheck, unit) end ]=]; ret = ret:format(trigger.unit == "group" and "true" or "false", @@ -6038,10 +6038,10 @@ Private.event_prototypes = { store = true, init = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '')", conditionType = "string", - preamble = "local npcIdChecker = WeakAuras.ParseStringCheck(%q)", + preamble = "local npcIdChecker = Private.ExecEnv.ParseStringCheck(%q)", test = "npcIdChecker:Check(npcId)", conditionPreamble = function(input) - return WeakAuras.ParseStringCheck(input) + return Private.ExecEnv.ParseStringCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.npcId) @@ -6140,11 +6140,11 @@ Private.event_prototypes = { display = L["Source Unit Name/Realm"], type = "string", multiline = true, - preamble = "local sourceNameRealmChecker = WeakAuras.ParseNameCheck(%q)", + preamble = "local sourceNameRealmChecker = Private.ExecEnv.ParseNameCheck(%q)", test = "sourceNameRealmChecker:Check(sourceName, sourceRealm)", conditionType = "string", conditionPreamble = function(input) - return WeakAuras.ParseNameCheck(input) + return Private.ExecEnv.ParseNameCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.sourceName, state.sourceRealm) @@ -6189,11 +6189,11 @@ Private.event_prototypes = { display = L["Name/Realm of Caster's Target"], type = "string", multiline = true, - preamble = "local destNameRealmChecker = WeakAuras.ParseNameCheck(%q)", + preamble = "local destNameRealmChecker = Private.ExecEnv.ParseNameCheck(%q)", test = "destNameRealmChecker:Check(destName, destRealm)", conditionType = "string", conditionPreamble = function(input) - return WeakAuras.ParseNameCheck(input) + return Private.ExecEnv.ParseNameCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.destName, state.destRealm) @@ -6829,7 +6829,7 @@ Private.event_prototypes = { display = L["Group Type"], type = "multiselect", values = "group_types", - init = "WeakAuras.GroupType()", + init = "Private.ExecEnv.GroupType()", events = {"PARTY_MEMBERS_CHANGED", "RAID_ROSTER_UPDATE"} }, { @@ -7131,11 +7131,11 @@ Private.event_prototypes = { end, type = "string", multiline = true, - preamble = "local zoneChecker = WeakAuras.ParseZoneCheck(%q)", + preamble = "local zoneChecker = Private.ExecEnv.ParseZoneCheck(%q)", test = "zoneChecker:Check(MapId)", conditionType = "string", conditionPreamble = function(input) - return WeakAuras.ParseZoneCheck(input) + return Private.ExecEnv.ParseZoneCheck(input) end, conditionTest = function(state, needle, op, preamble) return preamble:Check(state.zoneId) diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index bb2ed19..ca49dd8 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -928,8 +928,8 @@ local function modify(parent, region, data) self.updatedChildren[regionData] = true end end - if childData and WeakAuras.clones[childID] then - for cloneID, cloneRegion in pairs(WeakAuras.clones[childID]) do + if childData and Private.clones[childID] then + for cloneID, cloneRegion in pairs(Private.clones[childID]) do local regionData = createRegionData(childData, cloneRegion, childID, cloneID, dataIndex) if cloneRegion.toShow then tinsert(self.sortedChildren, regionData) @@ -1266,7 +1266,7 @@ local function modify(parent, region, data) self:Hide() end if WeakAuras.IsOptionsOpen() then - WeakAuras.OptionsFrame().moversizer:ReAnchor() + Private.OptionsFrame().moversizer:ReAnchor() end Private.StopProfileSystem("dynamicgroup") Private.StopProfileAura(data.id) diff --git a/WeakAuras/RegionTypes/Group.lua b/WeakAuras/RegionTypes/Group.lua index 6006e4d..1ed3702 100644 --- a/WeakAuras/RegionTypes/Group.lua +++ b/WeakAuras/RegionTypes/Group.lua @@ -138,7 +138,7 @@ local function modify(parent, region, data) -- Scan children for visibility if not childVisible then for child in Private.TraverseLeafs(data) do - local childRegion = WeakAuras.regions[child.id] and WeakAuras.regions[child.id].region; + local childRegion = Private.regions[child.id] and Private.regions[child.id].region; if childRegion and childRegion.toShow then childVisible = true; break; diff --git a/WeakAuras/RegionTypes/Model.lua b/WeakAuras/RegionTypes/Model.lua index 7a5a4ea..508b224 100644 --- a/WeakAuras/RegionTypes/Model.lua +++ b/WeakAuras/RegionTypes/Model.lua @@ -280,7 +280,7 @@ end do function Private.PreShowModels(self, event) Private.StartProfileSystem("model"); - for id, data in pairs(WeakAuras.regions) do + for id, data in pairs(Private.regions) do Private.StartProfileAura(id); if data.region.toShow then if (data.regionType == "model") then diff --git a/WeakAuras/RegionTypes/RegionPrototype.lua b/WeakAuras/RegionTypes/RegionPrototype.lua index e340535..a106747 100644 --- a/WeakAuras/RegionTypes/RegionPrototype.lua +++ b/WeakAuras/RegionTypes/RegionPrototype.lua @@ -118,13 +118,13 @@ local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ce function Private.GetAnchorsForData(parentData, type) local result if not parentData.controlledChildren then - if not WeakAuras.regionOptions[parentData.regionType] then + if not Private.regionOptions[parentData.regionType] then return end local anchors - if WeakAuras.regionOptions[parentData.regionType].getAnchors then - anchors = WeakAuras.regionOptions[parentData.regionType].getAnchors(parentData) + if Private.regionOptions[parentData.regionType].getAnchors then + anchors = Private.regionOptions[parentData.regionType].getAnchors(parentData) else anchors = Private.default_types_for_anchor end @@ -452,7 +452,7 @@ end WeakAuras.regionPrototype.AnchorSubRegion = AnchorSubRegion function WeakAuras.regionPrototype.create(region) - local defaultsForRegion = WeakAuras.regionTypes[region.regionType] and WeakAuras.regionTypes[region.regionType].default; + local defaultsForRegion = Private.regionTypes[region.regionType] and Private.regionTypes[region.regionType].default; region.SoundPlay = SoundPlay; region.SoundRepeatStop = SoundRepeatStop; region.SendChat = SendChat; @@ -501,7 +501,7 @@ function WeakAuras.regionPrototype.modify(parent, region, data) region.states = nil region.subRegionEvents:ClearSubscribers() - local defaultsForRegion = WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].default; + local defaultsForRegion = Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].default; if region.SetRegionAlpha then region:SetRegionAlpha(data.alpha) @@ -626,7 +626,7 @@ local regionsForFrameTick = {} local frameForFrameTick = CreateFrame("Frame"); -WeakAuras.frames["Frame Tick Frame"] = frameForFrameTick +Private.frames["Frame Tick Frame"] = frameForFrameTick local function FrameTick() if WeakAuras.IsOptionsOpen() then diff --git a/WeakAuras/RegionTypes/Text.lua b/WeakAuras/RegionTypes/Text.lua index 43f6413..30768ee 100644 --- a/WeakAuras/RegionTypes/Text.lua +++ b/WeakAuras/RegionTypes/Text.lua @@ -142,8 +142,8 @@ local function modify(parent, region, data) region:SetHeight(height) if data.parent then Private.EnsureRegion(data.parent) - if WeakAuras.regions[data.parent].region.PositionChildren then - WeakAuras.regions[data.parent].region:PositionChildren() + if Private.regions[data.parent].region.PositionChildren then + Private.regions[data.parent].region:PositionChildren() end end end @@ -165,8 +165,8 @@ local function modify(parent, region, data) region.height = height; region:SetWidth(region.width); region:SetHeight(region.height); - if(data.parent and WeakAuras.regions[data.parent].region.PositionChildren) then - WeakAuras.regions[data.parent].region:PositionChildren(); + if(data.parent and Private.regions[data.parent].region.PositionChildren) then + Private.regions[data.parent].region:PositionChildren(); end end end diff --git a/WeakAuras/SubRegionTypes/Glow.lua b/WeakAuras/SubRegionTypes/Glow.lua index a5d8bc0..1b94ae9 100644 --- a/WeakAuras/SubRegionTypes/Glow.lua +++ b/WeakAuras/SubRegionTypes/Glow.lua @@ -346,7 +346,7 @@ local function modify(parent, region, parentData, data, first) end -- This is used by the templates to add glow -function WeakAuras.getDefaultGlow(regionType) +function Private.getDefaultGlow(regionType) if regionType == "aurabar" then return { ["type"] = "subglow", diff --git a/WeakAuras/Types.lua b/WeakAuras/Types.lua index 6a26e9b..a29f4b1 100644 --- a/WeakAuras/Types.lua +++ b/WeakAuras/Types.lua @@ -2482,7 +2482,7 @@ Private.non_transmissable_fields_v2000 = { } } -WeakAuras.data_stub = { +Private.data_stub = { -- note: this is the minimal data stub which prevents false positives in diff upon reimporting an aura. -- pending a refactor of other code which adds unnecessary fields, it is possible to shrink it triggers = { diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 7a34bfe..3a1bdc5 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -112,7 +112,7 @@ function Private.LoadOptions(msg) -- inform the user and queue ooc prettyPrint(L["Options will finish loading after combat ends."]) queueshowooc = msg or ""; - WeakAuras.frames["Addon Initialization Handler"]:RegisterEvent("PLAYER_REGEN_ENABLED") + Private.frames["Addon Initialization Handler"]:RegisterEvent("PLAYER_REGEN_ENABLED") return false; else local loaded, reason = LoadAddOn("WeakAurasOptions"); @@ -216,29 +216,30 @@ local loadFuncsForOptions = {}; local loadEvents = {} -- All regions keyed on id, has properties: region, regionType, also see clones -WeakAuras.regions = {}; +Private.regions = {}; +local regions = Private.regions; -- keyed on id, contains bool indicating whether the aura is loaded Private.loaded = {}; local loaded = Private.loaded; -- contains regions for clones -WeakAuras.clones = {}; -local clones = WeakAuras.clones; +Private.clones = {}; +local clones = Private.clones; -- Unused regions that are kept around for clones local clonePool = {} -- One table per regionType, see RegisterRegionType, notable properties: create, modify and default -WeakAuras.regionTypes = {}; -local regionTypes = WeakAuras.regionTypes; +Private.regionTypes = {}; +local regionTypes = Private.regionTypes; Private.subRegionTypes = {} local subRegionTypes = Private.subRegionTypes -- One table per regionType, see RegisterRegionOptions -WeakAuras.regionOptions = {}; -local regionOptions = WeakAuras.regionOptions; +Private.regionOptions = {}; +local regionOptions = Private.regionOptions; Private.subRegionOptions = {} local subRegionOptions = Private.subRegionOptions @@ -282,7 +283,6 @@ local fallbacksStates = {}; local triggerSystems = {} local timers = {}; -- Timers for autohiding, keyed on id, triggernum, cloneid -WeakAuras.timers = timers; WeakAuras.raidUnits = {}; WeakAuras.raidpetUnits = {}; @@ -319,13 +319,13 @@ local playerLevel = UnitLevel("player"); Private.customActionsFunctions = {}; -- Custom Functions used in conditions, keyed on id, condition number, "changes", property number -WeakAuras.customConditionsFunctions = {}; +Private.ExecEnv.customConditionsFunctions = {}; -- Text format functions for chat messages, keyed on id, condition number, changes, property number -WeakAuras.conditionTextFormatters = {} +Private.ExecEnv.conditionTextFormatters = {} -- Helpers for conditions, that is custom run functions and preamble objects for built in checks -- keyed on UID not on id! -WeakAuras.conditionHelpers = {} +Private.ExecEnv.conditionHelpers = {} local load_prototype = Private.load_prototype; @@ -336,7 +336,7 @@ local levelColors = { [3] = "|cFFFF4040" }; -function WeakAuras.validate(input, default) +function Private.validate(input, default) for field, defaultValue in pairs(default) do if(type(defaultValue) == "table" and type(input[field]) ~= "table") then input[field] = {}; @@ -344,7 +344,7 @@ function WeakAuras.validate(input, default) input[field] = defaultValue; end if(type(input[field]) == "table") then - WeakAuras.validate(input[field], defaultValue); + Private.validate(input[field], defaultValue); end end end @@ -948,7 +948,7 @@ local function tooltip_draw() end local colorFrame = CreateFrame("Frame"); -WeakAuras.frames["LDB Icon Recoloring"] = colorFrame; +Private.frames["LDB Icon Recoloring"] = colorFrame; local colorElapsed = 0; local colorDelay = 2; @@ -956,7 +956,7 @@ local r, g, b = 0.8, 0, 1; local r2, g2, b2 = random(2)-1, random(2)-1, random(2)-1; local tooltip_update_frame = CreateFrame("Frame"); -WeakAuras.frames["LDB Tooltip Updater"] = tooltip_update_frame; +Private.frames["LDB Tooltip Updater"] = tooltip_update_frame; -- function copied from LibDBIcon-1.0.lua local function getAnchors(frame) @@ -1087,7 +1087,7 @@ function Private.Login(initialTime, takeNewSnapshots) end coroutine.yield(); - WeakAuras.AddMany(toAdd, takeNewSnapshots); + Private.AddMany(toAdd, takeNewSnapshots); coroutine.yield(); Private.RegisterLoadEvents(); @@ -1108,7 +1108,7 @@ function Private.Login(initialTime, takeNewSnapshots) loginFinished = true -- Tell Dynamic Groups that we are done with login - for _, region in pairs(WeakAuras.regions) do + for _, region in pairs(Private.regions) do if (region.region.RunDelayedActions) then region.region:RunDelayedActions(); end @@ -1138,12 +1138,12 @@ function Private.Login(initialTime, takeNewSnapshots) end local WeakAurasFrame = CreateFrame("Frame", "WeakAurasFrame", UIParent); -WeakAuras.frames["WeakAuras Main Frame"] = WeakAurasFrame; +Private.frames["WeakAuras Main Frame"] = WeakAurasFrame; WeakAurasFrame:SetAllPoints(UIParent); WeakAurasFrame:SetFrameStrata("BACKGROUND"); local loadedFrame = CreateFrame("Frame"); -WeakAuras.frames["Addon Initialization Handler"] = loadedFrame; +Private.frames["Addon Initialization Handler"] = loadedFrame; loadedFrame:RegisterEvent("ADDON_LOADED"); loadedFrame:RegisterEvent("PLAYER_LOGIN"); loadedFrame:RegisterEvent("PLAYER_LOGOUT"); @@ -1223,7 +1223,7 @@ loadedFrame:SetScript("OnEvent", function(self, event, addon) if (queueshowooc) then WeakAuras.OpenOptions(queueshowooc) queueshowooc = nil - WeakAuras.frames["Addon Initialization Handler"]:UnregisterEvent("PLAYER_REGEN_ENABLED") + Private.frames["Addon Initialization Handler"]:UnregisterEvent("PLAYER_REGEN_ENABLED") end end end @@ -1275,7 +1275,7 @@ end function Private.PauseAllDynamicGroups() local suspended = {} - for id, region in pairs(WeakAuras.regions) do + for id, region in pairs(Private.regions) do if (region.region.Suspend) then region.region:Suspend(); tinsert(suspended, id) @@ -1302,7 +1302,7 @@ function Private.IsOptionsProcessingPaused() return pausedOptionsProcessing; end -function WeakAuras.GroupType() +function Private.ExecEnv.GroupType() if (IsInRaid()) then return "raid"; end @@ -1398,7 +1398,7 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...) end local size, difficulty, instanceType = GetInstanceTypeAndSize() - local group = WeakAuras.GroupType() + local group = Private.ExecEnv.GroupType() local changed = 0; local shouldBeLoaded, couldBeLoaded; @@ -1487,8 +1487,7 @@ function Private.ScanForLoads(toCheck, event, arg1, ...) end local loadFrame = CreateFrame("Frame"); -WeakAuras.loadFrame = loadFrame; -WeakAuras.frames["Display Load Handling"] = loadFrame; +Private.frames["Display Load Handling"] = loadFrame; loadFrame:RegisterEvent("PLAYER_TALENT_UPDATE"); loadFrame:RegisterEvent("SPELL_UPDATE_USABLE"); @@ -1514,8 +1513,7 @@ loadFrame:RegisterEvent("PLAYER_FLAGS_CHANGED") loadFrame:RegisterEvent("PARTY_LEADER_CHANGED") local unitLoadFrame = CreateFrame("Frame"); -WeakAuras.unitLoadFrame = unitLoadFrame; -WeakAuras.frames["Display Load Handling 2"] = unitLoadFrame; +Private.frames["Display Load Handling 2"] = unitLoadFrame; unitLoadFrame:RegisterEvent("UNIT_FLAGS"); unitLoadFrame:RegisterEvent("UNIT_ENTERED_VEHICLE"); @@ -1541,8 +1539,8 @@ end local function UnloadAll() -- Even though auras are collapsed, their finish animation can be running for id in pairs(loaded) do - if WeakAuras.regions[id] and WeakAuras.regions[id].region then - Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true) + if Private.regions[id] and Private.regions[id].region then + Private.CancelAnimation(Private.regions[id].region, true, true, true, true, true, true) end if clones[id] then for _, region in pairs(clones[id]) do @@ -1583,7 +1581,7 @@ function Private.Resume() local suspended = Private.PauseAllDynamicGroups() - for id, region in pairs(WeakAuras.regions) do + for id, region in pairs(Private.regions) do region.region:Collapse(); end @@ -1651,11 +1649,11 @@ function Private.UnloadDisplays(toUnload, ...) local uid = WeakAuras.GetData(id).uid Private.UnloadConditions(uid) - WeakAuras.regions[id].region:Collapse(); + Private.regions[id].region:Collapse(); Private.CollapseAllClones(id); -- Even though auras are collapsed, their finish animation can be running - Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true) + Private.CancelAnimation(Private.regions[id].region, true, true, true, true, true, true) if clones[id] then for cloneId, region in pairs(clones[id]) do Private.CancelAnimation(region, true, true, true, true, true, true) @@ -1720,11 +1718,11 @@ function WeakAuras.Delete(data) end end - if WeakAuras.regions[id] then - WeakAuras.regions[id].region:Collapse() - Private.CancelAnimation(WeakAuras.regions[id].region, true, true, true, true, true, true) - WeakAuras.regions[id].region = nil - WeakAuras.regions[id] = nil + if Private.regions[id] then + Private.regions[id].region:Collapse() + Private.CancelAnimation(Private.regions[id].region, true, true, true, true, true, true) + Private.regions[id].region = nil + Private.regions[id] = nil end if clones[id] then @@ -1762,10 +1760,10 @@ function WeakAuras.Delete(data) end Private.customActionsFunctions[id] = nil; - WeakAuras.customConditionsFunctions[id] = nil; - WeakAuras.conditionTextFormatters[id] = nil + Private.ExecEnv.customConditionsFunctions[id] = nil; + Private.ExecEnv.conditionTextFormatters[id] = nil Private.frameLevels[id] = nil; - WeakAuras.conditionHelpers[data.uid] = nil + Private.ExecEnv.conditionHelpers[data.uid] = nil Private.RemoveHistory(data.uid) @@ -1795,10 +1793,10 @@ function WeakAuras.Rename(data, newid) end UIDtoID[data.uid] = newid - WeakAuras.regions[newid] = WeakAuras.regions[oldid]; - WeakAuras.regions[oldid] = nil; - if WeakAuras.regions[newid] then - WeakAuras.regions[newid].region.id = newid + Private.regions[newid] = Private.regions[oldid]; + Private.regions[oldid] = nil; + if Private.regions[newid] then + Private.regions[newid].region.id = newid end if(clones[oldid]) then clones[newid] = clones[oldid] @@ -1858,11 +1856,11 @@ function WeakAuras.Rename(data, newid) Private.customActionsFunctions[newid] = Private.customActionsFunctions[oldid]; Private.customActionsFunctions[oldid] = nil; - WeakAuras.customConditionsFunctions[newid] = WeakAuras.customConditionsFunctions[oldid]; - WeakAuras.customConditionsFunctions[oldid] = nil; + Private.ExecEnv.customConditionsFunctions[newid] = Private.ExecEnv.customConditionsFunctions[oldid]; + Private.ExecEnv.customConditionsFunctions[oldid] = nil; - WeakAuras.conditionTextFormatters[newid] = WeakAuras.conditionTextFormatters[oldid] - WeakAuras.conditionTextFormatters[oldid] = nil + Private.ExecEnv.conditionTextFormatters[newid] = Private.ExecEnv.conditionTextFormatters[oldid] + Private.ExecEnv.conditionTextFormatters[oldid] = nil Private.frameLevels[newid] = Private.frameLevels[oldid]; Private.frameLevels[oldid] = nil; @@ -1880,9 +1878,9 @@ function Private.Convert(data, newType) Private.FakeStatesFor(id, false) - if WeakAuras.regions[id] then - WeakAuras.regions[id].region = nil - WeakAuras.regions[id] = nil + if Private.regions[id] then + Private.regions[id].region = nil + Private.regions[id] = nil end data.regionType = newType; @@ -2150,7 +2148,7 @@ local function loadOrder(tbl, idtable) end coroutine.yield() end - error("Circular dependency in WeakAuras.AddMany between "..table.concat(depends, ", ")); + error("Circular dependency in Private.AddMany between "..table.concat(depends, ", ")); else if not(loaded[data.parent]) then local dependsOut = CopyTable(depends) @@ -2178,7 +2176,7 @@ local function loadOrder(tbl, idtable) return order end -function WeakAuras.AddMany(tbl, takeSnapshots) +function Private.AddMany(tbl, takeSnapshots) local idtable = {}; for _, data in ipairs(tbl) do -- There was an unfortunate bug in update.lua in 2022 that resulted @@ -2203,8 +2201,8 @@ function WeakAuras.AddMany(tbl, takeSnapshots) end for data in pairs(groups) do if data.type == "dynamicgroup" then - if WeakAuras.regions[data.id] then - WeakAuras.regions[data.id].region:ReloadControlledChildren() + if Private.regions[data.id] then + Private.regions[data.id].region:ReloadControlledChildren() end else WeakAuras.Add(data) @@ -2554,23 +2552,23 @@ end function WeakAuras.PreAdd(data) -- Readd what Compress removed before version 8 if (not data.internalVersion or data.internalVersion < 7) then - WeakAuras.validate(data, oldDataStub) + Private.validate(data, oldDataStub) elseif (data.internalVersion < 8) then - WeakAuras.validate(data, oldDataStub2) + Private.validate(data, oldDataStub2) end - local default = data.regionType and WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].default + local default = data.regionType and Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].default if default then - WeakAuras.validate(data, default) + Private.validate(data, default) end - local regionValidate = data.regionType and WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].validate + local regionValidate = data.regionType and Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].validate if regionValidate then regionValidate(data) end Private.Modernize(data); - WeakAuras.validate(data, WeakAuras.data_stub); + Private.validate(data, Private.data_stub); if data.subRegions then for _, subRegionData in ipairs(data.subRegions) do local subType = subRegionData.type @@ -2581,7 +2579,7 @@ function WeakAuras.PreAdd(data) default = default(data.regionType) end if default then - WeakAuras.validate(subRegionData, default) + Private.validate(subRegionData, default) end else WeakAuras.prettyPrint(L["ERROR in '%s' unknown or incompatible sub element type '%s'"]:format(data.id, subType)) @@ -2626,11 +2624,11 @@ local function pAdd(data, simpleChange) if simpleChange then db.displays[id] = data if WeakAuras.GetRegion(data.id) then - WeakAuras.SetRegion(data) + Private.SetRegion(data) end if clones[id] then for cloneId, region in pairs(clones[id]) do - WeakAuras.SetRegion(data, cloneId) + Private.SetRegion(data, cloneId) end end Private.UpdatedTriggerState(id) @@ -2644,7 +2642,7 @@ local function pAdd(data, simpleChange) end db.displays[id] = data; if WeakAuras.GetRegion(data.id) then - WeakAuras.SetRegion(data) + Private.SetRegion(data) end Private.ScanForLoadsGroup({[id] = true}); loadEvents["GROUP"] = loadEvents["GROUP"] or {} @@ -2654,8 +2652,8 @@ local function pAdd(data, simpleChange) if (WeakAuras.IsOptionsOpen()) then visible = Private.FakeStatesFor(id, false) else - if (WeakAuras.regions[id] and WeakAuras.regions[id].region) then - WeakAuras.regions[id].region:Collapse() + if (Private.regions[id] and Private.regions[id].region) then + Private.regions[id].region:Collapse() else Private.CollapseAllClones(id) end @@ -2688,8 +2686,8 @@ local function pAdd(data, simpleChange) loadEvents["SCAN_ALL"][id] = true local loadForOptionsFuncStr = ConstructFunction(load_prototype, data.load, true); - local loadFunc = WeakAuras.LoadFunction(loadFuncStr); - local loadForOptionsFunc = WeakAuras.LoadFunction(loadForOptionsFuncStr); + local loadFunc = Private.LoadFunction(loadFuncStr); + local loadForOptionsFunc = Private.LoadFunction(loadForOptionsFuncStr); local triggerLogicFunc; if data.triggers.disjunctive == "custom" then triggerLogicFunc = WeakAuras.LoadFunction("return "..(data.triggers.customTriggerLogic or "")); @@ -2715,7 +2713,7 @@ local function pAdd(data, simpleChange) end if WeakAuras.GetRegion(data.id) then - WeakAuras.SetRegion(data) + Private.SetRegion(data) end triggerState[id] = { @@ -2766,10 +2764,10 @@ function Private.AddParents(data) end end -function WeakAuras.SetRegion(data, cloneId) +function Private.SetRegion(data, cloneId) local regionType = data.regionType; if not(regionType) then - error("Improper arguments to WeakAuras.SetRegion - regionType not defined"); + error("Improper arguments to Private.SetRegion - regionType not defined"); else if(not regionTypes[regionType]) then regionType = "fallback"; @@ -2778,7 +2776,7 @@ function WeakAuras.SetRegion(data, cloneId) local id = data.id; if not(id) then - error("Improper arguments to WeakAuras.SetRegion - id not defined"); + error("Improper arguments to Private.SetRegion - id not defined"); else local region; if(cloneId) then @@ -2800,9 +2798,9 @@ function WeakAuras.SetRegion(data, cloneId) region = clones[id][cloneId]; end else - if((not WeakAuras.regions[id]) or (not WeakAuras.regions[id].region) or WeakAuras.regions[id].regionType ~= regionType) then + if((not regions[id]) or (not regions[id].region) or regions[id].regionType ~= regionType) then region = regionTypes[regionType].create(WeakAurasFrame, data); - WeakAuras.regions[id] = { + regions[id] = { regionType = regionType, region = region }; @@ -2813,12 +2811,12 @@ function WeakAuras.SetRegion(data, cloneId) region.toShow = true end else - region = WeakAuras.regions[id].region + region = regions[id].region end end region.id = id; region.cloneId = cloneId or ""; - WeakAuras.validate(data, regionTypes[regionType].default); + Private.validate(data, regionTypes[regionType].default); local parent = WeakAurasFrame; if(data.parent) then @@ -2864,7 +2862,7 @@ local function EnsureClone(id, cloneId) clones[id] = clones[id] or {} if not(clones[id][cloneId]) then local data = WeakAuras.GetData(id) - WeakAuras.SetRegion(data, cloneId) + Private.SetRegion(data, cloneId) end return clones[id][cloneId] end @@ -2875,8 +2873,8 @@ function Private.CreatingRegions() end --- Ensures that a region exists local function EnsureRegion(id) - if not WeakAuras.regions[id] or not WeakAuras.regions[id].region then - WeakAuras.regions[id] = WeakAuras.regions[id] or {} + if not Private.regions[id] or not Private.regions[id].region then + Private.regions[id] = Private.regions[id] or {} -- The region doesn't yet exist -- But we must also ensure that our parents exists -- and as an additional wrinkle, for dynamic groups, all children must exist! @@ -2902,20 +2900,20 @@ local function EnsureRegion(id) end for _, toCreateId in ipairs_reverse(aurasToCreate) do local data = WeakAuras.GetData(toCreateId) - WeakAuras.SetRegion(data) + Private.SetRegion(data) if (data.regionType == "dynamicgroup") then for child in Private.TraverseAllChildren(data) do - WeakAuras.SetRegion(child) + Private.SetRegion(child) end end end creatingRegions = false for _, dynamicGroupId in ipairs_reverse(dynamicGroups) do - local dgRegion = WeakAuras.regions[dynamicGroupId].region + local dgRegion = Private.regions[dynamicGroupId].region dgRegion:ReloadControlledChildren() end end - return WeakAuras.regions[id] and WeakAuras.regions[id].region + return Private.regions[id] and Private.regions[id].region end --- Ensures that a region/clone exists and returns it -- Even if we are asked to only create a clone, we create the default region too. @@ -2932,7 +2930,7 @@ function WeakAuras.GetRegion(id, cloneId) if(cloneId and cloneId ~= "") then return clones[id] and clones[id][cloneId] end - return WeakAuras.regions[id] and WeakAuras.regions[id].region + return Private.regions[id] and Private.regions[id].region end -- Note, does not create a clone! @@ -2941,7 +2939,7 @@ function Private.GetRegionByUID(uid, cloneId) if(cloneId and cloneId ~= "") then return id and clones[id] and clones[id][cloneId]; end - return id and WeakAuras.regions[id] and WeakAuras.regions[id].region + return id and Private.regions[id] and Private.regions[id].region end function Private.CollapseAllClones(id, triggernum) @@ -3168,8 +3166,8 @@ function Private.HandleGlowAction(actions, region) if WeakAuras.GetData(frame_name) then Private.EnsureRegion(frame_name) end - if WeakAuras.regions[frame_name] then - glow_frame = WeakAuras.regions[frame_name].region + if Private.regions[frame_name] then + glow_frame = Private.regions[frame_name].region should_glow_frame = true end else @@ -3355,6 +3353,7 @@ Private.CanHaveDuration = wrapTriggerSystemFunction("CanHaveDuration", "firstVal Private.CanHaveClones = wrapTriggerSystemFunction("CanHaveClones", "or"); Private.CanHaveTooltip = wrapTriggerSystemFunction("CanHaveTooltip", "or"); -- This has to be in WeakAuras for now, because GetNameAndIcon can be called from the options +-- before the Options has access to Private WeakAuras.GetNameAndIcon = wrapTriggerSystemFunction("GetNameAndIcon", "nameAndIcon"); Private.GetTriggerDescription = wrapTriggerSystemFunction("GetTriggerDescription", "call"); @@ -3543,7 +3542,7 @@ end local FrameTimes = {}; function WeakAuras.ProfileFrames(all) UpdateAddOnCPUUsage(); - for name, frame in pairs(WeakAuras.frames) do + for name, frame in pairs(Private.frames) do local FrameTime = GetFrameCPUUsage(frame); FrameTimes[name] = FrameTimes[name] or 0; if(all or FrameTime > FrameTimes[name]) then @@ -3556,7 +3555,7 @@ end local DisplayTimes = {}; function WeakAuras.ProfileDisplays(all) UpdateAddOnCPUUsage(); - for id, regionData in pairs(WeakAuras.regions) do + for id, regionData in pairs(Private.regions) do local DisplayTime = GetFrameCPUUsage(regionData.region, true); DisplayTimes[id] = DisplayTimes[id] or 0; if(all or DisplayTime > DisplayTimes[id]) then @@ -3603,8 +3602,8 @@ local function SetFrameLevel(id, frameLevel) if (Private.frameLevels[id] == frameLevel) then return; end - if (WeakAuras.regions[id] and WeakAuras.regions[id].region) then - Private.ApplyFrameLevel(WeakAuras.regions[id].region, frameLevel) + if (Private.regions[id] and Private.regions[id].region) then + Private.ApplyFrameLevel(Private.regions[id].region, frameLevel) end if (clones[id]) then for i,v in pairs(clones[id]) do @@ -4093,8 +4092,8 @@ function Private.UpdatedTriggerState(id) for _, clone in pairs(clones[id]) do clone:Collapse() end - if WeakAuras.regions[id] then - WeakAuras.regions[id].region:Collapse() + if Private.regions[id] then + Private.regions[id].region:Collapse() end elseif (show and oldShow) then -- Already shown, update regions -- Hide old clones @@ -4104,8 +4103,8 @@ function Private.UpdatedTriggerState(id) end end if (not activeTriggerState[""] or not activeTriggerState[""].show) then - if WeakAuras.regions[id] then - WeakAuras.regions[id].region:Collapse() + if Private.regions[id] then + Private.regions[id].region:Collapse() end end -- Show new states @@ -4541,7 +4540,7 @@ end local function xPositionNextToOptions() local xOffset; - local optionsFrame = WeakAuras.OptionsFrame(); + local optionsFrame = Private.OptionsFrame(); local centerX = (optionsFrame:GetLeft() + optionsFrame:GetRight()) / 2; if (centerX > GetScreenWidth() / 2) then if (optionsFrame:GetLeft() > 400) then @@ -4615,7 +4614,7 @@ local function ensureMouseFrame() mouseFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", db.mousePointerFrame.xOffset, db.mousePointerFrame.yOffset); else -- Fnd a suitable position - local optionsFrame = WeakAuras.OptionsFrame(); + local optionsFrame = Private.OptionsFrame(); local yOffset = (optionsFrame:GetTop() + optionsFrame:GetBottom()) / 2; local xOffset = xPositionNextToOptions(); -- We use the top right, because the main frame uses the top right as the reference too @@ -4784,7 +4783,7 @@ function Private.ensurePRDFrame() end if (not xOffset or not yOffset) then - local optionsFrame = WeakAuras.OptionsFrame(); + local optionsFrame = Private.OptionsFrame(); yOffset = optionsFrame:GetBottom() + prdHeight - GetScreenHeight(); xOffset = xPositionNextToOptions() + prdWidth / 2 - GetScreenWidth(); end @@ -4871,7 +4870,7 @@ local function tryAnchorAgain() if (data and region) then local parent = WeakAurasFrame; if (data.parent and WeakAuras.GetData(data.parent) and Private.EnsureRegion(data.parent)) then - parent = WeakAuras.regions[data.parent].region; + parent = Private.regions[data.parent].region; end Private.AnchorFrame(data, region, parent); end @@ -4948,8 +4947,8 @@ local function GetAnchorFrame(data, region, parent) if (frame_name == id) then return parent; end - if(WeakAuras.regions[frame_name]) then - return WeakAuras.regions[frame_name].region; + if(Private.regions[frame_name]) then + return Private.regions[frame_name].region; end postponeAnchor(id); else @@ -5030,7 +5029,7 @@ function Private.AnchorFrame(data, region, parent, force) end end -function WeakAuras.FindUnusedId(prefix) +function Private.FindUnusedId(prefix) prefix = prefix or "New" local num = 2; local id = prefix @@ -5183,7 +5182,7 @@ do end end -function WeakAuras.ParseNameCheck(name) +function Private.ExecEnv.ParseNameCheck(name) local matches = { name = {}, realm = {}, @@ -5264,7 +5263,7 @@ function WeakAuras.ParseNameCheck(name) return matches end -function WeakAuras.ParseZoneCheck(input) +function Private.ExecEnv.ParseZoneCheck(input) if not input then return end local matcher = { @@ -5284,7 +5283,7 @@ function WeakAuras.ParseZoneCheck(input) return matcher end -function WeakAuras.ParseStringCheck(input) +function Private.ExecEnv.ParseStringCheck(input) if not input then return end local matcher = { zones = {}, diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua index 4f455cc..0abdf48 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua @@ -283,7 +283,7 @@ local Actions = { ["Group"] = function(source, groupId, target, before) if source and not source.data.parent then if groupId then - local group = WeakAuras.GetDisplayButton(groupId) + local group = OptionsPrivate.GetDisplayButton(groupId) if group and group:IsGroup() then local children = group.data.controlledChildren if target then @@ -337,7 +337,7 @@ local Actions = { OptionsPrivate.Private.AddParents(parent) WeakAuras.UpdateGroupOrders(parent); WeakAuras.ClearAndUpdateOptions(parent.id); - local group = WeakAuras.GetDisplayButton(parent.id) + local group = OptionsPrivate.GetDisplayButton(parent.id) group.callbacks.UpdateExpandButton(); group:UpdateParentWarning() group:ReloadTooltip() @@ -376,7 +376,7 @@ end ------------------------- local function GetDropTarget() - local buttonList = WeakAuras.displayButtons + local buttonList = OptionsPrivate.displayButtons for id, button in pairs(buttonList) do if not button.dragging and button:IsEnabled() and button:IsShown() then @@ -405,7 +405,7 @@ end local function Show_DropIndicator(id) local indicator = OptionsPrivate.DropIndicator() - local source = WeakAuras.GetDisplayButton(id) + local source = OptionsPrivate.GetDisplayButton(id) local target, pos if source then target, pos = select(2, GetDropTarget()) @@ -519,7 +519,7 @@ local methods = { for index, selectedId in ipairs(self.grouping) do local selectedData = WeakAuras.GetData(selectedId); tinsert(self.data.controlledChildren, selectedId); - local selectedButton = WeakAuras.GetDisplayButton(selectedId); + local selectedButton = OptionsPrivate.GetDisplayButton(selectedId); while selectedData.parent do selectedButton:Ungroup(); end @@ -535,7 +535,7 @@ local methods = { if (selectedData.controlledChildren) then for child in OptionsPrivate.Private.TraverseAllChildren(selectedData) do - local childButton = WeakAuras.GetDisplayButton(child.id) + local childButton = OptionsPrivate.GetDisplayButton(child.id) childButton:UpdateOffset() end end @@ -618,12 +618,12 @@ local methods = { -- And this fills in the leafs DuplicateAuras(self.data, newGroup, mapping) - local button = WeakAuras.GetDisplayButton(newGroup.id) + local button = OptionsPrivate.GetDisplayButton(newGroup.id) button.callbacks.UpdateExpandButton() button:UpdateParentWarning() for old, new in pairs(mapping) do - local button = WeakAuras.GetDisplayButton(new.id) + local button = OptionsPrivate.GetDisplayButton(new.id) button.callbacks.UpdateExpandButton() button:UpdateParentWarning() end @@ -679,7 +679,7 @@ local methods = { OptionsPrivate.Private.AddParents(parentData) WeakAuras.ClearAndUpdateOptions(parentData.id) self:SetGroupOrder(index - 1, #parentData.controlledChildren); - local otherbutton = WeakAuras.GetDisplayButton(parentData.controlledChildren[index]); + local otherbutton = OptionsPrivate.GetDisplayButton(parentData.controlledChildren[index]); otherbutton:SetGroupOrder(index, #parentData.controlledChildren); OptionsPrivate.SortDisplayButtons(); local updata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = -32}; @@ -718,7 +718,7 @@ local methods = { OptionsPrivate.Private.AddParents(parentData) WeakAuras.ClearAndUpdateOptions(parentData.id) self:SetGroupOrder(index + 1, #parentData.controlledChildren); - local otherbutton = WeakAuras.GetDisplayButton(parentData.controlledChildren[index]); + local otherbutton = OptionsPrivate.GetDisplayButton(parentData.controlledChildren[index]); otherbutton:SetGroupOrder(index, #parentData.controlledChildren); OptionsPrivate.SortDisplayButtons() local updata = {duration = 0.15, type = "custom", use_translate = true, x = 0, y = -32}; @@ -739,12 +739,12 @@ local methods = { local suspended = OptionsPrivate.Private.PauseAllDynamicGroups() if(self.view.visibility == 2) then for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do - WeakAuras.GetDisplayButton(child.id):PriorityHide(2); + OptionsPrivate.GetDisplayButton(child.id):PriorityHide(2); end self:PriorityHide(2) else for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do - WeakAuras.GetDisplayButton(child.id):PriorityShow(2); + OptionsPrivate.GetDisplayButton(child.id):PriorityShow(2); end self:PriorityShow(2) end @@ -837,7 +837,7 @@ local methods = { if (not self.data.controlledChildren) then local convertMenu = {}; - for regionType, regionData in pairs(WeakAuras.regionOptions) do + for regionType, regionData in pairs(OptionsPrivate.Private.regionOptions) do if(regionType ~= "group" and regionType ~= "dynamicgroup" and regionType ~= self.data.regionType) then tinsert(convertMenu, { text = regionData.displayName, @@ -1016,7 +1016,7 @@ local methods = { tinsert(namestable, {" ", "|cFF00FFFF"..L["Control-click to select multiple displays"]}); end tinsert(namestable, {" ", "|cFF00FFFF"..L["Shift-click to create chat link"]}); - local regionData = WeakAuras.regionOptions[data.regionType or ""] + local regionData = OptionsPrivate.Private.regionOptions[data.regionType or ""] local displayName = regionData and regionData.displayName or ""; self:SetDescription({data.id, displayName}, unpack(namestable)); end, @@ -1091,14 +1091,14 @@ local methods = { end WeakAuras.ClearAndUpdateOptions(self.data.id); WeakAuras.UpdateGroupOrders(parentData); - local parentButton = WeakAuras.GetDisplayButton(parentData.id) + local parentButton = OptionsPrivate.GetDisplayButton(parentData.id) if(#parentData.controlledChildren == 0) then parentButton:DisableExpand() end parentButton:UpdateParentWarning() for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do - local button = WeakAuras.GetDisplayButton(child.id) + local button = OptionsPrivate.GetDisplayButton(child.id) button:UpdateOffset() end @@ -1471,7 +1471,7 @@ local methods = { ["UpdateParentWarning"] = function(self) self:UpdateWarning() for parent in OptionsPrivate.Private.TraverseParents(self.data) do - local parentButton = WeakAuras.GetDisplayButton(parent.id) + local parentButton = OptionsPrivate.GetDisplayButton(parent.id) if parentButton then parentButton:UpdateWarning() end @@ -1585,17 +1585,17 @@ local methods = { end, ["RecheckParentVisibility"] = function(self) if self.data.parent then - local parentButton = WeakAuras.GetDisplayButton(self.data.parent) + local parentButton = OptionsPrivate.GetDisplayButton(self.data.parent) parentButton:RecheckVisibility() else - WeakAuras.OptionsFrame().loadedButton:RecheckVisibility() - WeakAuras.OptionsFrame().unloadedButton:RecheckVisibility() + OptionsPrivate.Private.OptionsFrame().loadedButton:RecheckVisibility() + OptionsPrivate.Private.OptionsFrame().unloadedButton:RecheckVisibility() end end, ["RecheckVisibility"] = function(self) local none, all = true, true; for child in OptionsPrivate.Private.TraverseAllChildren(self.data) do - local childButton = WeakAuras.GetDisplayButton(child.id); + local childButton = OptionsPrivate.GetDisplayButton(child.id); if(childButton) then if(childButton:GetVisibility() ~= 2) then all = false; @@ -1693,7 +1693,7 @@ local methods = { self:ReleaseThumbnail() self:AcquireThumbnail() else - local option = WeakAuras.regionOptions[self.thumbnailType] + local option = OptionsPrivate.Private.regionOptions[self.thumbnailType] if option and option.modifyThumbnail then option.modifyThumbnail(self.frame, self.thumbnail, self.data) end @@ -1707,7 +1707,7 @@ local methods = { if self.thumbnail then local regionType = self.thumbnailType - local option = WeakAuras.regionOptions[regionType] + local option = OptionsPrivate.Private.regionOptions[regionType] option.releaseThumbnail(self.thumbnail) self.thumbnail = nil end @@ -1727,7 +1727,7 @@ local methods = { local regionType = self.data.regionType self.thumbnailType = regionType - local option = WeakAuras.regionOptions[regionType] + local option = OptionsPrivate.Private.regionOptions[regionType] if option and option.acquireThumbnail then self.thumbnail = option.acquireThumbnail(button, self.data) self:SetIcon(self.thumbnail) diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewButton.lua index 3bc471e..a017d03 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasNewButton.lua @@ -1,4 +1,5 @@ if not WeakAuras.IsLibsOK() then return end +local AddonName, OptionsPrivate = ... local Type, Version = "WeakAurasNewButton", 25 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) @@ -55,7 +56,7 @@ local methods = { end end, ["SetThumbnail"] = function(self, regionType, data) - local regionData = WeakAuras.regionOptions[regionType] + local regionData = OptionsPrivate.Private.regionOptions[regionType] if regionData and regionData.acquireThumbnail then local thumbnail = regionData.acquireThumbnail(self.frame, data) self:SetIcon(thumbnail) @@ -65,7 +66,7 @@ local methods = { end, ["ReleaseThumbnail"] = function(self) if self.thumbnail then - local regionData = WeakAuras.regionOptions[self.thumbnailType] + local regionData = OptionsPrivate.Private.regionOptions[self.thumbnailType] if regionData and regionData.releaseThumbnail then regionData.releaseThumbnail(self.thumbnail) end diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingInstallButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingInstallButton.lua index 5fa6423..2bb623c 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingInstallButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingInstallButton.lua @@ -84,7 +84,7 @@ local methods = { self:ReleaseThumbnail() self:AcquireThumbnail() else - local option = WeakAuras.regionOptions[self.thumbnailType] + local option = OptionsPrivate.Private.regionOptions[self.thumbnailType] if option and option.modifyThumbnail then option.modifyThumbnail(self.frame, self.thumbnail, self.data) end @@ -98,7 +98,7 @@ local methods = { if self.thumbnail then local regionType = self.thumbnailType - local option = WeakAuras.regionOptions[regionType] + local option = OptionsPrivate.Private.regionOptions[regionType] if self.thumbnail.icon then self.thumbnail.icon:SetDesaturated(false) end @@ -121,7 +121,7 @@ local methods = { local regionType = self.data.regionType self.thumbnailType = regionType - local option = WeakAuras.regionOptions[regionType] + local option = OptionsPrivate.Private.regionOptions[regionType] if option and option.acquireThumbnail then self.thumbnail = option.acquireThumbnail(button, self.data) if self.thumbnail.icon then diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua index ea4d608..6d58dd8 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasPendingUpdateButton.lua @@ -214,7 +214,7 @@ local methods = { self:ReleaseThumbnail() self:AcquireThumbnail() else - local option = WeakAuras.regionOptions[self.thumbnailType] + local option = OptionsPrivate.Private.regionOptions[self.thumbnailType] if option and option.modifyThumbnail then option.modifyThumbnail(self.frame, self.thumbnail, self.data) end @@ -228,7 +228,7 @@ local methods = { if self.thumbnail then local regionType = self.thumbnailType - local option = WeakAuras.regionOptions[regionType] + local option = OptionsPrivate.Private.regionOptions[regionType] if self.thumbnail.icon then self.thumbnail.icon:SetDesaturated(false) end @@ -251,7 +251,7 @@ local methods = { local regionType = self.data.regionType self.thumbnailType = regionType - local option = WeakAuras.regionOptions[regionType] + local option = OptionsPrivate.Private.regionOptions[regionType] if option and option.acquireThumbnail then self.thumbnail = option.acquireThumbnail(button, self.data) if self.thumbnail.icon then diff --git a/WeakAurasOptions/AnimationOptions.lua b/WeakAurasOptions/AnimationOptions.lua index 1fe0a05..bc76cbf 100644 --- a/WeakAurasOptions/AnimationOptions.lua +++ b/WeakAurasOptions/AnimationOptions.lua @@ -17,8 +17,8 @@ local setAll = OptionsPrivate.commonOptions.CreateSetAll("animation", getAll) local function filterAnimPresetTypes(intable, id) local ret = {}; OptionsPrivate.Private.EnsureRegion(id) - local region = WeakAuras.regions[id] and WeakAuras.regions[id].region; - local regionType = WeakAuras.regions[id] and WeakAuras.regions[id].regionType; + local region = OptionsPrivate.Private.regions[id] and OptionsPrivate.Private.regions[id].region; + local regionType = OptionsPrivate.Private.regions[id] and OptionsPrivate.Private.regions[id].regionType; local data = WeakAuras.GetData(id); if data.controlledChildren then @@ -82,8 +82,8 @@ function OptionsPrivate.GetAnimationOptions(data) if(field == "main") then local region = OptionsPrivate.Private.EnsureRegion(id) OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, region, false, nil, true); - if(WeakAuras.clones[id]) then - for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do + if(OptionsPrivate.Private.clones[id]) then + for cloneId, cloneRegion in pairs(OptionsPrivate.Private.clones[id]) do OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId); end end @@ -928,8 +928,8 @@ function OptionsPrivate.GetAnimationOptions(data) local function extraSetFunction() OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, OptionsPrivate.Private.EnsureRegion(id), false, nil, true) - if(WeakAuras.clones[id]) then - for cloneId, cloneRegion in pairs(WeakAuras.clones[id]) do + if(OptionsPrivate.Private.clones[id]) then + for cloneId, cloneRegion in pairs(OptionsPrivate.Private.clones[id]) do OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, cloneRegion, false, nil, true, cloneId) end diff --git a/WeakAurasOptions/CommonOptions.lua b/WeakAurasOptions/CommonOptions.lua index 28d24b8..868fcdb 100644 --- a/WeakAurasOptions/CommonOptions.lua +++ b/WeakAurasOptions/CommonOptions.lua @@ -2,7 +2,6 @@ if not WeakAuras.IsLibsOK() then return end local AddonName, OptionsPrivate = ... local L = WeakAuras.L -local regionOptions = WeakAuras.regionOptions local commonOptionsCache = {} OptionsPrivate.commonOptionsCache = commonOptionsCache @@ -500,7 +499,7 @@ local function replaceNameDescFuncs(intable, data, subOption) local index = string.find(input, ".", 1, true); if (index) then local regionType = string.sub(input, 1, index - 1); - return regionOptions[regionType] and regionType; + return OptionsPrivate.Private.regionOptions[regionType] and regionType; end return nil; end diff --git a/WeakAurasOptions/DisplayOptions.lua b/WeakAurasOptions/DisplayOptions.lua index f9d53c1..1b8dda3 100644 --- a/WeakAurasOptions/DisplayOptions.lua +++ b/WeakAurasOptions/DisplayOptions.lua @@ -1,7 +1,6 @@ if not WeakAuras.IsLibsOK() then return end local AddonName, OptionsPrivate = ... local L = WeakAuras.L -local regionOptions = WeakAuras.regionOptions local flattenRegionOptions = OptionsPrivate.commonOptions.flattenRegionOptions local fixMetaOrders = OptionsPrivate.commonOptions.fixMetaOrders @@ -90,8 +89,8 @@ function OptionsPrivate.GetDisplayOptions(data) local hasSubElements = false - if(regionOptions[data.regionType]) then - regionOption = regionOptions[data.regionType].create(id, data); + if(OptionsPrivate.Private.regionOptions[data.regionType]) then + regionOption = OptionsPrivate.Private.regionOptions[data.regionType].create(id, data); if data.subRegions then local subIndex = {} @@ -210,8 +209,8 @@ function OptionsPrivate.GetDisplayOptions(data) for child in OptionsPrivate.Private.TraverseLeafs(data) do if child and not handledRegionTypes[child.regionType] then handledRegionTypes[child.regionType] = true; - if regionOptions[child.regionType] then - allOptions = union(allOptions, regionOptions[child.regionType].create(id, data)); + if OptionsPrivate.Private.regionOptions[child.regionType] then + allOptions = union(allOptions, OptionsPrivate.Private.regionOptions[child.regionType].create(id, data)); else unsupportedCount = unsupportedCount + 1 allOptions["__unsupported" .. unsupportedCount] = { diff --git a/WeakAurasOptions/GroupOptions.lua b/WeakAurasOptions/GroupOptions.lua index 817be4f..718eaae 100644 --- a/WeakAurasOptions/GroupOptions.lua +++ b/WeakAurasOptions/GroupOptions.lua @@ -2,15 +2,14 @@ if not WeakAuras.IsLibsOK() then return end local AddonName, OptionsPrivate = ... local L = WeakAuras.L -local regionOptions = WeakAuras.regionOptions; local parsePrefix = OptionsPrivate.commonOptions.parsePrefix local flattenRegionOptions = OptionsPrivate.commonOptions.flattenRegionOptions function OptionsPrivate.GetGroupOptions(data) local regionOption; local id = data.id - if (regionOptions[data.regionType]) then - regionOption = regionOptions[data.regionType].create(id, data); + if (OptionsPrivate.Private.regionOptions[data.regionType]) then + regionOption = OptionsPrivate.Private.regionOptions[data.regionType].create(id, data); else regionOption = { [data.regionType] = { diff --git a/WeakAurasOptions/OptionsFrames/FrameChooser.lua b/WeakAurasOptions/OptionsFrames/FrameChooser.lua index ea83896..039338e 100644 --- a/WeakAurasOptions/OptionsFrames/FrameChooser.lua +++ b/WeakAurasOptions/OptionsFrames/FrameChooser.lua @@ -17,7 +17,7 @@ local frameChooserBox local oldFocus local oldFocusName function OptionsPrivate.StartFrameChooser(data, path) - local frame = WeakAuras.OptionsFrame(); + local frame = OptionsPrivate.Private.OptionsFrame(); if not(frameChooserFrame) then frameChooserFrame = CreateFrame("Frame"); frameChooserBox = CreateFrame("Frame", nil, frameChooserFrame); @@ -50,7 +50,7 @@ function OptionsPrivate.StartFrameChooser(data, path) if(focusName == "WorldFrame" or not focusName) then focusName = nil; local focusIsGroup = false; - for id, regionData in pairs(WeakAuras.regions) do + for id, regionData in pairs(OptionsPrivate.Private.regions) do if(regionData.region:IsVisible() and MouseIsOver(regionData.region)) then local isGroup = regionData.regionType == "group" or regionData.regionType == "dynamicgroup"; if (not focusName or (not isGroup and focusIsGroup)) then diff --git a/WeakAurasOptions/OptionsFrames/MoverSizer.lua b/WeakAurasOptions/OptionsFrames/MoverSizer.lua index 031b766..e076260 100644 --- a/WeakAurasOptions/OptionsFrames/MoverSizer.lua +++ b/WeakAurasOptions/OptionsFrames/MoverSizer.lua @@ -380,7 +380,7 @@ local function BuildAlignLines(mover) skipIds[child.id] = true end - for k, v in pairs(WeakAuras.displayButtons) do + for k, v in pairs(OptionsPrivate.displayButtons) do local region = WeakAuras.GetRegion(v.data.id) if not skipIds[k] and v.view.visibility ~= 0 and region then local scale = region:GetEffectiveScale() / UIParent:GetEffectiveScale() diff --git a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua index 936c83b..bc33f2b 100644 --- a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua +++ b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua @@ -17,8 +17,7 @@ local AceConfigRegistry = LibStub("AceConfigRegistry-3.0") local WeakAuras = WeakAuras local L = WeakAuras.L -local displayButtons = WeakAuras.displayButtons -local regionOptions = WeakAuras.regionOptions +local displayButtons = OptionsPrivate.displayButtons local tempGroup = OptionsPrivate.tempGroup local aceOptions = {} @@ -138,11 +137,11 @@ function OptionsPrivate.CreateFrame() OptionsPrivate.Private.ClearFakeStates() - for id, data in pairs(WeakAuras.regions) do + for id, data in pairs(OptionsPrivate.Private.regions) do data.region:Collapse() data.region:OptionsClosed() - if WeakAuras.clones[id] then - for _, cloneRegion in pairs(WeakAuras.clones[id]) do + if OptionsPrivate.Private.clones[id] then + for _, cloneRegion in pairs(OptionsPrivate.Private.clones[id]) do cloneRegion:Collapse() cloneRegion:OptionsClosed() end @@ -1126,7 +1125,7 @@ function OptionsPrivate.CreateFrame() end if targetId then - local pickedButton = WeakAuras.GetDisplayButton(targetId) + local pickedButton = OptionsPrivate.GetDisplayButton(targetId) if pickedButton.data.controlledChildren then targetIsDynamicGroup = pickedButton.data.regionType == "dynamicgroup" else @@ -1180,7 +1179,7 @@ function OptionsPrivate.CreateFrame() end local regionTypesSorted = {} - for regionType, regionData in pairs(regionOptions) do + for regionType, regionData in pairs(OptionsPrivate.Private.regionOptions) do tinsert(regionTypesSorted, regionType) end @@ -1201,14 +1200,14 @@ function OptionsPrivate.CreateFrame() return false end - return regionOptions[a].displayName < regionOptions[b].displayName + return OptionsPrivate.Private.regionOptions[a].displayName < OptionsPrivate.Private.regionOptions[b].displayName end) for index, regionType in ipairs(regionTypesSorted) do if (targetIsDynamicGroup and (regionType == "group" or regionType == "dynamicgroup")) then -- Dynamic groups can't contain group/dynamic groups else - local regionData = regionOptions[regionType] + local regionData = OptionsPrivate.Private.regionOptions[regionType] local button = AceGUI:Create("WeakAurasNewButton") button:SetTitle(regionData.displayName) if(type(regionData.icon) == "string" or type(regionData.icon) == "table") then @@ -1262,8 +1261,8 @@ function OptionsPrivate.CreateFrame() } if not frame.importThumbnail then - local thumbnail = regionOptions["text"].createThumbnail(UIParent) - regionOptions["text"].modifyThumbnail(UIParent, thumbnail, data) + local thumbnail = OptionsPrivate.Private.regionOptions["text"].createThumbnail(UIParent) + OptionsPrivate.Private.regionOptions["text"].modifyThumbnail(UIParent, thumbnail, data) thumbnail.mask:SetPoint("BOTTOMLEFT", thumbnail, "BOTTOMLEFT", 3, 3) thumbnail.mask:SetPoint("TOPRIGHT", thumbnail, "TOPRIGHT", -3, -3) frame.importThumbnail = thumbnail diff --git a/WeakAurasOptions/OptionsFrames/Update.lua b/WeakAurasOptions/OptionsFrames/Update.lua index 67abe32..15dd6a9 100644 --- a/WeakAurasOptions/OptionsFrames/Update.lua +++ b/WeakAurasOptions/OptionsFrames/Update.lua @@ -1676,7 +1676,7 @@ local methods = { uidMap:ChangeId(uid, existingData.id) else if WeakAuras.GetData(uidMap:GetIdFor(uid)) then - local newId = WeakAuras.FindUnusedId(uidMap:GetIdFor(uid)) + local newId = OptionsPrivate.Private.FindUnusedId(uidMap:GetIdFor(uid)) uidMap:ChangeId(uid, newId) end end @@ -1731,7 +1731,7 @@ local methods = { if string.sub(data.id, 1, #targetName) == targetName then -- Our name is already prefixed with targetName, don't try to improve else - local newId = WeakAuras.FindUnusedId(targetName) + local newId = OptionsPrivate.Private.FindUnusedId(targetName) local oldid = data.id WeakAuras.Rename(data, newId) if targetName[aura.uid] then -- We can hope that the aura the squatter renames itself, so try again @@ -1851,7 +1851,7 @@ local methods = { data.authorMode = nil WeakAuras.Add(data) OptionsPrivate.Private.SetHistory(data.uid, data, "import") - local button = WeakAuras.GetDisplayButton(data.id) + local button = OptionsPrivate.GetDisplayButton(data.id) button:SetData(data) if (data.parent) then local parentIsDynamicGroup = structureUidMap:GetParentIsDynamicGroup(uid) @@ -1875,14 +1875,14 @@ local methods = { for i = #phase2Order, 1, -1 do local uid = phase2Order[i] local data = OptionsPrivate.Private.GetDataByUID(uid) - local displayButton = WeakAuras.GetDisplayButton(data.id) + local displayButton = OptionsPrivate.GetDisplayButton(data.id) displayButton:UpdateOffset() end end, ImportPhase1 = function(self, uidMap, uid, phase2Order) tinsert(phase2Order, uid) local data = uidMap:GetPhase1Data(uid) - local newId = WeakAuras.FindUnusedId(data.id) + local newId = OptionsPrivate.Private.FindUnusedId(data.id) uidMap:ChangeId(uid, newId) data.preferToUpdate = false @@ -1913,7 +1913,7 @@ local methods = { WeakAuras.Add(data) OptionsPrivate.Private.SetHistory(data.uid, data, "import") - local button = WeakAuras.GetDisplayButton(data.id) + local button = OptionsPrivate.GetDisplayButton(data.id) button:SetData(data) if (data.parent) then local parentIsDynamicGroup = uidMap:GetParentIsDynamicGroup(uid) @@ -1936,7 +1936,7 @@ local methods = { for i = #phase2Order, 1, -1 do local uid = phase2Order[i] local data = OptionsPrivate.Private.GetDataByUID(uid) - local displayButton = WeakAuras.GetDisplayButton(data.id) + local displayButton = OptionsPrivate.GetDisplayButton(data.id) displayButton:UpdateOffset() end diff --git a/WeakAurasOptions/RegionOptions/Model.lua b/WeakAurasOptions/RegionOptions/Model.lua index d17d866..d4ac7dd 100644 --- a/WeakAurasOptions/RegionOptions/Model.lua +++ b/WeakAurasOptions/RegionOptions/Model.lua @@ -149,7 +149,7 @@ local function modifyThumbnail(parent, region, data) local model = region.model region:SetScript("OnUpdate", function() - local optionsFrame = WeakAuras.OptionsFrame(); + local optionsFrame = OptionsPrivate.Private.OptionsFrame(); if optionsFrame then model:SetParent(optionsFrame) region:SetScript("OnUpdate", nil) diff --git a/WeakAurasOptions/RegionOptions/StopMotion.lua b/WeakAurasOptions/RegionOptions/StopMotion.lua index b31374c..3239918 100644 --- a/WeakAurasOptions/RegionOptions/StopMotion.lua +++ b/WeakAurasOptions/RegionOptions/StopMotion.lua @@ -6,7 +6,7 @@ local AddonName, OptionsPrivate = ... local texture_types = WeakAuras.StopMotion.texture_types; local texture_data = WeakAuras.StopMotion.texture_data; local animation_types = WeakAuras.StopMotion.animation_types; -local setTile = WeakAuras.setTile; +local setTile = WeakAuras.setTile local function setTextureFunc(textureWidget, texturePath, textureName) local data = texture_data[texturePath]; diff --git a/WeakAurasOptions/SubRegionOptions/SubRegionCommon.lua b/WeakAurasOptions/SubRegionOptions/SubRegionCommon.lua index 8197233..76e9486 100644 --- a/WeakAurasOptions/SubRegionOptions/SubRegionCommon.lua +++ b/WeakAurasOptions/SubRegionOptions/SubRegionCommon.lua @@ -23,7 +23,7 @@ local function AdjustConditions(data, replacements) end end -function WeakAuras.DeleteSubRegion(data, index, regionType) +function OptionsPrivate.DeleteSubRegion(data, index, regionType) if not data.subRegions then return end @@ -123,7 +123,7 @@ function OptionsPrivate.AddUpDownDeleteDuplicate(options, parentData, index, sub end options.__delete = function() for child in OptionsPrivate.Private.TraverseLeafsOrAura(parentData) do - WeakAuras.DeleteSubRegion(child, index, subRegionType) + OptionsPrivate.DeleteSubRegion(child, index, subRegionType) end WeakAuras.ClearAndUpdateOptions(parentData.id) end diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index ab35b25..59266d5 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -19,7 +19,7 @@ local L = WeakAuras.L local ADDON_NAME = "WeakAurasOptions"; local displayButtons = {}; -WeakAuras.displayButtons = displayButtons; +OptionsPrivate.displayButtons = displayButtons; local spellCache = WeakAuras.spellCache; local savedVars = {}; @@ -93,13 +93,13 @@ function OptionsPrivate.DuplicateAura(data, newParent, massEdit, targetIndex) OptionsPrivate.Private.AddParents(parentData) for index, id in pairs(parentData.controlledChildren) do - local childButton = WeakAuras.GetDisplayButton(id) + local childButton = OptionsPrivate.GetDisplayButton(id) childButton:SetGroup(parentData.id, parentData.regionType == "dynamicgroup") childButton:SetGroupOrder(index, #parentData.controlledChildren) end if not massEdit then - local button = WeakAuras.GetDisplayButton(parentData.id) + local button = OptionsPrivate.GetDisplayButton(parentData.id) button.callbacks.UpdateExpandButton() button:UpdateParentWarning() end @@ -244,7 +244,7 @@ local function commonParent(controlledChildren) local targetIndex = math.huge for index, id in ipairs(controlledChildren) do local childData = WeakAuras.GetData(id); - local childButton = WeakAuras.GetDisplayButton(id) + local childButton = OptionsPrivate.GetDisplayButton(id) targetIndex = min(targetIndex, childButton:GetGroupOrder() or math.huge) if (parent == nil) then @@ -262,13 +262,13 @@ end local function CreateNewGroupFromSelection(regionType, resetChildPositions) local data = { - id = WeakAuras.FindUnusedId(tempGroup.controlledChildren[1].." Group"), + id = OptionsPrivate.Private.FindUnusedId(tempGroup.controlledChildren[1].." Group"), regionType = regionType, }; - WeakAuras.DeepMixin(data, WeakAuras.data_stub) + WeakAuras.DeepMixin(data, OptionsPrivate.Private.data_stub) data.internalVersion = WeakAuras.InternalVersion() - WeakAuras.validate(data, WeakAuras.regionTypes[regionType].default); + OptionsPrivate.Private.validate(data, OptionsPrivate.Private.regionTypes[regionType].default); local parent, targetIndex = commonParent(tempGroup.controlledChildren) @@ -283,7 +283,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions) WeakAuras.UpdateGroupOrders(parentData); OptionsPrivate.ClearOptions(parentData.id); - local parentButton = WeakAuras.GetDisplayButton(parent) + local parentButton = OptionsPrivate.GetDisplayButton(parent) parentButton.callbacks.UpdateExpandButton(); parentButton:Expand(); parentButton:ReloadTooltip(); @@ -295,7 +295,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions) for index, childId in pairs(tempGroup.controlledChildren) do local childData = WeakAuras.GetData(childId); - local childButton = WeakAuras.GetDisplayButton(childId) + local childButton = OptionsPrivate.GetDisplayButton(childId) local oldParent = childData.parent local oldParentData = WeakAuras.GetData(oldParent) if (oldParent) then @@ -308,7 +308,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions) OptionsPrivate.Private.AddParents(oldParentData) WeakAuras.UpdateGroupOrders(oldParentData); WeakAuras.ClearAndUpdateOptions(oldParent); - local oldParentButton = WeakAuras.GetDisplayButton(oldParent) + local oldParentButton = OptionsPrivate.GetDisplayButton(oldParent) oldParentButton.callbacks.UpdateExpandButton(); oldParentButton:ReloadTooltip() oldParentButton:UpdateParentWarning() @@ -328,7 +328,7 @@ local function CreateNewGroupFromSelection(regionType, resetChildPositions) childButton:SetGroupOrder(index, #data.controlledChildren); end - local button = WeakAuras.GetDisplayButton(data.id); + local button = OptionsPrivate.GetDisplayButton(data.id); button.callbacks.UpdateExpandButton(); button:UpdateParentWarning() OptionsPrivate.SortDisplayButtons(); @@ -455,7 +455,7 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = { if self.data.parents then for id in pairs(self.data.parents) do local parentData = WeakAuras.GetData(id) - local parentButton = WeakAuras.GetDisplayButton(id) + local parentButton = OptionsPrivate.GetDisplayButton(id) WeakAuras.UpdateGroupOrders(parentData) if(#parentData.controlledChildren == 0) then parentButton:DisableExpand() @@ -509,14 +509,6 @@ function OptionsPrivate.ConfirmDelete(toDelete, parents) end end -function WeakAuras.OptionsFrame() - if(frame) then - return frame; - else - return nil; - end -end - local function AfterScanForLoads() if(frame) then if (frame:IsVisible()) then @@ -558,19 +550,19 @@ end local function OnRename(event, uid, oldid, newid) local data = OptionsPrivate.Private.GetDataByUID(uid) - WeakAuras.displayButtons[newid] = WeakAuras.displayButtons[oldid]; - WeakAuras.displayButtons[newid]:SetData(data) - WeakAuras.displayButtons[oldid] = nil; + OptionsPrivate.displayButtons[newid] = OptionsPrivate.displayButtons[oldid]; + OptionsPrivate.displayButtons[newid]:SetData(data) + OptionsPrivate.displayButtons[oldid] = nil; OptionsPrivate.ClearOptions(oldid) - WeakAuras.displayButtons[newid]:SetTitle(newid); + OptionsPrivate.displayButtons[newid]:SetTitle(newid); collapsedOptions[newid] = collapsedOptions[oldid] collapsedOptions[oldid] = nil if(data.controlledChildren) then for _, childId in pairs(data.controlledChildren) do - WeakAuras.displayButtons[childId]:SetGroup(newid) + OptionsPrivate.displayButtons[childId]:SetGroup(newid) end end @@ -589,12 +581,21 @@ local function OnRename(event, uid, oldid, newid) end end +local function OptionsFrame() + if(frame) then + return frame + else + return nil + end +end + function WeakAuras.ToggleOptions(msg, Private) if not Private then return end if not OptionsPrivate.Private then OptionsPrivate.Private = Private + Private.OptionsFrame = OptionsFrame OptionsPrivate.Private.callbacks:RegisterCallback("AuraWarningsUpdated", function(event, uid) local id = OptionsPrivate.Private.UIDtoID(uid) if displayButtons[id] then @@ -603,7 +604,7 @@ function WeakAuras.ToggleOptions(msg, Private) end local data = Private.GetDataByUID(uid) if data and data.parent then - local button = WeakAuras.GetDisplayButton(data.parent); + local button = OptionsPrivate.GetDisplayButton(data.parent); if button then button:UpdateParentWarning() end @@ -741,7 +742,7 @@ local function LayoutDisplayButtons(msg) button:PriorityShow(1); end end - WeakAuras.OptionsFrame().loadedButton:RecheckVisibility() + OptionsPrivate.Private.OptionsFrame().loadedButton:RecheckVisibility() end OptionsPrivate.Private.ResumeAllDynamicGroups(suspended) @@ -905,8 +906,8 @@ function OptionsPrivate.ConvertDisplay(data, newType) local visibility = displayButtons[id]:GetVisibility(); displayButtons[id]:PriorityHide(2); - if WeakAuras.regions[id] then - WeakAuras.regions[id].region:Collapse() + if OptionsPrivate.Private.regions[id] then + OptionsPrivate.Private.regions[id].region:Collapse() end OptionsPrivate.Private.CollapseAllClones(id); @@ -936,7 +937,7 @@ function WeakAuras.UpdateGroupOrders(data) if(data.controlledChildren) then local total = #data.controlledChildren; for index, id in pairs(data.controlledChildren) do - local button = WeakAuras.GetDisplayButton(id); + local button = OptionsPrivate.GetDisplayButton(id); button:SetGroupOrder(index, total); end end @@ -1326,7 +1327,7 @@ function OptionsPrivate.PickDisplayMultipleShift(target) end end -function WeakAuras.GetDisplayButton(id) +function OptionsPrivate.GetDisplayButton(id) if(id and displayButtons[id]) then return displayButtons[id]; end @@ -1351,7 +1352,7 @@ function OptionsPrivate.StartGrouping(data) local children = {}; -- start grouping for selected buttons for index, childId in ipairs(tempGroup.controlledChildren) do - local button = WeakAuras.GetDisplayButton(childId); + local button = OptionsPrivate.GetDisplayButton(childId); button:StartGrouping(tempGroup.controlledChildren, true); children[childId] = true; end @@ -1386,11 +1387,11 @@ function OptionsPrivate.Ungroup(data) if (frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0) then for index, childId in ipairs(tempGroup.controlledChildren) do - local button = WeakAuras.GetDisplayButton(childId); + local button = OptionsPrivate.GetDisplayButton(childId); button:Ungroup(data); end else - local button = WeakAuras.GetDisplayButton(data.id); + local button = OptionsPrivate.GetDisplayButton(data.id); button:Ungroup(data); end WeakAuras.FillOptions() @@ -1438,8 +1439,8 @@ local function CompareButtonOrder(a, b) if (parents[parent]) then -- We have found the common parent, the last node in the chain is -- Compare the previous nodes GroupOrder - local aButton = WeakAuras.GetDisplayButton(parents[parent]) - local bButton = WeakAuras.GetDisplayButton(bNode) + local aButton = OptionsPrivate.GetDisplayButton(parents[parent]) + local bButton = OptionsPrivate.GetDisplayButton(bNode) return aButton:GetGroupOrder() < bButton:GetGroupOrder() end lastBParent = parent @@ -1448,8 +1449,8 @@ local function CompareButtonOrder(a, b) end -- If we are here there was no common parent - local aButton = WeakAuras.GetDisplayButton(lastAParent) - local bButton = WeakAuras.GetDisplayButton(lastBParent) + local aButton = OptionsPrivate.GetDisplayButton(lastAParent) + local bButton = OptionsPrivate.GetDisplayButton(lastBParent) return aButton.data.id < bButton.data.id end @@ -1518,7 +1519,7 @@ function OptionsPrivate.StartDrag(mainAura) -- set dragging for selected buttons in reverse for ordering for child in OptionsPrivate.Private.TraverseAllChildren(tempGroup) do - local button = WeakAuras.GetDisplayButton(child.id); + local button = OptionsPrivate.GetDisplayButton(child.id); button:DragStart("MULTI", true, mainAura, size) children[child.id] = true end @@ -1534,7 +1535,7 @@ function OptionsPrivate.StartDrag(mainAura) local mode = "GROUP" local children = {}; for child in OptionsPrivate.Private.TraverseAll(mainAura) do - local button = WeakAuras.GetDisplayButton(child.id); + local button = OptionsPrivate.GetDisplayButton(child.id); button:DragStart(mode, true, mainAura) children[child.id] = true end @@ -1665,11 +1666,11 @@ end function WeakAuras.SetMoverSizer(id) OptionsPrivate.Private.EnsureRegion(id) - if WeakAuras.regions[id].region.toShow then - frame.moversizer:SetToRegion(WeakAuras.regions[id].region, db.displays[id]) + if OptionsPrivate.Private.regions[id].region.toShow then + frame.moversizer:SetToRegion(OptionsPrivate.Private.regions[id].region, db.displays[id]) else - if WeakAuras.clones[id] then - local _, clone = next(WeakAuras.clones[id]) + if OptionsPrivate.Private.clones[id] then + local _, clone = next(OptionsPrivate.Private.clones[id]) if clone then frame.moversizer:SetToRegion(clone, db.displays[id]) end @@ -1694,25 +1695,25 @@ function WeakAuras.NewAura(sourceData, regionType, targetId) local function ensure(t, k, v) return t and k and v and t[k] == v end - local new_id = WeakAuras.FindUnusedId("New") + local new_id = OptionsPrivate.Private.FindUnusedId("New") local data = {id = new_id, regionType = regionType, uid = WeakAuras.GenerateUniqueID()} - WeakAuras.DeepMixin(data, WeakAuras.data_stub); + WeakAuras.DeepMixin(data, OptionsPrivate.Private.data_stub); if (sourceData) then WeakAuras.DeepMixin(data, sourceData); end data.internalVersion = WeakAuras.InternalVersion(); - WeakAuras.validate(data, WeakAuras.regionTypes[regionType].default); + OptionsPrivate.Private.validate(data, OptionsPrivate.Private.regionTypes[regionType].default); AddDefaultSubRegions(data) if targetId then - local target = WeakAuras.GetDisplayButton(targetId); + local target = OptionsPrivate.GetDisplayButton(targetId); local group if (target) then if (target:IsGroup()) then group = target; else - group = WeakAuras.GetDisplayButton(target.data.parent); + group = OptionsPrivate.GetDisplayButton(target.data.parent); end if (group) then -- Sanity check so that we don't create a group/dynamic group in a group