From 7e10a3670d90ab33ab905e9089ecb3b5a49f6311 Mon Sep 17 00:00:00 2001 From: Meow <30401521+me0wg4ming@users.noreply.github.com> Date: Mon, 16 Feb 2026 23:25:39 +0100 Subject: [PATCH] updated focus.lua to use directly CastSpellByName with arg2 updated focus.lua to use directly CastSpellByName with arg2 --- modules/focus.lua | 81 ++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 44 deletions(-) diff --git a/modules/focus.lua b/modules/focus.lua index 8e86eeaf..4719f919 100644 --- a/modules/focus.lua +++ b/modules/focus.lua @@ -90,59 +90,52 @@ function SlashCmdList.PFCASTFOCUS(msg) local focusGUID = pfUI.uf.focus.label local hasGUID = focusGUID and focusGUID ~= "" - -- Nampower path with GUID targeting (if available and we have GUID focus) - if hasGUID and CastSpellByNameNoQueue then - local _, currentGUID = nil, nil - if UnitExists then - _, currentGUID = UnitExists("target") - end - local player = UnitIsUnit("target", "player") - - -- Target focus by GUID - if TargetByGUID then - TargetByGUID(focusGUID) - else - -- Fallback: use GUID as unitstring (works on Turtle) + -- Nampower with NEW unitStr targeting support (no target toggle needed!) + if hasGUID and CastSpellByName then + if func then + -- For lua functions, we still need target toggle (function might use UnitName("target") etc) + local _, currentGUID = nil, nil + if UnitExists then + _, currentGUID = UnitExists("target") + end + local player = UnitIsUnit("target", "player") + + -- Target focus by GUID TargetUnit(focusGUID) - end - - -- Verify we actually targeted the focus - local _, targetGUID = nil, nil - if UnitExists then - _, targetGUID = UnitExists("target") - end - - if targetGUID ~= focusGUID then + + -- Verify we actually targeted the focus + local _, targetGUID = nil, nil + if UnitExists then + _, targetGUID = UnitExists("target") + end + + if targetGUID ~= focusGUID then + -- Restore original target and fail + if currentGUID then + TargetUnit(currentGUID) + elseif player then + TargetUnit("player") + else + TargetLastTarget() + end + UIErrorsFrame:AddMessage(SPELL_FAILED_BAD_TARGETS, 1, 0, 0) + return + end + + -- Execute function + func() + -- Restore original target - if currentGUID and TargetByGUID then - TargetByGUID(currentGUID) - elseif currentGUID then + if currentGUID then TargetUnit(currentGUID) elseif player then TargetUnit("player") else TargetLastTarget() end - UIErrorsFrame:AddMessage(SPELL_FAILED_BAD_TARGETS, 1, 0, 0) - return - end - - -- Execute the spell cast - if func then - func() else - CastSpellByNameNoQueue(msg) - end - - -- Restore original target - if currentGUID and TargetByGUID then - TargetByGUID(currentGUID) - elseif currentGUID then - TargetUnit(currentGUID) - elseif player then - TargetUnit("player") - else - TargetLastTarget() + -- Direct spell cast with GUID - NO TARGET TOGGLE! 🎉 + CastSpellByName(msg, focusGUID) end return