From cafbe5aee3eed50b20ccbc7fb525dda5735ccc41 Mon Sep 17 00:00:00 2001 From: Daniel Yates Date: Fri, 19 Aug 2011 23:03:04 +0100 Subject: [PATCH] Added PAC 5.0 "compatability". Reverted update logic to old system. --- Core.lua | 10 +++++++++- Modules/Buttons.lua | 42 +++++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/Core.lua b/Core.lua index 8ee66b0..00d13f9 100644 --- a/Core.lua +++ b/Core.lua @@ -364,6 +364,14 @@ function CoreFrame:OnEvent(event, ...) if(event == "ADDON_LOADED") then -- Make sure we're the loaded one. if(... == "PowerAurasButtons") then + -- Check: If PAC >= 5.0, bail. + if(PowaAuras and PowaAuras:VersionGreater(PowaAuras.VersionParts, {Major=4,Minor=99,Build=0,Revision=""})) then + self:Print("You're using Power Auras 5.0. Using my witty charms and general awesomeness, " .. + "this plugin has been integrated into Power Auras directly. /dance, /cheer and /lick. " .. + "Your settings have not been migrated, but you can do so by using the slash command " .. + "\"/powa pacb\". You do not need to keep this addon after migrating your settings."); + return; + end -- Fix config first. CoreFrame:FixSettings(); -- Create an epic event. @@ -380,4 +388,4 @@ function CoreFrame:OnEvent(event, ...) end end -- Register. -CoreFrame:SetScript("OnEvent", CoreFrame.OnEvent); \ No newline at end of file +CoreFrame:SetScript("OnEvent", CoreFrame.OnEvent); diff --git a/Modules/Buttons.lua b/Modules/Buttons.lua index 6db4865..a3b4ff9 100644 --- a/Modules/Buttons.lua +++ b/Modules/Buttons.lua @@ -360,11 +360,11 @@ function ModuleFrame:OnInitialize() ButtonsBySlot[button._state_action] = button; end end); --- -- Add a button update hook. --- LAB:RegisterCallback("OnButtonUpdate", function(_, button) --- if(not button:IsShown()) then return; end --- ModuleFrame:UpdateButton(button); --- end); + -- Add a button update hook. + LAB:RegisterCallback("OnButtonUpdate", function(_, button) + if(not button:IsShown()) then return; end + ModuleFrame:UpdateButton(button); + end); end end -- Odds are you're using the default buttons if you're not using Dominos/BT. @@ -378,22 +378,22 @@ function ModuleFrame:OnInitialize() ModuleFrame:RegisterButtons("MultiBarBottomRightButton"); ModuleFrame:RegisterButtons("MultiBarBottomLeftButton"); end --- -- If you use Dominos or have the Blizzard buttons on, you need this. --- if(Dominos or RazerNaga or CoreFrame:GetModuleSetting("Buttons", "RegisterBlizzardButtons")) then --- -- Hook for button updates. --- hooksecurefunc("ActionButton_Update", function(button) --- if(not button:IsShown()) then return; end --- ModuleFrame:UpdateButton(button); --- end); --- end - -- Update only if slot data changes. - CoreFrame:RegisterBlizzEventListener("ACTIONBAR_SLOT_CHANGED", ModuleFrame, function(self, id) - if(id == 0 or not ButtonsBySlot[id]) then - ModuleFrame:UpdateAllButtons(); - else - ModuleFrame:UpdateButton(ButtonsBySlot[id]); - end - end); + -- If you use Dominos or have the Blizzard buttons on, you need this. + if(Dominos or RazerNaga or CoreFrame:GetModuleSetting("Buttons", "RegisterBlizzardButtons")) then + -- Hook for button updates. + hooksecurefunc("ActionButton_Update", function(button) + if(not button:IsShown()) then return; end + ModuleFrame:UpdateButton(button); + end); + end +-- -- Update only if slot data changes. +-- CoreFrame:RegisterBlizzEventListener("ACTIONBAR_SLOT_CHANGED", ModuleFrame, function(self, id) +-- if(id == 0 or not ButtonsBySlot[id]) then +-- ModuleFrame:UpdateAllButtons(); +-- else +-- ModuleFrame:UpdateButton(ButtonsBySlot[id]); +-- end +-- end); -- Create some events for modules to hook on to. CoreFrame:RegisterModuleEvent("OnButtonUpdate"); CoreFrame:RegisterModuleEvent("OnButtonProcess"); -- 1.7.9.5