from retail

This commit is contained in:
Bunny67
2020-06-09 23:31:40 +03:00
parent 7a5876526d
commit de72394bda
32 changed files with 313 additions and 291 deletions
+29 -12
View File
@@ -696,11 +696,6 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId,
changed = true
end
if state.tooltip or state.tooltip1 or state.tooltip2 or state.tooltip3 then
state.tooltip, state.tooltip1, state.tooltip2, state.tooltip3 = nil, nil, nil, nil
changed = true
end
if state.matchCount ~= matchCount then
state.matchCount = matchCount
changed = true
@@ -867,10 +862,18 @@ local function TriggerInfoApplies(triggerInfo, unit)
return false
end
if triggerInfo.ignoreDead and UnitIsDeadOrGhost(unit) then
return false
end
if triggerInfo.ignoreDisconnected and not UnitIsConnected(unit) then
return false
end
if triggerInfo.unit == "group" and triggerInfo.groupSubType == "party" then
if IsInRaid() then
-- Filter our player/party# while in raid and keep only raid units that are correct
if not WeakAuras.multiUnitUnits.raid[unit] or not UnitIsUnit("player", unit) then
if unit:sub(1,4) ~= "raid" or not UnitIsUnit("player", unit) then
return false
end
else
@@ -881,11 +884,11 @@ local function TriggerInfoApplies(triggerInfo, unit)
end
-- Filter our player/party# while in raid
if (triggerInfo.unit == "group" and triggerInfo.groupSubType == "group" and IsInRaid() and not WeakAuras.multiUnitUnits.raid[unit]) then
if (triggerInfo.unit == "group" and triggerInfo.groupSubType == "group" and IsInRaid() and unit:sub(1,4) ~= "raid") then
return false
end
if triggerInfo.unit == "group" and triggerInfo.groupSubType == "raid" and not WeakAuras.multiUnitUnits.raid[unit] then
if triggerInfo.unit == "group" and triggerInfo.groupSubType == "raid" and unit:sub(1,4) ~= "raid" then
return false
end
@@ -1353,13 +1356,13 @@ end
local function ScanUnit(time, arg1)
if not arg1 then return end
if (WeakAuras.multiUnitUnits.raid[arg1] and IsInRaid()) then
if (arg1:sub(1,4) == "raid" and IsInRaid()) then
ScanGroupUnit(time, matchDataChanged, "group", arg1)
elseif (WeakAuras.multiUnitUnits.party[arg1] and not IsInRaid()) then
elseif ((arg1:sub(1,5) == "party" or arg1 == "player") and not IsInRaid()) then
ScanGroupUnit(time, matchDataChanged, "group", arg1)
elseif WeakAuras.multiUnitUnits.boss[arg1] then
elseif arg1:sub(1,4) == "boss" then
ScanGroupUnit(time, matchDataChanged, "boss", arg1)
elseif WeakAuras.multiUnitUnits.arena[arg1] then
elseif arg1:sub(1,5) == "arena" then
ScanGroupUnit(time, matchDataChanged, "arena", arg1)
else
ScanGroupUnit(time, matchDataChanged, nil, arg1)
@@ -1503,6 +1506,14 @@ local function EventHandler(frame, event, arg1, arg2, ...)
tinsert(unitsToRemove, unit)
end
end
elseif event == "UNIT_FLAGS" then
if arg1:sub(1,4) == "raid" or arg1:sub(1, 5) == "party" or arg1 == "player" then
RecheckActiveForUnitType("group", arg1, deactivatedTriggerInfos)
end
elseif event == "PLAYER_FLAGS_CHANGED" then
if arg1:sub(1,4) == "raid" or arg1:sub(1, 5) == "party" or arg1 == "player" then
RecheckActiveForUnitType("group", arg1, deactivatedTriggerInfos)
end
elseif event == "UNIT_ENTERED_VEHICLE" or event == "UNIT_EXITED_VEHICLE" then
if arg1 == "player" then
ScanGroupUnit(time, matchDataChanged, nil, "vehicle")
@@ -1530,6 +1541,8 @@ local function EventHandler(frame, event, arg1, arg2, ...)
end
frame:RegisterEvent("UNIT_AURA")
frame:RegisterEvent("UNIT_FLAGS")
frame:RegisterEvent("PLAYER_FLAGS_CHANGED")
frame:RegisterEvent("UNIT_PET")
frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
frame:RegisterEvent("ARENA_OPPONENT_UPDATE")
@@ -2104,6 +2117,8 @@ function BuffTrigger.Add(data)
local groupTrigger = trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
local effectiveIgnoreSelf = groupTrigger and trigger.ignoreSelf
local effectiveClass = groupTrigger and trigger.useClass and trigger.class
local effectiveIgnoreDead = groupTrigger and trigger.ignoreDead
local effectiveIgnoreDisconnected = groupTrigger and trigger.ignoreDisconnected
if trigger.unit == "multi" then
BuffTrigger.InitMultiAura()
@@ -2154,6 +2169,8 @@ function BuffTrigger.Add(data)
fetchTooltip = not IsSingleMissing(trigger) and trigger.unit ~= "multi" and trigger.fetchTooltip,
groupTrigger = IsGroupTrigger(trigger),
ignoreSelf = effectiveIgnoreSelf,
ignoreDead = effectiveIgnoreDead,
ignoreDisconnected = effectiveIgnoreDisconnected,
groupSubType = groupSubType,
groupCountFunc = groupCountFunc,
class = effectiveClass,
+33 -31
View File
@@ -388,11 +388,13 @@ local function callFunctionForActivateEvent(func, trigger, fallback, errorHandle
return fallback
end
local ok, value = pcall(func, trigger)
if not ok then
errorHandler(value)
return fallback
else
if ok and value then
return value
else
if not ok then
errorHandler(value)
end
return fallback
end
end
@@ -804,6 +806,11 @@ function GenericTrigger.ScanWithFakeEvent(id, fake)
end
updateTriggerState = RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, eventName) or updateTriggerState;
end
for unit, unitData in pairs(event.unit_events) do
for _, event in ipairs(unitData) do
updateTriggerState = RunTriggerFunc(allStates, events[id][triggernum], id, triggernum, event, unit) or updateTriggerState
end
end
end
end
end
@@ -855,7 +862,7 @@ function HandleUnitEvent(frame, event, unit, ...)
WeakAuras.StartProfileSystem("generictrigger " .. event .. " " .. unit);
if not(WeakAuras.IsPaused()) then
if (UnitIsUnit(unit, frame.unit)) then
WeakAuras.ScanUnitEvents(event, unit, ...);
WeakAuras.ScanUnitEvents(event, frame.unit, ...);
end
end
WeakAuras.StopProfileSystem("generictrigger " .. event .. " " .. unit);
@@ -1227,9 +1234,6 @@ function GenericTrigger.Add(data, region)
triggerFunc = WeakAuras.LoadFunction("return "..(trigger.custom or ""), id);
if (trigger.custom_type == "stateupdate") then
tsuConditionVariables = WeakAuras.LoadFunction("return function() return \n" .. (trigger.customVariables or "") .. "\n end");
if not tsuConditionVariables then
tsuConditionVariables = function() return end
end
end
if(trigger.custom_type == "status" or trigger.custom_type == "event" and trigger.custom_hide == "custom") then
@@ -1753,11 +1757,9 @@ do
swingTimerFrame:RegisterEvent("PLAYER_ENTER_COMBAT");
swingTimerFrame:RegisterEvent("UNIT_ATTACK_SPEED");
swingTimerFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED");
if WeakAuras.IsClassic() then
swingTimerFrame:RegisterEvent("UNIT_SPELLCAST_START")
swingTimerFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
swingTimerFrame:RegisterEvent("UNIT_SPELLCAST_FAILED")
end
swingTimerFrame:RegisterEvent("UNIT_SPELLCAST_START")
swingTimerFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
swingTimerFrame:RegisterEvent("UNIT_SPELLCAST_FAILED")
swingTimerFrame:SetScript("OnEvent",
function(_, event, ...)
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
@@ -3670,47 +3672,47 @@ function GenericTrigger.CreateFallbackState(data, triggernum, state)
WeakAuras.ActivateAuraEnvironment(data.id, "", state);
local firstTrigger = data.triggers[1].trigger
if (event.nameFunc) then
local success, res = pcall(event.nameFunc, firstTrigger);
if not success then
geterrorhandler()(res)
local ok, name = pcall(event.nameFunc, firstTrigger);
if not ok then
geterrorhandler()(name)
state.name = nil
else
state.name = res or nil
state.name = name or nil
end
end
if (event.iconFunc) then
local success, res = pcall(event.iconFunc, firstTrigger);
if not success then
geterrorhandler()(res)
local ok, icon = pcall(event.iconFunc, firstTrigger);
if not ok then
geterrorhandler()(icon)
state.icon = nil
else
state.icon = res or nil
state.icon = icon or nil
end
end
if (event.textureFunc ) then
local success, res = pcall(event.textureFunc, firstTrigger);
if not success then
geterrorhandler()(res)
local ok, texture = pcall(event.textureFunc, firstTrigger);
if not ok then
geterrorhandler()(texture)
state.texture = nil
else
state.texture = res or nil
state.texture = texture or nil
end
end
if (event.stacksFunc) then
local success, res = pcall(event.stacksFunc, firstTrigger);
if not success then
geterrorhandler()(res)
local ok, stacks = pcall(event.stacksFunc, firstTrigger);
if not ok then
geterrorhandler()(stacks)
state.stacks = nil
else
state.stacks = res or nil
state.stacks = stacks or nil
end
end
if (event.durationFunc) then
local success, arg1, arg2, arg3, inverse = pcall(event.durationFunc, firstTrigger);
if not success then
local ok, arg1, arg2, arg3, inverse = pcall(event.durationFunc, firstTrigger);
if not ok then
geterrorhandler()(arg1)
state.progressType = "timed";
state.duration = 0;
+4 -4
View File
@@ -7,8 +7,8 @@ WeakAuras.halfWidth = WeakAuras.normalWidth / 2
WeakAuras.doubleWidth = WeakAuras.normalWidth * 2
local versionStringFromToc = GetAddOnMetadata("WeakAuras", "Version")
local versionString = "2.17.4"
local buildTime = "20200422171414"
local versionString = "2.17.5"
local buildTime = "20200511190745"
WeakAuras.versionString = versionStringFromToc
WeakAuras.buildTime = buildTime
@@ -39,7 +39,7 @@ end
WeakAuras.PowerAurasPath = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Auras\\"
WeakAuras.PowerAurasSoundPath = "Interface\\Addons\\WeakAuras\\PowerAurasMedia\\Sounds\\"
-- force enable WeakAurasCompanion and Archive because some addon managers interfere with it
-- Force enable WeakAurasCompanion and Archive because some addon managers interfere with it
EnableAddOn("WeakAurasCompanion")
EnableAddOn("WeakAurasArchive")
@@ -62,7 +62,7 @@ end
function WeakAuras.StopProfileAura()
end
-- if weakauras shuts down due to being installed on the wrong target, keep the bindings from erroring
-- If WeakAuras shuts down due to being installed on the wrong target, keep the bindings from erroring
function WeakAuras.StartProfile()
end
@@ -1,5 +1,5 @@
local MAJOR_VERSION = "LibGetFrame-1.0"
local MINOR_VERSION = 9
local MINOR_VERSION = 20
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
local lib = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
if not lib then return end
@@ -48,25 +48,30 @@ local defaultPlayerFrames = {
"SUFUnitplayer",
"PitBull4_Frames_Player",
"ElvUF_Player",
"oUF_TukuiPlayer",
"oUF_.-Player",
"oUF_PlayerPlate",
"PlayerFrame",
}
local defaultTargetFrames = {
"SUFUnittarget",
"PitBull4_Frames_Target",
"ElvUF_Target",
"oUF_.-Target",
"TargetFrame",
"oUF_TukuiTarget",
}
local defaultTargettargetFrames = {
"SUFUnittargetarget",
"PitBull4_Frames_Target's target",
"ElvUF_TargetTarget",
"oUF_.-TargetTarget",
"oUF_ToT",
"TargetTargetFrame",
"oUF_TukuiTargetTarget",
}
local GetFramesCache = {}
local FrameToUnitFresh = {}
local FrameToUnit = {}
local UpdatedFrames = {}
local function ScanFrames(depth, frame, ...)
if not frame then return end
@@ -83,6 +88,11 @@ local function ScanFrames(depth, frame, ...)
local name = frame:GetName()
if unit and frame:IsVisible() and name then
GetFramesCache[frame] = name
if unit ~= FrameToUnit[frame] then
FrameToUnit[frame] = unit
UpdatedFrames[frame] = unit
end
FrameToUnitFresh[frame] = unit
end
end
end
@@ -90,18 +100,31 @@ local function ScanFrames(depth, frame, ...)
end
local wait = false
local function doScanForUnitFrames()
wait = false
wipe(UpdatedFrames)
wipe(GetFramesCache)
wipe(FrameToUnitFresh)
ScanFrames(0, UIParent)
callbacks:Fire("GETFRAME_REFRESH")
for frame, unit in pairs(UpdatedFrames) do
callbacks:Fire("FRAME_UNIT_UPDATE", frame, unit)
end
for frame, unit in pairs(FrameToUnit) do
if FrameToUnitFresh[frame] ~= unit then
callbacks:Fire("FRAME_UNIT_REMOVED", frame, unit)
FrameToUnit[frame] = nil
end
end
end
local function ScanForUnitFrames(noDelay)
if noDelay then
wipe(GetFramesCache)
ScanFrames(0, UIParent)
callbacks:Fire("GETFRAME_REFRESH")
doScanForUnitFrames()
elseif not wait then
wait = true
C_Timer.After(1, function()
wipe(GetFramesCache)
ScanFrames(0, UIParent)
wait = false
callbacks:Fire("GETFRAME_REFRESH")
doScanForUnitFrames()
end)
end
end
@@ -157,7 +180,9 @@ local defaultOptions = {
targetFrames = defaultTargetFrames,
targettargetFrames = defaultTargettargetFrames,
ignoreFrames = {
"PitBull4_Frames_Target's target's target"
"PitBull4_Frames_Target's target's target",
"ElvUF_PartyGroup%dUnitButton%dTarget",
"RavenButton"
},
returnAll = false,
}
+1 -1
View File
@@ -96,7 +96,7 @@ local properties = {
min = 1,
softMax = screenWidth,
bigStep = 1,
defautl = 32,
default = 32,
},
height = {
display = L["Height"],
+3 -3
View File
@@ -163,7 +163,7 @@ end
local sortNilFirst = WeakAuras.InvertSort(WeakAuras.SortNilLast)
function WeakAuras.SortNilFirst(a, b)
if a == nil and b == nil then
-- we want SortNil to always prevent nils from propogating
-- we want SortNil to always prevent nils from propagating
-- as well as to sort nils onto one side
-- to maintain stability, we need SortNil(nil, nil) to always be false
-- hence this special case
@@ -778,8 +778,8 @@ local function modify(parent, region, data)
end
function region:Suspend()
-- Stops group from repositioning and reindexing children
-- Calls to Activate, Deactivate, and Reindex will cache the relevant children
-- Stops group from repositioning and re-indexing children
-- Calls to Activate, Deactivate, and Re-index will cache the relevant children
-- Similarly, Sort, Position, and Resize will be stopped
-- to be called on the next Resume
-- for when the group is resumed
+2 -2
View File
@@ -133,9 +133,9 @@ local function AcquireModel(region, data)
-- Enable model animation
if(data.advance) then
local elapsed = 0;
model:SetScript("OnUpdate", function(self, e)
model:SetScript("OnUpdate", function(self, elaps)
WeakAuras.StartProfileSystem("model");
elapsed = elapsed + (e * 1000);
elapsed = elapsed + (elaps * 1000);
model:SetSequenceTime(data.sequence, elapsed);
WeakAuras.StopProfileSystem("model");
end)
+12 -12
View File
@@ -52,12 +52,12 @@ end
-- Adjusted Duration
function WeakAuras.regionPrototype.AddAdjustedDurationToDefault(default)
default.useAdjustededMax = false;
default.useAdjustededMin = false;
default.useAdjustedMax = false;
default.useAdjustedMin = false;
end
function WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, order)
options.useAdjustededMin = {
options.useAdjustedMin = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Set Minimum Progress"],
@@ -83,7 +83,7 @@ function WeakAuras.regionPrototype.AddAdjustedDurationOptions(options, data, ord
hidden = function() return not (not data.useAdjustededMin and data.useAdjustededMax) end,
};
options.useAdjustededMax = {
options.useAdjustedMax = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Set Maximum Progress"],
@@ -505,9 +505,9 @@ function WeakAuras.regionPrototype.modify(parent, region, data)
if (defaultsForRegion and defaultsForRegion.alpha) then
region:SetRegionAlpha(data.alpha);
end
local hasAdjustedMin = defaultsForRegion and defaultsForRegion.useAdjustededMin ~= nil and data.useAdjustededMin
local hasAdjustedMin = defaultsForRegion and defaultsForRegion.useAdjustedMin ~= nil and data.useAdjustededMin
and data.adjustedMin;
local hasAdjustedMax = defaultsForRegion and defaultsForRegion.useAdjustededMax ~= nil and data.useAdjustededMax
local hasAdjustedMax = defaultsForRegion and defaultsForRegion.useAdjustedMax ~= nil and data.useAdjustededMax
and data.adjustedMax;
region.adjustedMin = nil
@@ -707,8 +707,8 @@ end
-- Expand/Collapse function
function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, parent, parentRegionType)
local id = data.id
local indynamicgroup = parentRegionType == "dynamicgroup";
local ingroup = parentRegionType == "group";
local inDynamicGroup = parentRegionType == "dynamicgroup";
local inGroup = parentRegionType == "group";
local startMainAnimation = function()
WeakAuras.Animate("display", data, "main", data.animation.main, region, false, nil, true, cloneId);
@@ -730,7 +730,7 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
end
local hideRegion;
if(indynamicgroup) then
if(inDynamicGroup) then
hideRegion = function()
if region.PreHide then
region:PreHide()
@@ -761,7 +761,7 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
end
end
if(indynamicgroup) then
if(inDynamicGroup) then
function region:Collapse()
if (not region.toShow) then
return;
@@ -816,7 +816,7 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
hideRegion();
end
if ingroup then
if inGroup then
parent:UpdateBorder(region);
end
@@ -853,7 +853,7 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
startMainAnimation();
end
if ingroup then
if inGroup then
parent:UpdateBorder(region);
end
+3 -3
View File
@@ -91,7 +91,7 @@ local function animRotate(object, degrees, anchor)
end
-- Something to rotate
if object.animationGroup or degrees ~= 0 then
-- Create AnimatioGroup and rotation animation
-- Create AnimationGroup and rotation animation
object.animationGroup = object.animationGroup or object:CreateAnimationGroup();
local group = object.animationGroup;
group.rotate = group.rotate or group:CreateAnimation("rotation");
@@ -150,8 +150,8 @@ local function create()
-- WOW's layout system works best if frames and all their parents are anchored
-- In this case, it appears that a text doesn't get the right size on the initial
-- load with a custom font. (Though it works if the font is non-custom or after
-- a reloadui). Just moving the normal AnchorSubRegion to the start of modify was not enough
-- But anchoring the text to UIParent before reanchoring it correctly does seem to fix
-- a ReloadUI). Just moving the normal AnchorSubRegion to the start of modify was not enough
-- But anchoring the text to UIParent before re-anchoring it correctly does seem to fix
-- the issue. Also see #1778
text:SetPoint("CENTER", UIParent, "CENTER")
+6 -6
View File
@@ -746,25 +746,25 @@ local function recurseStringify(data, level, lines)
for k, v in pairs(data) do
local lineFormat = strrep(" ", level) .. "[%s] = %s"
local form1, form2, value
local ktype, vtype = type(k), type(v)
if ktype == "string" then
local kType, vType = type(k), type(v)
if kType == "string" then
form1 = "%q"
elseif ktype == "number" then
elseif kType == "number" then
form1 = "%d"
else
form1 = "%s"
end
if vtype == "string" then
if vType == "string" then
form2 = "%q"
v = v:gsub("\\", "\\\\"):gsub("\n", "\\n"):gsub("\"", "\\\"")
elseif vtype == "boolean" then
elseif vType == "boolean" then
v = tostring(v)
form2 = "%s"
else
form2 = "%s"
end
lineFormat = lineFormat:format(form1, form2)
if vtype == "table" then
if vType == "table" then
tinsert(lines, lineFormat:format(k, "{"))
recurseStringify(v, level + 1, lines)
tinsert(lines, strrep(" ", level) .. "},")
+51 -57
View File
@@ -722,38 +722,38 @@ function WeakAuras.GetActiveConditions(id, cloneId)
return triggerState[id].activatedConditions[cloneId];
end
local function formatValueForAssignment(vtype, value, pathToCustomFunction)
local function formatValueForAssignment(vType, value, pathToCustomFunction)
if (value == nil) then
value = false;
end
if (vtype == "bool") then
if (vType == "bool") then
return value and tostring(value) or "false";
elseif(vtype == "number") then
elseif(vType == "number") then
return value and tostring(value) or "0";
elseif (vtype == "list") then
elseif (vType == "list") then
return type(value) == "string" and string.format("%q", value) or "nil";
elseif(vtype == "color") then
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
elseif(vType == "chat") then
if (value and type(value) == "table") then
return string.format("{message_type = %q, message = %q, message_dest = %q, message_channel = %q, message_custom = %s}",
tostring(value.message_type), tostring(value.message or ""),
tostring(value.message_dest), tostring(value.message_channel),
pathToCustomFunction);
end
elseif(vtype == "sound") then
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
elseif(vType == "customcode") then
return string.format("%s", pathToCustomFunction);
elseif vtype == "glowexternal" then
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},
@@ -869,7 +869,7 @@ local function CreateTestForCondition(input, allConditionsTemplate, usedStates)
usedStates[trigger] = true;
local conditionTemplate = allConditionsTemplate[trigger] and allConditionsTemplate[trigger][variable];
local ctype = conditionTemplate and conditionTemplate.type;
local cType = conditionTemplate and conditionTemplate.type;
local test = conditionTemplate and conditionTemplate.test;
local stateCheck = "state[" .. trigger .. "] and state[" .. trigger .. "].show and ";
@@ -882,27 +882,27 @@ local function CreateTestForCondition(input, allConditionsTemplate, usedStates)
local opString = type(op) == "string" and "[[" .. op .. "]]" or op;
check = "state and WeakAuras.CallCustomConditionTest(" .. testFunctionNumber .. ", state[" .. trigger .. "], " .. valueString .. ", " .. (opString or "nil") .. ")";
end
elseif (ctype == "number" and op) then
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
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
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
elseif (cType == "bool") then
local rightSide = value == 0 and "false" or "true";
check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]." .. variable .. "==" .. rightSide
elseif (ctype == "string") then
elseif (cType == "string") then
if(op == "==") then
check = stateCheck .. stateVariableCheck .. "state[" .. trigger .. "]." .. variable .. " == [[" .. value .. "]]";
elseif (op == "find('%s')") then
@@ -912,7 +912,7 @@ local function CreateTestForCondition(input, allConditionsTemplate, usedStates)
end
end
if (ctype == "timer" and value) then
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";
@@ -1339,8 +1339,8 @@ end
function WeakAuras.RegisterForGlobalConditions(id)
local data = WeakAuras.GetData(id);
for event, conditonFunctions in pairs(dynamicConditions) do
conditonFunctions.id = nil;
for event, conditionFunctions in pairs(dynamicConditions) do
conditionFunctions.id = nil;
end
local register = {};
@@ -1462,9 +1462,9 @@ WeakAuras.frames["LDB Tooltip Updater"] = tooltip_update_frame;
local function getAnchors(frame)
local x, y = frame:GetCenter()
if not x or not y then return "CENTER" end
local hhalf = (x > UIParent:GetWidth()*2/3) and "RIGHT" or (x < UIParent:GetWidth()/3) and "LEFT" or ""
local vhalf = (y > UIParent:GetHeight()/2) and "TOP" or "BOTTOM"
return vhalf..hhalf, frame, (vhalf == "TOP" and "BOTTOM" or "TOP")..hhalf
local hHalf = (x > UIParent:GetWidth()*2/3) and "RIGHT" or (x < UIParent:GetWidth()/3) and "LEFT" or ""
local vHalf = (y > UIParent:GetHeight()/2) and "TOP" or "BOTTOM"
return vHalf..hHalf, frame, (vHalf == "TOP" and "BOTTOM" or "TOP")..hHalf
end
local Broker_WeakAuras;
@@ -3709,7 +3709,7 @@ function WeakAuras.SyncParentChildRelationships(silent)
-- 1. Find all auras where data.parent ~= nil or data.controlledChildren ~= nil
-- If an aura has both, then remove data.parent
-- If an aura has data.parent which doesn't exist, then remove data.parent
-- If an aura has data.parent which doesn't have data.controledChildren, then remove data.parent
-- If an aura has data.parent which doesn't have data.controlledChildren, then remove data.parent
-- 2. For each aura with data.controlledChildren, iterate through the list of children and remove entries where:
-- The child doesn't exist in the database
-- The child ID is duplicated in data.controlledChildren (only the first will be kept)
@@ -4448,9 +4448,10 @@ function WeakAuras.ReleaseClone(id, cloneId, regionType)
clonePool[regionType][#clonePool[regionType] + 1] = region;
end
function WeakAuras.HandleChatAction(message_type, message, message_dest, message_channel, r, g, b, region, customFunc)
function WeakAuras.HandleChatAction(message_type, message, message_dest, message_channel, r, g, b, region, customFunc, when)
local useHiddenStates = when == "finish"
if (message:find('%%')) then
message = WeakAuras.ReplacePlaceHolders(message, region, customFunc);
message = WeakAuras.ReplacePlaceHolders(message, region, customFunc, useHiddenStates);
end
if(message_type == "PRINT") then
DEFAULT_CHAT_FRAME:AddMessage(message, r or 1, g or 1, b or 1);
@@ -4466,23 +4467,13 @@ function WeakAuras.HandleChatAction(message_type, message, message_dest, message
pcall(function() SendChatMessage(message, "WHISPER", nil, message_dest) end);
end
end
elseif(message_type == "CHANNEL") then
local channel = message_channel and tonumber(message_channel);
if(GetChannelName(channel)) then
pcall(function() SendChatMessage(message, "CHANNEL", nil, channel) end);
end
elseif(message_type == "SMARTRAID") then
local isInstanceGroup = IsInGroup(LE_PARTY_CATEGORY_INSTANCE)
if UnitInBattleground("player") then
pcall(function() SendChatMessage(message, "CHAT_MSG_BATTLEGROUND") end)
elseif UnitInRaid("player") then
pcall(function() SendChatMessage(message, "RAID") end)
elseif UnitInParty("player") then
if isInstanceGroup then
pcall(function() SendChatMessage(message, "CHAT_MSG_BATTLEGROUND") end)
else
pcall(function() SendChatMessage(message, "PARTY") end)
end
pcall(function() SendChatMessage(message, "PARTY") end)
else
if IsInInstance() then
pcall(function() SendChatMessage(message, "SAY") end)
@@ -4695,7 +4686,7 @@ function WeakAuras.PerformActions(data, when, region)
if(actions.do_message and actions.message_type and actions.message) then
local customFunc = WeakAuras.customActionsFunctions[data.id][when .. "_message"];
WeakAuras.HandleChatAction(actions.message_type, actions.message, actions.message_dest, actions.message_channel, actions.r, actions.g, actions.b, region, customFunc);
WeakAuras.HandleChatAction(actions.message_type, actions.message, actions.message_dest, actions.message_channel, actions.r, actions.g, actions.b, region, customFunc, when);
end
if (actions.stop_sound) then
@@ -5899,11 +5890,12 @@ local function evaluateTriggerStateTriggers(id)
result = true;
else
if (triggerState[id].disjunctive == "custom" and triggerState[id].triggerLogicFunc) then
local ok
ok, result = pcall(triggerState[id].triggerLogicFunc, triggerState[id].triggers);
local ok, returnValue = pcall(triggerState[id].triggerLogicFunc, triggerState[id].triggers);
if not ok then
geterrorhandler()(result)
geterrorhandler()(returnValue)
result = false
else
result = returnValue
end
end
end
@@ -6121,7 +6113,7 @@ local function ReplaceValuePlaceHolders(textStr, region, customFunc, state)
end
-- States:
-- 0 Normal state, text is just appened to result. Can transition to percent start state 1 via %
-- 0 Normal state, text is just appended to result. Can transition to percent start state 1 via %
-- 1 Percent start state, entered via %. Can transition to via { to braced, via % to normal, AZaz09 to percent rest state
-- 2 Percent rest state, stay in it via AZaz09, transition to normal on anything else
-- 3 Braced state, } transitions to normal, everything else stay in braced state
@@ -6233,31 +6225,33 @@ function WeakAuras.ContainsAnyPlaceHolders(textStr)
return ContainsPlaceHolders(textStr, function(symbol) return true end)
end
local function ValueForSymbol(symbol, region, customFunc, regionState, regionStates)
local function ValueForSymbol(symbol, region, customFunc, regionState, regionStates, useHiddenStates)
local triggerNum, sym = string.match(symbol, "(.+)%.(.+)")
triggerNum = triggerNum and tonumber(triggerNum)
if triggerNum and sym then
if regionStates and regionStates[triggerNum] then
if regionStates[triggerNum][sym] then
return tostring(regionStates[triggerNum][sym]) or ""
else
local value = ReplaceValuePlaceHolders(sym, region, customFunc, regionStates[triggerNum]);
return value or ""
if regionStates[triggerNum] then
if (useHiddenStates or regionStates[triggerNum].show) then
if regionStates[triggerNum][sym] then
return tostring(regionStates[triggerNum][sym]) or ""
else
local value = ReplaceValuePlaceHolders(sym, region, customFunc, regionStates[triggerNum]);
return value or ""
end
end
end
return ""
elseif regionState and regionState[symbol] then
return regionState.show and tostring(regionState[symbol]) or ""
elseif regionState[symbol] then
return (useHiddenStates or regionState.show) and tostring(regionState[symbol]) or ""
else
local value = regionState and ReplaceValuePlaceHolders(symbol, region, customFunc, regionState);
local value = (useHiddenStates or regionState.show) and ReplaceValuePlaceHolders(symbol, region, customFunc, regionState);
return value or ""
end
end
function WeakAuras.ReplacePlaceHolders(textStr, region, customFunc)
function WeakAuras.ReplacePlaceHolders(textStr, region, customFunc, useHiddenStates)
local regionValues = region.values;
local regionState = region.state;
local regionStates = region.states;
local regionState = region.state or {};
local regionStates = region.states or {};
if (not regionState and not regionValues) then
return;
end
@@ -6269,7 +6263,7 @@ function WeakAuras.ReplacePlaceHolders(textStr, region, customFunc)
if (endPos == 2) then
if string.byte(textStr, 1) == 37 then
local value = ReplaceValuePlaceHolders(string.sub(textStr, 2), region, customFunc, regionState);
local value = (regionState.show or useHiddenStates) and ReplaceValuePlaceHolders(string.sub(textStr, 2), region, customFunc, regionState);
if (value) then
textStr = tostring(value);
end
@@ -6307,7 +6301,7 @@ function WeakAuras.ReplacePlaceHolders(textStr, region, customFunc)
-- 0-9a-zA-Z or dot character
else -- End of variable
local symbol = string.sub(textStr, start, currentPos - 1)
result = result .. ValueForSymbol(symbol, region, customFunc, regionState, regionStates)
result = result .. ValueForSymbol(symbol, region, customFunc, regionState, regionStates, useHiddenStates)
if char == 37 then
else
@@ -6317,7 +6311,7 @@ function WeakAuras.ReplacePlaceHolders(textStr, region, customFunc)
elseif state == 3 then
if char == 125 then -- } closing brace
local symbol = string.sub(textStr, start, currentPos - 1)
result = result .. ValueForSymbol(symbol, region, customFunc, regionState, regionStates)
result = result .. ValueForSymbol(symbol, region, customFunc, regionState, regionStates, useHiddenStates)
start = currentPos + 1
end
end
@@ -6446,7 +6440,7 @@ local function ensureMouseFrame()
local optionsFrame = WeakAuras.OptionsFrame();
local yOffset = (optionsFrame:GetTop() + optionsFrame:GetBottom()) / 2;
local xOffset = xPositionNextToOptions();
-- We use the top right, because the main frame usees the top right as the reference too
-- We use the top right, because the main frame uses the top right as the reference too
mouseFrame:ClearAllPoints();
mouseFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset - GetScreenWidth(), yOffset - GetScreenHeight());
end
+2 -2
View File
@@ -1,7 +1,7 @@
## Interface: 80300
## Interface: 30300
## Title: WeakAuras 2
## Author: Mirrored and the WeakAuras Team
## Version: 2.17.4
## Version: 2.17.5
## Notes: A powerful, comprehensive utility for displaying graphics and information based on buffs, debuffs, and other triggers.
## Notes-esES: Potente y completa aplicación que te permitirá mostrar por pantalla múltiples diseños, basados en beneficios, perjuicios y otros activadores.
## Notes-deDE: Ein leistungsfähiges, umfassendes Addon zur grafischen Darstellung von Informationen von Auren, Cooldowns, Timern und vielem mehr.