diff --git a/README.md b/README.md index 4964f2c1..95ed2c56 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/modules/focus.lua b/modules/focus.lua index ab183c74..66bebcb4 100644 --- a/modules/focus.lua +++ b/modules/focus.lua @@ -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