Clean up WeakAuras table and remove members that no one should touch

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