From 4f1a91bae0d0ec0fae5b97751c53c9b60836ff79 Mon Sep 17 00:00:00 2001 From: shagu Date: Tue, 31 Dec 2019 11:30:32 +0100 Subject: [PATCH] thirdparty: adapt supermacro to new actionbars --- modules/thirdparty.lua | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/modules/thirdparty.lua b/modules/thirdparty.lua index a9d4caf9..0b2d59d7 100644 --- a/modules/thirdparty.lua +++ b/modules/thirdparty.lua @@ -1149,25 +1149,23 @@ pfUI:RegisterModule("thirdparty", "vanilla", function () if C.thirdparty.supermacro.enable == "0" then return end if not pfUI.bars then return end - -- refresh super macro texture - local function SMRefresh() - local slot = this:GetID() - local text = GetActionText(slot) + -- hook events to include SuperMacro refreshs + local ButtonFullUpdate = pfUI.bars.ButtonFullUpdate + pfUI.bars.ButtonFullUpdate = function(button) + -- 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 _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 - -- 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 local ButtonEnter = pfUI.bars[1][1]:GetScript("OnEnter") local function NewButtonEnter() @@ -1185,11 +1183,7 @@ pfUI:RegisterModule("thirdparty", "vanilla", function () -- trigger the event whenever SuperMacro got an update hooksecurefunc("SM_UpdateActionSpell", function() - for i=1,10 do - for j=1,12 do - pfUI.bars[i][j].forceupdate = true - end - end + for slot=1,120 do pfUI.bars.update[slot] = true end end) end)