Originally Posted by Laurent
Anyway I could make it better?
|
If you want to make it harder for other addons to come in later an change what you've done and make it easier to change which frames you hide/reposition then you could do something like:
Code:
local function DoNothing() end
local hide = {
'AchievementMicroButton',
'ActionBarDownButton',
'ActionBarUpButton',
'CharacterBag0Slot',
'CharacterBag1Slot',
'CharacterBag2Slot',
'CharacterBag3Slot',
'ExhaustionLevelFillBar',
'ExhaustionTick',
'HelpMicroButton',
'KeyRingButton',
'LFGMicroButton',
'MainMenuBarBackpackButton',
'MainMenuBarLeftEndCap',
'MainMenuBarMaxLevelBar',
'MainMenuBarPageNumber',
'MainMenuBarRightEndCap',
'MainMenuBarTexture0',
'MainMenuBarTexture1',
'MainMenuBarTexture2',
'MainMenuBarTexture3',
'MainMenuExpBar',
'PVPMicroButton',
'ReputationWatchBar',
'ShapeshiftBarLeft',
'ShapeshiftBarMiddle',
'ShapeshiftBarRight',
'SlidingActionBarTexture0',
'SlidingActionBarTextur1'
}
local reposition = {
CharacterMicroButton = { 'BOTTOM', TalentMicroButton, 'TOP', 0, -20 },
MainMenuBar = { 'BOTTOMLEFT', UIParent, 'BOTTOMLEFT', 0, 0 },
MainMenuMicroButton = { 'LEFT', QuestLogMicroButton, 'RIGHT', 3, 0 },
MultiBarBottomLeft = { 'BOTTOMLEFT', ActionButton1, 'TOPLEFT', 0, 5 },
MultiBarBottomRight = { 'BOTTOMLEFT', MultiBarBottomLeftButton1, 'TOPLEFT', 0, 5 },
MultiCastActionBarFrame = { 'BOTTOMLEFT', MultiBarBottomRightButton1, 'TOPLEFT', 7, 5 },
PetActionBarFrame = { 'BOTTOMLEFT', MultiBarBottomRightButton1, 'TOPLEFT', 7, 5 },
QuestLogMicroButton = { 'BOTTOMLEFT', ActionButton12, 'BOTTOMRIGHT', 3, 0 },
ShapeshiftBarFrame = { 'BOTTOMLEFT', MultiBarBottomRightButton1, 'TOPLEFT', 7, 5 },
SocialsMicroButton = { 'BOTTOM', MainMenuMicroButton, 'TOP', 0, -20 },
SpellbookMicroButton = { 'BOTTOM', SocialsMicroButton, 'TOP', 0, -20 },
TalentMicroButton = { 'BOTTOM', QuestLogMicroButton, 'TOP', 0, -20 }
}
local _G, frame = _G
for _, name in ipairs(hide) do
frame = _G[name]
if frame then
frame:Hide()
frame.Hide, frame.Show = DoNothing, DoNothing
end
end
for name in pairs(reposition) do
if _G[name] then
_G[name]:ClearAllPoints()
end
end
local unpack = unpack
for name, position in pairs(reposition) do
frame = _G[name]
if frame then
frame:SetPoint(unpack(position))
frame.ClearAllPoints, frame.SetAllPoints, frame.SetPoint = DoNothing, DoNothing, DoNothing
end
end