Commit dca7f6b1 authored by Blazeflack's avatar Blazeflack

Why fix code which is no longer necessary? Remove it!

parent 4711f137
......@@ -3,8 +3,6 @@ local EAB = E:GetModule('ExtraActionBars')
local AB = E:GetModule('ActionBars');
local EP = LibStub("LibElvUIPlugin-1.0")
local addon, ns = ...
local ABpage
local enteredWorld = false
-- Create incompatibility warning popup
E.PopupDialogs['EAB_Incompatible'] = {
......@@ -23,7 +21,7 @@ function EAB:UpdateButtonSettings()
end
end
function EAB:CreateBar()
function EAB:CreateBars()
-- Set defaults.
AB['barDefaults']['bar7'] = {
['page'] = 7,
......@@ -64,54 +62,32 @@ function EAB:CreateBar()
AB:UpdateCooldownSettings()
AB:ReassignBindings()
-- Set variable we can use to check if we've entered the world.
enteredWorld = true
-- Hook UpdateButtonSettings to also update the extra bars when needed.
hooksecurefunc(AB, 'UpdateButtonSettings', EAB.UpdateButtonSettings)
end
-- Create dummy frame from which we create our bars and hook our update function
local EABFrame = CreateFrame('Frame', 'EAB')
EABFrame:RegisterEvent('PLAYER_ENTERING_WORLD')
EABFrame:RegisterEvent('ACTIVE_TALENT_GROUP_CHANGED')
EABFrame:RegisterEvent('PLAYER_SPECIALIZATION_CHANGED')
EABFrame:SetScript('OnEvent',function(self, event, arg1)
if event == 'PLAYER_ENTERING_WORLD' then
--Create Bars
EAB:CreateBar()
--Warn about incompatible addon
if IsAddOnLoaded('ElvUI_OneExtraActionBar') then
E:StaticPopup_Show('EAB_Incompatible')
end
self:UnregisterEvent('PLAYER_ENTERING_WORLD')
elseif event == 'ACTIVE_TALENT_GROUP_CHANGED' then
-- 'ACTIVE_TALENT_GROUP_CHANGED' event appear to fire once before we have even entered the world. Prevent a lua error here.
if enteredWorld == true then
-- We changed talentspec with dual spec, update the bar
EAB:UpdateButtonSettings()
end
elseif event == 'PLAYER_SPECIALIZATION_CHANGED' then
if arg1 == 'player' then
if InCombatLockdown() then
-- In combat, wait until we're out of combat
EAB:RegisterEvent('PLAYER_REGEN_ENABLED')
else
-- We learned a specialization, update the bar
EAB:UpdateButtonSettings()
end
end
end
end)
function EAB:PLAYER_REGEN_ENABLED()
self:UnregisterEvent('PLAYER_REGEN_ENABLED')
self:UpdateButtonSettings()
--Create Bars
EAB:CreateBars()
end
function EAB:PLAYER_ENTERING_WORLD()
self:UnregisterEvent('PLAYER_ENTERING_WORLD')
--Warn about incompatible addon
if IsAddOnLoaded('ElvUI_OneExtraActionBar') then
E:StaticPopup_Show('EAB_Incompatible')
end
if InCombatLockdown() then self:RegisterEvent('PLAYER_REGEN_ENABLED'); return; end
--Create Bars
EAB:CreateBars()
end
function EAB:OnInitialize()
self:RegisterEvent('PLAYER_ENTERING_WORLD')
-- Register callback with LibElvUIPlugin
EP:RegisterPlugin(addon, EAB.InsertOptions)
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment