thirdparty: adapt supermacro to new actionbars

This commit is contained in:
shagu
2019-12-31 11:30:32 +01:00
parent 308087ca5f
commit 4f1a91bae0
+11 -17
View File
@@ -1149,25 +1149,23 @@ pfUI:RegisterModule("thirdparty", "vanilla", function ()
if C.thirdparty.supermacro.enable == "0" then return end if C.thirdparty.supermacro.enable == "0" then return end
if not pfUI.bars then return end if not pfUI.bars then return end
-- refresh super macro texture -- hook events to include SuperMacro refreshs
local function SMRefresh() local ButtonFullUpdate = pfUI.bars.ButtonFullUpdate
local slot = this:GetID() pfUI.bars.ButtonFullUpdate = function(button)
local text = GetActionText(slot) -- run the old function
ButtonFullUpdate(button)
-- update with SuperMacro textures
if not button then return end
local text = GetActionText(button:GetID())
if text then if text then
if _G.SM_ACTION_SPELL and _G.SM_ACTION_SPELL["regular"] and _G.SM_ACTION_SPELL["regular"][text] then if _G.SM_ACTION_SPELL and _G.SM_ACTION_SPELL["regular"] and _G.SM_ACTION_SPELL["regular"][text] then
this.icon:SetTexture(_G.SM_ACTION_SPELL["regular"][text].texture) button.icon:SetTexture(_G.SM_ACTION_SPELL["regular"][text].texture)
end end
end end
end end
-- hook events to include SuperMacro refreshs
local ButtonEvent = pfUI.bars[1][1]:GetScript("OnEvent")
local function NewButtonEvent()
ButtonEvent()
SMRefresh()
end
-- hook events to include SuperMacro refreshs -- hook events to include SuperMacro refreshs
local ButtonEnter = pfUI.bars[1][1]:GetScript("OnEnter") local ButtonEnter = pfUI.bars[1][1]:GetScript("OnEnter")
local function NewButtonEnter() local function NewButtonEnter()
@@ -1185,11 +1183,7 @@ pfUI:RegisterModule("thirdparty", "vanilla", function ()
-- trigger the event whenever SuperMacro got an update -- trigger the event whenever SuperMacro got an update
hooksecurefunc("SM_UpdateActionSpell", function() hooksecurefunc("SM_UpdateActionSpell", function()
for i=1,10 do for slot=1,120 do pfUI.bars.update[slot] = true end
for j=1,12 do
pfUI.bars[i][j].forceupdate = true
end
end
end) end)
end) end)