diff --git a/api/unitframes.lua b/api/unitframes.lua index 33e7188d..3ed7ce44 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -19,10 +19,9 @@ function pfUI.uf.ClearGuidTracking() end -- slash command to toggle unitframe test mode -_G.SLASH_PFTEST1, _G.SLASH_PFTEST2 = "/pftest", "/pfuftest" -_G.SlashCmdList.PFTEST = function() +pfUI.api.RegisterSlashCommand("PFTEST", { "/pftest", "/pfuftest" }, function() pfUI.uf.showall = not pfUI.uf.showall -end +end, true) -- HoT buff indicators that need name verification because their icons are -- reused by other spells. Maps icon (lowercased) → expected aura name + @@ -3015,9 +3014,7 @@ end -- ============================================================================ -- Slash Commands for Stats Frame -- ============================================================================ -_G.SLASH_PFUISTATS1 = "/pfuistats" -_G.SLASH_PFUISTATS2 = "/ufstats" -_G.SlashCmdList["PFUISTATS"] = function(msg) +pfUI.api.RegisterSlashCommand("PFUISTATS", { "/pfuistats", "/ufstats" }, function(msg) msg = string.lower(msg or "") if not pfUI.uf.stats then @@ -3069,4 +3066,4 @@ _G.SlashCmdList["PFUISTATS"] = function(msg) end end end -end \ No newline at end of file +end, true) \ No newline at end of file diff --git a/modules/addonbuttons.lua b/modules/addonbuttons.lua index a05bbe86..431c03ad 100644 --- a/modules/addonbuttons.lua +++ b/modules/addonbuttons.lua @@ -440,6 +440,5 @@ pfUI:RegisterModule("addonbuttons", function () pfUI.addonbuttons:UpdateConfig() - _G.SLASH_PFABP1, _G.SLASH_PFABP2 = "/abp", "/pfabp" - _G.SlashCmdList.PFABP = ManualAddOrRemove + pfUI.api.RegisterSlashCommand("PFABP", { "/abp", "/pfabp" }, ManualAddOrRemove, true) end) diff --git a/modules/farmmode.lua b/modules/farmmode.lua index 2bfc63a8..6a95e28a 100644 --- a/modules/farmmode.lua +++ b/modules/farmmode.lua @@ -25,8 +25,7 @@ pfUI:RegisterModule("farmmode", function () Minimap_ZoomOut() end - _G.SLASH_PFFARMMAP1, _G.SLASH_PFFARMMAP2 = "/farm", "/farmmode" - _G.SlashCmdList.PFFARMMAP = ToggleFarmMode + pfUI.api.RegisterSlashCommand("PFFARMMAP", { "/farm", "/farmmode" }, ToggleFarmMode, true) pfUI.farmmap = CreateFrame("Minimap", "pfFarmMap", UIParent) pfUI.farmmap:Hide() diff --git a/modules/focus.lua b/modules/focus.lua index abacb340..ee6e395a 100644 --- a/modules/focus.lua +++ b/modules/focus.lua @@ -30,8 +30,7 @@ end) -- /focusname is pfUI-specific because the engine has no name→GUID -- lookup for off-screen units — we resolve via a short target-swap. -SLASH_PFFOCUSNAME1, SLASH_PFFOCUSNAME2 = '/focusname', '/pffocusname' -function SlashCmdList.PFFOCUSNAME(msg) +pfUI.api.RegisterSlashCommand("PFFOCUSNAME", { '/focusname', '/pffocusname' }, function(msg) if msg == "" then return end local prevGUID = UnitGUID("target") @@ -61,10 +60,9 @@ function SlashCmdList.PFFOCUSNAME(msg) else ClearTarget() end -end +end, true) -SLASH_PFCASTFOCUS1, SLASH_PFCASTFOCUS2 = '/castfocus', '/pfcastfocus' -function SlashCmdList.PFCASTFOCUS(msg) +pfUI.api.RegisterSlashCommand("PFCASTFOCUS", { '/castfocus', '/pfcastfocus' }, function(msg) local focusGUID = UnitGUID("focus") if not focusGUID or focusGUID == "0x0000000000000000" then UIErrorsFrame:AddMessage(SPELL_FAILED_BAD_TARGETS, 1, 0, 0) @@ -105,10 +103,9 @@ function SlashCmdList.PFCASTFOCUS(msg) else TargetLastTarget() end -end +end, true) -SLASH_PFSWAPFOCUS1, SLASH_PFSWAPFOCUS2 = '/swapfocus', '/pfswapfocus' -function SlashCmdList.PFSWAPFOCUS(msg) +pfUI.api.RegisterSlashCommand("PFSWAPFOCUS", { '/swapfocus', '/pfswapfocus' }, function(msg) local targetGUID = UnitGUID("target") local oldFocusGUID = UnitGUID("focus") @@ -118,4 +115,4 @@ function SlashCmdList.PFSWAPFOCUS(msg) TargetUnit(oldFocusGUID) end end -end +end, true) diff --git a/modules/loothistory.lua b/modules/loothistory.lua index ebaa47ae..2a1a25cf 100644 --- a/modules/loothistory.lua +++ b/modules/loothistory.lua @@ -385,6 +385,5 @@ pfUI:RegisterModule("loothistory", function () pfUI.loothistory:SetShown(not pfUI.loothistory:IsShown()) end - _G.SLASH_PFLOOTHISTORY1, _G.SLASH_PFLOOTHISTORY2 = "/loothistory", "/pfloothistory" - _G.SlashCmdList.PFLOOTHISTORY = Toggle + pfUI.api.RegisterSlashCommand("PFLOOTHISTORY", { "/loothistory", "/pfloothistory" }, Toggle, true) end) diff --git a/modules/mouseover.lua b/modules/mouseover.lua index b2f675f1..6613956e 100644 --- a/modules/mouseover.lua +++ b/modules/mouseover.lua @@ -1,6 +1,5 @@ pfUI:RegisterModule("mouseover", function () - _G.SLASH_PFCAST1, _G.SLASH_PFCAST2 = "/pfcast", "/pfmouse" - function SlashCmdList.PFCAST(msg) + pfUI.api.RegisterSlashCommand("PFCAST", { "/pfcast", "/pfmouse" }, function(msg) local func = pfUI.api.TryMemoizedFuncLoadstringForSpellCasts(msg) local unit = "mouseover" @@ -30,5 +29,5 @@ pfUI:RegisterModule("mouseover", function () if restore_target then TargetUnit(unit) end func() if restore_target then TargetLastTarget() end - end + end, true) end) \ No newline at end of file diff --git a/modules/nampower.lua b/modules/nampower.lua index d8281d12..a2989368 100644 --- a/modules/nampower.lua +++ b/modules/nampower.lua @@ -150,9 +150,7 @@ pfUI:RegisterModule("nampower", function () -- /disenchantall slash command (DisenchantAll is Nampower-provided) if DisenchantAll then - _G.SLASH_PFDISENCHANTALL1 = "/disenchantall" - _G.SLASH_PFDISENCHANTALL2 = "/dea" - SlashCmdList["PFDISENCHANTALL"] = function(msg) + pfUI.api.RegisterSlashCommand("PFDISENCHANTALL", { "/disenchantall", "/dea" }, function(msg) -- DisenchantAll(itemIdOrName | quality, [includeSoulbound]). -- Quality is a string keyword ("greens", "blues", "purples", or pipe- -- combined). Numbers are interpreted as item IDs, not quality levels. @@ -161,7 +159,7 @@ pfUI:RegisterModule("nampower", function () local target = tonumber(arg) or arg DisenchantAll(target) DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: DisenchantAll(" .. tostring(target) .. ")") - end + end, true) end -- Druid Secondary Mana Bar diff --git a/modules/share.lua b/modules/share.lua index b3470489..2cd9f2f4 100644 --- a/modules/share.lua +++ b/modules/share.lua @@ -389,9 +389,8 @@ pfUI:RegisterModule("share", function () end) end - _G.SLASH_PFEXPORT1, _G.SLASH_PFEXPORT2, _G.SLASH_PFEXPORT3 = "/export", "/import", "/share" - function SlashCmdList.PFEXPORT(msg, editbox) + pfUI.api.RegisterSlashCommand("PFEXPORT", { "/export", "/import", "/share" }, function(msg, editbox) f:Show() - end + end, true) end end) diff --git a/modules/superwow.lua b/modules/superwow.lua index 7dba6e06..eedcbb91 100644 --- a/modules/superwow.lua +++ b/modules/superwow.lua @@ -2,8 +2,7 @@ -- https://github.com/balakethelock/SuperWoW -- DLL Status Check Command (always available) -SLASH_PFDLLSTATUS1 = "/pfdll" -SlashCmdList["PFDLLSTATUS"] = function() +pfUI.api.RegisterSlashCommand("PFDLLSTATUS", { "/pfdll" }, function() local chat = DEFAULT_CHAT_FRAME chat:AddMessage("|cff33ffccpfUI|r: DLL Status Check") @@ -43,7 +42,7 @@ SlashCmdList["PFDLLSTATUS"] = function() else chat:AddMessage(" |cffff0000Target frame|r: NOT found") end -end +end, true) pfUI:RegisterModule("superwow", function () if SetAutoloot and SpellInfo and not SUPERWOW_VERSION then @@ -173,12 +172,10 @@ pfUI:RegisterModule("superwow", function () end -- Add slash command for clickthrough toggle - _G.SLASH_PFCLICKTHROUGH1 = "/clickthrough" - _G.SLASH_PFCLICKTHROUGH2 = "/ct" - SlashCmdList["PFCLICKTHROUGH"] = function() + pfUI.api.RegisterSlashCommand("PFCLICKTHROUGH", { "/clickthrough", "/ct" }, function() local enabled = pfUI.api.ToggleClickthrough() DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: Clickthrough mode " .. (enabled and "|cff00ff00enabled|r" or "|cffff0000disabled|r")) - end + end, true) end end) \ No newline at end of file diff --git a/modules/unitxp.lua b/modules/unitxp.lua index 31b2639c..33a9ddf6 100644 --- a/modules/unitxp.lua +++ b/modules/unitxp.lua @@ -352,8 +352,7 @@ pfUI:RegisterModule("unitxp", function () end -- Debug command to test UnitXP indicators - _G.SLASH_PFUNITXP1 = "/pfunitxp" - SlashCmdList["PFUNITXP"] = function() + pfUI.api.RegisterSlashCommand("PFUNITXP", { "/pfunitxp" }, function() local chat = DEFAULT_CHAT_FRAME chat:AddMessage("|cff33ffccpfUI|r: UnitXP Indicator Debug") @@ -387,5 +386,5 @@ pfUI:RegisterModule("unitxp", function () else chat:AddMessage(" Target frame: |cffff0000NOT found|r") end - end + end, true) end) \ No newline at end of file