From 2157fbc553281fca8a9644068526a1dda9738ed3 Mon Sep 17 00:00:00 2001 From: NoM0Re Date: Tue, 25 Feb 2025 21:16:08 +0100 Subject: [PATCH] Fix dynamic group icons scaling issue, ensure class & spec load on login, reworked queued actions dynamic group icons used incorrectly parent scale, even without set --- WeakAuras/BuffTrigger2.lua | 2 +- WeakAuras/GenericTrigger.lua | 55 ----------------------- WeakAuras/Prototypes.lua | 21 +++++---- WeakAuras/RegionTypes/DynamicGroup.lua | 6 ++- WeakAuras/RegionTypes/RegionPrototype.lua | 2 +- 5 files changed, 18 insertions(+), 68 deletions(-) diff --git a/WeakAuras/BuffTrigger2.lua b/WeakAuras/BuffTrigger2.lua index 821a8b9..a8a8587 100644 --- a/WeakAuras/BuffTrigger2.lua +++ b/WeakAuras/BuffTrigger2.lua @@ -112,7 +112,7 @@ local function UnitExistsFixed(unit) if #unit > 9 and unit:sub(1, 9) == "nameplate" then return nameplateExists[unit] or false end - return UnitExists(unit) or UnitGUID(unit) or false + return (UnitExists(unit) and UnitGUID(unit)) or false end local function UnitIsVisibleFixed(unit) diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 082c284..af571d9 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -3690,61 +3690,6 @@ function WeakAuras.RegisterItemCountWatch() end end --- Queued Action -do - local GetActionInfo, GetMacroSpell, GetSpellLink = GetActionInfo, GetMacroSpell, GetSpellLink - - local queuedActionFrame = nil - local buttonIDList = {} - local spellIDList = {} - - local function GetActionSpellID(slot) - local actionType, id, _, spellId = GetActionInfo(slot) - if actionType == "spell" then - return spellId - elseif actionType == "macro" then - local name, rank = GetMacroSpell(id) - if name then - local spellLink = GetSpellLink(name, rank or "") - if spellLink then - return tonumber(spellLink:match("spell:(%d+)")) - end - end - end - end - - function WeakAuras.WatchQueuedAction() - if not(queuedActionFrame) then - queuedActionFrame = CreateFrame("Frame"); - Private.frames["Queued Action Frame"] = queuedActionFrame - for slotID = 1, 120 do - local spellID = GetActionSpellID(slotID) - if spellID then - buttonIDList[slotID] = spellID - spellIDList[spellID] = slotID - end - end - end - queuedActionFrame:RegisterEvent("ACTIONBAR_SLOT_CHANGED") - queuedActionFrame:SetScript("OnEvent", function(_, _, slotID) - Private.StartProfileSystem("generictrigger queued action"); - local spellID = GetActionSpellID(slotID) - if spellID then - buttonIDList[slotID] = spellID - spellIDList[spellID] = slotID - elseif buttonIDList[slotID] then - spellIDList[buttonIDList[slotID]] = nil - buttonIDList[slotID] = nil - end - Private.StopProfileSystem("generictrigger queued action"); - end) - end - - function WeakAuras.FindSpellActionButtons(spellID) - return spellIDList[spellID] - end -end - -- LibSpecWrapper -- We always register, because it's probably not that often called, and ScanEvents checks -- early if anyone wants the event diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index c545f10..0609332 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -1038,7 +1038,7 @@ Private.load_prototype = { type = "multiselect", values = "spec_types_all", test = "WeakAuras.CheckClassSpec(class, %s)", - events = {"UNIT_SPEC_CHANGED_player"}, + events = {"UNIT_SPEC_CHANGED_player", "WA_DELAYED_PLAYER_ENTERING_WORLD"}, }, { name = "talent", @@ -4841,7 +4841,7 @@ Private.event_prototypes = { ["Class/Spec"] = { type = "unit", events = {}, - internal_events = { "UNIT_SPEC_CHANGED_player" }, + internal_events = {"UNIT_SPEC_CHANGED_player", "WA_DELAYED_PLAYER_ENTERING_WORLD"}, name = L["Class and Specialization"], init = function(trigger) local class = select(2, UnitClass("player")) or "UNKNOWN" @@ -7718,15 +7718,18 @@ Private.event_prototypes = { "ACTIONBAR_PAGE_CHANGED" }, name = L["Queued Action"], - loadFunc = function() - WeakAuras.WatchQueuedAction() - end, init = function(trigger) trigger.spellName = trigger.spellName or 0 + local spellName + if trigger.use_exact_spellName then + spellName = trigger.spellName + else + spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName + end local ret = [=[ - local button = WeakAuras.FindSpellActionButtons(%d) + local spellname = %q ]=] - return ret:format(trigger.spellName) + return ret:format(spellName) end, args = { { @@ -7735,11 +7738,11 @@ Private.event_prototypes = { display = L["Spell"], type = "spell", test = "true", - forceExactOption = true, + showExactOption = true, }, { hidden = true, - test = "button and IsCurrentAction(button)"; + test = "spellname and IsCurrentSpell(spellname)"; }, }, iconFunc = function(trigger) diff --git a/WeakAuras/RegionTypes/DynamicGroup.lua b/WeakAuras/RegionTypes/DynamicGroup.lua index 93380f3..aa184a5 100644 --- a/WeakAuras/RegionTypes/DynamicGroup.lua +++ b/WeakAuras/RegionTypes/DynamicGroup.lua @@ -97,7 +97,7 @@ end local function releaseControlPoint(self, controlPoint) controlPoint:Hide() - controlPoint:ClearAnchorPoint() + controlPoint:SetAnchorPoint(self.parent.selfPoint) local regionData = controlPoint.regionData if regionData then if self.parent.anchorPerUnit == "UNITFRAME" then @@ -1391,9 +1391,11 @@ local function modify(parent, region, data) end if parent and parent.IsObjectType and parent:IsObjectType("Frame") then controlPoint:SetParent(parent) + controlPoint:SetScale(data.scale and data.scale > 0 and data.scale <= 10 and data.scale or 1) end else controlPoint:SetParent(self) + controlPoint:SetScale(1) end local childData = controlPoint.regionData.data @@ -1536,7 +1538,7 @@ local function modify(parent, region, data) -- if self.dynamicAnchor then self:UpdateBorder(); return end Private.StartProfileSystem("dynamicgroup") Private.StartProfileAura(data.id) - local numVisible, minX, maxX, maxY, minY = 0 + local numVisible, minX, maxX, maxY, minY = 0, nil, nil, nil, nil for active, regionData in ipairs(self.sortedChildren) do if regionData.shown then numVisible = numVisible + 1 diff --git a/WeakAuras/RegionTypes/RegionPrototype.lua b/WeakAuras/RegionTypes/RegionPrototype.lua index f0240d0..65c215b 100644 --- a/WeakAuras/RegionTypes/RegionPrototype.lua +++ b/WeakAuras/RegionTypes/RegionPrototype.lua @@ -703,7 +703,7 @@ function Private.regionPrototype.create(region) region.RunCode = RunCode; region.GlowExternal = GlowExternal; - --region.ReAnchor = UpdatePosition; https://github.com/WeakAuras/WeakAuras2/commit/7859d5e + region.ReAnchor = UpdatePosition; region.SetAnchor = SetAnchor; region.SetOffset = SetOffset; region.SetXOffset = SetXOffset;