mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-04 20:50:01 +00:00
focus: add /castfocus command
This commit is contained in:
@@ -29,6 +29,7 @@ This is **not** an addon-pack like [ShaguUI](http://shagu.org/ShaguUI/), however
|
||||
/farm Toggles the Farm-Mode
|
||||
/pfcast Same as /cast but for mouseover units
|
||||
/focus Creates a Focus-Frame for the current target
|
||||
/castfocus Same as /cast but for focus frame
|
||||
/clearfocus Clears the Focus-Frame
|
||||
|
||||
## Languages
|
||||
|
||||
@@ -20,6 +20,51 @@ function SlashCmdList.PFCLEARFOCUS(msg)
|
||||
end
|
||||
end
|
||||
|
||||
SLASH_PFCASTFOCUS1 = '/castfocus'
|
||||
function SlashCmdList.PFCASTFOCUS(msg)
|
||||
if not pfUI.uf.focus or not pfUI.uf.focus:IsShown() or not pfUI.uf.focus.unitname then
|
||||
UIErrorsFrame:AddMessage(SPELL_FAILED_BAD_TARGETS, 1, 0, 0)
|
||||
return
|
||||
end
|
||||
|
||||
local skiptarget = false
|
||||
local player = UnitIsUnit("target", "player")
|
||||
|
||||
if pfUI.uf.focus.label and UnitIsUnit("target", pfUI.uf.focus.label .. pfUI.uf.focus.id) then
|
||||
skiptarget = true
|
||||
else
|
||||
pfScanActive = true
|
||||
if pfUI.uf.focus.label and pfUI.uf.focus.id then
|
||||
TargetUnit(pfUI.uf.focus.label .. pfUI.uf.focus.id)
|
||||
else
|
||||
TargetByName(pfUI.uf.focus.unitname)
|
||||
end
|
||||
|
||||
if strlower(UnitName("target")) ~= strlower(pfUI.uf.focus.unitname) then
|
||||
pfScanActive = nil
|
||||
TargetLastTarget()
|
||||
UIErrorsFrame:AddMessage(SPELL_FAILED_BAD_TARGETS, 1, 0, 0)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local func = loadstring(msg or "")
|
||||
if func then
|
||||
func()
|
||||
else
|
||||
CastSpellByName(msg)
|
||||
end
|
||||
|
||||
if skiptarget == false then
|
||||
pfScanActive = nil
|
||||
if player then
|
||||
TargetUnit("player")
|
||||
else
|
||||
TargetLastTarget()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pfUI:RegisterModule("focus", function ()
|
||||
-- do not go further on disabled UFs
|
||||
if C.unitframes.disable == "1" then return end
|
||||
|
||||
Reference in New Issue
Block a user