focus: add swapfocus command

This commit is contained in:
shagu
2019-04-22 13:44:19 +02:00
parent 6c6aaacd83
commit 0d0fb10c2f
2 changed files with 15 additions and 2 deletions
+1
View File
@@ -31,6 +31,7 @@ This is **not** an addon-pack like [ShaguUI](http://shagu.org/ShaguUI/), however
/focus Creates a Focus-Frame for the current target
/castfocus Same as /cast but for focus frame
/clearfocus Clears the Focus-Frame
/swapfocus Toggle Focus and Target-Frame
/abp Addon Button Panel
## Languages
+14 -2
View File
@@ -1,4 +1,4 @@
SLASH_PFFOCUS1 = '/focus'
SLASH_PFFOCUS1, SLASH_PFFOCUS2 = '/focus', '/pffocus'
function SlashCmdList.PFFOCUS(msg)
if not pfUI.uf or not pfUI.uf.focus then return end
@@ -13,7 +13,7 @@ function SlashCmdList.PFFOCUS(msg)
end
end
SLASH_PFCLEARFOCUS1 = '/clearfocus'
SLASH_PFCLEARFOCUS1, SLASH_PFCLEARFOCUS2 = '/clearfocus', '/pfclearfocus'
function SlashCmdList.PFCLEARFOCUS(msg)
if pfUI.uf and pfUI.uf.focus then
pfUI.uf.focus:Hide()
@@ -65,6 +65,18 @@ function SlashCmdList.PFCASTFOCUS(msg)
end
end
SLASH_PFSWAPFOCUS1, SLASH_PFSWAPFOCUS2 = '/swapfocus', '/pfswapfocus'
function SlashCmdList.PFSWAPFOCUS(msg)
if not pfUI.uf or not pfUI.uf.focus then return end
local oldunit = UnitExists("target") and strlower(UnitName("target"))
if oldunit and pfUI.uf.focus.unitname then
TargetByName(pfUI.uf.focus.unitname)
pfUI.uf.focus.unitname = oldunit
pfUI.uf.focus:Show()
end
end
pfUI:RegisterModule("focus", function ()
-- do not go further on disabled UFs
if C.unitframes.disable == "1" then return end