Commit 3b0b4be3 authored by Darth Predator's avatar Darth Predator

A lot of cache and shit

parent 28e72f7e
......@@ -6,6 +6,9 @@ local focusInsert = false
local EP = LibStub("LibElvUIPlugin-1.0")
local addon = ...
--GLOBALS: hooksecurefunc, CreateFrame
local _G = _G
P['abm'] = {
['player'] = false,
['target'] = false,
......@@ -19,10 +22,10 @@ P['abm'] = {
}
function ABM:PlayerABmove()
local auraBar = ElvUF_Player.AuraBars
local auraBar = _G["ElvUF_Player"].AuraBars
--Create Holder frame for our AuraBar Mover
local holder = CreateFrame('Frame', nil, auraBar)
holder:Point("BOTTOM", ElvUF_Player, "TOP", 0, 0)
holder:Point("BOTTOM", _G["ElvUF_Player"], "TOP", 0, 0)
auraBar:SetPoint("BOTTOM", holder, "TOP", 0, 0)
auraBar.Holder = holder
......@@ -31,10 +34,10 @@ function ABM:PlayerABmove()
end
function ABM:TargetABmove()
local auraBar = ElvUF_Target.AuraBars
local auraBar = _G["ElvUF_Target"].AuraBars
--Create Holder frame for our AuraBar Mover
local holder = CreateFrame('Frame', nil, auraBar)
holder:Point("BOTTOM", ElvUF_Target, "TOP", 0, 0)
holder:Point("BOTTOM", _G["ElvUF_Target"], "TOP", 0, 0)
auraBar:SetPoint("BOTTOM", holder, "TOP", 0, 0)
auraBar.Holder = holder
......@@ -43,10 +46,10 @@ function ABM:TargetABmove()
end
function ABM:FocusABmove()
local auraBar = ElvUF_Focus.AuraBars
local auraBar = _G["ElvUF_Focus"].AuraBars
--Create Holder frame for our AuraBar Mover
local holder = CreateFrame('Frame', nil, auraBar)
holder:Point("BOTTOM", ElvUF_Focus, "TOP", 0, 0)
holder:Point("BOTTOM", _G["ElvUF_Focus"], "TOP", 0, 0)
auraBar:SetPoint("BOTTOM", holder, "TOP", 0, 0)
auraBar.Holder = holder
......@@ -77,8 +80,8 @@ function ABM:UpdatePlayer(frame, db)
auraBars:ClearAllPoints()
local attachTo
if not E.db.abm.player then
local attachTo
if db.aurabar.attachTo == 'BUFFS' then
attachTo = frame.Buffs
elseif db.aurabar.attachTo == 'DEBUFFS' then
......@@ -109,7 +112,7 @@ function ABM:UpdatePlayer(frame, db)
frame:UpdateAllElements()
end
function ABM:UpdateTarget(frame, db)
function ABM:UpdateTarget(frame, db)
frame.db = db
local POWERBAR_OFFSET = db.power.offset
if not db.aurabar.enable then return end
......@@ -132,8 +135,8 @@ function ABM:UpdateTarget(frame, db)
auraBars:ClearAllPoints()
local attachTo
if not E.db.abm.target then
local attachTo
if db.aurabar.attachTo == 'BUFFS' then
attachTo = frame.Buffs
elseif db.aurabar.attachTo == 'DEBUFFS' then
......@@ -187,8 +190,8 @@ function ABM:UpdateFocus(frame, db)
auraBars:ClearAllPoints()
local attachTo
if not E.db.abm.focus then
local attachTo
if db.aurabar.attachTo == 'BUFFS' then
attachTo = frame.Buffs
elseif db.aurabar.attachTo == 'DEBUFFS' then
......@@ -224,6 +227,24 @@ function ABM:ChangeTarget()
self:UnregisterEvent("PLAYER_TARGET_CHANGED")
end
function ABM:MoverToggle()
if E.db.abm.player then
E:EnableMover("ElvUF_PlayerAuraMover")
else
E:DisableMover("ElvUF_PlayerAuraMover")
end
if E.db.abm.target then
E:EnableMover("ElvUF_TargetAuraMover")
else
E:DisableMover("ElvUF_TargetAuraMover")
end
if E.db.abm.focus then
E:EnableMover("ElvUF_FocusAuraMover")
else
E:DisableMover("ElvUF_FocusAuraMover")
end
end
function ABM:Initialize()
EP:RegisterPlugin(addon,ABM.GetOptions)
ABM:PlayerABmove()
......@@ -235,6 +256,7 @@ function ABM:Initialize()
hooksecurefunc(UF, "Update_FocusFrame", ABM.UpdateFocus)
self:RegisterEvent("PLAYER_TARGET_CHANGED", "ChangeTarget")
ABM:MoverToggle()
end
E:RegisterModule(ABM:GetName())
\ 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