This commit is contained in:
Bunny67
2020-08-03 00:12:52 +03:00
parent fcd7277800
commit 9956fb7ede
20 changed files with 2562 additions and 4746 deletions
+470
View File
@@ -0,0 +1,470 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, Private = ...
-- Animations
local animations = {}
local pending_controls = {}
local anim_presets = WeakAuras.anim_presets;
local anim_function_strings = WeakAuras.anim_function_strings;
local function noopErrorHandler() end
local frame = WeakAuras.frames["WeakAuras Main Frame"]
local updatingAnimations;
local last_update = GetTime();
local function UpdateAnimations()
WeakAuras.StartProfileSystem("animations");
local errorHandler = WeakAuras.IsOptionsOpen() and noopErrorHandler or geterrorhandler()
for groupId, groupRegion in pairs(pending_controls) do
pending_controls[groupId] = nil;
groupRegion:DoPositionChildren();
end
local time = GetTime();
local elapsed = time - last_update;
last_update = time;
local num = 0;
for id, anim in pairs(animations) do
WeakAuras.StartProfileAura(anim.name);
num = num + 1;
local finished = false;
if(anim.duration_type == "seconds") then
if anim.duration > 0 then
anim.progress = anim.progress + (elapsed / anim.duration);
else
anim.progress = anim.progress + (elapsed / 1);
end
if(anim.progress >= 1) then
anim.progress = 1;
finished = true;
end
elseif(anim.duration_type == "relative") then
local state = anim.region.state;
if (not state
or (state.progressType == "timed" and state.duration < 0.01)
or (state.progressType == "static" and state.value < 0.01)) then
anim.progress = 0;
if(anim.type == "start" or anim.type == "finish") then
finished = true;
end
else
local relativeProgress = 0;
if(state.progressType == "static") then
relativeProgress = state.value / state.total;
elseif (state.progressType == "timed") then
relativeProgress = 1 - ((state.expirationTime - time) / state.duration);
end
relativeProgress = state.inverse and (1 - relativeProgress) or relativeProgress;
anim.progress = relativeProgress / anim.duration
local iteration = math.floor(anim.progress);
--anim.progress = anim.progress - iteration;
if not(anim.iteration) then
anim.iteration = iteration;
elseif(anim.iteration ~= iteration) then
anim.iteration = nil;
finished = true;
end
end
else
anim.progress = 1;
end
local progress = anim.inverse and (1 - anim.progress) or anim.progress;
progress = anim.easeFunc(progress, anim.easeStrength or 3)
WeakAuras.ActivateAuraEnvironment(anim.name, anim.cloneId, anim.region.state, anim.region.states);
if(anim.translateFunc) then
if (anim.region.SetOffsetAnim) then
local ok, x, y = pcall(anim.translateFunc, progress, 0, 0, anim.dX, anim.dY);
if not ok then
errorHandler(x)
else
anim.region:SetOffsetAnim(x, y);
end
else
anim.region:ClearAllPoints();
local ok, x, y = xpcall(anim.translateFunc, progress, anim.startX, anim.startY, anim.dX, anim.dY);
if not ok then
errorHandler(x)
else
anim.region:SetPoint(anim.selfPoint, anim.anchor, anim.anchorPoint, x, y);
end
end
end
if(anim.alphaFunc) then
local ok, alpha = pcall(anim.alphaFunc, progress, anim.startAlpha, anim.dAlpha);
if not ok then
errorHandler(alpha)
else
if (anim.region.SetAnimAlpha) then
anim.region:SetAnimAlpha(alpha);
else
anim.region:SetAlpha(alpha);
end
end
end
if(anim.scaleFunc) then
local ok, scaleX, scaleY = pcall(anim.scaleFunc, progress, 1, 1, anim.scaleX, anim.scaleY);
if not ok then
errorHandler(scaleX)
else
if(anim.region.Scale) then
anim.region:Scale(scaleX, scaleY);
else
anim.region:SetWidth(anim.startWidth * scaleX);
anim.region:SetHeight(anim.startHeight * scaleY);
end
end
end
if(anim.rotateFunc and anim.region.Rotate) then
local ok, rotate = pcall(anim.rotateFunc, progress, anim.startRotation, anim.rotate);
if not ok then
errorHandler(rotate)
else
anim.region:Rotate(rotate);
end
end
if(anim.colorFunc and anim.region.ColorAnim) then
local startR, startG, startB, startA = anim.region:GetColor();
startR, startG, startB, startA = startR or 1, startG or 1, startB or 1, startA or 1;
local ok, r, g, b, a = pcall(anim.colorFunc, progress, startR, startG, startB, startA, anim.colorR, anim.colorG, anim.colorB, anim.colorA);
if not ok then
errorHandler(r)
else
anim.region:ColorAnim(r, g, b, a);
end
end
WeakAuras.ActivateAuraEnvironment(nil);
if(finished) then
if not(anim.loop) then
if (anim.region.SetOffsetAnim) then
anim.region:SetOffsetAnim(0, 0);
else
if(anim.startX) then
anim.region:SetPoint(anim.selfPoint, anim.anchor, anim.anchorPoint, anim.startX, anim.startY);
end
end
if (anim.region.SetAnimAlpha) then
anim.region:SetAnimAlpha(nil);
elseif(anim.startAlpha) then
anim.region:SetAlpha(anim.startAlpha);
end
if(anim.startWidth) then
if(anim.region.Scale) then
anim.region:Scale(1, 1);
else
anim.region:SetWidth(anim.startWidth);
anim.region:SetHeight(anim.startHeight);
end
end
if(anim.startRotation) then
if(anim.region.Rotate) then
anim.region:Rotate(anim.startRotation);
end
end
if(anim.region.ColorAnim) then
anim.region:ColorAnim(nil);
end
animations[id] = nil;
end
if(anim.loop) then
WeakAuras.Animate(anim.namespace, anim.data, anim.type, anim.anim, anim.region, anim.inverse, anim.onFinished, anim.loop, anim.cloneId);
elseif(anim.onFinished) then
anim.onFinished();
end
end
WeakAuras.StopProfileAura(anim.name);
end
-- XXX: I tried to have animations only update if there are actually animation data to animate upon.
-- This caused all start animations to break, and I couldn't figure out why.
-- May revisit at a later time.
--[[
if(num == 0) then
WeakAuras.debug("Animation stopped", 3);
frame:SetScript("OnUpdate", nil);
updatingAnimations = nil;
updatingAnimations = nil;
end
]]--
WeakAuras.StopProfileSystem("animations");
end
function Private.RegisterGroupForPositioning(id, region)
pending_controls[id] = region
updatingAnimations = true
frame:SetScript("OnUpdate", UpdateAnimations)
end
function WeakAuras.Animate(namespace, data, type, anim, region, inverse, onFinished, loop, cloneId)
local id = data.id;
local key = tostring(region);
local valid;
if(anim and anim.type == "custom" and (anim.use_translate or anim.use_alpha or (anim.use_scale and region.Scale) or (anim.use_rotate and region.Rotate) or (anim.use_color and region.Color))) then
valid = true;
elseif(anim and anim.type == "preset" and anim.preset and anim_presets[anim.preset]) then
anim = anim_presets[anim.preset];
valid = true;
end
if(valid) then
local progress, duration, selfPoint, anchor, anchorPoint, startX, startY, startAlpha, startWidth, startHeight, startRotation, easeType, easeStrength;
local translateFunc, alphaFunc, scaleFunc, rotateFunc, colorFunc, easeFunc;
if(animations[key]) then
if(animations[key].type == type and not loop) then
return "no replace";
end
anim.x = anim.x or 0;
anim.y = anim.y or 0;
selfPoint, anchor, anchorPoint, startX, startY = animations[key].selfPoint, animations[key].anchor, animations[key].anchorPoint, animations[key].startX, animations[key].startY;
anim.alpha = anim.alpha or 0;
startAlpha = animations[key].startAlpha;
anim.scalex = anim.scalex or 1;
anim.scaley = anim.scaley or 1;
startWidth, startHeight = animations[key].startWidth, animations[key].startHeight;
anim.rotate = anim.rotate or 0;
startRotation = animations[key].startRotation;
anim.colorR = anim.colorR or 1;
anim.colorG = anim.colorG or 1;
anim.colorB = anim.colorB or 1;
anim.colorA = anim.colorA or 1;
else
anim.x = anim.x or 0;
anim.y = anim.y or 0;
if not region.SetOffsetAnim then
selfPoint, anchor, anchorPoint, startX, startY = region:GetPoint(1);
end
anim.alpha = anim.alpha or 0;
startAlpha = region:GetAlpha();
anim.scalex = anim.scalex or 1;
anim.scaley = anim.scaley or 1;
startWidth, startHeight = region:GetWidth(), region:GetHeight();
anim.rotate = anim.rotate or 0;
startRotation = region.GetRotation and region:GetRotation() or 0;
anim.colorR = anim.colorR or 1;
anim.colorG = anim.colorG or 1;
anim.colorB = anim.colorB or 1;
anim.colorA = anim.colorA or 1;
end
if(anim.use_translate) then
if not(anim.translateType == "custom" and anim.translateFunc) then
anim.translateType = anim.translateType or "straightTranslate";
anim.translateFunc = anim_function_strings[anim.translateType]
end
if (anim.translateFunc) then
translateFunc = WeakAuras.LoadFunction("return " .. anim.translateFunc, id, "translate animation");
else
if (region.SetOffsetAnim) then
region:SetOffsetAnim(0, 0);
else
region:SetPoint(selfPoint, anchor, anchorPoint, startX, startY);
end
end
else
if (region.SetOffsetAnim) then
region:SetOffsetAnim(0, 0);
else
region:SetPoint(selfPoint, anchor, anchorPoint, startX, startY);
end
end
if(anim.use_alpha) then
if not(anim.alphaType == "custom" and anim.alphaFunc) then
anim.alphaType = anim.alphaType or "straight";
anim.alphaFunc = anim_function_strings[anim.alphaType]
end
if (anim.alphaFunc) then
alphaFunc = WeakAuras.LoadFunction("return " .. anim.alphaFunc, id, "alpha animation");
else
if (region.SetAnimAlpha) then
region:SetAnimAlpha(nil);
else
region:SetAlpha(startAlpha);
end
end
else
if (region.SetAnimAlpha) then
region:SetAnimAlpha(nil);
else
region:SetAlpha(startAlpha);
end
end
if(anim.use_scale) then
if not(anim.scaleType == "custom" and anim.scaleFunc) then
anim.scaleType = anim.scaleType or "straightScale";
anim.scaleFunc = anim_function_strings[anim.scaleType]
end
if (anim.scaleFunc) then
scaleFunc = WeakAuras.LoadFunction("return " .. anim.scaleFunc, id, "scale animation");
else
region:Scale(1, 1);
end
elseif(region.Scale) then
region:Scale(1, 1);
end
if(anim.use_rotate) then
if not(anim.rotateType == "custom" and anim.rotateFunc) then
anim.rotateType = anim.rotateType or "straight";
anim.rotateFunc = anim_function_strings[anim.rotateType]
end
if (anim.rotateFunc) then
rotateFunc = WeakAuras.LoadFunction("return " .. anim.rotateFunc, id, "rotate animation");
else
region:Rotate(startRotation);
end
elseif(region.Rotate) then
region:Rotate(startRotation);
end
if(anim.use_color) then
if not(anim.colorType == "custom" and anim.colorFunc) then
anim.colorType = anim.colorType or "straightColor";
anim.colorFunc = anim_function_strings[anim.colorType]
end
if (anim.colorFunc) then
colorFunc = WeakAuras.LoadFunction("return " .. anim.colorFunc, id, "color animation");
else
region:ColorAnim(nil);
end
elseif(region.ColorAnim) then
region:ColorAnim(nil);
end
easeFunc = WeakAuras.anim_ease_functions[anim.easeType or "none"]
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.GetData(id);
if(data and data.parent) then
local parentRegion = WeakAuras.regions[data.parent].region;
if(parentRegion and parentRegion.controlledRegions) then
for index, regionData in pairs(parentRegion.controlledRegions) do
local childRegion = regionData.region;
local childKey = regionData.key;
if(childKey and childKey ~= tostring(region) and animations[childKey] and animations[childKey].type == "main" and duration == animations[childKey].duration) then
progress = animations[childKey].progress;
break;
end
end
end
end
end
local animation = animations[key] or {}
animations[key] = animation
animation.progress = progress
animation.startX = startX
animation.startY = startY
animation.startAlpha = startAlpha
animation.startWidth = startWidth
animation.startHeight = startHeight
animation.startRotation = startRotation
animation.dX = (anim.use_translate and anim.x)
animation.dY = (anim.use_translate and anim.y)
animation.dAlpha = (anim.use_alpha and (anim.alpha - startAlpha))
animation.scaleX = (anim.use_scale and anim.scalex)
animation.scaleY = (anim.use_scale and anim.scaley)
animation.rotate = anim.rotate
animation.colorR = (anim.use_color and anim.colorR)
animation.colorG = (anim.use_color and anim.colorG)
animation.colorB = (anim.use_color and anim.colorB)
animation.colorA = (anim.use_color and anim.colorA)
animation.translateFunc = translateFunc
animation.alphaFunc = alphaFunc
animation.scaleFunc = scaleFunc
animation.rotateFunc = rotateFunc
animation.colorFunc = colorFunc
animation.region = region
animation.selfPoint = selfPoint
animation.anchor = anchor
animation.anchorPoint = anchorPoint
animation.duration = duration
animation.duration_type = anim.duration_type or "seconds"
animation.inverse = inverse
animation.easeType = anim.easeType
animation.easeFunc = easeFunc
animation.easeStrength = anim.easeStrength
animation.type = type
animation.loop = loop
animation.onFinished = onFinished
animation.name = id
animation.cloneId = cloneId or ""
animation.namespace = namespace;
animation.data = data;
animation.anim = anim;
if not(updatingAnimations) then
frame:SetScript("OnUpdate", UpdateAnimations);
updatingAnimations = true;
end
return true;
else
if(animations[key]) then
if(animations[key].type ~= type or loop) then
WeakAuras.CancelAnimation(region, true, true, true, true, true);
end
end
return false;
end
end
function WeakAuras.IsAnimating(region)
local key = tostring(region);
local anim = animations[key];
if(anim) then
return anim.type;
else
return nil;
end
end
function WeakAuras.CancelAnimation(region, resetPos, resetAlpha, resetScale, resetRotation, resetColor, doOnFinished)
local key = tostring(region);
local anim = animations[key];
if(anim) then
if(resetPos) then
if (anim.region.SetOffsetAnim) then
anim.region:SetOffsetAnim(0, 0);
else
anim.region:ClearAllPoints();
anim.region:SetPoint(anim.selfPoint, anim.anchor, anim.anchorPoint, anim.startX, anim.startY);
end
end
if(resetAlpha) then
if (anim.region.SetAnimAlpha) then
anim.region:SetAnimAlpha(nil);
else
anim.region:SetAlpha(anim.startAlpha);
end
end
if(resetScale) then
if(anim.region.Scale) then
anim.region:Scale(1, 1);
else
anim.region:SetWidth(anim.startWidth);
anim.region:SetHeight(anim.startHeight);
end
end
if(resetRotation and anim.region.Rotate) then
anim.region:Rotate(anim.startRotation);
end
if(resetColor and anim.region.ColorAnim) then
anim.region:ColorAnim(nil);
end
animations[key] = nil;
if(doOnFinished and anim.onFinished) then
anim.onFinished();
end
return true;
else
return false;
end
end
function Private.RenameAnimations(oldid, newid)
for key, animation in pairs(animations) do
if animation.name == oldid then
animation.name = newid;
end
end
end
+1 -1
View File
@@ -260,7 +260,7 @@ function WeakAuras.ActivateAuraEnvironment(id, cloneId, state, states, onlyConfi
-- Finally, run the init function if supplied
local actions = data.actions.init
if(actions and actions.do_custom and actions.custom) then
local func = WeakAuras.customActionsFunctions[id]["init"]
local func = Private.customActionsFunctions[id]["init"]
if func then
xpcall(func, geterrorhandler())
end
+24 -1887
View File
File diff suppressed because it is too large Load Diff
+1 -7
View File
@@ -2215,12 +2215,6 @@ function BuffTrigger.Add(data)
end
end
--- Updates old data to the new format.
-- @param data
function BuffTrigger.Modernize(data)
-- Does nothing yet!
end
--- Returns whether the trigger can have a duration.
-- @param data
-- @param triggernum
@@ -2667,7 +2661,7 @@ local function TrackUid(unit)
unit = unit.."target"
GUID = UnitGUID(unit)
if GUID then
WeakAuras.SetUID(GUID, unit)
SetUID(GUID, unit)
BuffTrigger.HandlePendingTracks(unit, GUID)
else
ReleaseUID(unit)
+770
View File
@@ -0,0 +1,770 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, Private = ...
local L = WeakAuras.L
local timer = WeakAuras.timer
-- Dynamic Condition functions to run. keyed on event and id
local dynamicConditions = {};
-- Global Dynamic Condition Funcs, keyed on the event
local globalDynamicConditionFuncs = {};
-- Check Conditions Functions, keyed on id
local checkConditions = {};
local clones = WeakAuras.clones;
local function formatValueForAssignment(vType, value, pathToCustomFunction, pathToFormatters)
if (value == nil) then
value = false;
end
if (vType == "bool") then
return value and tostring(value) or "false";
elseif(vType == "number") then
return value and tostring(value) or "0";
elseif (vType == "list") then
return type(value) == "string" and string.format("%q", value) or "nil";
elseif(vType == "color") then
if (value and type(value) == "table") then
return string.format("{%s, %s, %s, %s}", tostring(value[1]), tostring(value[2]), tostring(value[3]), tostring(value[4]));
end
return "{1, 1, 1, 1}";
elseif(vType == "chat") then
if (value and type(value) == "table") then
local serialized = string.format("{message_type = %q, message = %q, message_dest = %q, message_channel = %q, message_custom = %s, message_formaters = %s}",
tostring(value.message_type), tostring(value.message or ""),
tostring(value.message_dest), tostring(value.message_channel),
pathToCustomFunction,
pathToFormatters)
return serialized
end
elseif(vType == "sound") then
if (value and type(value) == "table") then
return string.format("{ sound = %q, sound_channel = %q, sound_path = %q, sound_kit_id = %q, sound_type = %q, %s}",
tostring(value.sound or ""), tostring(value.sound_channel or ""), tostring(value.sound_path or ""),
tostring(value.sound_kit_id or ""), tostring(value.sound_type or ""),
value.sound_repeat and "sound_repeat = " .. tostring(value.sound_repeat) or "nil");
end
elseif(vType == "customcode") then
return string.format("%s", pathToCustomFunction);
elseif vType == "glowexternal" then
if (value and type(value) == "table") then
return ([[{ glow_action = %q, glow_frame_type = %q, glow_type = %q,
glow_frame = %q, use_glow_color = %s, glow_color = {%s, %s, %s, %s},
glow_lines = %d, glow_frequency = %f, glow_length = %f, glow_thickness = %f, glow_XOffset = %f, glow_YOffset = %f,
glow_scale = %f, glow_border = %s }]]):format(
value.glow_action or "",
value.glow_frame_type or "",
value.glow_type or "",
value.glow_frame or "",
value.use_glow_color and "true" or "false",
type(value.glow_color) == "table" and tostring(value.glow_color[1]) or "1",
type(value.glow_color) == "table" and tostring(value.glow_color[2]) or "1",
type(value.glow_color) == "table" and tostring(value.glow_color[3]) or "1",
type(value.glow_color) == "table" and tostring(value.glow_color[4]) or "1",
value.glow_lines or 8,
value.glow_frequency or 0.25,
value.glow_length or 10,
value.glow_thickness or 1,
value.glow_XOffset or 0,
value.glow_YOffset or 0,
value.glow_scale or 1,
value.glow_border and "true" or "false"
)
end
end
return "nil";
end
local function formatValueForCall(type, property)
if (type == "bool" or type == "number" or type == "list") then
return "propertyChanges['" .. property .. "']";
elseif (type == "color") then
local pcp = "propertyChanges['" .. property .. "']";
return pcp .. "[1], " .. pcp .. "[2], " .. pcp .. "[3], " .. pcp .. "[4]";
end
return "nil";
end
local conditionChecksTimers = {};
conditionChecksTimers.recheckTime = {};
conditionChecksTimers.recheckHandle = {};
function WeakAuras.scheduleConditionCheck(time, id, cloneId)
conditionChecksTimers.recheckTime[id] = conditionChecksTimers.recheckTime[id] or {}
conditionChecksTimers.recheckHandle[id] = conditionChecksTimers.recheckHandle[id] or {};
if (conditionChecksTimers.recheckTime[id][cloneId] and conditionChecksTimers.recheckTime[id][cloneId] > time) then
timer:CancelTimer(conditionChecksTimers.recheckHandle[id][cloneId]);
conditionChecksTimers.recheckHandle[id][cloneId] = nil;
end
if (conditionChecksTimers.recheckHandle[id][cloneId] == nil) then
conditionChecksTimers.recheckHandle[id][cloneId] = timer:ScheduleTimerFixed(function()
conditionChecksTimers.recheckHandle[id][cloneId] = nil;
local region;
if(cloneId and cloneId ~= "") then
region = clones[id] and clones[id][cloneId];
else
region = WeakAuras.regions[id].region;
end
if (region and region.toShow) then
checkConditions[id](region);
end
end, time - GetTime())
conditionChecksTimers.recheckTime[id][cloneId] = time;
end
end
function WeakAuras.CallCustomConditionTest(uid, testFunctionNumber, ...)
local ok, result = pcall(WeakAuras.conditionHelpers[uid].customTestFunctions[testFunctionNumber], ...)
if not ok then
geterrorhandler()(result)
elseif (ok) then
return result
end
end
local function CreateTestForCondition(uid, input, allConditionsTemplate, usedStates)
local trigger = input and input.trigger;
local variable = input and input.variable;
local op = input and input.op;
local value = input and input.value;
local check = nil;
local recheckCode = nil;
if (variable == "AND" or variable == "OR") then
local test = {};
if (input.checks) then
for i, subcheck in ipairs(input.checks) do
local subtest, subrecheckCode = CreateTestForCondition(uid, subcheck, allConditionsTemplate, usedStates);
if (subtest) then
tinsert(test, "(" .. subtest .. ")");
end
if (subrecheckCode) then
recheckCode = recheckCode or "";
recheckCode = recheckCode .. subrecheckCode;
end
end
end
if (next(test)) then
if (variable == "AND") then
check = table.concat(test, " and ");
else
check = table.concat(test, " or ");
end
end
end
if (trigger and variable and value) then
usedStates[trigger] = true;
local conditionTemplate = allConditionsTemplate[trigger] and allConditionsTemplate[trigger][variable];
local cType = conditionTemplate and conditionTemplate.type;
local test = conditionTemplate and conditionTemplate.test;
local preamble = conditionTemplate and conditionTemplate.preamble;
local stateCheck = "state[" .. trigger .. "] and state[" .. trigger .. "].show and ";
local stateVariableCheck = "state[" .. trigger .. "]." .. variable .. "~= nil and ";
local preambleString
if preamble then
WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {}
WeakAuras.conditionHelpers[uid].preambles = WeakAuras.conditionHelpers[uid].preambles or {}
tinsert(WeakAuras.conditionHelpers[uid].preambles, preamble(value));
local preambleNumber = #WeakAuras.conditionHelpers[uid].preambles
preambleString = string.format("WeakAuras.conditionHelpers[%q].preambles[%s]", uid, preambleNumber)
end
if (test) then
if (value) then
WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {}
WeakAuras.conditionHelpers[uid].customTestFunctions = WeakAuras.conditionHelpers[uid].customTestFunctions or {}
tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, test);
local testFunctionNumber = #(WeakAuras.conditionHelpers[uid].customTestFunctions);
local valueString = type(value) == "string" and string.format("%q", value) or value;
local opString = type(op) == "string" and string.format("%q", op) or op;
check = string.format("state and WeakAuras.CallCustomConditionTest(%q, %s, state[%s], %s, %s, %s)",
uid, testFunctionNumber, trigger, valueString, (opString or "nil"), preambleString or "nil");
end
elseif (cType == "customcheck") then
if value then
local customCheck = WeakAuras.LoadFunction("return " .. value, "custom check")
if customCheck then
WeakAuras.conditionHelpers[uid] = WeakAuras.conditionHelpers[uid] or {}
WeakAuras.conditionHelpers[uid].customTestFunctions = WeakAuras.conditionHelpers[uid].customTestFunctions or {}
tinsert(WeakAuras.conditionHelpers[uid].customTestFunctions, customCheck);
local testFunctionNumber = #(WeakAuras.conditionHelpers[uid].customTestFunctions);
check = string.format("state and WeakAuras.CallCustomConditionTest(%q, %s, state)",
uid, testFunctionNumber, trigger);
end
end
elseif (cType == "number" and op) then
local v = tonumber(value)
if (v) then
check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]." .. variable .. op .. v;
end
elseif (cType == "timer" and op) then
if (op == "==") then
check = stateCheck .. stateVariableCheck .. "abs(state[" .. trigger .. "]." ..variable .. "- now -" .. value .. ") < 0.05";
else
check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]." .. variable .. "- now" .. op .. value;
end
elseif (cType == "select" and op) then
if (tonumber(value)) then
check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]." .. variable .. op .. tonumber(value);
else
check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]." .. variable .. op .. "'" .. value .. "'";
end
elseif (cType == "bool") then
local rightSide = value == 0 and "false" or "true";
check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]." .. variable .. "==" .. rightSide
elseif (cType == "string") then
if(op == "==") then
check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]." .. variable .. " == [[" .. value .. "]]";
elseif (op == "find('%s')") then
check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]." .. variable .. ":find([[" .. value .. "]], 1, true)";
elseif (op == "match('%s')") then
check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]." .. variable .. ":match([[" .. value .. "]], 1, true)";
end
end
if (cType == "timer" and value) then
recheckCode = " nextTime = state[" .. trigger .. "] and state[" .. trigger .. "]." .. variable .. " and (state[" .. trigger .. "]." .. variable .. " -" .. value .. ")\n";
recheckCode = recheckCode .. " if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then\n"
recheckCode = recheckCode .. " recheckTime = nextTime\n";
recheckCode = recheckCode .. " end\n"
end
end
return check, recheckCode;
end
local function CreateCheckCondition(uid, ret, condition, conditionNumber, allConditionsTemplate, debug)
local usedStates = {};
local check, recheckCode = CreateTestForCondition(uid, condition.check, allConditionsTemplate, usedStates);
if (check) then
ret = ret .. " state = region.states\n"
ret = ret .. " if (" .. check .. ") then\n";
ret = ret .. " newActiveConditions[" .. conditionNumber .. "] = true;\n";
ret = ret .. " end\n";
end
if (recheckCode) then
ret = ret .. recheckCode;
end
if (check or recheckCode) then
ret = ret .. "\n";
end
return ret;
end
local function ParseProperty(property)
local subIndex, prop = string.match(property, "^sub%.(%d*).(.*)")
if subIndex then
return tonumber(subIndex), prop
else
return nil, property
end
end
local function GetBaseProperty(data, property, start)
if (not data) then
return nil;
end
local subIndex, prop = ParseProperty(property)
if subIndex then
return GetBaseProperty(data.subRegions[subIndex], prop, start)
end
start = start or 1;
local next = string.find(property, ".", start, true);
if (next) then
return GetBaseProperty(data[string.sub(property, start, next - 1)], property, next + 1);
end
local key = string.sub(property, start);
return data[key] or data[tonumber(key)];
end
local function CreateDeactivateCondition(ret, condition, conditionNumber, data, properties, usedProperties, debug)
if (condition.changes) then
ret = ret .. " if (activatedConditions[".. conditionNumber .. "] and not newActiveConditions[" .. conditionNumber .. "]) then\n"
if (debug) then ret = ret .. " print('Deactivating condition " .. conditionNumber .. "' )\n"; end
for changeNum, change in ipairs(condition.changes) do
if (change.property) then
local propertyData = properties and properties[change.property]
if (propertyData and propertyData.type and propertyData.setter) then
usedProperties[change.property] = true;
ret = ret .. " propertyChanges['" .. change.property .. "'] = " .. formatValueForAssignment(propertyData.type, GetBaseProperty(data, change.property)) .. "\n";
if (debug) then ret = ret .. " print('- " .. change.property .. " " ..formatValueForAssignment(propertyData.type, GetBaseProperty(data, change.property)) .. "')\n"; end
end
end
end
ret = ret .. " end\n"
end
return ret;
end
local function CreateActivateCondition(ret, id, condition, conditionNumber, properties, debug)
if (condition.changes) then
ret = ret .. " if (newActiveConditions[" .. conditionNumber .. "]) then\n"
ret = ret .. " if (not activatedConditions[".. conditionNumber .. "]) then\n"
if (debug) then ret = ret .. " print('Activating condition " .. conditionNumber .. "' )\n"; end
-- non active => active
for changeNum, change in ipairs(condition.changes) do
if (change.property) then
local propertyData = properties and properties[change.property]
if (propertyData and propertyData.type) then
if (propertyData.setter) then
ret = ret .. " propertyChanges['" .. change.property .. "'] = " .. formatValueForAssignment(propertyData.type, change.value) .. "\n";
if (debug) then ret = ret .. " print('- " .. change.property .. " " .. formatValueForAssignment(propertyData.type, change.value) .. "')\n"; end
elseif (propertyData.action) then
local pathToCustomFunction = "nil";
local pathToFormatter = "nil"
if (WeakAuras.customConditionsFunctions[id]
and WeakAuras.customConditionsFunctions[id][conditionNumber]
and WeakAuras.customConditionsFunctions[id][conditionNumber].changes
and WeakAuras.customConditionsFunctions[id][conditionNumber].changes[changeNum]) then
pathToCustomFunction = string.format("WeakAuras.customConditionsFunctions[%q][%s].changes[%s]", id, conditionNumber, changeNum);
end
if WeakAuras.conditionTextFormatters[id]
and WeakAuras.conditionTextFormatters[id][conditionNumber]
and WeakAuras.conditionTextFormatters[id][conditionNumber].changes
and WeakAuras.conditionTextFormatters[id][conditionNumber].changes[changeNum] then
pathToFormatter = string.format("WeakAuras.conditionTextFormatters[%q][%s].changes[%s]", id, conditionNumber, changeNum);
end
ret = ret .. " region:" .. propertyData.action .. "(" .. formatValueForAssignment(propertyData.type, change.value, pathToCustomFunction, pathToFormatter) .. ")" .. "\n";
if (debug) then ret = ret .. " print('# " .. propertyData.action .. "(" .. formatValueForAssignment(propertyData.type, change.value, pathToCustomFunction, pathToFormatter) .. "')\n"; end
end
end
end
end
ret = ret .. " else\n"
-- active => active, only override properties
for changeNum, change in ipairs(condition.changes) do
if (change.property) then
local propertyData = properties and properties[change.property]
if (propertyData and propertyData.type and propertyData.setter) then
ret = ret .. " if(propertyChanges['" .. change.property .. "'] ~= nil) then\n"
ret = ret .. " propertyChanges['" .. change.property .. "'] = " .. formatValueForAssignment(propertyData.type, change.value) .. "\n";
if (debug) then ret = ret .. " print('- " .. change.property .. " " .. formatValueForAssignment(propertyData.type, change.value) .. "')\n"; end
ret = ret .. " end\n"
end
end
end
ret = ret .. " end\n"
ret = ret .. " end\n"
ret = ret .. "\n";
ret = ret .. " activatedConditions[".. conditionNumber .. "] = newActiveConditions[" .. conditionNumber .. "]\n";
end
return ret;
end
function WeakAuras.GetProperties(data)
local properties;
local propertiesFunction = WeakAuras.regionTypes[data.regionType] and WeakAuras.regionTypes[data.regionType].properties;
if (type(propertiesFunction) == "function") then
properties = propertiesFunction(data);
elseif propertiesFunction then
properties = CopyTable(propertiesFunction);
else
properties = {}
end
if data.subRegions then
local subIndex = {}
for index, subRegion in ipairs(data.subRegions) do
local subRegionTypeData = WeakAuras.subRegionTypes[subRegion.type];
local propertiesFunction = subRegionTypeData and subRegionTypeData.properties
local subProperties;
if (type(propertiesFunction) == "function") then
subProperties = propertiesFunction(data, subRegion);
elseif propertiesFunction then
subProperties = CopyTable(propertiesFunction)
end
if subProperties then
for key, property in pairs(subProperties) do
subIndex[key] = subIndex[key] and subIndex[key] + 1 or 1
property.display = { subIndex[key] .. ". " .. subRegionTypeData.displayName, property.display, property.defaultProperty }
properties["sub." .. index .. "." .. key ] = property;
end
end
end
end
return properties;
end
function Private.LoadConditionPropertyFunctions(data)
local id = data.id;
if (data.conditions) then
WeakAuras.customConditionsFunctions[id] = {};
for conditionNumber, condition in ipairs(data.conditions) do
if (condition.changes) then
for changeIndex, change in ipairs(condition.changes) do
if ( (change.property == "chat" or change.property == "customcode") and type(change.value) == "table" and change.value.custom) then
local custom = change.value.custom;
local prefix, suffix;
if (change.property == "chat") then
prefix, suffix = "return ", "";
else
prefix, suffix = "return function()", "\nend";
end
local customFunc = WeakAuras.LoadFunction(prefix .. custom .. suffix, id, "condition");
if (customFunc) then
WeakAuras.customConditionsFunctions[id][conditionNumber] = WeakAuras.customConditionsFunctions[id][conditionNumber] or {};
WeakAuras.customConditionsFunctions[id][conditionNumber].changes = WeakAuras.customConditionsFunctions[id][conditionNumber].changes or {};
WeakAuras.customConditionsFunctions[id][conditionNumber].changes[changeIndex] = customFunc;
end
end
if change.property == "chat" then
local getter = function(key, default)
local fullKey = "message_format_" .. key
if change.value[fullKey] == nil then
change.value[fullKey] = default
end
return change.value[fullKey]
end
local formatters = change.value and WeakAuras.CreateFormatters(change.value.message, getter)
WeakAuras.conditionTextFormatters[id] = WeakAuras.conditionTextFormatters[id] or {}
WeakAuras.conditionTextFormatters[id][conditionNumber] = WeakAuras.conditionTextFormatters[id][conditionNumber] or {};
WeakAuras.conditionTextFormatters[id][conditionNumber].changes = WeakAuras.conditionTextFormatters[id][conditionNumber].changes or {};
WeakAuras.conditionTextFormatters[id][conditionNumber].changes[changeIndex] = formatters;
end
end
end
end
end
end
local globalConditions =
{
["incombat"] = {
display = L["In Combat"],
type = "bool",
events = {"PLAYER_REGEN_ENABLED", "PLAYER_REGEN_DISABLED"},
globalStateUpdate = function(state)
state.incombat = UnitAffectingCombat("player") == 1 and true or false;
end
},
["hastarget"] = {
display = L["Has Target"],
type = "bool",
events = {"PLAYER_TARGET_CHANGED", "PLAYER_ENTERING_WORLD"},
globalStateUpdate = function(state)
state.hastarget = UnitExists("target") == 1 and true or false;
end
},
["attackabletarget"] = {
display = L["Attackable Target"],
type = "bool",
events = {"PLAYER_TARGET_CHANGED", "UNIT_FACTION"},
globalStateUpdate = function(state)
state.attackabletarget = UnitCanAttack("player", "target") == 1 and true or false;
end
},
["customcheck"] = {
display = L["Custom Check"],
type = "customcheck"
}
}
function WeakAuras.GetGlobalConditions()
return globalConditions;
end
local function ConstructConditionFunction(data)
local debug = false;
if (not data.conditions or #data.conditions == 0) then
return nil;
end
local usedProperties = {};
local allConditionsTemplate = WeakAuras.GetTriggerConditions(data);
allConditionsTemplate[-1] = WeakAuras.GetGlobalConditions();
local ret = "";
ret = ret .. "local newActiveConditions = {};\n"
ret = ret .. "local propertyChanges = {};\n"
ret = ret .. "local nextTime;\n"
ret = ret .. "return function(region, hideRegion)\n";
if (debug) then ret = ret .. " print('check conditions for:', region.id, region.cloneId)\n"; end
ret = ret .. " local id = region.id\n";
ret = ret .. " local cloneId = region.cloneId or ''\n";
ret = ret .. " local activatedConditions = WeakAuras.GetActiveConditions(id, cloneId)\n";
ret = ret .. " wipe(newActiveConditions)\n";
ret = ret .. " local recheckTime;\n"
ret = ret .. " local now = GetTime();\n"
local normalConditionCount = data.conditions and #data.conditions;
-- First Loop gather which conditions are active
ret = ret .. " if (not hideRegion) then\n"
if (data.conditions) then
WeakAuras.conditionHelpers[data.uid] = nil
for conditionNumber, condition in ipairs(data.conditions) do
ret = CreateCheckCondition(data.uid, ret, condition, conditionNumber, allConditionsTemplate, debug)
end
end
ret = ret .. " end\n";
ret = ret .. " if (recheckTime) then\n"
ret = ret .. " WeakAuras.scheduleConditionCheck(recheckTime, id, cloneId);\n"
ret = ret .. " end\n"
local properties = WeakAuras.GetProperties(data);
-- Now build a property + change list
-- Second Loop deals with conditions that are no longer active
ret = ret .. " wipe(propertyChanges)\n"
if (data.conditions) then
for conditionNumber, condition in ipairs(data.conditions) do
ret = CreateDeactivateCondition(ret, condition, conditionNumber, data, properties, usedProperties, debug)
end
end
ret = ret .. "\n";
-- Third Loop deals with conditions that are newly active
if (data.conditions) then
for conditionNumber, condition in ipairs(data.conditions) do
ret = CreateActivateCondition(ret, data.id, condition, conditionNumber, properties, debug)
end
end
-- Last apply changes to region
for property, _ in pairs(usedProperties) do
ret = ret .. " if(propertyChanges['" .. property .. "'] ~= nil) then\n"
local arg1 = "";
if (properties[property].arg1) then
if (type(properties[property].arg1) == "number") then
arg1 = tostring(properties[property].arg1) .. ", ";
else
arg1 = "'" .. properties[property].arg1 .. "', ";
end
end
local base = "region:"
local subIndex = ParseProperty(property)
if subIndex then
base = "region.subRegions[" .. subIndex .. "]:"
end
ret = ret .. " " .. base .. properties[property].setter .. "(" .. arg1 .. formatValueForCall(properties[property].type, property) .. ")\n";
if (debug) then ret = ret .. " print('Calling " .. properties[property].setter .. " with', " .. arg1 .. formatValueForCall(properties[property].type, property) .. ")\n"; end
ret = ret .. " end\n";
end
ret = ret .. "end\n";
return ret;
end
function Private.LoadConditionFunction(data)
local checkConditionsFuncStr = ConstructConditionFunction(data);
local checkCondtionsFunc = checkConditionsFuncStr and WeakAuras.LoadFunction(checkConditionsFuncStr, data.id, "condition checks");
checkConditions[data.id] = checkCondtionsFunc;
end
function Private.RunConditions(region, id, hideRegion)
-- TODO rename show
if (checkConditions[id]) then
checkConditions[id](region, hideRegion);
end
end
local dynamicConditionsFrame = nil;
local globalConditionAllState = {
[""] = {
show = true;
}
};
local globalConditionState = globalConditionAllState[""];
function WeakAuras.GetGlobalConditionState()
return globalConditionAllState;
end
local function runDynamicConditionFunctions(funcs)
for id in pairs(funcs) do
if (Private.IsAuraActive(id) and checkConditions[id]) then
local activeTriggerState = WeakAuras.GetTriggerStateForTrigger(id, Private.ActiveTrigger(id));
for cloneId, state in pairs(activeTriggerState) do
local region = WeakAuras.GetRegion(id, cloneId);
checkConditions[id](region, false);
end
end
end
end
local function handleDynamicConditions(self, event)
if (globalDynamicConditionFuncs[event]) then
for i, func in ipairs(globalDynamicConditionFuncs[event]) do
func(globalConditionState);
end
end
if (dynamicConditions[event]) then
runDynamicConditionFunctions(dynamicConditions[event]);
end
end
local lastDynamicConditionsUpdateCheck;
local function handleDynamicConditionsOnUpdate(self)
handleDynamicConditions(self, "FRAME_UPDATE");
if (not lastDynamicConditionsUpdateCheck or GetTime() - lastDynamicConditionsUpdateCheck > 0.2) then
lastDynamicConditionsUpdateCheck = GetTime();
handleDynamicConditions(self, "WA_SPELL_RANGECHECK");
end
end
local registeredGlobalFunctions = {};
local function EvaluateCheckForRegisterForGlobalConditions(id, check, allConditionsTemplate, register)
local trigger = check and check.trigger;
local variable = check and check.variable;
if (trigger == -2) then
if (check.checks) then
for _, subcheck in ipairs(check.checks) do
EvaluateCheckForRegisterForGlobalConditions(id, subcheck, allConditionsTemplate, register);
end
end
elseif trigger == -1 and variable == "customcheck" then
if check.op then
for event in string.gmatch(check.op, "[%w_]+") do
if (not dynamicConditions[event]) then
register[event] = true;
dynamicConditions[event] = {};
end
dynamicConditions[event][id] = true;
end
end
elseif (trigger and variable) then
local conditionTemplate = allConditionsTemplate[trigger] and allConditionsTemplate[trigger][variable];
if (conditionTemplate and conditionTemplate.events) then
for _, event in ipairs(conditionTemplate.events) do
if (not dynamicConditions[event]) then
register[event] = true;
dynamicConditions[event] = {};
end
dynamicConditions[event][id] = true;
end
if (conditionTemplate.globalStateUpdate and not registeredGlobalFunctions[variable]) then
registeredGlobalFunctions[variable] = true;
for _, event in ipairs(conditionTemplate.events) do
globalDynamicConditionFuncs[event] = globalDynamicConditionFuncs[event] or {};
tinsert(globalDynamicConditionFuncs[event], conditionTemplate.globalStateUpdate);
end
conditionTemplate.globalStateUpdate(globalConditionState);
end
end
end
end
function Private.RegisterForGlobalConditions(id)
local data = WeakAuras.GetData(id);
for event, conditionFunctions in pairs(dynamicConditions) do
conditionFunctions.id = nil;
end
local register = {};
if (data.conditions) then
local allConditionsTemplate = WeakAuras.GetTriggerConditions(data);
allConditionsTemplate[-1] = WeakAuras.GetGlobalConditions();
for conditionNumber, condition in ipairs(data.conditions) do
EvaluateCheckForRegisterForGlobalConditions(id, condition.check, allConditionsTemplate, register);
end
end
if (next(register) and not dynamicConditionsFrame) then
dynamicConditionsFrame = CreateFrame("FRAME");
dynamicConditionsFrame:SetScript("OnEvent", handleDynamicConditions);
WeakAuras.frames["Rerun Conditions Frame"] = dynamicConditionsFrame
end
for event in pairs(register) do
if (event == "FRAME_UPDATE" or event == "WA_SPELL_RANGECHECK") then
if (not dynamicConditionsFrame.onUpdate) then
dynamicConditionsFrame:SetScript("OnUpdate", handleDynamicConditionsOnUpdate);
dynamicConditionsFrame.onUpdate = true;
end
else
pcall(dynamicConditionsFrame.RegisterEvent, dynamicConditionsFrame, event);
end
end
end
function Private.UnregisterForGlobalConditions(id)
for event, condFuncs in pairs(dynamicConditions) do
condFuncs[id] = nil;
end
end
function Private.UnloadAllConditions()
for id in pairs(conditionChecksTimers.recheckTime) do
if (conditionChecksTimers.recheckHandle[id]) then
for _, v in pairs(conditionChecksTimers.recheckHandle[id]) do
timer:CancelTimer(v)
end
end
end
wipe(conditionChecksTimers.recheckTime)
wipe(conditionChecksTimers.recheckHandle)
dynamicConditions = {}
end
function Private.UnloadConditions(id)
conditionChecksTimers.recheckTime[id] = nil;
if (conditionChecksTimers.recheckHandle[id]) then
for _, v in pairs(conditionChecksTimers.recheckHandle[id]) do
timer:CancelTimer(v);
end
end
conditionChecksTimers.recheckHandle[id] = nil;
Private.UnregisterForGlobalConditions(id);
end
function Private.DeleteConditions(id)
checkConditions[id] = nil
conditionChecksTimers.recheckTime[id] = nil
if (conditionChecksTimers.recheckHandle[id]) then
for cloneId, v in pairs(conditionChecksTimers.recheckHandle[id]) do
timer:CancelTimer(v)
end
end
conditionChecksTimers.recheckHandle[id] = nil
for event, funcs in pairs(dynamicConditions) do
funcs[id] = nil
end
end
function Private.RenameConditions(oldid, newid)
checkConditions[newid] = checkConditions[oldid];
checkConditions[oldid] = nil;
conditionChecksTimers.recheckTime[newid] = conditionChecksTimers.recheckTime[oldid];
conditionChecksTimers.recheckTime[oldid] = nil;
conditionChecksTimers.recheckHandle[newid] = conditionChecksTimers.recheckHandle[oldid];
conditionChecksTimers.recheckHandle[oldid] = nil;
for event, funcs in pairs(dynamicConditions) do
funcs[newid] = funcs[oldid]
funcs[oldid] = nil;
end
end
+2 -101
View File
@@ -76,12 +76,11 @@ local event_prototypes = WeakAuras.event_prototypes;
local timer = WeakAuras.timer;
local debug = WeakAuras.debug;
local events = WeakAuras.events;
local loaded_events = WeakAuras.loaded_events;
local events = {}
local loaded_events = {}
local loaded_unit_events = {};
local loaded_auras = {}; -- id to bool map
local timers = WeakAuras.timers;
local specificBosses = WeakAuras.specificBosses;
-- Local functions
local LoadEvent, HandleEvent, HandleUnitEvent, TestForTriState, TestForToggle, TestForLongString, TestForMultiSelect
@@ -1128,7 +1127,6 @@ end
function GenericTrigger.Add(data, region)
local id = data.id;
events[id] = nil;
WeakAuras.forceable_events[id] = {};
for triggernum, triggerData in ipairs(data.triggers) do
local trigger, untrigger = triggerData.trigger, triggerData.untrigger
@@ -1473,103 +1471,6 @@ local oldPowerTriggers = {
["Shards"] = 7,
}
function GenericTrigger.Modernize(data)
for triggernum, triggerData in ipairs(data.triggers) do
local trigger, untrigger = triggerData.trigger, triggerData.untrigger
if (data.internalVersion < 2) then
-- Convert any references to "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM" to "COMBAT_LOG_EVENT_UNFILTERED"
if(trigger and trigger.custom) then
trigger.custom = trigger.custom:gsub("COMBAT_LOG_EVENT_UNFILTERED_CUSTOM", "COMBAT_LOG_EVENT_UNFILTERED");
end
if(untrigger and untrigger.custom) then
untrigger.custom = untrigger.custom:gsub("COMBAT_LOG_EVENT_UNFILTERED_CUSTOM", "COMBAT_LOG_EVENT_UNFILTERED");
end
if trigger and trigger["event"] and trigger["event"] == "DBM Timer" then
if (type(trigger.spellId) == "number") then
trigger.spellId = tostring(trigger.spellId);
end
end
if trigger and trigger["event"] and trigger["event"] == "Item Set Equipped" then
trigger.event = "Equipment Set";
end
-- Convert ember trigger
local fixEmberTrigger = function(trigger)
if (trigger.power and not trigger.ember) then
trigger.ember = tostring(tonumber(trigger.power) * 10);
trigger.use_ember = trigger.use_power
trigger.ember_operator = trigger.power_operator;
trigger.power = nil;
trigger.use_power = nil;
trigger.power_operator = nil;
end
end
if (trigger and trigger.type and trigger.event and trigger.type == "status" and trigger.event == "Burning Embers") then
fixEmberTrigger(trigger);
fixEmberTrigger(untrigger);
end
if (trigger and trigger.type and trigger.event and trigger.type == "status"
and (trigger.event == "Cooldown Progress (Spell)"
or trigger.event == "Cooldown Progress (Item)"
or trigger.event == "Death Knight Rune")) then
if (not trigger.showOn) then
if (trigger.use_inverse) then
trigger.showOn = "showOnReady"
else
trigger.showOn = "showOnCooldown"
end
if (trigger.event == "Death Knight Rune") then
trigger.use_genericShowOn = true;
end
trigger.use_inverse = nil
end
end
for old, new in pairs(combatLogUpgrade) do
if (trigger and trigger[old]) then
local useOld = "use_" .. old;
local useNew = "use_" .. new;
trigger[useNew] = trigger[useOld];
trigger[new] = trigger[old];
trigger[old] = nil;
trigger[useOld] = nil;
end
end
-- Convert separated Power Triggers to sub options of the Power trigger
if (trigger and trigger.type and trigger.event and trigger.type == "status" and oldPowerTriggers[trigger.event]) then
trigger.powertype = oldPowerTriggers[trigger.event]
trigger.use_powertype = true;
trigger.use_percentpower = false;
if (trigger.event == "Combo Points") then
trigger.power = trigger.combopoints;
trigger.power_operator = trigger.combopoints_operator
trigger.use_power = trigger.use_combopoints;
end
trigger.event = "Power";
trigger.unit = "player";
end
end
if data.internalVersion < 6 then
if trigger and trigger.type ~= "aura" then
trigger.genericShowOn = trigger.showOn or "showOnActive"
trigger.showOn = nil
trigger.use_genericShowOn = trigger.use_showOn
end
end
end
end
function GenericTrigger.AllAdded()
-- Remove GTFO options if GTFO isn't enabled and there are no saved GTFO auras
local hideGTFO = true;
+1 -1
View File
@@ -2,7 +2,7 @@ WeakAuras = {}
WeakAuras.L = {}
WeakAuras.frames = {}
WeakAuras.normalWidth = 1.25
WeakAuras.normalWidth = 1.3
WeakAuras.halfWidth = WeakAuras.normalWidth / 2
WeakAuras.doubleWidth = WeakAuras.normalWidth * 2
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

+929
View File
@@ -0,0 +1,929 @@
if not WeakAuras.IsCorrectVersion() then return end
local AddonName, Private = ...
-- Takes as input a table of display data and attempts to update it to be compatible with the current version
function Private.Modernize(data)
if (not data.internalVersion or data.internalVersion < 2) then
WeakAuras.prettyPrint(string.format("Data for '%s' is too old, can't modernize.", data.id))
data.internalVersion = 2;
end
-- Version 3 was introduced April 2018 in Legion
if (data.internalVersion < 3) then
if (data.parent) then
local parentData = WeakAuras.GetData(data.parent);
if(parentData and parentData.regionType == "dynamicgroup") then
-- Version 3 allowed for offsets for dynamic groups, before that they were ignored
-- Thus reset them in the V2 to V3 upgrade
data.xOffset = 0;
data.yOffset = 0;
end
end
end
-- Version 4 was introduced July 2018 in BfA
if (data.internalVersion < 4) then
if (data.conditions) then
for conditionIndex, condition in ipairs(data.conditions) do
if (condition.check) then
local triggernum = condition.check.trigger;
if (triggernum) then
local trigger;
if (triggernum == 0) then
trigger = data.trigger;
elseif(data.additional_triggers and data.additional_triggers[triggernum]) then
trigger = data.additional_triggers[triggernum].trigger;
end
if (trigger and trigger.event == "Cooldown Progress (Spell)") then
if (condition.check.variable == "stacks") then
condition.check.variable = "charges";
end
end
end
end
end
end
end
-- Version 5 was introduced July 2018 in BFA
if data.internalVersion < 5 then
-- this is to fix hybrid sorting
if data.sortHybridTable then
if data.controlledChildren then
local newSortTable = {}
for index, isHybrid in pairs(data.sortHybridTable) do
local childID = data.controlledChildren[index]
if childID then
newSortTable[childID] = isHybrid
end
end
data.sortHybridTable = newSortTable
end
end
end
-- Version 6 was introduced July 30, 2018 in BFA
if data.internalVersion < 6 then
if data.triggers then
for triggernum, triggerData in ipairs(data.triggers) do
local trigger = triggerData.trigger;
if trigger and trigger.type == "aura" then
if trigger.showOn == "showOnMissing" then
trigger.buffShowOn = "showOnMissing"
elseif trigger.showOn == "showActiveOrMissing" then
trigger.buffShowOn = "showAlways"
else
trigger.buffShowOn = "showOnActive"
end
trigger.showOn = nil
elseif trigger and trigger.type ~= "aura" then
trigger.genericShowOn = trigger.showOn or "showOnActive"
trigger.showOn = nil
trigger.use_genericShowOn = trigger.use_showOn
end
end
end
end
-- Version 7 was introduced September 1, 2018 in BFA
-- Triggers were cleaned up into a 1-indexed array
if data.internalVersion < 7 then
-- migrate trigger data
data.triggers = data.additional_triggers or {}
tinsert(data.triggers, 1, {
trigger = data.trigger or {},
untrigger = data.untrigger or {},
})
data.additional_triggers = nil
data.trigger = nil
data.untrigger = nil
data.numTriggers = nil
data.triggers.customTriggerLogic = data.customTriggerLogic
data.customTriggerLogic = nil
local activeTriggerMode = data.activeTriggerMode or WeakAuras.trigger_modes.first_active
if activeTriggerMode ~= WeakAuras.trigger_modes.first_active then
activeTriggerMode = activeTriggerMode + 1
end
data.triggers.activeTriggerMode = activeTriggerMode
data.activeTriggerMode = nil
data.triggers.disjunctive = data.disjunctive
data.disjunctive = nil
-- migrate condition trigger references
local function recurseRepairChecks(checks)
if not checks then return end
for _, check in pairs(checks) do
if check.trigger and check.trigger >= 0 then
check.trigger = check.trigger + 1
end
recurseRepairChecks(check.checks)
end
end
for _, condition in pairs(data.conditions) do
if condition.check.trigger and condition.check.trigger >= 0 then
condition.check.trigger = condition.check.trigger + 1
end
recurseRepairChecks(condition.check.checks)
end
end
-- Version 8 was introduced in September 2018
-- Changes are in PreAdd
-- Version 9 was introduced in September 2018
if data.internalVersion < 9 then
local function repairCheck(check)
if check and check.variable == "buffed" then
local trigger = check.trigger and data.triggers[check.trigger] and data.triggers[check.trigger].trigger;
if (trigger) then
if(trigger.buffShowOn == "showOnActive") then
check.variable = "show";
elseif (trigger.buffShowOn == "showOnMissing") then
check.variable = "show";
check.value = check.value == 0 and 1 or 0;
end
end
end
end
local function recurseRepairChecks(checks)
if not checks then return end
for _, check in pairs(checks) do
repairCheck(check);
recurseRepairChecks(check.checks);
end
end
for _, condition in pairs(data.conditions) do
repairCheck(condition.check);
recurseRepairChecks(condition.check.checks);
end
end
-- Version 10 is skipped, due to a bad migration script (see https://github.com/WeakAuras/WeakAuras2/pull/1091)
-- Version 11 was introduced in January 2019
if data.internalVersion < 11 then
if data.url and data.url ~= "" then
local slug, version = data.url:match("wago.io/([^/]+)/([0-9]+)")
if not slug and not version then
version = 1
end
if version and tonumber(version) then
data.version = tonumber(version)
end
end
end
-- Version 13 was introduced March 2019 in BFA
if data.internalVersion < 13 then
if data.regionType == "dynamicgroup" then
local selfPoints = {
default = "CENTER",
RIGHT = function(data)
if data.align == "LEFT" then
return "TOPLEFT"
elseif data.align == "RIGHT" then
return "BOTTOMLEFT"
else
return "LEFT"
end
end,
LEFT = function(data)
if data.align == "LEFT" then
return "TOPRIGHT"
elseif data.align == "RIGHT" then
return "BOTTOMRIGHT"
else
return "RIGHT"
end
end,
UP = function(data)
if data.align == "LEFT" then
return "BOTTOMLEFT"
elseif data.align == "RIGHT" then
return "BOTTOMRIGHT"
else
return "BOTTOM"
end
end,
DOWN = function(data)
if data.align == "LEFT" then
return "TOPLEFT"
elseif data.align == "RIGHT" then
return "TOPRIGHT"
else
return "TOP"
end
end,
HORIZONTAL = function(data)
if data.align == "LEFT" then
return "TOP"
elseif data.align == "RIGHT" then
return "BOTTOM"
else
return "CENTER"
end
end,
VERTICAL = function(data)
if data.align == "LEFT" then
return "LEFT"
elseif data.align == "RIGHT" then
return "RIGHT"
else
return "CENTER"
end
end,
CIRCLE = "CENTER",
COUNTERCIRCLE = "CENTER",
}
local selfPoint = selfPoints[data.grow or "DOWN"] or selfPoints.DOWN
if type(selfPoint) == "function" then
selfPoint = selfPoint(data)
end
data.selfPoint = selfPoint
end
end
-- Version 14 was introduced March 2019 in BFA
if data.internalVersion < 14 then
if data.triggers then
for triggerId, triggerData in pairs(data.triggers) do
if type(triggerData) == "table"
and triggerData.trigger
and triggerData.trigger.debuffClass
and type(triggerData.trigger.debuffClass) == "string"
and triggerData.trigger.debuffClass ~= ""
then
local idx = triggerData.trigger.debuffClass
data.triggers[triggerId].trigger.debuffClass = { [idx] = true }
end
end
end
end
-- Version 15 was introduced April 2019 in BFA
if data.internalVersion < 15 then
if data.triggers then
for triggerId, triggerData in ipairs(data.triggers) do
if triggerData.trigger.type == "status" and triggerData.trigger.event == "Spell Known" then
triggerData.trigger.use_exact_spellName = true
end
end
end
end
-- Version 16 was introduced May 2019 in BFA
if data.internalVersion < 16 then
-- second conversion: migrate name/realm conditions to tristate
if data.load.use_name == false then
data.load.use_name = nil
end
if data.load.use_realm == false then
data.load.use_realm = nil
end
end
-- Version 18 was a migration for stance/form trigger, but deleted later because of migration issue
-- Version 20 was introduced July 2019 in BFA
if data.internalVersion < 20 then
if data.regionType == "icon" then
local convertPoint = function(containment, point)
if not point or point == "CENTER" then
return "CENTER"
elseif containment == "INSIDE" then
return "INNER_" .. point
elseif containment == "OUTSIDE" then
return "OUTER_" .. point
end
end
local text1 = {
["type"] = "subtext",
text_visible = data.text1Enabled ~= false,
text_color = data.text1Color,
text_text = data.text1,
text_font = data.text1Font,
text_fontSize = data.text1FontSize,
text_fontType = data.text1FontFlags,
text_selfPoint = "AUTO",
text_anchorPoint = convertPoint(data.text1Containment, data.text1Point),
anchorXOffset = 0,
anchorYOffset = 0,
text_shadowColor = { 0, 0, 0, 1},
text_shadowXOffset = 0,
text_shadowYOffset = 0,
}
local usetext2 = data.text2Enabled
local text2 = {
["type"] = "subtext",
text_visible = data.text2Enabled or false,
text_color = data.text2Color,
text_text = data.text2,
text_font = data.text2Font,
text_fontSize = data.text2FontSize,
text_fontType = data.text2FontFlags,
text_selfPoint = "AUTO",
text_anchorPoint = convertPoint(data.text2Containment, data.text2Point),
anchorXOffset = 0,
anchorYOffset = 0,
text_shadowColor = { 0, 0, 0, 1},
text_shadowXOffset = 0,
text_shadowYOffset = 0,
}
data.text1Enabled = nil
data.text1Color = nil
data.text1 = nil
data.text1Font = nil
data.text1FontSize = nil
data.text1FontFlags = nil
data.text1Containment = nil
data.text1Point = nil
data.text2Enabled = nil
data.text2Color = nil
data.text2 = nil
data.text2Font = nil
data.text2FontSize = nil
data.text2FontFlags = nil
data.text2Containment = nil
data.text2Point = nil
local propertyRenames = {
text1Color = "sub.1.text_color",
text1FontSize = "sub.1.text_fontSize",
text2Color = "sub.2.text_color",
text2FontSize = "sub.2.text_fontSize"
}
tinsert(data.subRegions, text1)
if (usetext2) then
tinsert(data.subRegions, text2)
end
if (data.conditions) then
for conditionIndex, condition in ipairs(data.conditions) do
for changeIndex, change in ipairs(condition.changes) do
if propertyRenames[change.property] then
change.property = propertyRenames[change.property]
end
end
end
end
end
end
-- Version 20 was introduced May 2019 in BFA
if data.internalVersion < 20 then
if data.regionType == "aurabar" then
local orientationToPostion = {
HORIZONTAL_INVERSE = { "INNER_LEFT", "INNER_RIGHT" },
HORIZONTAL = { "INNER_RIGHT", "INNER_LEFT" },
VERTICAL_INVERSE = { "INNER_BOTTOM", "INNER_TOP" },
VERTICAL = {"INNER_TOP", "INNER_BOTTOM"}
}
local positions = orientationToPostion[data.orientation] or { "INNER_LEFT", "INNER_RIGHT" }
local text1 = {
["type"] = "subtext",
text_visible = data.timer,
text_color = data.timerColor,
text_text = data.displayTextRight,
text_font = data.timerFont,
text_fontSize = data.timerSize,
text_fontType = data.timerFlags,
text_selfPoint = "AUTO",
text_anchorPoint = positions[1],
anchorXOffset = 0,
anchorYOffset = 0,
text_shadowColor = { 0, 0, 0, 1},
text_shadowXOffset = 1,
text_shadowYOffset = -1,
rotateText = data.rotateText
}
local text2 = {
["type"] = "subtext",
text_visible = data.text,
text_color = data.textColor,
text_text = data.displayTextLeft,
text_font = data.textFont,
text_fontSize = data.textSize,
text_fontType = data.textFlags,
text_selfPoint = "AUTO",
text_anchorPoint = positions[2],
anchorXOffset = 0,
anchorYOffset = 0,
text_shadowColor = { 0, 0, 0, 1},
text_shadowXOffset = 1,
text_shadowYOffset = -1,
rotateText = data.rotateText
}
local text3 = {
["type"] = "subtext",
text_visible = data.stacks,
text_color = data.stacksColor,
text_text = "%s",
text_font = data.stacksFont,
text_fontSize = data.stacksSize,
text_fontType = data.stacksFlags,
text_selfPoint = "AUTO",
text_anchorPoint = "ICON_CENTER",
anchorXOffset = 0,
anchorYOffset = 0,
text_shadowColor = { 0, 0, 0, 1},
text_shadowXOffset = 1,
text_shadowYOffset = -1,
rotateText = data.rotateText
}
data.timer = nil
data.textColor = nil
data.displayTextRight = nil
data.textFont = nil
data.textSize = nil
data.textFlags = nil
data.text = nil
data.timerColor = nil
data.displayTextLeft = nil
data.timerFont = nil
data.timerSize = nil
data.timerFlags = nil
data.stacks = nil
data.stacksColor = nil
data.stacksFont = nil
data.stacksSize = nil
data.stacksFlags = nil
data.rotateText = nil
local propertyRenames = {
timerColor = "sub.1.text_color",
timerSize = "sub.1.text_fontSize",
textColor = "sub.2.text_color",
textSize = "sub.2.text_fontSize",
stacksColor = "sub.3.text_color",
stacksSize = "sub.3.text_fontSize",
}
data.subRegions = data.subRegions or {}
tinsert(data.subRegions, text1)
tinsert(data.subRegions, text2)
tinsert(data.subRegions, text3)
if (data.conditions) then
for conditionIndex, condition in ipairs(data.conditions) do
for changeIndex, change in ipairs(condition.changes) do
if propertyRenames[change.property] then
change.property = propertyRenames[change.property]
end
end
end
end
end
end
if data.internalVersion < 21 then
if data.regionType == "dynamicgroup" then
data.border = data.background and data.background ~= "None"
data.borderEdge = data.border
data.borderBackdrop = data.background ~= "None" and data.background
data.borderInset = data.backgroundInset
data.background = nil
data.backgroundInset = nil
end
end
if data.internalVersion < 22 then
if data.regionType == "aurabar" then
data.subRegions = data.subRegions or {}
local border = {
["type"] = "subborder",
border_visible = data.border,
border_color = data.borderColor,
border_edge = data.borderEdge,
border_offset = data.borderOffset,
border_size = data.borderSize,
border_anchor = "bar",
}
data.border = nil
data.borderColor = nil
data.borderEdge = nil
data.borderOffset = nil
data.borderInset = nil
data.borderSize = nil
if data.borderInFront then
tinsert(data.subRegions, border)
else
tinsert(data.subRegions, 1, border)
end
local propertyRenames = {
borderColor = "sub.".. #data.subRegions..".border_color",
}
if (data.conditions) then
for conditionIndex, condition in ipairs(data.conditions) do
for changeIndex, change in ipairs(condition.changes) do
if propertyRenames[change.property] then
change.property = propertyRenames[change.property]
end
end
end
end
end
end
if data.internalVersion < 23 then
if data.triggers then
for triggerId, triggerData in ipairs(data.triggers) do
local trigger = triggerData.trigger
-- Stance/Form/Aura form field type changed from type="select" to type="multiselect"
if trigger and trigger.type == "status" and trigger.event == "Stance/Form/Aura" then
local value = trigger.form
if type(value) ~= "table" then
if trigger.use_form == false then
if value then
trigger.form = { multi = { [value] = true } }
else
trigger.form = { multi = { } }
end
elseif trigger.use_form then
trigger.form = { single = value }
end
end
end
end
end
end
if data.internalVersion < 24 then
if data.triggers then
for triggerId, triggerData in ipairs(data.triggers) do
local trigger = triggerData.trigger
if trigger and trigger.type == "status" and trigger.event == "Weapon Enchant" then
if trigger.use_inverse then
trigger.showOn = "showOnMissing"
else
trigger.showOn = "showOnActive"
end
trigger.use_inverse = nil
if not trigger.use_weapon then
trigger.use_weapon = "true"
trigger.weapon = "main"
end
end
end
end
end
if data.internalVersion < 25 then
if data.regionType == "icon" then
data.subRegions = data.subRegions or {}
-- Need to check if glow is needed
local prefix = "sub.".. #data.subRegions + 1 .. "."
-- For Conditions
local propertyRenames = {
glow = prefix .. "glow",
useGlowColor = prefix .. "useGlowColor",
glowColor = prefix .. "glowColor",
glowType = prefix .. "glowType",
glowLines = prefix .. "glowLines",
glowFrequency = prefix .. "glowFrequency",
glowLength = prefix .. "glowLength",
glowThickness = prefix .. "glowThickness",
glowScale = prefix .. "glowScale",
glowBorder = prefix .. "glowBorder",
glowXOffset = prefix .. "glowXOffset",
glowYOffset = prefix .. "glowYOffset",
}
local needsGlow = data.glow
if (not needsGlow and data.conditions) then
for conditionIndex, condition in ipairs(data.conditions) do
for changeIndex, change in ipairs(condition.changes) do
if propertyRenames[change.property] then
needsGlow = true
break
end
end
end
end
if needsGlow then
local glow = {
["type"] = "subglow",
glow = data.glow,
useGlowColor = data.useGlowColor,
glowColor = data.glowColor,
glowType = data.glowType,
glowLines = data.glowLines,
glowFrequency = data.glowFrequency,
glowLength = data.glowLength,
glowThickness = data.glowThickness,
glowScale = data.glowScale,
glowBorder = data.glowBorder,
glowXOffset = data.glowXOffset,
glowYOffset = data.glowYOffset,
}
tinsert(data.subRegions, glow)
end
data.glow = nil
data.useglowColor = nil
data.useGlowColor = nil
data.glowColor = nil
data.glowType = nil
data.glowLines = nil
data.glowFrequency = nil
data.glowLength = nil
data.glowThickness = nil
data.glowScale = nil
data.glowBorder = nil
data.glowXOffset = nil
data.glowYOffset = nil
if (data.conditions) then
for conditionIndex, condition in ipairs(data.conditions) do
for changeIndex, change in ipairs(condition.changes) do
if propertyRenames[change.property] then
change.property = propertyRenames[change.property]
end
end
end
end
end
end
if data.internalVersion < 26 then
if data.conditions then
for conditionIndex, condition in ipairs(data.conditions) do
for changeIndex, change in ipairs(condition.changes) do
if change.property == "xOffset" or change.property == "yOffset" then
change.value = (change.value or 0) - (data[change.property] or 0)
change.property = change.property .. "Relative"
end
end
end
end
end
if data.internalVersion < 28 then
if data.actions then
if data.actions.start and data.actions.start.do_glow then
data.actions.start.glow_frame_type = "FRAMESELECTOR"
end
if data.actions.finish and data.actions.finish.do_glow then
data.actions.finish.glow_frame_type = "FRAMESELECTOR"
end
end
end
if data.internalVersion < 29 then
if data.actions then
if data.actions.start
and data.actions.start.do_glow
and data.actions.start.glow_type == nil
then
data.actions.start.glow_type = "buttonOverlay"
end
if data.actions.finish
and data.actions.finish.do_glow
and data.actions.finish.glow_type == nil
then
data.actions.finish.glow_type = "buttonOverlay"
end
end
end
if data.internalVersion < 30 then
local convertLegacyPrecision = function(precision)
if not precision then
return 1
end
if precision < 4 then
return precision, false
else
return precision - 3, true
end
end
local progressPrecision = data.progressPrecision
local totalPrecision = data.totalPrecision
if data.regionType == "text" then
local seenSymbols = {}
WeakAuras.ParseTextStr(data.displayText, function(symbol)
if not seenSymbols[symbol] then
local triggerNum, sym = string.match(symbol, "(.+)%.(.+)")
sym = sym or symbol
if sym == "p" or sym == "t" then
data["displayText_format_" .. symbol .. "_format"] = "timed"
data["displayText_format_" .. symbol .. "_time_precision"], data["displayText_format_" .. symbol .. "_time_dynamic"]
= convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision)
end
end
seenSymbols[symbol] = symbol
end)
end
if data.subRegions then
for index, subRegionData in ipairs(data.subRegions) do
if subRegionData.type == "subtext" then
local seenSymbols = {}
WeakAuras.ParseTextStr(subRegionData.text_text, function(symbol)
if not seenSymbols[symbol] then
local triggerNum, sym = string.match(symbol, "(.+)%.(.+)")
sym = sym or symbol
if sym == "p" or sym == "t" then
subRegionData["text_text_format_" .. symbol .. "_format"] = "timed"
subRegionData["text_text_format_" .. symbol .. "_time_precision"], subRegionData["text_text_format_" .. symbol .. "_time_dynamic"]
= convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision)
end
end
seenSymbols[symbol] = symbol
end)
end
end
end
if data.actions then
for _, when in ipairs{ "start", "finish" } do
if data.actions[when] then
local seenSymbols = {}
WeakAuras.ParseTextStr(data.actions[when].message, function(symbol)
if not seenSymbols[symbol] then
local triggerNum, sym = string.match(symbol, "(.+)%.(.+)")
sym = sym or symbol
if sym == "p" or sym == "t" then
data.actions[when]["message_format_" .. symbol .. "_format"] = "timed"
data.actions[when]["message_format_" .. symbol .. "_time_precision"], data.actions[when]["message_format_" .. symbol .. "_time_dynamic"]
= convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision)
end
end
seenSymbols[symbol] = symbol
end)
end
end
end
if data.conditions then
for conditionIndex, condition in ipairs(data.conditions) do
for changeIndex, change in ipairs(condition.changes) do
if change.property == "chat" and change.value then
local seenSymbols = {}
WeakAuras.ParseTextStr(change.value.message, function(symbol)
if not seenSymbols[symbol] then
local triggerNum, sym = string.match(symbol, "(.+)%.(.+)")
sym = sym or symbol
if sym == "p" or sym == "t" then
change.value["message_format_" .. symbol .. "_format"] = "timed"
change.value["message_format_" .. symbol .. "_time_precision"], change.value["message_format_" .. symbol .. "_time_dynamic"]
= convertLegacyPrecision(sym == "p" and progressPrecision or totalPrecision)
end
end
seenSymbols[symbol] = symbol
end)
end
end
end
end
-- To convert:
-- * actions
-- * conditions
data.progressPrecision = nil
data.totalPrecision = nil
end
-- Introduced in June 2020 in Bfa
if data.internalVersion < 31 then
local allowedNames
local ignoredNames
if data.load.use_name == true and data.load.name then
allowedNames = data.load.name
elseif data.load.use_name == false and data.load.name then
ignoredNames = data.load.name
end
if data.load.use_realm == true and data.load.realm then
allowedNames = (allowedNames or "") .. "-" .. data.load.realm
elseif data.load.use_realm == false and data.load.realm then
ignoredNames = (ignoredNames or "") .. "-" .. data.load.realm
end
if allowedNames then
data.load.use_namerealm = true
data.load.namerealm = allowedNames
end
if ignoredNames then
data.load.use_namerealmblack = true
data.load.namerealmblack = ignoredNames
end
data.load.use_name = nil
data.load.name = nil
data.load.use_realm = nil
data.load.realm = nil
end
-- Introduced in June 2020 in Bfa
if data.internalVersion < 32 then
local replacements = {}
local function repairCheck(replacements, check)
if check and check.trigger then
if replacements[check.trigger] then
if replacements[check.trigger][check.variable] then
check.variable = replacements[check.trigger][check.variable]
end
end
end
end
if data.triggers then
for triggerId, triggerData in ipairs(data.triggers) do
if triggerData.trigger.type == "status" then
local event = triggerData.trigger.event
if event == "Unit Characteristics" or event == "Health" or event == "Power" then
replacements[triggerId] = {}
replacements[triggerId]["use_name"] = "use_namerealm"
replacements[triggerId]["name"] = "namerealm"
elseif event == "Cast" then
replacements[triggerId] = {}
replacements[triggerId]["use_sourceName"] = "use_sourceNameRealm"
replacements[triggerId]["sourceName"] = "sourceNameRealm"
replacements[triggerId]["use_destName"] = "use_destNameRealm"
replacements[triggerId]["destName"] = "destNameRealm"
end
if replacements[triggerId] then
for old, new in pairs(replacements[triggerId]) do
triggerData.trigger[new] = triggerData.trigger[old]
triggerData.trigger[old] = nil
end
local function recurseRepairChecks(replacements, checks)
if not checks then return end
for _, check in pairs(checks) do
repairCheck(replacements, check);
recurseRepairChecks(replacements, check.checks);
end
end
for _, condition in pairs(data.conditions) do
repairCheck(replacements, condition.check);
recurseRepairChecks(replacements, condition.check.checks);
end
end
end
end
end
end
-- Introduced in July 2020 in Bfa
if data.internalVersion < 33 then
data.load.use_ignoreNameRealm = data.load.use_namerealmblack
data.load.ignoreNameRealm = data.load.namerealmblack
data.load.use_namerealmblack = nil
data.load.namerealmblack = nil
-- trigger.useBlackExactSpellId and trigger.blackauraspellids
if data.triggers then
for triggerId, triggerData in ipairs(data.triggers) do
triggerData.trigger.useIgnoreName = triggerData.trigger.useBlackName
triggerData.trigger.ignoreAuraNames = triggerData.trigger.blackauranames
triggerData.trigger.useIgnoreExactSpellId = triggerData.trigger.useBlackExactSpellId
triggerData.trigger.ignoreAuraSpellids = triggerData.trigger.blackauraspellids
triggerData.trigger.useBlackName = nil
triggerData.trigger.blackauranames = nil
triggerData.trigger.useBlackExactSpellId = nil
triggerData.trigger.blackauraspellids = nil
end
end
end
-- Introduced in July 2020 in Shadolands
if data.internalVersion < 34 then
if data.regionType == 'dynamicgroup'
and (data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") then
if data.arcLength == 360 then
data.fullCircle = true
else
data.fullCircle = false
end
end
end
data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion());
end
+20 -5
View File
@@ -27,6 +27,7 @@ local default = {
yOffset = 0,
radius = 200,
rotation = 0,
fullCircle = true,
arcLength = 360,
constantFactor = "RADIUS",
frameStrata = 1,
@@ -574,7 +575,7 @@ local growers = {
local radius = data.radius or 0
local limit = data.useLimit and data.limit or math.huge
local sAngle = (data.rotation or 0) * math.pi / 180
local arc = (data.arcLength or 0) * math.pi / 180
local arc = (data.fullCircle and 360 or data.arcLength or 0) * math.pi / 180
local anchorPerUnitFunc = data.useAnchorPerUnit and createAnchorPerUnitFunc(data)
return function(newPositions, activeRegions)
local frames = {}
@@ -596,7 +597,14 @@ local growers = {
end
end
local theta = sAngle
local dAngle = arc / numVisible
local dAngle
if numVisible == 1 then
dAngle = 0
elseif not data.fullCircle then
dAngle = arc / (numVisible - 1)
else
dAngle = arc / numVisible
end
newPositions[frame] = {}
for i, regionData in ipairs(regionDatas) do
if i <= numVisible then
@@ -615,7 +623,7 @@ local growers = {
local radius = data.radius or 0
local limit = data.useLimit and data.limit or math.huge
local sAngle = (data.rotation or 0) * math.pi / 180
local arc = (data.arcLength or 0) * math.pi / 180
local arc = (data.fullCircle and 360 or data.arcLength or 0) * math.pi / 180
local anchorPerUnitFunc = data.useAnchorPerUnit and createAnchorPerUnitFunc(data)
return function(newPositions, activeRegions)
local frames = {}
@@ -637,7 +645,14 @@ local growers = {
end
end
local theta = sAngle
local dAngle = arc / -numVisible
local dAngle
if numVisible == 1 then
dAngle = 0
elseif not data.fullCircle then
dAngle = arc / (1 - numVisible)
else
dAngle = arc / -numVisible
end
newPositions[frame] = {}
for i, regionData in ipairs(regionDatas) do
if i <= numVisible then
@@ -1010,7 +1025,7 @@ local function modify(parent, region, data)
self.needToPosition = false
if #self.sortedChildren > 0 then
if animate then
WeakAuras.RegisterGroupForPositioning(data.id, self)
Private.RegisterGroupForPositioning(data.id, self)
else
self:DoPositionChildren()
end
+5 -8
View File
@@ -740,12 +740,11 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
if region.PreHide then
region:PreHide()
end
if WeakAuras.checkConditions[id] then
WeakAuras.checkConditions[id](region, true);
end
Private.RunConditions(region, id, true)
region:Hide();
if (cloneId) then
WeakAuras.ReleaseClone(region.id, cloneId, data.regionType);
Private.ReleaseClone(region.id, cloneId, data.regionType);
parent:RemoveChild(id, cloneId)
else
parent:DeactivateChild(id, cloneId);
@@ -756,12 +755,10 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
if region.PreHide then
region:PreHide()
end
if WeakAuras.checkConditions[id] then
WeakAuras.checkConditions[id](region, true);
end
Private.RunConditions(region, id, true)
region:Hide();
if (cloneId) then
WeakAuras.ReleaseClone(region.id, cloneId, data.regionType);
Private.ReleaseClone(region.id, cloneId, data.regionType);
end
end
end
+41 -2455
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -34,6 +34,9 @@ Profiling.lua
WeakAuras.lua
History.lua
Transmission.lua
Modernize.lua
Animations.lua
Conditions.lua
# trigger systems
BuffTrigger.lua
@@ -37,7 +37,7 @@ local methods = {
["OnAcquire"] = function(self)
-- restore default values
self:SetHeight(16)
self:SetWidth(32)
self:SetWidth(16)
self:SetDisabled(false)
self:SetText()
self.hTex:SetVertexColor(1, 1, 1, 0.1)
@@ -47,7 +47,11 @@ local methods = {
["SetText"] = function(self, text)
self.text:SetText(text)
self:SetWidth(self.text:GetStringWidth() + 24)
if text ~= "" then
self:SetWidth(self.text:GetStringWidth() + 28)
else
self:SetWidth(16)
end
end,
["SetDisabled"] = function(self, disabled)
+98 -236
View File
@@ -56,11 +56,19 @@ local function getAuraMatchesList(name)
end
end
local noop = function() end
local function GetBuffTriggerOptions(data, triggernum)
local trigger= data.triggers[triggernum].trigger
local spellCache = WeakAuras.spellCache;
local ValidateNumeric = WeakAuras.ValidateNumeric;
local aura_options = {
deleteNote = {
type = "description",
order = 8,
name = L["Note: The legacy buff trigger is now permanently disabled. It will be removed in the near future."],
fontSize = "large"
},
convertToBuffTrigger2SpaceBeforeDesc = {
type = "description",
width = 0.4,
@@ -90,20 +98,12 @@ local function GetBuffTriggerOptions(data, triggernum)
width = 0.3,
order = 8.4,
name = "",
hidden = function()
-- For those that update without restarting
return not WeakAuras.CanConvertBuffTrigger2
end,
},
convertToBuffTrigger2 = {
type = "execute",
width = WeakAuras.doubleWidth - 0.6,
name = L["Convert to New Aura Trigger"],
order = 8.5,
hidden = function()
-- For those that update without restarting
return not WeakAuras.CanConvertBuffTrigger2
end,
disabled = function()
if (not WeakAuras.CanConvertBuffTrigger2) then
return true;
@@ -136,20 +136,15 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Use Full Scan (High CPU)"],
width = WeakAuras.doubleWidth,
order = 9,
set = noop
},
autoclone = {
type = "toggle",
name = L["Show all matches (Auto-clone)"],
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end,
set = function(info, v)
trigger.autoclone = v;
if(v == true) then
WeakAuras.ShowCloneDialog(data);
end
WeakAuras.Add(data);
end,
order = 9.5
order = 9.5,
set = noop
},
useName = {
type = "toggle",
@@ -158,14 +153,16 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 10,
hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit ~= "multi"); end,
disabled = true,
get = function() return true end
get = function() return true end,
set = noop
},
use_name = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Aura Name"],
order = 10,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end
hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end,
set = noop
},
name_operator = {
type = "select",
@@ -174,7 +171,8 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 11,
disabled = function() return not trigger.use_name end,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end,
values = WeakAuras.string_operator_types
values = WeakAuras.string_operator_types,
set = noop
},
name = {
type = "input",
@@ -183,25 +181,15 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 12,
disabled = function() return not trigger.use_name end,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end,
set = function(info, v)
if (tonumber(v)) then
trigger.spellId = tonumber(v);
trigger.name = nil;
else
trigger.spellId = nil;
trigger.name = v;
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
use_tooltip = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Tooltip"],
order = 13,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end,
set = noop
},
tooltip_operator = {
type = "select",
@@ -210,7 +198,8 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 14,
disabled = function() return not trigger.use_tooltip end,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end,
values = WeakAuras.string_operator_types
values = WeakAuras.string_operator_types,
set = noop
},
tooltip = {
type = "input",
@@ -218,7 +207,8 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Tooltip"],
order = 15,
disabled = function() return not trigger.use_tooltip end,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end,
set = noop
},
use_stealable = {
type = "toggle",
@@ -237,23 +227,15 @@ local function GetBuffTriggerOptions(data, triggernum)
elseif(value == false) then return "false";
else return "true"; end
end,
set = function(info, v)
if(v) then
trigger.use_stealable = true;
else
local value = trigger.use_stealable;
if(value == false) then trigger.use_stealable = nil;
else trigger.use_stealable = false end
end
WeakAuras.Add(data);
end
set = noop
},
use_spellId = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Spell ID"],
order = 17,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end,
set = noop
},
spellId = {
type = "input",
@@ -261,14 +243,16 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Spell ID"],
order = 18,
disabled = function() return not trigger.use_spellId end,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.unit ~= "multi"); end,
set = noop
},
use_debuffClass = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Debuff Type"],
order = 19,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end
hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end,
set = noop
},
debuffClass = {
type = "select",
@@ -277,7 +261,8 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 20,
disabled = function() return not trigger.use_debuffClass end,
hidden = function() return not (trigger.type == "aura" and trigger.fullscan); end,
values = WeakAuras.debuff_class_types
values = WeakAuras.debuff_class_types,
set = noop
},
multiuse_name = {
type = "toggle",
@@ -286,7 +271,8 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 10,
hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit == "multi"); end,
disabled = true,
get = function() return true end
get = function() return true end,
set = noop
},
multiicon = {
type = "execute",
@@ -298,7 +284,8 @@ local function GetBuffTriggerOptions(data, triggernum)
return icon and tostring(icon) or "", 18, 18 end,
order = 11,
disabled = function() return not trigger.name and spellCache.GetIcon(trigger.name) end,
hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit == "multi"); end
hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit == "multi"); end,
set = noop
},
multiname = {
type = "input",
@@ -308,17 +295,7 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 12,
hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit == "multi"); end,
get = function(info) return trigger.spellId and tostring(trigger.spellId) or trigger.name end,
set = function(info, v)
if(v == "") then
trigger.name = nil;
trigger.spellId = nil;
else
trigger.name, trigger.spellId = WeakAuras.spellCache.CorrectAuraName(v);
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
name1icon = {
type = "execute",
@@ -331,7 +308,8 @@ local function GetBuffTriggerOptions(data, triggernum)
end,
order = 11,
disabled = function() return not spellCache.GetIcon(trigger.names[1]) end,
hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit ~= "multi"); end
hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit ~= "multi"); end,
set = noop
},
name1 = {
type = "input",
@@ -341,19 +319,7 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 12,
hidden = function() return not (trigger.type == "aura" and not trigger.fullscan and trigger.unit ~= "multi"); end,
get = function(info) return trigger.spellIds[1] and tostring(trigger.spellIds[1]) or trigger.names[1] end,
set = function(info, v)
if(v == "") then
if(trigger.names[1]) then
tremove(trigger.names, 1);
spellId_tremove(trigger.spellIds, 1);
end
else
trigger.names[1], trigger.spellIds[1] = WeakAuras.spellCache.CorrectAuraName(v);
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
name2space = {
type = "execute",
@@ -383,19 +349,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
hidden = function() return not (trigger.type == "aura" and trigger.names[1] and not trigger.fullscan and trigger.unit ~= "multi"); end,
get = function(info) return trigger.spellIds[2] and tostring(trigger.spellIds[2]) or trigger.names[2] end,
set = function(info, v)
if(v == "") then
if(trigger.names[2]) then
tremove(trigger.names, 2);
spellId_tremove(trigger.spellIds, 2);
end
else
trigger.names[2], trigger.spellIds[2] = WeakAuras.spellCache.CorrectAuraName(v);
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
name3space = {
type = "execute",
@@ -425,19 +379,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
hidden = function() return not (trigger.type == "aura" and trigger.names[2] and not trigger.fullscan and trigger.unit ~= "multi"); end,
get = function(info) return trigger.spellIds[3] and tostring(trigger.spellIds[3]) or trigger.names[3] end,
set = function(info, v)
if(v == "") then
if(trigger.names[3]) then
tremove(trigger.names, 3);
spellId_tremove(trigger.spellIds, 3);
end
else
trigger.names[3], trigger.spellIds[3] = WeakAuras.spellCache.CorrectAuraName(v);
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
name4space = {
type = "execute",
@@ -466,19 +408,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
hidden = function() return not (trigger.type == "aura" and trigger.names[3] and not trigger.fullscan and trigger.unit ~= "multi"); end,
get = function(info) return trigger.spellIds[4] and tostring(trigger.spellIds[4]) or trigger.names[4] end,
set = function(info, v)
if(v == "") then
if(trigger.names[4]) then
tremove(trigger.names, 4);
spellId_tremove(trigger.spellIds, 4);
end
else
trigger.names[4], trigger.spellIds[4] = WeakAuras.spellCache.CorrectAuraName(v);
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
name5space = {
type = "execute",
@@ -508,19 +438,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
hidden = function() return not (trigger.type == "aura" and trigger.names[4] and not trigger.fullscan and trigger.unit ~= "multi"); end,
get = function(info) return trigger.spellIds[5] and tostring(trigger.spellIds[5]) or trigger.names[5] end,
set = function(info, v)
if(v == "") then
if(trigger.names[5]) then
tremove(trigger.names, 5);
spellId_tremove(trigger.spellIds, 5);
end
else
trigger.names[5], trigger.spellIds[5] = WeakAuras.spellCache.CorrectAuraName(v);
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
name6space = {
type = "execute",
@@ -550,19 +468,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
hidden = function() return not (trigger.type == "aura" and trigger.names[5] and not trigger.fullscan and trigger.unit ~= "multi"); end,
get = function(info) return trigger.spellIds[6] and tostring(trigger.spellIds[6]) or trigger.names[6] end,
set = function(info, v)
if(v == "") then
if(trigger.names[6]) then
tremove(trigger.names, 6);
spellId_tremove(trigger.spellIds, 6);
end
else
trigger.names[6], trigger.spellIds[6] = WeakAuras.spellCache.CorrectAuraName(v);
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
name7space = {
type = "execute",
@@ -592,19 +498,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
hidden = function() return not (trigger.type == "aura" and trigger.names[6] and not trigger.fullscan and trigger.unit ~= "multi"); end,
get = function(info) return trigger.spellIds[7] and tostring(trigger.spellIds[7]) or trigger.names[7] end,
set = function(info, v)
if(v == "") then
if(trigger.names[7]) then
tremove(trigger.names, 7);
spellId_tremove(trigger.spellIds, 7);
end
else
trigger.names[7], trigger.spellIds[7] = WeakAuras.spellCache.CorrectAuraName(v);
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
name8space = {
type = "execute",
@@ -634,19 +528,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
hidden = function() return not (trigger.type == "aura" and trigger.names[7] and not trigger.fullscan and trigger.unit ~= "multi"); end,
get = function(info) return trigger.spellIds[8] and tostring(trigger.spellIds[8]) or trigger.names[8] end,
set = function(info, v)
if(v == "") then
if(trigger.names[8]) then
tremove(trigger.names, 8);
spellId_tremove(trigger.spellIds, 8);
end
else
trigger.names[8], trigger.spellIds[8] = WeakAuras.spellCache.CorrectAuraName(v);
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
name9space = {
type = "execute",
@@ -676,19 +558,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
hidden = function() return not (trigger.type == "aura" and trigger.names[8] and not trigger.fullscan and trigger.unit ~= "multi"); end,
get = function(info) return trigger.spellIds[9] and tostring(trigger.spellIds[9]) or trigger.names[9] end,
set = function(info, v)
if(v == "") then
if(trigger.names[9]) then
tremove(trigger.names, 9);
spellId_tremove(trigger.spellIds, 9);
end
else
trigger.names[9], trigger.spellIds[9] = WeakAuras.spellCache.CorrectAuraName(v);
end
WeakAuras.Add(data);
WeakAuras.UpdateThumbnail(data);
WeakAuras.UpdateDisplayButton(data);
end,
set = noop
},
useUnit = {
type = "toggle",
@@ -697,7 +567,8 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 40,
disabled = true,
hidden = function() return not (trigger.type == "aura"); end,
get = function() return true end
get = function() return true end,
set = noop
},
unit = {
type = "select",
@@ -712,20 +583,13 @@ local function GetBuffTriggerOptions(data, triggernum)
end
end,
hidden = function() return not (trigger.type == "aura"); end,
set = function(info, v)
trigger.unit = v;
trigger.use_specific_unit = (v == "member");
if(v == "multi") then
WeakAuras.ShowCloneDialog(data);
end
WeakAuras.Add(data);
end,
get = function()
if(trigger.fullscan and (trigger.unit == "group" or trigger.unit == "multi")) then
trigger.unit = "player";
end
return trigger.unit;
end
end,
set = noop
},
useSpecificUnit = {
type = "toggle",
@@ -734,7 +598,8 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 42,
disabled = true,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "member") end,
get = function() return true end
get = function() return true end,
set = noop
},
specificUnit = {
type = "input",
@@ -742,7 +607,8 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Specific Unit"],
order = 43,
desc = L["Can be a Name or a Unit ID (e.g. party1). A name only works on friendly players in your group."],
hidden = function() return not (trigger.type == "aura" and trigger.unit == "member") end
hidden = function() return not (trigger.type == "aura" and trigger.unit == "member") end,
set = noop
},
useGroup_count = {
type = "toggle",
@@ -751,7 +617,8 @@ local function GetBuffTriggerOptions(data, triggernum)
disabled = true,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end,
get = function() return true; end,
order = 45
order = 45,
set = noop
},
group_countOperator = {
type = "select",
@@ -760,7 +627,8 @@ local function GetBuffTriggerOptions(data, triggernum)
width = WeakAuras.halfWidth,
values = operator_types,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end,
get = function() return trigger.group_countOperator; end
get = function() return trigger.group_countOperator; end,
set = noop
},
group_count = {
type = "input",
@@ -773,15 +641,7 @@ local function GetBuffTriggerOptions(data, triggernum)
width = WeakAuras.halfWidth,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end,
get = function() return trigger.group_count; end,
set = function(info, v)
if(WeakAuras.ParseNumber(v)) then
trigger.group_count = v;
else
trigger.group_count = "";
end
WeakAuras.Add(data);
WeakAuras.UpdateDisplayButton(data);
end
set = noop
},
ignoreSelf = {
type = "toggle",
@@ -789,20 +649,15 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 47.3,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end,
set = noop
},
groupclone = {
type = "toggle",
name = L["Show all matches (Auto-clone)"],
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end,
set = function(info, v)
trigger.groupclone = v;
if(v == true) then
WeakAuras.ShowCloneDialog(data);
end
WeakAuras.Add(data);
end,
order = 47.4
order = 47.4,
set = noop
},
name_info = {
type = "select",
@@ -818,7 +673,8 @@ local function GetBuffTriggerOptions(data, triggernum)
return nil;
end
end,
values = group_aura_name_info_types
values = group_aura_name_info_types,
set = noop
},
stack_info = {
type = "select",
@@ -834,7 +690,8 @@ local function GetBuffTriggerOptions(data, triggernum)
return nil;
end
end,
values = group_aura_stack_info_types
values = group_aura_stack_info_types,
set = noop
},
hideAlone = {
type = "toggle",
@@ -842,6 +699,7 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 47.7,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura" and trigger.unit == "group"); end,
set = noop
},
useDebuffType = {
type = "toggle",
@@ -850,7 +708,8 @@ local function GetBuffTriggerOptions(data, triggernum)
order = 50,
disabled = true,
hidden = function() return not (trigger.type == "aura"); end,
get = function() return true end
get = function() return true end,
set = noop
},
debuffType = {
type = "select",
@@ -858,14 +717,16 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Aura Type"],
order = 51,
values = debuff_types,
hidden = function() return not (trigger.type == "aura"); end
hidden = function() return not (trigger.type == "aura"); end,
set = noop
},
subcount = {
type = "toggle",
width = WeakAuras.doubleWidth,
name = L["Use tooltip \"size\" instead of stacks"],
hidden = function() return not (trigger.type == "aura" and trigger.fullscan) end,
order = 55
order = 55,
set = noop
},
subcountCount = {
type = "select",
@@ -873,14 +734,16 @@ local function GetBuffTriggerOptions(data, triggernum)
width = WeakAuras.doubleWidth,
name = L["Use nth value from tooltip:"],
hidden = function() return not (trigger.type == "aura" and trigger.fullscan and trigger.subcount) end,
order = 55.5
order = 55.5,
set = noop
},
useRem = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Remaining Time"],
hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end,
order = 56
order = 56,
set = noop
},
remOperator = {
type = "select",
@@ -890,7 +753,8 @@ local function GetBuffTriggerOptions(data, triggernum)
values = operator_types,
disabled = function() return not trigger.useRem; end,
hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end,
get = function() return trigger.useRem and trigger.remOperator or nil end
get = function() return trigger.useRem and trigger.remOperator or nil end,
set = noop
},
rem = {
type = "input",
@@ -900,14 +764,16 @@ local function GetBuffTriggerOptions(data, triggernum)
width = WeakAuras.halfWidth,
disabled = function() return not trigger.useRem; end,
hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end,
get = function() return trigger.useRem and trigger.rem or nil end
get = function() return trigger.useRem and trigger.rem or nil end,
set = noop
},
useCount = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Stack Count"],
hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end,
order = 60
order = 60,
set = noop
},
countOperator = {
type = "select",
@@ -917,7 +783,8 @@ local function GetBuffTriggerOptions(data, triggernum)
values = operator_types,
disabled = function() return not trigger.useCount; end,
hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end,
get = function() return trigger.useCount and trigger.countOperator or nil end
get = function() return trigger.useCount and trigger.countOperator or nil end,
set = noop
},
count = {
type = "input",
@@ -927,7 +794,8 @@ local function GetBuffTriggerOptions(data, triggernum)
width = WeakAuras.halfWidth,
disabled = function() return not trigger.useCount; end,
hidden = function() return not (trigger.type == "aura" and trigger.unit ~= "multi"); end,
get = function() return trigger.useCount and trigger.count or nil end
get = function() return trigger.useCount and trigger.count or nil end,
set = noop
},
ownOnly = {
type = "toggle",
@@ -950,18 +818,9 @@ local function GetBuffTriggerOptions(data, triggernum)
elseif(value == false) then return "false";
else return "true"; end
end,
set = function(info, v)
if(v) then
trigger.ownOnly = true;
else
local value = trigger.ownOnly;
if(value == false) then trigger.ownOnly = nil;
else trigger.ownOnly = false end
end
WeakAuras.Add(data);
end,
order = 70,
hidden = function() return not (trigger.type == "aura"); end
hidden = function() return not (trigger.type == "aura"); end,
set = noop
},
useBuffShowOn = {
type = "toggle",
@@ -972,7 +831,8 @@ local function GetBuffTriggerOptions(data, triggernum)
hidden = function()
return not (trigger.type == "aura" and not(trigger.unit ~= "group" and trigger.fullscan and trigger.autoclone) and trigger.unit ~= "multi" and not(trigger.unit == "group" and not trigger.groupclone));
end,
get = function() return true end
get = function() return true end,
set = noop
},
buffShowOn = {
type = "select",
@@ -983,7 +843,8 @@ local function GetBuffTriggerOptions(data, triggernum)
get = function() return trigger.buffShowOn end,
hidden = function()
return not (trigger.type == "aura" and not(trigger.unit ~= "group" and trigger.fullscan and trigger.autoclone) and trigger.unit ~= "multi" and not(trigger.unit == "group" and not trigger.groupclone));
end
end,
set = noop
},
unitExists = {
type = "toggle",
@@ -996,7 +857,8 @@ local function GetBuffTriggerOptions(data, triggernum)
and trigger.unit ~= "multi"
and trigger.unit ~= "group"
and trigger.unit ~= "player");
end
end,
set = noop
},
linespacer = {
type = "description",
+40 -2
View File
@@ -34,6 +34,44 @@ local function union(table1, table2)
return meta;
end
local function CorrectSpellName(input)
local inputId = tonumber(input);
if(inputId) then
local name = GetSpellInfo(inputId);
if(name) then
return inputId;
else
return nil;
end
elseif(input) then
local link;
if(input:sub(1,1) == "\124") then
link = input;
else
link = GetSpellLink(input);
end
if(link) and link ~= "" then
local itemId = link:match("spell:(%d+)");
return tonumber(itemId);
end
end
end
local function CorrectItemName(input)
local inputId = tonumber(input);
if(inputId) then
return inputId;
elseif(input) then
local _, link = GetItemInfo(input);
if(link) then
local itemId = link:match("item:(%d+)");
return tonumber(itemId);
else
return nil;
end
end
end
-- Also used by the GenericTrigger
function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, triggertype, unevent)
local trigger, untrigger;
@@ -564,9 +602,9 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
if(arg.type == "aura") then
fixedInput = WeakAuras.spellCache.CorrectAuraName(v);
elseif(arg.type == "spell") then
fixedInput = WeakAuras.CorrectSpellName(v);
fixedInput = CorrectSpellName(v);
elseif(arg.type == "item") then
fixedInput = WeakAuras.CorrectItemName(v);
fixedInput = CorrectItemName(v);
end
trigger[realname] = fixedInput;
WeakAuras.Add(data);
+147 -40
View File
@@ -268,8 +268,8 @@ function WeakAuras.CreateFrame()
title:SetPoint("BOTTOMLEFT", titleBG, "BOTTOMLEFT", -25, 0)
title:SetPoint("TOPRIGHT", titleBG, "TOPRIGHT", 25, 0)
CreateFrameSizer(frame, commitWindowChanges, "BOTTOMLEFT")
CreateFrameSizer(frame, commitWindowChanges, "BOTTOMRIGHT")
frame.bottomLeftResizer = CreateFrameSizer(frame, commitWindowChanges, "BOTTOMLEFT")
frame.bottomRightResizer = CreateFrameSizer(frame, commitWindowChanges, "BOTTOMRIGHT")
local minimize = CreateDecoration(frame)
minimize:SetPoint("TOPRIGHT", -65, 12)
@@ -292,13 +292,27 @@ function WeakAuras.CreateFrame()
self.toolbarContainer.frame:Hide()
self.filterInput:Hide();
self.filterInputClear:Hide();
self.tipFrame.frame:Hide()
self.bottomLeftResizer:Hide()
self.bottomRightResizer:Hide()
else
if self.tipFrameIsVisible then
self.tipFrame.frame:Show()
end
self.bottomLeftResizer:Show()
self.bottomRightResizer:Show()
if self.window == "default" then
self.buttonsContainer.frame:Show()
self.container.frame:Show()
if self.tipFrameIsVisible then
self.tipFrame.frame:Show()
else
self.tipFrame.frame:Hide()
end
else
self.buttonsContainer.frame:Hide()
self.container.frame:Hide()
self.tipFrame.frame:Hide()
end
if self.window == "texture" then
@@ -394,45 +408,132 @@ function WeakAuras.CreateFrame()
frame:UpdateFrameVisible()
end)
local _, _, _, enabled, loadable = GetAddOnInfo("WeakAurasTutorials")
if enabled and loadable then
local tutorial = CreateDecoration(frame)
tutorial:SetPoint("TOPRIGHT", -140, 12)
local tipFrame = AceGUI:Create("SimpleGroup")
tipFrame.frame:SetParent(frame)
tipFrame:SetLayout("Flow")
tipFrame.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 22, 15)
tipFrame.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 15)
tipFrame.frame:Hide()
frame.tipFrame = tipFrame
local tutorialbutton = CreateFrame("BUTTON", nil, tutorial)
tutorialbutton:SetWidth(30)
tutorialbutton:SetHeight(30)
tutorialbutton:SetPoint("CENTER", tutorial, "CENTER", 1, -1)
tutorialbutton:SetNormalTexture("Interface\\GossipFrame\\DailyActiveQuestIcon")
tutorialbutton:GetNormalTexture():ClearAllPoints()
tutorialbutton:GetNormalTexture():SetSize(16, 16)
tutorialbutton:GetNormalTexture():SetPoint("center", -2, 0)
tutorialbutton:SetPushedTexture("Interface\\GossipFrame\\DailyActiveQuestIcon")
tutorialbutton:GetPushedTexture():ClearAllPoints()
tutorialbutton:GetPushedTexture():SetSize(16, 16)
tutorialbutton:GetPushedTexture():SetPoint("center", -2, -2)
tutorialbutton:SetHighlightTexture("Interface\\BUTTONS\\UI-Panel-MinimizeButton-Highlight.blp")
tutorialbutton:SetScript("OnClick", function()
if not IsAddOnLoaded("WeakAurasTutorials") then
local loaded, reason = LoadAddOn("WeakAurasTutorials")
if not loaded then
reason = string.lower("|cffff2020" .. _G["ADDON_" .. reason] .. "|r.")
prettyPrint("Tutorials could not be loaded, the addon is " .. reason)
return
end
end
WeakAuras.ToggleTutorials()
local tipPopup = CreateFrame("Frame", nil, frame)
tipPopup:SetFrameStrata("FULLSCREEN")
tipPopup:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 16,
edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
})
tipPopup:SetBackdropColor(0, 0, 0, 0.8)
--tipPopup:SetHeight(100)
tipPopup:Hide()
local tipPopupTitle = tipPopup:CreateFontString(nil, "BACKGROUND", "GameFontNormalLarge")
tipPopupTitle:SetPoint("TOPLEFT", tipPopup, "TOPLEFT", 10, -10)
tipPopupTitle:SetPoint("TOPRIGHT", tipPopup, "TOPRIGHT", -10, -10)
tipPopupTitle:SetJustifyH("LEFT")
tipPopupTitle:SetJustifyV("TOP")
local tipPopupLabel = tipPopup:CreateFontString(nil, "BACKGROUND", "GameFontWhite")
tipPopupLabel:SetPoint("TOPLEFT", tipPopupTitle, "BOTTOMLEFT", 0, -6)
tipPopupLabel:SetPoint("TOPRIGHT", tipPopupTitle, "BOTTOMRIGHT", 0, -6)
tipPopupLabel:SetJustifyH("LEFT")
tipPopupLabel:SetJustifyV("TOP")
local urlWidget = CreateFrame("EDITBOX", nil, tipPopup, "InputBoxTemplate")
urlWidget:SetFont(STANDARD_TEXT_FONT, 12)
urlWidget:SetPoint("TOPLEFT", tipPopupLabel, "BOTTOMLEFT", 6, 0)
urlWidget:SetPoint("TOPRIGHT", tipPopupLabel, "BOTTOMRIGHT", 0, 0)
urlWidget:SetScript("OnChar", function() urlWidget:SetText(urlWidget.text); urlWidget:HighlightText(); end);
urlWidget:SetScript("OnMouseUp", function() urlWidget:HighlightText(); end);
urlWidget:SetScript("OnEscapePressed", function() tipPopup:Hide() end)
urlWidget:SetHeight(34)
local tipPopupCtrlC = tipPopup:CreateFontString(nil, "BACKGROUND", "GameFontWhite")
tipPopupCtrlC:SetPoint("TOPLEFT", urlWidget, "BOTTOMLEFT", -6, 0)
tipPopupCtrlC:SetPoint("TOPRIGHT", urlWidget, "BOTTOMRIGHT", 0, 0)
tipPopupCtrlC:SetJustifyH("LEFT")
tipPopupCtrlC:SetJustifyV("TOP")
tipPopupCtrlC:SetText("Press Ctrl+C to copy the URL")
local function ToggleTip(referenceWidget, url, title, description)
if tipPopup:IsVisible() and urlWidget.text == url then
tipPopup:Hide()
return
end
urlWidget.text = url
urlWidget:SetText(url)
tipPopupTitle:SetText(title)
tipPopupLabel:SetText(description)
urlWidget:HighlightText()
tipPopup:SetWidth(400)
tipPopup:SetHeight(26 + tipPopupTitle:GetHeight() + tipPopupLabel:GetHeight() + urlWidget:GetHeight() + tipPopupCtrlC:GetHeight())
tipPopup:SetPoint("BOTTOMLEFT", referenceWidget.frame, "TOPLEFT", -6, 4)
tipPopup:Show()
end
local addFooter = function(title, texture, url, description)
local button = AceGUI:Create("WeakAurasToolbarButton")
button:SetText(title)
button:SetTexture(texture)
button:SetCallback("OnClick", function()
ToggleTip(button, url, title, description)
end)
tipFrame:AddChild(button)
end
addFooter(L["Get Help"], [[Interface\AddOns\WeakAuras\Media\Textures\discord.tga]], "https://discord.gg/wa2",
L["Chat with WeakAuras experts on our Discord server."])
addFooter(L["Documentation"], [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/WeakAuras/WeakAuras2/wiki",
L["Check out our wiki for a large collection of examples and snippets."])
addFooter(L["Find Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_logo.tga]], "https://wago.io",
L["Browse Wago, the largest collection of auras."])
if not WeakAurasCompanion then
addFooter(L["Update Auras"], [[Interface\AddOns\WeakAuras\Media\Textures\wagoupdate_refresh.tga]], "https://weakauras.wtf",
L["Keep your Wago imports up to date with the Companion App."])
end
addFooter(L["Found a Bug?"], [[Interface\AddOns\WeakAuras\Media\Textures\bug_report.tga]], "https://github.com/WeakAuras/WeakAuras2/issues/new",
L["Report bugs our our issue tracker."])
-- Disable for now
--local closeTipButton = CreateFrame("Button", nil, tipFrame.frame, "UIPanelCloseButton")
--closeTipButton:SetScript("OnClick", function()
-- frame:HideTip()
--end)
--closeTipButton:SetPoint("TOPRIGHT", tipFrame.frame, "TOPRIGHT", 0, 6)
--closeTipButton:Show()
frame.ShowTip = function(self)
self.tipFrameIsVisible = true
self.tipFrame.frame:Show()
self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 17, 30)
self.container.frame:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -17, 28)
end
frame.HideTip = function(self)
self.tipFrameIsVisible = false
self.tipFrame.frame:Hide()
self.buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12)
self.container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
end
-- Right Side Container
local container = AceGUI:Create("InlineGroup")
container.frame:SetParent(frame)
container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 12)
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -83 - WeakAuras.normalWidth * 340, -14)
container.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 10)
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -14)
container.frame:Show()
--container.frame:SetClipsChildren(true)
container.titletext:Hide()
-- Hide the border
container.content:GetParent():SetBackdrop(nil)
container.content:SetPoint("TOPLEFT", 0, 0)
container.content:SetPoint("BOTTOMRIGHT", 0, 0)
frame.container = container
frame.texturePicker = WeakAuras.TexturePicker(frame)
@@ -451,7 +552,7 @@ function WeakAuras.CreateFrame()
filterInput:SetScript("OnEnterPressed", function(...) filterInput:ClearFocus() end)
filterInput:SetScript("OnEscapePressed", function(...) filterInput:SetText("") filterInput:ClearFocus() end)
filterInput:SetHeight(15)
filterInput:SetPoint("TOP", frame, "TOP", 0, -34)
filterInput:SetPoint("TOP", frame, "TOP", 0, -44)
filterInput:SetPoint("LEFT", frame, "LEFT", 24, 0)
filterInput:SetPoint("RIGHT", container.frame, "LEFT", -5, 0)
filterInput:SetTextInsets(16, 16, 0, 0)
@@ -481,7 +582,7 @@ function WeakAuras.CreateFrame()
buttonsContainer:SetWidth(170)
buttonsContainer.frame:SetParent(frame)
buttonsContainer.frame:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 17, 12)
buttonsContainer.frame:SetPoint("TOP", frame, "TOP", 0, -34)
buttonsContainer.frame:SetPoint("TOP", frame, "TOP", 0, -46)
buttonsContainer.frame:SetPoint("RIGHT", container.frame, "LEFT", -17)
buttonsContainer.frame:Show()
frame.buttonsContainer = buttonsContainer
@@ -489,9 +590,9 @@ function WeakAuras.CreateFrame()
-- Toolbar
local toolbarContainer = AceGUI:Create("SimpleGroup")
toolbarContainer.frame:SetParent(buttonsContainer.frame)
toolbarContainer.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 20, -10)
toolbarContainer.frame:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -17, -10)
toolbarContainer.frame:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 20, -32)
toolbarContainer.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 20, -16)
toolbarContainer.frame:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -17, -16)
toolbarContainer.frame:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 20, -38)
toolbarContainer:SetLayout("Flow")
local newButton = AceGUI:Create("WeakAurasToolbarButton")
@@ -839,6 +940,7 @@ function WeakAuras.CreateFrame()
local tabsWidget
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -14)
container:ReleaseChildren()
container:SetLayout("Fill")
tabsWidget = AceGUI:Create("TabGroup")
@@ -846,10 +948,10 @@ function WeakAuras.CreateFrame()
local tabs = {
{ value = "region", text = L["Display"]},
{ value = "trigger", text = L["Trigger"]},
{ value = "load", text = L["Load"]},
{ value = "conditions", text = L["Conditions"]},
{ value = "action", text = L["Actions"]},
{ value = "animation", text = L["Animations"]},
{ value = "conditions", text = L["Conditions"]},
{ value = "load", text = L["Load"]},
{ value = "authorOptions", text = L["Custom Options"]},
{ value = "information", text = L["Information"]},
}
@@ -936,10 +1038,15 @@ function WeakAuras.CreateFrame()
self.moversizer:Hide()
self.pickedOption = "New"
container.frame:SetPoint("TOPLEFT", frame, "TOPRIGHT", -63 - WeakAuras.normalWidth * 340, -8)
container:SetLayout("fill")
local border = AceGUI:Create("InlineGroup")
border:SetLayout("Fill")
container:AddChild(border)
local containerScroll = AceGUI:Create("ScrollFrame")
containerScroll:SetLayout("flow")
container:SetLayout("fill")
container:AddChild(containerScroll)
border:AddChild(containerScroll)
local _, _, _, enabled = GetAddOnInfo("WeakAurasTemplates")
if enabled then
+4 -1
View File
@@ -543,6 +543,9 @@ function WeakAuras.ShowOptions(msg)
if (frame.window == "codereview") then
frame.codereview:Close();
end
-- TODO check if it should be shown
frame:ShowTip()
end
function WeakAuras.HideOptions()
@@ -1682,4 +1685,4 @@ function WeakAuras.HandleRename(data, oldid, newid)
WeakAuras.SetGrouping()
WeakAuras.SortDisplayButtons()
WeakAuras.PickDisplay(newid)
end
end