beta
This commit is contained in:
@@ -71,7 +71,7 @@ local function UpdateAnimations()
|
||||
end
|
||||
local progress = anim.inverse and (1 - anim.progress) or anim.progress;
|
||||
progress = anim.easeFunc(progress, anim.easeStrength or 3)
|
||||
WeakAuras.ActivateAuraEnvironmentForRegion(anim.region)
|
||||
Private.ActivateAuraEnvironmentForRegion(anim.region)
|
||||
if(anim.translateFunc) then
|
||||
if (anim.region.SetOffsetAnim) then
|
||||
local ok, x, y = pcall(anim.translateFunc, progress, 0, 0, anim.dX, anim.dY);
|
||||
@@ -133,7 +133,7 @@ local function UpdateAnimations()
|
||||
anim.region:ColorAnim(r, g, b, a);
|
||||
end
|
||||
end
|
||||
WeakAuras.ActivateAuraEnvironment(nil);
|
||||
Private.ActivateAuraEnvironment(nil);
|
||||
if(finished) then
|
||||
if not(anim.loop) then
|
||||
if (anim.region.SetOffsetAnim) then
|
||||
@@ -321,7 +321,7 @@ function WeakAuras.Animate(namespace, uid, type, anim, region, inverse, onFinish
|
||||
duration = WeakAuras.ParseNumber(anim.duration) or 0;
|
||||
progress = 0;
|
||||
if(namespace == "display" and type == "main" and not onFinished and not anim.duration_type == "relative") then
|
||||
local data = WeakAuras.GetDataByUID(uid);
|
||||
local data = Private.GetDataByUID(uid);
|
||||
if(data and data.parent) then
|
||||
local parentRegion = WeakAuras.regions[data.parent].region;
|
||||
if(parentRegion and parentRegion.controlledRegions) then
|
||||
|
||||
+101
-39
@@ -109,15 +109,6 @@ end
|
||||
|
||||
WeakAuras.WA_Utf8Sub = WA_Utf8Sub
|
||||
|
||||
local helperFunctions = {
|
||||
WA_GetUnitAura = WA_GetUnitAura,
|
||||
WA_GetUnitBuff = WA_GetUnitBuff,
|
||||
WA_GetUnitDebuff = WA_GetUnitDebuff,
|
||||
WA_IterateGroupMembers = WA_IterateGroupMembers,
|
||||
WA_ClassColorName = WA_ClassColorName,
|
||||
WA_Utf8Sub = WA_Utf8Sub,
|
||||
}
|
||||
|
||||
local LCG = LibStub("LibCustomGlow-1.0")
|
||||
WeakAuras.ShowOverlayGlow = LCG.ButtonGlow_Start
|
||||
WeakAuras.HideOverlayGlow = LCG.ButtonGlow_Stop
|
||||
@@ -125,10 +116,6 @@ WeakAuras.HideOverlayGlow = LCG.ButtonGlow_Stop
|
||||
local LGF = LibStub("LibGetFrame-1.0")
|
||||
WeakAuras.GetUnitFrame = LGF.GetUnitFrame
|
||||
|
||||
local function forbidden()
|
||||
prettyPrint(L["A WeakAura just tried to use a forbidden function but has been blocked from doing so. Please check your auras!"])
|
||||
end
|
||||
|
||||
local blockedFunctions = {
|
||||
-- Lua functions that may allow breaking out of the environment
|
||||
getfenv = true,
|
||||
@@ -149,7 +136,6 @@ local blockedFunctions = {
|
||||
AcceptTrade = true,
|
||||
SetSendMailMoney = true,
|
||||
EditMacro = true,
|
||||
SlashCmdList = true,
|
||||
DevTools_DumpCommand = true,
|
||||
hash_SlashCmdList = true,
|
||||
CreateMacro = true,
|
||||
@@ -160,9 +146,8 @@ local blockedFunctions = {
|
||||
DeleteCursorItem = true,
|
||||
}
|
||||
|
||||
local overrideFunctions = {
|
||||
ActionButton_ShowOverlayGlow = WeakAuras.ShowOverlayGlow,
|
||||
ActionButton_HideOverlayGlow = WeakAuras.HideOverlayGlow,
|
||||
local blockedTables = {
|
||||
SlashCmdList = true,
|
||||
}
|
||||
|
||||
local aura_environments = {}
|
||||
@@ -171,42 +156,50 @@ local aura_environments = {}
|
||||
-- 2 == fully initialized
|
||||
local environment_initialized = {}
|
||||
|
||||
function WeakAuras.IsEnvironmentInitialized(id)
|
||||
function Private.IsEnvironmentInitialized(id)
|
||||
return environment_initialized[id] == 2
|
||||
end
|
||||
|
||||
function WeakAuras.DeleteAuraEnvironment(id)
|
||||
function Private.DeleteAuraEnvironment(id)
|
||||
aura_environments[id] = nil
|
||||
environment_initialized[id] = nil
|
||||
end
|
||||
|
||||
function WeakAuras.RenameAuraEnvironment(oldid, newid)
|
||||
function Private.RenameAuraEnvironment(oldid, newid)
|
||||
aura_environments[oldid], aura_environments[newid] = nil, aura_environments[oldid]
|
||||
environment_initialized[oldid], environment_initialized[newid] = nil, environment_initialized[oldid]
|
||||
end
|
||||
|
||||
local current_uid = nil
|
||||
local current_aura_env = nil
|
||||
local aura_env_stack = {} -- Stack of of aura environments, allows use of recursive aura activations through calls to WeakAuras.ScanEvents().
|
||||
-- Stack of of aura environments/uids, allows use of recursive aura activations through calls to WeakAuras.ScanEvents().
|
||||
local aura_env_stack = {}
|
||||
|
||||
function WeakAuras.ClearAuraEnvironment(id)
|
||||
function Private.ClearAuraEnvironment(id)
|
||||
environment_initialized[id] = nil;
|
||||
end
|
||||
|
||||
function WeakAuras.ActivateAuraEnvironmentForRegion(region, onlyConfig)
|
||||
WeakAuras.ActivateAuraEnvironment(region.id, region.cloneId, region.state, region.states, onlyConfig)
|
||||
function Private.ActivateAuraEnvironmentForRegion(region, onlyConfig)
|
||||
Private.ActivateAuraEnvironment(region.id, region.cloneId, region.state, region.states, onlyConfig)
|
||||
end
|
||||
|
||||
function WeakAuras.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig)
|
||||
function Private.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfig)
|
||||
local data = WeakAuras.GetData(id)
|
||||
local region = WeakAuras.GetRegion(id, cloneId)
|
||||
if not data then
|
||||
-- Pop the last aura_env from the stack, and update current_aura_env appropriately.
|
||||
tremove(aura_env_stack)
|
||||
current_aura_env = aura_env_stack[#aura_env_stack] or nil
|
||||
if aura_env_stack[#aura_env_stack] then
|
||||
current_aura_env, current_uid = unpack(aura_env_stack[#aura_env_stack])
|
||||
else
|
||||
current_aura_env = nil
|
||||
current_uid = nil
|
||||
end
|
||||
else
|
||||
-- Existing config is initialized to a high enough value
|
||||
if environment_initialized[id] == 2 or (onlyConfig and environment_initialized[id] == 1) then
|
||||
-- Point the current environment to the correct table
|
||||
current_uid = data.uid
|
||||
current_aura_env = aura_environments[id]
|
||||
current_aura_env.id = id
|
||||
current_aura_env.cloneId = cloneId
|
||||
@@ -214,17 +207,18 @@ function WeakAuras.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfi
|
||||
current_aura_env.states = states
|
||||
current_aura_env.region = region
|
||||
-- Push the new environment onto the stack
|
||||
tinsert(aura_env_stack, current_aura_env)
|
||||
tinsert(aura_env_stack, {current_aura_env, data.uid})
|
||||
elseif onlyConfig then
|
||||
environment_initialized[id] = 1
|
||||
aura_environments[id] = {}
|
||||
current_uid = data.uid
|
||||
current_aura_env = aura_environments[id]
|
||||
current_aura_env.id = id
|
||||
current_aura_env.cloneId = cloneId
|
||||
current_aura_env.state = state
|
||||
current_aura_env.states = states
|
||||
current_aura_env.region = region
|
||||
tinsert(aura_env_stack, current_aura_env)
|
||||
tinsert(aura_env_stack, {current_aura_env, data.uid})
|
||||
|
||||
if not data.controlledChildren then
|
||||
current_aura_env.config = CopyTable(data.config)
|
||||
@@ -233,6 +227,7 @@ function WeakAuras.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfi
|
||||
-- Either this aura environment has not yet been initialized, or it was reset via an edit in WeakaurasOptions
|
||||
environment_initialized[id] = 2
|
||||
aura_environments[id] = aura_environments[id] or {}
|
||||
current_uid = data.uid
|
||||
current_aura_env = aura_environments[id]
|
||||
current_aura_env.id = id
|
||||
current_aura_env.cloneId = cloneId
|
||||
@@ -240,7 +235,7 @@ function WeakAuras.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfi
|
||||
current_aura_env.states = states
|
||||
current_aura_env.region = region
|
||||
-- push new environment onto the stack
|
||||
tinsert(aura_env_stack, current_aura_env)
|
||||
tinsert(aura_env_stack, {current_aura_env, data.uid})
|
||||
|
||||
if data.controlledChildren then
|
||||
current_aura_env.child_envs = {}
|
||||
@@ -248,8 +243,8 @@ function WeakAuras.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfi
|
||||
local childData = WeakAuras.GetData(childID)
|
||||
if childData then
|
||||
if not environment_initialized[childID] then
|
||||
WeakAuras.ActivateAuraEnvironment(childID)
|
||||
WeakAuras.ActivateAuraEnvironment()
|
||||
Private.ActivateAuraEnvironment(childID)
|
||||
Private.ActivateAuraEnvironment()
|
||||
end
|
||||
current_aura_env.child_envs[dataIndex] = aura_environments[childID]
|
||||
end
|
||||
@@ -273,9 +268,68 @@ function WeakAuras.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfi
|
||||
end
|
||||
end
|
||||
|
||||
local function blocked()
|
||||
Private.AuraWarnings.UpdateWarning(current_uid, "SandboxForbidden", "error",
|
||||
L["Forbidden function or table."])
|
||||
end
|
||||
|
||||
local function MakeReadOnly(input, options)
|
||||
return setmetatable({},
|
||||
{
|
||||
__index = function(t, k)
|
||||
if options.blockedFunctions[k] then
|
||||
return options.blocked
|
||||
elseif options.blockedTables[k] then
|
||||
return options.blocked()
|
||||
elseif options.override[k] then
|
||||
return options.override[k]
|
||||
else
|
||||
return input[k]
|
||||
end
|
||||
end,
|
||||
__newindex = options.setBlocked,
|
||||
__metatable = false
|
||||
})
|
||||
end
|
||||
|
||||
local FakeWeakAurasMixin = {
|
||||
blockedFunctions = {
|
||||
Add = true,
|
||||
Rename = true,
|
||||
Delete = true
|
||||
},
|
||||
blockedTables = {
|
||||
AuraWarnings = true
|
||||
},
|
||||
override = {
|
||||
me = UnitName("player"),
|
||||
myGUID = UnitGUID("player")
|
||||
},
|
||||
blocked = blocked,
|
||||
setBlocked = function()
|
||||
Private.AuraWarnings.UpdateWarning(current_uid, "FakeWeakAurasSet", "error",
|
||||
L["Writing to the WeakAuras table is not allowed."], true)
|
||||
end
|
||||
}
|
||||
|
||||
local FakeWeakAuras = MakeReadOnly(WeakAuras, FakeWeakAurasMixin)
|
||||
|
||||
local overridden = {
|
||||
WA_GetUnitAura = WA_GetUnitAura,
|
||||
WA_GetUnitBuff = WA_GetUnitBuff,
|
||||
WA_GetUnitDebuff = WA_GetUnitDebuff,
|
||||
WA_IterateGroupMembers = WA_IterateGroupMembers,
|
||||
WA_ClassColorName = WA_ClassColorName,
|
||||
WA_Utf8Sub = WA_Utf8Sub,
|
||||
ActionButton_ShowOverlayGlow = WeakAuras.ShowOverlayGlow,
|
||||
ActionButton_HideOverlayGlow = WeakAuras.HideOverlayGlow,
|
||||
WeakAuras = FakeWeakAuras
|
||||
}
|
||||
|
||||
local env_getglobal
|
||||
local exec_env = setmetatable({}, { __index =
|
||||
function(t, k)
|
||||
local exec_env = setmetatable({},
|
||||
{
|
||||
__index = function(t, k)
|
||||
if k == "_G" then
|
||||
return t
|
||||
elseif k == "getglobal" then
|
||||
@@ -283,15 +337,23 @@ local exec_env = setmetatable({}, { __index =
|
||||
elseif k == "aura_env" then
|
||||
return current_aura_env
|
||||
elseif blockedFunctions[k] then
|
||||
return forbidden
|
||||
elseif overrideFunctions[k] then
|
||||
return overrideFunctions[k]
|
||||
elseif helperFunctions[k] then
|
||||
return helperFunctions[k]
|
||||
return blocked
|
||||
elseif blockedTables[k] then
|
||||
return blocked()
|
||||
elseif overridden[k] then
|
||||
return overridden[k]
|
||||
else
|
||||
return _G[k]
|
||||
end
|
||||
end,
|
||||
__newindex = function(table, key, value)
|
||||
if _G[key] then
|
||||
Private.AuraWarnings.UpdateWarning(current_uid, "OverridingGlobal", "warning",
|
||||
string.format(L["The aura has overwritten the global '%s', this might affect other auras."], key))
|
||||
end
|
||||
rawset(table, key, value)
|
||||
end,
|
||||
__metatable = false
|
||||
})
|
||||
|
||||
function env_getglobal(k)
|
||||
@@ -317,6 +379,6 @@ function WeakAuras.LoadFunction(string, id, inTrigger)
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.GetSanitizedGlobal(key)
|
||||
function Private.GetSanitizedGlobal(key)
|
||||
return exec_env[key]
|
||||
end
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, Private = ...
|
||||
|
||||
local WeakAuras = WeakAuras
|
||||
local L = WeakAuras.L
|
||||
|
||||
-- keyed on uid, key, { severity, message }
|
||||
local warnings = {}
|
||||
local printedWarnings = {}
|
||||
|
||||
local function OnDelete(event, uid)
|
||||
warnings[uid] = nil
|
||||
end
|
||||
|
||||
Private:RegisterCallback("Delete", OnDelete)
|
||||
|
||||
local function UpdateWarning(uid, key, severity, message, printOnConsole)
|
||||
if not uid then
|
||||
WeakAuras.prettyPrint(L["Warning for unknown aura:"], message)
|
||||
return
|
||||
end
|
||||
if printOnConsole then
|
||||
printedWarnings[uid] = printedWarnings[uid] or {}
|
||||
if printedWarnings[uid][key] == nil then
|
||||
WeakAuras.prettyPrint(string.format(L["Aura '%s': %s"], WeakAuras.UIDtoID(uid), message))
|
||||
printedWarnings[uid][key] = true
|
||||
end
|
||||
end
|
||||
|
||||
warnings[uid] = warnings[uid] or {}
|
||||
if severity and message then
|
||||
warnings[uid][key] = {
|
||||
severity = severity,
|
||||
message = message
|
||||
}
|
||||
else
|
||||
warnings[uid][key] = nil
|
||||
end
|
||||
|
||||
Private.callbacks:Fire("AuraWarningsUpdated", uid)
|
||||
end
|
||||
|
||||
local severityLevel = {
|
||||
info = 0,
|
||||
warning = 1,
|
||||
error = 2
|
||||
}
|
||||
|
||||
-- TODO proper icons
|
||||
local icons = {
|
||||
info = [[Interface/friendsframe/informationicon.blp]],
|
||||
warning = [[Interface/buttons/adventureguidemicrobuttonalert.blp]],
|
||||
error = [[Interface/DialogFrame/UI-Dialog-Icon-AlertNew]]
|
||||
}
|
||||
|
||||
local titles = {
|
||||
info = L["Information"],
|
||||
warning = L["Warning"],
|
||||
error = L["Error"]
|
||||
}
|
||||
|
||||
local function AddMessages(result, messages, icon, mixedSeverity)
|
||||
if not messages then
|
||||
return result
|
||||
end
|
||||
for index, message in ipairs(messages) do
|
||||
if result ~= "" then
|
||||
result = result .. "\n\n"
|
||||
end
|
||||
if mixedSeverity then
|
||||
result = result .. "|T" .. icon .. ":12:12:0:0:64:64:4:60:4:60|t"
|
||||
end
|
||||
result = result .. message
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
local function FormatWarnings(uid)
|
||||
if not warnings[uid] then
|
||||
return
|
||||
end
|
||||
|
||||
local maxSeverity
|
||||
local mixedSeverity = false
|
||||
|
||||
local messagePerSeverity = {}
|
||||
|
||||
for key, warning in pairs(warnings[uid]) do
|
||||
if not maxSeverity then
|
||||
maxSeverity = warning.severity
|
||||
elseif severityLevel[warning.severity] > severityLevel[maxSeverity] then
|
||||
maxSeverity = warning.severity
|
||||
elseif severityLevel[warning.severity] < severityLevel[maxSeverity] then
|
||||
mixedSeverity = true
|
||||
end
|
||||
messagePerSeverity[warning.severity] = messagePerSeverity[warning.severity] or {}
|
||||
tinsert(messagePerSeverity[warning.severity], warning.message)
|
||||
end
|
||||
|
||||
if not maxSeverity then
|
||||
return
|
||||
end
|
||||
|
||||
local result = ""
|
||||
result = AddMessages(result, messagePerSeverity["error"], icons["error"], mixedSeverity)
|
||||
result = AddMessages(result, messagePerSeverity["warning"], icons["warning"], mixedSeverity)
|
||||
result = AddMessages(result, messagePerSeverity["info"], icons["info"], mixedSeverity)
|
||||
return icons[maxSeverity], titles[maxSeverity], result
|
||||
end
|
||||
|
||||
Private.AuraWarnings = {}
|
||||
Private.AuraWarnings.UpdateWarning = UpdateWarning
|
||||
Private.AuraWarnings.FormatWarnings = FormatWarnings
|
||||
@@ -21,7 +21,22 @@ function BuffTrigger.Delete(id) end
|
||||
|
||||
function BuffTrigger.Rename(oldid, newid) end
|
||||
|
||||
function BuffTrigger.Add(data) end
|
||||
function BuffTrigger.Add(data)
|
||||
if data.triggers then
|
||||
local hasLegacyAuraTrigger = false
|
||||
for index, t in ipairs(data.triggers) do
|
||||
if t.trigger.type == "aura" then
|
||||
hasLegacyAuraTrigger = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if hasLegacyAuraTrigger then
|
||||
Private.AuraWarnings.UpdateWarning(data.uid, "legacy", "warning", "This aura has legacy aura trigger(s), which are no longer supported.")
|
||||
else
|
||||
Private.AuraWarnings.UpdateWarning(data.uid, "legacy")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BuffTrigger.CanHaveDuration(data, triggernum)
|
||||
return false
|
||||
|
||||
@@ -70,8 +70,6 @@ local timer = WeakAuras.timer
|
||||
local BuffTrigger = {}
|
||||
local triggerInfos = {}
|
||||
|
||||
local UnitGroupRolesAssigned = function() return "DAMAGER" end
|
||||
|
||||
-- keyed on unit, debuffType, spellname, with a scan object value
|
||||
-- scan object: id, triggernum, scanFunc
|
||||
local scanFuncName = {}
|
||||
|
||||
@@ -249,7 +249,9 @@ end
|
||||
local function CreateCheckCondition(uid, ret, condition, conditionNumber, allConditionsTemplate, nextIsLinked, debug)
|
||||
local usedStates = {};
|
||||
local check, recheckCode = CreateTestForCondition(uid, condition.check, allConditionsTemplate, usedStates);
|
||||
if (check) then
|
||||
if not check then
|
||||
check = "false"
|
||||
end
|
||||
if condition.linked and conditionNumber > 1 then
|
||||
ret = ret .. " elseif (" .. check .. ") then\n";
|
||||
else
|
||||
@@ -259,7 +261,7 @@ local function CreateCheckCondition(uid, ret, condition, conditionNumber, allCon
|
||||
if not nextIsLinked then
|
||||
ret = ret .. " end\n";
|
||||
end
|
||||
end
|
||||
|
||||
if (recheckCode) then
|
||||
ret = ret .. recheckCode;
|
||||
end
|
||||
|
||||
@@ -724,7 +724,7 @@ function WeakAuras.ScanUnitEvents(event, unit, ...)
|
||||
if event_list then
|
||||
for id, triggers in pairs(event_list) do
|
||||
WeakAuras.StartProfileAura(id);
|
||||
WeakAuras.ActivateAuraEnvironment(id);
|
||||
Private.ActivateAuraEnvironment(id);
|
||||
local updateTriggerState = false;
|
||||
for triggernum, data in pairs(triggers) do
|
||||
local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum);
|
||||
@@ -736,7 +736,7 @@ function WeakAuras.ScanUnitEvents(event, unit, ...)
|
||||
WeakAuras.UpdatedTriggerState(id);
|
||||
end
|
||||
WeakAuras.StopProfileAura(id);
|
||||
WeakAuras.ActivateAuraEnvironment(nil);
|
||||
Private.ActivateAuraEnvironment(nil);
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -746,7 +746,7 @@ end
|
||||
function WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ... )
|
||||
for id, triggers in pairs(event_list) do
|
||||
WeakAuras.StartProfileAura(id);
|
||||
WeakAuras.ActivateAuraEnvironment(id);
|
||||
Private.ActivateAuraEnvironment(id);
|
||||
local updateTriggerState = false;
|
||||
for triggernum, data in pairs(triggers) do
|
||||
local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum);
|
||||
@@ -758,7 +758,7 @@ function WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ... )
|
||||
WeakAuras.UpdatedTriggerState(id);
|
||||
end
|
||||
WeakAuras.StopProfileAura(id);
|
||||
WeakAuras.ActivateAuraEnvironment(nil);
|
||||
Private.ActivateAuraEnvironment(nil);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -776,7 +776,7 @@ end
|
||||
function GenericTrigger.CreateFakeStates(id, triggernum)
|
||||
local data = WeakAuras.GetData(id)
|
||||
|
||||
WeakAuras.ActivateAuraEnvironment(id);
|
||||
Private.ActivateAuraEnvironment(id);
|
||||
local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum);
|
||||
RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, "OPTIONS")
|
||||
|
||||
@@ -805,12 +805,12 @@ function GenericTrigger.CreateFakeStates(id, triggernum)
|
||||
AddFakeTime(state)
|
||||
end
|
||||
|
||||
WeakAuras.ActivateAuraEnvironment(nil);
|
||||
Private.ActivateAuraEnvironment(nil);
|
||||
end
|
||||
|
||||
function GenericTrigger.ScanWithFakeEvent(id, fake)
|
||||
local updateTriggerState = false;
|
||||
WeakAuras.ActivateAuraEnvironment(id);
|
||||
Private.ActivateAuraEnvironment(id);
|
||||
for triggernum, event in pairs(events[id] or {}) do
|
||||
local allStates = WeakAuras.GetTriggerStateForTrigger(id, triggernum);
|
||||
if (event.force_events) then
|
||||
@@ -839,7 +839,7 @@ function GenericTrigger.ScanWithFakeEvent(id, fake)
|
||||
if (updateTriggerState) then
|
||||
WeakAuras.UpdatedTriggerState(id);
|
||||
end
|
||||
WeakAuras.ActivateAuraEnvironment(nil);
|
||||
Private.ActivateAuraEnvironment(nil);
|
||||
end
|
||||
|
||||
function GenericTrigger.ScanAll()
|
||||
@@ -2431,7 +2431,10 @@ local watchUnitChange
|
||||
|
||||
-- Nameplates only distinguish between friends and everyone else
|
||||
function WeakAuras.GetPlayerReaction(unit)
|
||||
return UnitIsEnemy('player', unit) and 'hostile' or 'friendly'
|
||||
local r = UnitReaction("player", unit)
|
||||
if r then
|
||||
return r < 5 and "hostile" or "friendly"
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.WatchUnitChange(unit)
|
||||
@@ -3360,9 +3363,9 @@ function GenericTrigger.GetOverlayInfo(data, triggernum)
|
||||
end
|
||||
else
|
||||
local allStates = {};
|
||||
WeakAuras.ActivateAuraEnvironment(data.id);
|
||||
Private.ActivateAuraEnvironment(data.id);
|
||||
RunTriggerFunc(allStates, events[data.id][triggernum], data.id, triggernum, "OPTIONS");
|
||||
WeakAuras.ActivateAuraEnvironment(nil);
|
||||
Private.ActivateAuraEnvironment(nil);
|
||||
local count = 0;
|
||||
for id, state in pairs(allStates) do
|
||||
if (type(state.additionalProgress) == "table") then
|
||||
@@ -3676,9 +3679,9 @@ function GenericTrigger.GetTriggerConditions(data, triggernum)
|
||||
return result;
|
||||
elseif (trigger.custom_type == "stateupdate") then
|
||||
if (events[data.id][triggernum] and events[data.id][triggernum].tsuConditionVariables) then
|
||||
WeakAuras.ActivateAuraEnvironment(data.id, nil, nil, nil, true)
|
||||
Private.ActivateAuraEnvironment(data.id, nil, nil, nil, true)
|
||||
local result = events[data.id][triggernum].tsuConditionVariables()
|
||||
WeakAuras.ActivateAuraEnvironment(nil)
|
||||
Private.ActivateAuraEnvironment(nil)
|
||||
if (type(result)) ~= "table" then
|
||||
return nil;
|
||||
end
|
||||
@@ -3726,7 +3729,7 @@ function GenericTrigger.CreateFallbackState(data, triggernum, state)
|
||||
state.changed = true;
|
||||
local event = events[data.id][triggernum];
|
||||
|
||||
WeakAuras.ActivateAuraEnvironment(data.id, "", state);
|
||||
Private.ActivateAuraEnvironment(data.id, "", state);
|
||||
local firstTrigger = data.triggers[1].trigger
|
||||
if (event.nameFunc) then
|
||||
local ok, name = pcall(event.nameFunc, firstTrigger);
|
||||
@@ -3815,7 +3818,7 @@ function GenericTrigger.CreateFallbackState(data, triggernum, state)
|
||||
if (event.overlayFuncs) then
|
||||
RunOverlayFuncs(event, state);
|
||||
end
|
||||
WeakAuras.ActivateAuraEnvironment(nil);
|
||||
Private.ActivateAuraEnvironment(nil);
|
||||
end
|
||||
|
||||
function GenericTrigger.GetName(triggerType)
|
||||
|
||||
@@ -25,7 +25,7 @@ function WeakAuras.CleanArchive(historyCutoff, migrationCutoff)
|
||||
for uid, subStore in pairs(repo.stores) do
|
||||
-- Ideally we would just use Clean and not access the stores list directly,
|
||||
-- but that'd mean having Clean take a predicate which seems like overkill for the moment
|
||||
if not WeakAuras.GetDataByUID(uid) and subStore.timestamp < cutoffTime then
|
||||
if not Private.GetDataByUID(uid) and subStore.timestamp < cutoffTime then
|
||||
repo:Drop(uid)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2471,7 +2471,6 @@ WeakAuras.event_prototypes = {
|
||||
end
|
||||
end,
|
||||
init = function(trigger)
|
||||
--trigger.itemName = WeakAuras.CorrectItemName(trigger.itemName) or 0;
|
||||
trigger.itemName = trigger.itemName or 0;
|
||||
local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[["..trigger.itemName.."]]";
|
||||
local ret = [=[
|
||||
@@ -2780,7 +2779,6 @@ WeakAuras.event_prototypes = {
|
||||
WeakAuras.WatchItemCooldown(trigger.itemName);
|
||||
end,
|
||||
init = function(trigger)
|
||||
--trigger.itemName = WeakAuras.CorrectItemName(trigger.itemName) or 0;
|
||||
trigger.itemName = trigger.itemName or 0;
|
||||
end,
|
||||
args = {
|
||||
@@ -3880,7 +3878,6 @@ WeakAuras.event_prototypes = {
|
||||
force_events = "BAG_UPDATE",
|
||||
name = L["Item Count"],
|
||||
init = function(trigger)
|
||||
--trigger.itemName = WeakAuras.CorrectItemName(trigger.itemName) or 0;
|
||||
trigger.itemName = trigger.itemName or 0;
|
||||
local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[["..trigger.itemName.."]]";
|
||||
local ret = [[
|
||||
@@ -4459,7 +4456,6 @@ WeakAuras.event_prototypes = {
|
||||
force_events = "UNIT_INVENTORY_CHANGED",
|
||||
name = L["Item Equipped"],
|
||||
init = function(trigger)
|
||||
--trigger.itemName = WeakAuras.CorrectItemName(trigger.itemName) or 0;
|
||||
trigger.itemName = trigger.itemName or 0;
|
||||
local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[[" .. trigger.itemName .. "]]";
|
||||
|
||||
|
||||
@@ -311,9 +311,9 @@ local sorters = {
|
||||
local sortStr = data.customSort or ""
|
||||
local sortFunc = WeakAuras.LoadFunction("return " .. sortStr, data.id, "custom sort") or noop
|
||||
return function(a, b)
|
||||
WeakAuras.ActivateAuraEnvironment(data.id)
|
||||
Private.ActivateAuraEnvironment(data.id)
|
||||
local ok, result = pcall(sortFunc, a, b)
|
||||
WeakAuras.ActivateAuraEnvironment()
|
||||
Private.ActivateAuraEnvironment()
|
||||
if not ok then
|
||||
geterrorhandler()(result)
|
||||
else
|
||||
@@ -370,12 +370,12 @@ local anchorers = {
|
||||
local anchorStr = data.customAnchorPerUnit or ""
|
||||
local anchorFunc = WeakAuras.LoadFunction("return " .. anchorStr, data.id, "custom frame anchor") or noop
|
||||
return function(frames, activeRegions)
|
||||
WeakAuras.ActivateAuraEnvironment(data.id)
|
||||
Private.ActivateAuraEnvironment(data.id)
|
||||
local ok, ret = pcall(anchorFunc, frames, activeRegions)
|
||||
if not ok then
|
||||
geterrorhandler()(ret)
|
||||
end
|
||||
WeakAuras.ActivateAuraEnvironment()
|
||||
Private.ActivateAuraEnvironment()
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -735,9 +735,9 @@ local growers = {
|
||||
local growStr = data.customGrow or ""
|
||||
local growFunc = WeakAuras.LoadFunction("return " .. growStr, data.id, "custom grow") or noop
|
||||
return function(newPositions, activeRegions)
|
||||
WeakAuras.ActivateAuraEnvironment(data.id)
|
||||
Private.ActivateAuraEnvironment(data.id)
|
||||
local ok, ret = pcall(growFunc, newPositions, activeRegions)
|
||||
WeakAuras.ActivateAuraEnvironment()
|
||||
Private.ActivateAuraEnvironment()
|
||||
if not ok then
|
||||
geterrorhandler()(ret)
|
||||
wipe(newPositions)
|
||||
|
||||
@@ -886,10 +886,10 @@ local function modify(parent, region, data)
|
||||
|
||||
function region:SetTexture(texture)
|
||||
region.currentTexture = texture;
|
||||
region.foreground:SetTexture(texture, region.textureWrapMode, region.textureWrapMode);
|
||||
region.foreground:SetTexture(texture);
|
||||
foregroundSpinner:SetTexture(texture);
|
||||
if (data.sameTexture) then
|
||||
background:SetTexture(texture, region.textureWrapMode, region.textureWrapMode);
|
||||
background:SetTexture(texture);
|
||||
backgroundSpinner:SetTexture(texture);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -259,14 +259,15 @@ local function SendChat(self, options)
|
||||
if (not options or WeakAuras.IsOptionsOpen()) then
|
||||
return
|
||||
end
|
||||
|
||||
WeakAuras.HandleChatAction(options.message_type, options.message, options.message_dest, options.message_channel, options.r, options.g, options.b, self, options.message_custom, nil, options.message_formaters);
|
||||
end
|
||||
|
||||
local function RunCode(self, func)
|
||||
if func and not WeakAuras.IsOptionsOpen() then
|
||||
WeakAuras.ActivateAuraEnvironment(self.id, self.cloneId, self.state, self.states);
|
||||
Private.ActivateAuraEnvironment(self.id, self.cloneId, self.state, self.states);
|
||||
xpcall(func, geterrorhandler());
|
||||
WeakAuras.ActivateAuraEnvironment(nil);
|
||||
Private.ActivateAuraEnvironment(nil);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ local function install(data, oldData, patch, mode, isParent)
|
||||
return
|
||||
else
|
||||
-- user has chosen to not delete obsolete auras, so do nothing
|
||||
return WeakAuras.GetDataByUID(oldData.uid)
|
||||
return Private.GetDataByUID(oldData.uid)
|
||||
end
|
||||
else
|
||||
-- something to update
|
||||
@@ -350,7 +350,7 @@ local function install(data, oldData, patch, mode, isParent)
|
||||
end
|
||||
-- if at this point, then some change has been made in the db. Update History to reflect the change
|
||||
WeakAuras.SetHistory(installedUID, imported, "import")
|
||||
return WeakAuras.GetDataByUID(installedUID)
|
||||
return Private.GetDataByUID(installedUID)
|
||||
end
|
||||
|
||||
local function importPendingData()
|
||||
|
||||
+6
-24
@@ -245,6 +245,7 @@ WeakAuras.format_types = {
|
||||
min = 1,
|
||||
max = 20,
|
||||
hidden = hidden,
|
||||
step = 1,
|
||||
disabled = function()
|
||||
return not get(symbol .. "_abbreviate")
|
||||
end
|
||||
@@ -366,7 +367,6 @@ WeakAuras.format_types = {
|
||||
min = 1,
|
||||
max = 20,
|
||||
hidden = hidden,
|
||||
step = 1,
|
||||
disabled = function()
|
||||
return not get(symbol .. "_abbreviate")
|
||||
end
|
||||
@@ -736,12 +736,6 @@ WeakAuras.blend_types = {
|
||||
BLEND = L["Opaque"]
|
||||
}
|
||||
|
||||
WeakAuras.texture_wrap_types = {
|
||||
CLAMP = L["Clamp"],
|
||||
MIRROR = L["Mirror"],
|
||||
REPEAT = L["Repeat"]
|
||||
}
|
||||
|
||||
WeakAuras.slant_mode = {
|
||||
INSIDE = L["Keep Inside"],
|
||||
EXTEND = L["Extend Outside"]
|
||||
@@ -1337,7 +1331,7 @@ WeakAuras.texture_types = {
|
||||
["Interface\\AddOns\\WeakAuras\\Media\\Textures\\Trapezoid"] = "Trapezoid",
|
||||
["Interface\\AddOns\\WeakAuras\\Media\\Textures\\triangle-border.tga"] = "Triangle with Border",
|
||||
["Interface\\AddOns\\WeakAuras\\Media\\Textures\\triangle.tga"] = "Triangle",
|
||||
["Interface\\AddOns\\WeakAuras\\Media\\Textures\\Circle_Smooth2.tga"] = "Smoohth Circle Small",
|
||||
["Interface\\AddOns\\WeakAuras\\Media\\Textures\\Circle_Smooth2.tga"] = "Smooth Circle Small",
|
||||
["Interface\\AddOns\\WeakAuras\\Media\\Textures\\circle_border5.tga"] = "Circle Border",
|
||||
["Interface\\AddOns\\WeakAuras\\Media\\Textures\\ring_glow3.tga"] = "Circle Border Glow",
|
||||
["Interface\\AddOns\\WeakAuras\\Media\\Textures\\square_mini.tga"] = "Small Square",
|
||||
@@ -1404,8 +1398,8 @@ WeakAuras.texture_types["PowerAuras Icons"] = {
|
||||
[PowerAurasPath.."Aura27"] = "Alert",
|
||||
[PowerAurasPath.."Aura29"] = "Paw",
|
||||
[PowerAurasPath.."Aura30"] = "Bull",
|
||||
-- [PowerAurasPath.."Aura31"] = "Heiroglyphics Horizontal",
|
||||
[PowerAurasPath.."Aura32"] = "Heiroglyphics",
|
||||
-- [PowerAurasPath.."Aura31"] = "Hieroglyphics Horizontal",
|
||||
[PowerAurasPath.."Aura32"] = "Hieroglyphics",
|
||||
[PowerAurasPath.."Aura34"] = "Circled Arrow",
|
||||
[PowerAurasPath.."Aura35"] = "Short Sword",
|
||||
-- [PowerAurasPath.."Aura36"] = "Short Sword Horizontal",
|
||||
@@ -1447,7 +1441,7 @@ WeakAuras.texture_types["PowerAuras Icons"] = {
|
||||
-- [PowerAurasPath.."Aura111"] = "Hunter's Mark Horizontal",
|
||||
[PowerAurasPath.."Aura112"] = "Kaleidoscope",
|
||||
[PowerAurasPath.."Aura113"] = "Jesus Face",
|
||||
[PowerAurasPath.."Aura114"] = "Green Mushrrom",
|
||||
[PowerAurasPath.."Aura114"] = "Green Mushroom",
|
||||
[PowerAurasPath.."Aura115"] = "Red Mushroom",
|
||||
[PowerAurasPath.."Aura116"] = "Fire Flower",
|
||||
[PowerAurasPath.."Aura117"] = "Radioactive",
|
||||
@@ -1520,7 +1514,7 @@ WeakAuras.texture_types["PowerAuras Words"] = {
|
||||
[PowerAurasPath.."Aura39"] = "Silence",
|
||||
[PowerAurasPath.."Aura40"] = "Root",
|
||||
[PowerAurasPath.."Aura41"] = "Disorient",
|
||||
[PowerAurasPath.."Aura42"] = "Dispell",
|
||||
[PowerAurasPath.."Aura42"] = "Dispel",
|
||||
[PowerAurasPath.."Aura43"] = "Danger",
|
||||
[PowerAurasPath.."Aura44"] = "Buff",
|
||||
[PowerAurasPath.."Aura44"] = "Buff",
|
||||
@@ -2077,18 +2071,6 @@ WeakAuras.bool_types = {
|
||||
[1] = L["True"]
|
||||
}
|
||||
|
||||
WeakAuras.absorb_modes = {
|
||||
OVERLAY_FROM_START = L["Attach to Start"],
|
||||
OVERLAY_FROM_END = L["Attach to End"]
|
||||
}
|
||||
|
||||
WeakAuras.mythic_plus_affixes = {}
|
||||
|
||||
local mythic_plus_blacklist = {
|
||||
[1] = true,
|
||||
[15] = true
|
||||
}
|
||||
|
||||
WeakAuras.update_categories = {
|
||||
{
|
||||
name = "anchor",
|
||||
|
||||
+28
-28
@@ -31,6 +31,8 @@ LibStub("AceTimer-3.0"):Embed(WeakAurasTimers)
|
||||
WeakAuras.maxTimerDuration = 604800; -- A week, in seconds
|
||||
WeakAuras.maxUpTime = 4294967; -- 2^32 / 1000
|
||||
|
||||
Private.callbacks = LibStub("CallbackHandler-1.0"):New(Private)
|
||||
|
||||
function WeakAuras:Mixin(object, ...)
|
||||
for i = 1, select("#", ...) do
|
||||
local mixin = select(i, ...);
|
||||
@@ -88,7 +90,7 @@ function WeakAuras.OpenOptions(msg)
|
||||
if WeakAuras.NeedToRepairDatabase() then
|
||||
StaticPopup_Show("WEAKAURAS_CONFIRM_REPAIR", nil, nil, {reason = "downgrade"})
|
||||
elseif (WeakAuras.IsLoginFinished() and Private.LoadOptions(msg)) then
|
||||
WeakAuras.ToggleOptions(msg);
|
||||
WeakAuras.ToggleOptions(msg, Private);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1000,6 +1002,7 @@ end
|
||||
local frame = CreateFrame("FRAME", "WeakAurasFrame", UIParent);
|
||||
WeakAuras.frames["WeakAuras Main Frame"] = frame;
|
||||
frame:SetAllPoints(UIParent);
|
||||
|
||||
local loadedFrame = CreateFrame("FRAME");
|
||||
WeakAuras.frames["Addon Initialization Handler"] = loadedFrame;
|
||||
loadedFrame:RegisterEvent("ADDON_LOADED");
|
||||
@@ -1493,7 +1496,7 @@ end
|
||||
-- this cache is loaded lazily via pAdd()
|
||||
local UIDtoID = {}
|
||||
|
||||
function WeakAuras.GetDataByUID(uid)
|
||||
function Private.GetDataByUID(uid)
|
||||
return WeakAuras.GetData(UIDtoID[uid])
|
||||
end
|
||||
|
||||
@@ -1514,7 +1517,7 @@ function WeakAuras.Delete(data)
|
||||
if parentData.sortHybridTable then
|
||||
parentData.sortHybridTable[id] = nil
|
||||
end
|
||||
WeakAuras.ClearAuraEnvironment(data.parent);
|
||||
Private.ClearAuraEnvironment(data.parent);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1572,7 +1575,7 @@ function WeakAuras.Delete(data)
|
||||
|
||||
db.displays[id] = nil;
|
||||
|
||||
WeakAuras.DeleteAuraEnvironment(id)
|
||||
Private.DeleteAuraEnvironment(id)
|
||||
triggerState[id] = nil;
|
||||
|
||||
if (WeakAuras.mouseFrame) then
|
||||
@@ -1588,6 +1591,8 @@ function WeakAuras.Delete(data)
|
||||
WeakAuras.conditionHelpers[data.uid] = nil
|
||||
|
||||
WeakAuras.DeleteCollapsedData(id)
|
||||
|
||||
Private.callbacks:Fire("Delete", data.uid)
|
||||
end
|
||||
|
||||
function WeakAuras.Rename(data, newid)
|
||||
@@ -1641,7 +1646,7 @@ function WeakAuras.Rename(data, newid)
|
||||
triggerState[newid] = triggerState[oldid];
|
||||
triggerState[oldid] = nil;
|
||||
|
||||
WeakAuras.RenameAuraEnvironment(oldid, newid)
|
||||
Private.RenameAuraEnvironment(oldid, newid)
|
||||
|
||||
db.displays[newid] = db.displays[oldid];
|
||||
db.displays[oldid] = nil;
|
||||
@@ -2447,9 +2452,9 @@ local function pAdd(data, simpleChange)
|
||||
WeakAuras.UpdatedTriggerState(id)
|
||||
else
|
||||
if (data.controlledChildren) then
|
||||
WeakAuras.ClearAuraEnvironment(id);
|
||||
Private.ClearAuraEnvironment(id);
|
||||
if data.parent then
|
||||
WeakAuras.ClearAuraEnvironment(data.parent);
|
||||
Private.ClearAuraEnvironment(data.parent);
|
||||
end
|
||||
db.displays[id] = data;
|
||||
WeakAuras.SetRegion(data);
|
||||
@@ -2465,9 +2470,9 @@ local function pAdd(data, simpleChange)
|
||||
end
|
||||
end
|
||||
|
||||
WeakAuras.ClearAuraEnvironment(id);
|
||||
Private.ClearAuraEnvironment(id);
|
||||
if data.parent then
|
||||
WeakAuras.ClearAuraEnvironment(data.parent);
|
||||
Private.ClearAuraEnvironment(data.parent);
|
||||
end
|
||||
|
||||
db.displays[id] = data;
|
||||
@@ -2883,7 +2888,7 @@ function WeakAuras.HandleGlowAction(actions, region)
|
||||
glow_frame = regions[frame_name].region
|
||||
end
|
||||
else
|
||||
glow_frame = WeakAuras.GetSanitizedGlobal(actions.glow_frame)
|
||||
glow_frame = Private.GetSanitizedGlobal(actions.glow_frame)
|
||||
end
|
||||
elseif actions.glow_frame_type == "UNITFRAME" and region.state.unit then
|
||||
glow_frame = WeakAuras.GetUnitFrame(region.state.unit)
|
||||
@@ -2958,12 +2963,9 @@ function WeakAuras.PerformActions(data, when, region)
|
||||
if(actions.do_custom and actions.custom) then
|
||||
local func = Private.customActionsFunctions[data.id][when]
|
||||
if func then
|
||||
WeakAuras.ActivateAuraEnvironment(region.id, region.cloneId, region.state, region.states);
|
||||
local ok, ret = pcall(func);
|
||||
if not ok then
|
||||
geterrorhandler()(ret)
|
||||
end
|
||||
WeakAuras.ActivateAuraEnvironment(nil);
|
||||
Private.ActivateAuraEnvironment(region.id, region.cloneId, region.state, region.states);
|
||||
xpcall(func, geterrorhandler());
|
||||
Private.ActivateAuraEnvironment(nil);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3637,7 +3639,7 @@ end
|
||||
|
||||
local function evaluateTriggerStateTriggers(id)
|
||||
local result = false;
|
||||
WeakAuras.ActivateAuraEnvironment(id);
|
||||
Private.ActivateAuraEnvironment(id);
|
||||
|
||||
if WeakAuras.IsOptionsOpen() then
|
||||
-- While the options are open ignore the combination function
|
||||
@@ -3660,7 +3662,7 @@ local function evaluateTriggerStateTriggers(id)
|
||||
end
|
||||
end
|
||||
|
||||
WeakAuras.ActivateAuraEnvironment(nil);
|
||||
Private.ActivateAuraEnvironment(nil);
|
||||
return result;
|
||||
end
|
||||
|
||||
@@ -3815,7 +3817,7 @@ function WeakAuras.RunCustomTextFunc(region, customFunc)
|
||||
return nil
|
||||
end
|
||||
local state = region.state
|
||||
WeakAuras.ActivateAuraEnvironment(region.id, region.cloneId, region.state, region.states);
|
||||
Private.ActivateAuraEnvironment(region.id, region.cloneId, region.state, region.states);
|
||||
|
||||
local progress = WeakAuras.dynamic_texts.p.func(WeakAuras.dynamic_texts.p.get(state), state, 1)
|
||||
local dur = WeakAuras.dynamic_texts.t.func( WeakAuras.dynamic_texts.t.get(state), state, 1)
|
||||
@@ -3842,7 +3844,7 @@ function WeakAuras.RunCustomTextFunc(region, customFunc)
|
||||
table.remove(custom, 1)
|
||||
end
|
||||
|
||||
WeakAuras.ActivateAuraEnvironment(nil)
|
||||
Private.ActivateAuraEnvironment(nil)
|
||||
return custom
|
||||
end
|
||||
|
||||
@@ -4443,8 +4445,8 @@ local function GetAnchorFrame(data, region, parent)
|
||||
end
|
||||
postponeAnchor(id);
|
||||
else
|
||||
if (WeakAuras.GetSanitizedGlobal(anchorFrameFrame)) then
|
||||
return WeakAuras.GetSanitizedGlobal(anchorFrameFrame);
|
||||
if (Private.GetSanitizedGlobal(anchorFrameFrame)) then
|
||||
return Private.GetSanitizedGlobal(anchorFrameFrame);
|
||||
end
|
||||
postponeAnchor(id);
|
||||
return parent;
|
||||
@@ -4454,14 +4456,12 @@ local function GetAnchorFrame(data, region, parent)
|
||||
if (anchorFrameType == "CUSTOM" and region.customAnchorFunc) then
|
||||
WeakAuras.StartProfileSystem("custom region anchor")
|
||||
WeakAuras.StartProfileAura(region.id)
|
||||
WeakAuras.ActivateAuraEnvironment(region.id, region.cloneId, region.state)
|
||||
local ok, frame = pcall(region.customAnchorFunc)
|
||||
WeakAuras.ActivateAuraEnvironment()
|
||||
Private.ActivateAuraEnvironment(region.id, region.cloneId, region.state)
|
||||
local ok, frame = xpcall(region.customAnchorFunc, geterrorhandler())
|
||||
Private.ActivateAuraEnvironment()
|
||||
WeakAuras.StopProfileSystem("custom region anchor")
|
||||
WeakAuras.StopProfileAura(region.id)
|
||||
if not ok then
|
||||
geterrorhandler()(frame)
|
||||
elseif ok and frame then
|
||||
if ok and frame then
|
||||
return frame
|
||||
elseif WeakAuras.IsOptionsOpen() then
|
||||
return parent
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Interface: 30300
|
||||
## Title: WeakAuras 2
|
||||
## Author: Mirrored and the WeakAuras Team
|
||||
## Title: WeakAuras
|
||||
## Author: The WeakAuras Team
|
||||
## Version: 2.18.0
|
||||
## Notes: A powerful, comprehensive utility for displaying graphics and information based on buffs, debuffs, and other triggers.
|
||||
## Notes-esES: Potente y completa aplicación que te permitirá mostrar por pantalla múltiples diseños, basados en beneficios, perjuicios y otros activadores.
|
||||
@@ -9,7 +9,7 @@
|
||||
## Notes-zhTW: 一個強大且全面實用的顯示圖形和訊息基於增益,減益和其它觸發。
|
||||
## X-Category: Interface Enhancements
|
||||
## Globe-Post: WeakAurasOptions, WeakAurasModelPaths, WeakAurasTemplates
|
||||
## X-Website: https://www.curseforge.com/wow/addons/weakauras-2
|
||||
## X-Website: https://www.curseforge.com/wow/addons/weakauras
|
||||
## X-Curse-Project-ID: 65387
|
||||
## X-WoWI-ID: 24910
|
||||
## DefaultState: Enabled
|
||||
@@ -42,6 +42,7 @@ Conditions.lua
|
||||
BuffTrigger.lua
|
||||
BuffTrigger2.lua
|
||||
GenericTrigger.lua
|
||||
AuraWarnings.lua
|
||||
AuraEnvironment.lua
|
||||
|
||||
# region support
|
||||
@@ -60,5 +61,5 @@ RegionTypes\Model.lua
|
||||
SubRegionTypes\SubText.lua
|
||||
SubRegionTypes\Border.lua
|
||||
SubRegionTypes\Glow.lua
|
||||
SubRegionTypes\BarModel.lua
|
||||
SubRegionTypes\Tick.lua
|
||||
SubRegionTypes\BarModel.lua
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local tinsert, tconcat, tremove, wipe = table.insert, table.concat, table.remove, wipe
|
||||
local select, pairs, next, type, unpack = select, pairs, next, type, unpack
|
||||
local tostring, error = tostring, error
|
||||
|
||||
local Type, Version = "WeakAurasDisplayButton", 55
|
||||
local Type, Version = "WeakAurasDisplayButton", 56
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -1507,19 +1508,24 @@ local methods = {
|
||||
-- no addon, or no data, or ignore flag
|
||||
return false, false, nil, nil
|
||||
end,
|
||||
["RefreshBT2UpgradeIcon"] = function(self)
|
||||
if not self.data.controlledChildren and self.data.triggers then
|
||||
for index, t in ipairs(self.data.triggers) do
|
||||
if t.trigger and t.trigger.type == "aura" then
|
||||
self.bt2upgrade:SetScript("OnClick", function()
|
||||
WeakAuras.PickDisplay(self.data.id, "trigger")
|
||||
["UpdateWarning"] = function(self)
|
||||
local icon, title, warningText = OptionsPrivate.Private.AuraWarnings.FormatWarnings(self.data.uid)
|
||||
if warningText then
|
||||
self.warning:Show()
|
||||
self.warning:SetNormalTexture(icon)
|
||||
self.warning:SetScript("OnEnter", function()
|
||||
Show_Tooltip(
|
||||
self.frame,
|
||||
title,
|
||||
warningText
|
||||
)
|
||||
end)
|
||||
self.bt2upgrade:Show()
|
||||
return
|
||||
self.warning:SetScript("OnClick", function()
|
||||
WeakAuras.PickDisplay(self.data.id, "information")
|
||||
end)
|
||||
else
|
||||
self.warning:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
self.bt2upgrade:Hide()
|
||||
end,
|
||||
["RefreshUpdate"] = function(self, actionFunc)
|
||||
if self.data.parent then
|
||||
@@ -2042,23 +2048,13 @@ local function Constructor()
|
||||
groupUpdate:Hide()
|
||||
end
|
||||
|
||||
-- TODO: remove this once legacy aura trigger is removed
|
||||
local bt2upgrade = CreateFrame("BUTTON", nil, button);
|
||||
button.bt2upgrade = bt2upgrade
|
||||
bt2upgrade.func = function() end
|
||||
bt2upgrade:SetNormalTexture([[Interface\DialogFrame\UI-Dialog-Icon-AlertNew]])
|
||||
bt2upgrade:SetWidth(16)
|
||||
bt2upgrade:SetHeight(16)
|
||||
bt2upgrade:SetPoint("RIGHT", button, "RIGHT", -60, 0)
|
||||
bt2upgrade:SetScript("OnEnter", function()
|
||||
Show_Tooltip(
|
||||
button,
|
||||
L["Legacy Aura Trigger"],
|
||||
L["This aura has legacy aura trigger(s). Convert them to the new system to benefit from enhanced performance and features"]
|
||||
)
|
||||
end)
|
||||
bt2upgrade:SetScript("OnLeave", Hide_Tooltip)
|
||||
bt2upgrade:Hide()
|
||||
local warning = CreateFrame("BUTTON", nil, button);
|
||||
button.warning = warning
|
||||
warning:SetWidth(16)
|
||||
warning:SetHeight(16)
|
||||
warning:SetPoint("RIGHT", button, "RIGHT", -60, 0)
|
||||
warning:SetScript("OnLeave", Hide_Tooltip)
|
||||
warning:Hide()
|
||||
|
||||
local widget = {
|
||||
frame = button,
|
||||
@@ -2074,7 +2070,7 @@ local function Constructor()
|
||||
background = background,
|
||||
expand = expand,
|
||||
update = update,
|
||||
bt2upgrade = bt2upgrade,
|
||||
warning = warning,
|
||||
groupUpdate = groupUpdate,
|
||||
updateLogo = updateLogo,
|
||||
type = Type
|
||||
|
||||
@@ -60,6 +60,8 @@ local noop = function() end
|
||||
|
||||
local function GetBuffTriggerOptions(data, triggernum)
|
||||
local trigger = data.triggers[triggernum].trigger
|
||||
trigger.names = trigger.names or {}
|
||||
trigger.spellIds = trigger.spellIds or {}
|
||||
local spellCache = WeakAuras.spellCache;
|
||||
local ValidateNumeric = WeakAuras.ValidateNumeric;
|
||||
local aura_options = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local L = WeakAuras.L
|
||||
|
||||
@@ -143,5 +144,28 @@ function WeakAuras.GetInformationOptions(data)
|
||||
end
|
||||
end
|
||||
|
||||
-- Show warnings onyl for single selection for now
|
||||
if not isGroup then
|
||||
local icon, title, message = OptionsPrivate.Private.AuraWarnings.FormatWarnings(data.uid)
|
||||
if title and message then
|
||||
args.warningTitle = {
|
||||
type = "header",
|
||||
name = title,
|
||||
width = WeakAuras.doubleWidth,
|
||||
order = order,
|
||||
}
|
||||
order = order + 1
|
||||
|
||||
args.warnings = {
|
||||
type = "description",
|
||||
name = message,
|
||||
width = WeakAuras.doubleWidth,
|
||||
order = order,
|
||||
fontSize = "medium"
|
||||
}
|
||||
order = order + 1
|
||||
end
|
||||
end
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
-- Lua APIs
|
||||
local strtrim, strsub = strtrim, strsub
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
-- Lua APIs
|
||||
local pairs, rad = pairs, rad
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
-- Lua APIs
|
||||
local tinsert, tremove, wipe = table.insert, table.remove, wipe
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then
|
||||
return
|
||||
end
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
-- Lua APIs
|
||||
local pairs, type, ipairs = pairs, type, ipairs
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
-- Lua APIs
|
||||
local wipe = wipe
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local SharedMedia = LibStub("LibSharedMedia-3.0");
|
||||
local L = WeakAuras.L;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local L = WeakAuras.L
|
||||
|
||||
@@ -203,21 +204,29 @@ local function createOptions(id, data)
|
||||
bigStep = 3,
|
||||
hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end
|
||||
},
|
||||
fullCircle = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Full Circle"],
|
||||
order = 7,
|
||||
hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end
|
||||
},
|
||||
arcLength = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Arc Length"],
|
||||
order = 7,
|
||||
name = L["Total Angle"],
|
||||
order = 8,
|
||||
min = 0,
|
||||
max = 360,
|
||||
bigStep = 3,
|
||||
disabled = function() return data.fullCircle end,
|
||||
hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end
|
||||
},
|
||||
radius = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Radius"],
|
||||
order = 6,
|
||||
order = 9,
|
||||
softMin = 0,
|
||||
softMax = 500,
|
||||
bigStep = 1,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local L = WeakAuras.L;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local Masque = LibStub("Masque", true)
|
||||
local L = WeakAuras.L
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local L = WeakAuras.L;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local L = WeakAuras.L;
|
||||
|
||||
@@ -219,25 +220,18 @@ local function createOptions(id, data)
|
||||
bigStep = 0.01,
|
||||
isPercent = true
|
||||
},
|
||||
textureWrapMode = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Texture Wrap"],
|
||||
order = 55.2,
|
||||
values = WeakAuras.texture_wrap_types
|
||||
},
|
||||
slanted = {
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Slanted"],
|
||||
order = 55.3,
|
||||
order = 55.2,
|
||||
hidden = function() return data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE"; end
|
||||
},
|
||||
slant = {
|
||||
type = "range",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Slant Amount"],
|
||||
order = 55.4,
|
||||
order = 55.3,
|
||||
min = 0,
|
||||
max = 1,
|
||||
bigStep = 0.1,
|
||||
@@ -247,14 +241,14 @@ local function createOptions(id, data)
|
||||
type = "toggle",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Inverse Slant"],
|
||||
order = 55.5,
|
||||
order = 55.4,
|
||||
hidden = function() return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" end
|
||||
},
|
||||
slantMode = {
|
||||
type = "select",
|
||||
width = WeakAuras.normalWidth,
|
||||
name = L["Slant Mode"],
|
||||
order = 55.6,
|
||||
order = 55.5,
|
||||
hidden = function() return not data.slanted or data.orientation == "CLOCKWISE" or data.orientation == "ANTICLOCKWISE" end,
|
||||
values = WeakAuras.slant_mode
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
local L = WeakAuras.L
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local texture_types = WeakAuras.StopMotion.texture_types;
|
||||
local texture_data = WeakAuras.StopMotion.texture_data;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local SharedMedia = LibStub("LibSharedMedia-3.0");
|
||||
local L = WeakAuras.L;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
local L = WeakAuras.L
|
||||
|
||||
|
||||
@@ -472,7 +472,22 @@ function WeakAuras.OptionsFrame()
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.ToggleOptions(msg)
|
||||
function WeakAuras.ToggleOptions(msg, Private)
|
||||
if not Private then
|
||||
return
|
||||
end
|
||||
if not OptionsPrivate.Private then
|
||||
OptionsPrivate.Private = Private
|
||||
OptionsPrivate.Private:RegisterCallback("AuraWarningsUpdated", function(event, uid)
|
||||
local id = WeakAuras.UIDtoID(uid)
|
||||
if displayButtons[id] then
|
||||
-- The button does not yet exists if a new aura is created
|
||||
displayButtons[id]:UpdateWarning()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
if(frame and frame:IsVisible()) then
|
||||
WeakAuras.HideOptions();
|
||||
elseif (InCombatLockdown()) then
|
||||
@@ -1148,6 +1163,7 @@ function WeakAuras.EnsureDisplayButton(data)
|
||||
if(displayButtons[id]) then
|
||||
displayButtons[id]:SetData(data);
|
||||
displayButtons[id]:Initialize();
|
||||
displayButtons[id]:UpdateWarning()
|
||||
else
|
||||
print("|cFF8800FFWeakAuras|r: Error creating button for", id);
|
||||
end
|
||||
@@ -1246,8 +1262,6 @@ function WeakAuras.UpdateDisplayButton(data)
|
||||
if WeakAurasCompanion and button:IsGroup() then
|
||||
button:RefreshUpdate()
|
||||
end
|
||||
-- TODO: remove this once legacy aura trigger is removed
|
||||
button:RefreshBT2UpgradeIcon()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user