focus: add /castfocus command

This commit is contained in:
shagu
2018-09-06 20:34:00 +02:00
parent 6dad5edf93
commit 454f1806a0
2 changed files with 46 additions and 0 deletions
+1
View File
@@ -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
+45
View File
@@ -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