Scan nameplateN unit tokens for /target candidates, not SuperWoW WorldFrame

The /target candidate search's last SuperWoW-gated block walked WorldFrame
children and scraped GUIDs via pcall(frame.GetName, frame, 1). ClassicAPI now
provides modern nameplateN unit tokens that work with UnitExists/UnitCanAttack/
TargetUnit directly, so it collapses to iterating nameplate1..40 -- no SuperWoW
dependency, no WorldFrame hackery, and it also picks up default vanilla
nameplates. Scans the full range since assigned slots can be sparse.
This commit is contained in:
Brues
2026-07-28 00:00:51 -05:00
parent 7ecb66a8dc
commit 403567b381
+10 -14
View File
@@ -2845,20 +2845,16 @@ function CleveRoids.DoTarget(msg)
addCandidate(focusTok .. "target")
end
if CleveRoids.hasSuperwow then
local numChildren = WorldFrame:GetNumChildren()
local children = { WorldFrame:GetChildren() }
for i = 1, numChildren do
local frame = children[i]
if frame and frame:IsVisible() then
local success, guid = pcall(frame.GetName, frame, 1)
if success and guid and type(guid) == "string" and string.len(guid) > 0 then
if UnitExists(guid) then
addCandidate(guid)
end
end
end
-- Visible nameplates as targeting candidates, via ClassicAPI's nameplateN
-- unit tokens -- no SuperWoW WorldFrame child-walk / GUID scrape, and covers
-- default vanilla nameplates too. Slots are sparse (a removed plate leaves
-- its slot vacant until reused), so scan the full range rather than breaking
-- on the first gap; UnitExists returns false cleanly for a free/out-of-range
-- slot.
for i = 1, 40 do
local plate = "nameplate" .. i
if UnitExists(plate) then
addCandidate(plate)
end
end