From 3b5283cbd4808107fbc52d00c0e63de2d831397b Mon Sep 17 00:00:00 2001 From: macillespretorious-lgtm Date: Thu, 6 Aug 2026 23:34:12 +0100 Subject: [PATCH 1/3] Fix summon/target buttons silently doing nothing Two independent bugs, both confirmed via live testing in an 11-person raid on the current Classic Era client: 1. RaidSummon:getRaidMembers() assumed GetRaidRosterInfo(i)'s loop index equals the "raidN" unit token. These are different, only coincidentally-aligned numbering systems (roster list position vs actual subgroup slot), so the wrong unit could get targeted depending on raid composition. Fixed by resolving the real unit token via UnitName("raid"..u) matching instead. 2. RaidSummon_NameListButton's SecureActionButtonTemplate silently fails to dispatch type1/type2 macro actions on the current client -- PostClick fires but the underlying secure click action never executes, with no error. Confirmed via an isolated A/B test: two otherwise-identical buttons differing only in template: the SecureActionButtonTemplate one did nothing, an otherwise identical SecureUnitButtonTemplate one worked correctly. Fixed by switching the button's inherited template. Also included: GetAddOnMetadata moved to C_AddOns on the current client with no compatibility shim; added a fallback local. As a side effect of fixing bug 2, attribute staging was moved from PreClick (re-staged every click) into UpdateList (staged once when the list is built). This also means buttons stay clickable mid-combat using whatever was staged before the pull, since SetAttribute is no longer called during PreClick. --- RaidSummon/RaidSummon.lua | 78 +++++++++++++++++++++++++-------------- RaidSummon/RaidSummon.xml | 6 ++- 2 files changed, 55 insertions(+), 29 deletions(-) diff --git a/RaidSummon/RaidSummon.lua b/RaidSummon/RaidSummon.lua index 810d21c..fc857cd 100644 --- a/RaidSummon/RaidSummon.lua +++ b/RaidSummon/RaidSummon.lua @@ -1,5 +1,8 @@ RaidSummon = LibStub("AceAddon-3.0"):NewAddon("RaidSummon", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0", "AceComm-3.0") local L = LibStub("AceLocale-3.0"):GetLocale("RaidSummon", true) +-- Classic Era's latest patch moved GetAddOnMetadata to C_AddOns; fall +-- back to the old global for clients that haven't made the switch. +local GetAddOnMetadata = (C_AddOns and C_AddOns.GetAddOnMetadata) or GetAddOnMetadata --set options local options = { @@ -449,27 +452,13 @@ function RaidSummon:NameListButton_PreClick(source, button) RaidSummon:getRaidMembers() - if RaidSummonRaidMembersDB then - for i, v in ipairs (RaidSummonRaidMembersDB) do - if v.rName == name then - raidIndex = "raid"..v.rIndex - end - end - - if raidIndex then - --set target when not in combat (securetemplate) - if not InCombatLockdown() then - if RaidSummonRaidMembersDB then - source:SetAttribute("type1", "target") - source:SetAttribute("unit", raidIndex) - end - source:SetAttribute("type2", "spell") - source:SetAttribute("spell", "698") --698 - Ritual of Summoning - else - print(L["Lockdown"]) - end - end - end + -- Secure attributes (type1/macrotext1/type2/macrotext2) are staged + -- once in UpdateList() when the button's name/text is set, not here. + -- Re-staging in PreClick on every click did not reliably take effect + -- in time for the same click to use. Attributes staged before combat + -- remain valid through combat, so clicking still works mid-fight + -- even though UpdateList() itself can't restage anything new while + -- InCombatLockdown() is true. if buttonName == "RightButton" and targetname ~= nil and not InCombatLockdown() then @@ -567,14 +556,33 @@ function RaidSummon:UpdateList() end if not InCombatLockdown() then - _G["RaidSummon_NameList"..i]:Show() + -- Stage secure attributes here, once, when the list is + -- built, rather than inside a PreClick handler on every + -- click. Re-staging in PreClick (the old approach) did not + -- reliably take effect in time for the same click to use. + local btn = _G["RaidSummon_NameList"..i] + local rName = RaidSummonBrowseDB[i].rName + local ritualSpellName = GetSpellInfo(698) --698 - Ritual of Summoning + btn:SetAttribute("unit", nil) + btn:SetAttribute("type1", "macro") + btn:SetAttribute("macrotext1", "/target "..rName) + if ritualSpellName then + btn:SetAttribute("type2", "macro") + btn:SetAttribute("macrotext2", "/target "..rName.."\n/cast "..ritualSpellName) + end + btn:Show() else RaidSummon:UpdateListCombatCheck() end else if not InCombatLockdown() then _G["RaidSummon_NameList"..i.."TextName"]:SetText("") - _G["RaidSummon_NameList"..i]:Hide() + local btn = _G["RaidSummon_NameList"..i] + btn:SetAttribute("type1", nil) + btn:SetAttribute("macrotext1", nil) + btn:SetAttribute("type2", nil) + btn:SetAttribute("macrotext2", nil) + btn:Hide() else RaidSummon:UpdateListCombatCheck() end @@ -605,15 +613,29 @@ function RaidSummon:getRaidMembers() if (members > 0) then RaidSummonRaidMembersDB = {} + -- GetRaidRosterInfo(i)'s index is the roster LIST position, + -- which is not guaranteed to match the "raidN" unit token + -- (actual subgroup slot). They only coincidentally line up + -- for some raid compositions. Resolve rIndex from the actual + -- unit token instead of trusting the roster-list position. for i = 1, members do local rName, rRank, rSubgroup, rLevel, rClass, rfileName = GetRaidRosterInfo(i) if rName and rClass and rfileName then - RaidSummonRaidMembersDB[i] = {} - RaidSummonRaidMembersDB[i].rIndex = i - RaidSummonRaidMembersDB[i].rName = rName - RaidSummonRaidMembersDB[i].rClass = rClass - RaidSummonRaidMembersDB[i].rfileName = rfileName + local unitToken + for u = 1, MAX_RAID_MEMBERS do + if UnitName("raid"..u) == rName then + unitToken = u + break + end + end + if unitToken then + RaidSummonRaidMembersDB[i] = {} + RaidSummonRaidMembersDB[i].rIndex = unitToken + RaidSummonRaidMembersDB[i].rName = rName + RaidSummonRaidMembersDB[i].rClass = rClass + RaidSummonRaidMembersDB[i].rfileName = rfileName + end end end end diff --git a/RaidSummon/RaidSummon.xml b/RaidSummon/RaidSummon.xml index 20158c4..e8bb7ad 100644 --- a/RaidSummon/RaidSummon.xml +++ b/RaidSummon/RaidSummon.xml @@ -1,5 +1,9 @@ -