I am a fairly picky guy, and I like positioning elements by the pixel and putting elements in locations often not intended by the original Addon authors. I usually just edit the Addons to fit my tastes; but this is somewhat of a chore when things get updated as you could imagine...
So I've written a separate Addon that tweaks a bunch of my interface elements.
The problem is some Addons do these things in a way that I cannot manipulate just by calling the typical ClearAllPoints and SetPoint (for example, one Addon hooks the SetPoint of a frame because that's the right way to move it, if I also hook the setpoint of the frame that addon and my code start fighting over the frame.)
Here's the full code from ImprovedBlizzardUI:
Code:
--[[
modules\bars\buffs.lua
Moves and scales the Buff / Debuff Frames
]]
local addonName, Loc = ...;
local Buffs = CreateFrame('Frame', nil, UIParent);
Buffs.buffPoint = BuffFrame.SetPoint;
Buffs.buffScale = BuffFrame.SetScale;
--[[
Moves the Buff Frame Itself
@ return void
]]
local function MoveBuffs()
BuffFrame:ClearAllPoints();
Buffs.buffPoint(BuffFrame, 'TOPLEFT', MinimapCluster, -55, -2);
Buffs.buffScale(BuffFrame, BarsDB.buffScale);
end
--[[
Handles the WoW API Events Registered Below
@ param Frame $self The Frame that is handling the event
@ param string $event The WoW API Event that has been triggered
@ param arg $... The arguments of the Event
@ return void
]]
local function HandleEvents (self, event, ...)
if (event == 'PLAYER_LOGIN') then
MoveBuffs();
end
end
-- Register the Modules Events
Buffs:SetScript('OnEvent', HandleEvents);
Buffs:RegisterEvent('PLAYER_LOGIN');
hooksecurefunc( BuffFrame, 'SetPoint', function(frame) MoveBuffs() end);
hooksecurefunc( BuffFrame, 'SetScale', function(frame) MoveBuffs() end)
This is a single module, which moves the BuffFrame to a position that makes sense for an otherwise stock interface.
Ideally, I'd like to either hook or override the MoveBuffs() function so that the position is changed to this:
Code:
Buffs.buffPoint(BuffFrame, 'TOPRIGHT', BattlefieldMapFrame, 'TOPLEFT', -10, 0);
I've tried waiting until after ImprovedBlizzardUI is loaded (both by defining it as a dependency in the TOC and by using the ADDON_LOADED event) but for obvious reasons, trying to move the BuffFrame ends up firing their function, which then moves the BuffFrame back to where they want it.
How can I hook things like this in other AddOns so that I can have a blanket addon that changes what I want to change, and be more or less impervious to updates?