From 2d624f921c8b79f29846281068ba56de2d0ce768 Mon Sep 17 00:00:00 2001 From: shagu Date: Tue, 26 Sep 2017 08:39:18 +0200 Subject: [PATCH] actionbar: only run hook when actionbutton is set --- modules/actionbar.lua | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/modules/actionbar.lua b/modules/actionbar.lua index 7ef86531..420494e5 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -58,26 +58,27 @@ pfUI:RegisterModule("actionbar", function () local oldIsConsumableAction = IsConsumableAction _G.IsConsumableAction = function(slot) if oldIsConsumableAction(slot) then return true end - - reagentslots[slot] = nil - reagentscan:SetAction(slot) - if (reagentscan:NumLines() ~=0) then - for i=1,reagentscan:NumLines() do - local line = getglobal("pfReagentScannerTextLeft" .. i) - if line then - line = line:GetText() - local _, start = strfind(line,SPELL_REAGENTS,1) - if start then - reagentslots[slot] = strsub(line,start+1) - this:RegisterEvent("BAG_UPDATE") - return true + if this and this.GetParent and ActionButton_GetPagedID(this) == slot then + reagentslots[slot] = nil + reagentscan:SetAction(slot) + if (reagentscan:NumLines() ~=0) then + for i=1,reagentscan:NumLines() do + local line = getglobal("pfReagentScannerTextLeft" .. i) + if line then + line = line:GetText() + local _, start = strfind(line,SPELL_REAGENTS,1) + if start then + reagentslots[slot] = strsub(line,start+1) + this:RegisterEvent("BAG_UPDATE") + return true + end end end end - end - this:UnregisterEvent("BAG_UPDATE") - return nil + this:UnregisterEvent("BAG_UPDATE") + return nil + end end local oldGetActionCount = GetActionCount