-- variables
local defaults = {
togglecastbar = false,
togglebuffframe = false,
toggledebuffframe = false,
toggleplayerframe = false,
togglefocusframe = false,
toggletargetframe = false,
togglepetframe = false,
toggleraidframe = false,
toggleraidframemanager = false,
togglepartyframe = false,
togglebossframe = false
}
--initial load and set state
local function OnEvent(self, event, addOnName)
if addOnName == "HideEverything" then
if not State then
initMessage = WrapTextInColorCode("\nHideEverything loaded for the first time!\nEverything is hidden by default.\nUse /HE for instructions", "FF8C6FFF")
print(initMessage)
end
State = State or {}
self.state = State
for k, v in pairs(defaults) do
if self.state[k] == nil then
self.state[k] = v
end
end
if not self.state.togglecastbar then
PlayerCastingBarFrame:UnregisterAllEvents()
end
if not self.state.togglebuffframe then
BuffFrame:Hide()
end
if not self.state.toggledebuffframe then
DebuffFrame:Hide()
end
if not self.state.toggleplayerframe then
PlayerFrame:UnregisterAllEvents()
PlayerFrame:Hide()
end
if not self.state.togglefocusframe then
FocusFrame:UnregisterAllEvents()
FocusFrame:Hide()
end
if not self.state.toggletargetframe then
TargetFrame:UnregisterAllEvents()
TargetFrame:Hide()
end
if not self.state.togglepetframe then
PetFrame:UnregisterAllEvents()
PetFrame:Hide()
end
if not self.state.toggleraidframe then
CompactRaidFrameContainer:UnregisterAllEvents()
CompactRaidFrameContainer:Hide()
end
if not self.state.toggleraidframemanager then
CompactRaidFrameContainer:UnregisterAllEvents()
CompactRaidFrameContainer:Hide()
CompactRaidFrameManager:UnregisterAllEvents()
CompactRaidFrameManager:Hide()
end
if not self.state.togglepartyframe then
PartyFrame:UnregisterAllEvents()
PartyFrame:Hide()
end
if not self.state.togglebossframe then
BossTargetFrameContainer:UnregisterAllEvents()
BossTargetFrameContainer:Hide()
end
local version, build, _, tocversion = GetBuildInfo()
end
end
local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:SetScript("OnEvent", OnEvent)
--toggle the castbar
SLASH_CASTBAR1 = "/castbarframe"
SlashCmdList.CASTBAR = function(msg, editBox)
ToggleCastBarFrameFunc()
end
function ToggleCastBarFrameFunc()
if not InCombatLockdown() then
if f.state.togglecastbar then
PlayerCastingBarFrame:UnregisterAllEvents()
elseif not f.state.togglecastbar then
PlayerCastingBarFrame:RegisterAllEvents()
end
f.state.togglecastbar = not f.state.togglecastbar
print(WrapTextInColorCode("Cast Bar is ", "FF8C6FFF") .. (f.state.togglecastbar and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle the buff frame
SLASH_BUFFFRAME1 = "/buffsframe"
SlashCmdList.BUFFFRAME = function(msg, editBox)
ToggleBuffFrameFunc()
end
function ToggleBuffFrameFunc()
if not InCombatLockdown() then
if f.state.togglebuffframe then
BuffFrame:Hide()
elseif not f.state.togglebuffframe then
BuffFrame:Show()
end
f.state.togglebuffframe = not f.state.togglebuffframe
print(WrapTextInColorCode("Buff Frame is ", "FF8C6FFF") .. (f.state.togglebuffframe and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle the debuff frame
SLASH_DEBUFFFRAME1 = "/debuffsframe"
SlashCmdList.DEBUFFFRAME = function(msg, editBox)
ToggleDebuffFrameFunc()
end
function ToggleDebuffFrameFunc()
if not InCombatLockdown() then
if f.state.toggledebuffframe then
DebuffFrame:Hide()
elseif not f.state.toggledebuffframe then
DebuffFrame:Show()
end
f.state.toggledebuffframe = not f.state.toggledebuffframe
print(WrapTextInColorCode("Debuff Frame is ", "FF8C6FFF") .. (f.state.toggledebuffframe and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle the player frame
SLASH_PLAYERFRAME1 = "/playerframe"
SlashCmdList.PLAYERFRAME = function(msg, editBox)
TogglePlayerFrameFunc()
end
function TogglePlayerFrameFunc()
if not InCombatLockdown() then
if f.state.toggleplayerframe then
PlayerFrame:UnregisterAllEvents()
PlayerFrame:Hide()
elseif not f.state.toggleplayerframe then
PlayerFrame:RegisterAllEvents()
PlayerFrame:Show()
end
f.state.toggleplayerframe = not f.state.toggleplayerframe
print(WrapTextInColorCode("Player Frame is ", "FF8C6FFF") .. (f.state.toggleplayerframe and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle the focus frame
SLASH_FOCUSFRAME1 = "/focusframe"
SlashCmdList.FOCUSFRAME = function(msg, editBox)
ToggleFocusFrameFunc()
end
function ToggleFocusFrameFunc()
if not InCombatLockdown() then
if f.state.togglefocusframe then
FocusFrame:UnregisterAllEvents()
FocusFrame:Hide()
elseif not f.state.togglefocusframe then
FocusFrame:RegisterAllEvents()
FocusFrame:Show()
end
f.state.togglefocusframe = not f.state.togglefocusframe
print(WrapTextInColorCode("Focus Frame is ", "FF8C6FFF") .. (f.state.togglefocusframe and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle the target frame
SLASH_TARGETFRAME1 = "/targetframe"
SlashCmdList.TARGETFRAME = function(msg, editBox)
ToggleTargetFrameFunc()
end
function ToggleTargetFrameFunc()
if not InCombatLockdown() then
if f.state.toggletargetframe then
TargetFrame:UnregisterAllEvents()
TargetFrame:Hide()
elseif not f.state.toggletargetframe then
TargetFrame:RegisterAllEvents()
TargetFrame:Show()
end
f.state.toggletargetframe = not f.state.toggletargetframe
print(WrapTextInColorCode("Target Frame is ", "FF8C6FFF") .. (f.state.toggletargetframe and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle the pet frame
SLASH_PETFRAME1 = "/petframe"
SlashCmdList.PETFRAME = function(msg, editBox)
TogglePetFrameFunc()
end
function TogglePetFrameFunc()
if not InCombatLockdown() then
if f.state.togglepetframe then
PetFrame:UnregisterAllEvents()
PetFrame:Hide()
elseif not f.state.togglepetframe then
PetFrame:RegisterAllEvents()
PetFrame:Show()
end
f.state.togglepetframe = not f.state.togglepetframe
print(WrapTextInColorCode("Pet Frame is ", "FF8C6FFF") .. (f.state.togglepetframe and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle the raid frame
SLASH_RAIDFRAME1 = "/raidframe"
SlashCmdList.RAIDFRAME = function(msg, editBox)
ToggleRaidFrameFunc()
end
function ToggleRaidFrameFunc()
if not InCombatLockdown() then
if f.state.toggleraidframe then
CompactRaidFrameContainer:UnregisterAllEvents()
CompactRaidFrameContainer:Hide()
elseif not f.state.toggleraidframe then
CompactRaidFrameContainer:RegisterAllEvents()
CompactRaidFrameContainer:Show()
end
f.state.toggleraidframe = not f.state.toggleraidframe
print(WrapTextInColorCode("Raid Frame is ", "FF8C6FFF") .. (f.state.toggleraidframe and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle the raid frame manager
SLASH_RAIDFRAMEMANAGER1 = "/raidmanagerframe"
SlashCmdList.RAIDFRAMEMANAGER = function(msg, editBox)
ToggleRaidManagerFrameFunc()
end
function ToggleRaidManagerFrameFunc()
if not InCombatLockdown() then
if f.state.toggleraidframemanager then
CompactRaidFrameContainer:UnregisterAllEvents()
CompactRaidFrameContainer:Hide()
CompactRaidFrameManager:UnregisterAllEvents()
CompactRaidFrameManager:Hide()
elseif not f.state.toggleraidframemanager then
CompactRaidFrameManager:RegisterAllEvents()
CompactRaidFrameManager:Show()
end
f.state.toggleraidframemanager = not f.state.toggleraidframemanager
print(WrapTextInColorCode("Raid Frame Manager is ", "FF8C6FFF") .. (f.state.toggleraidframemanager and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle the party frame
SLASH_PARTYFRAME1 = "/partyframe"
SlashCmdList.PARTYFRAME = function(msg, editBox)
TogglePartyFrameFunc()
end
function TogglePartyFrameFunc()
if not InCombatLockdown() then
if f.state.togglepartyframe then
PartyFrame:UnregisterAllEvents()
PartyFrame:Hide()
elseif not f.state.togglepartyframe then
PartyFrame:RegisterAllEvents()
PartyFrame:Show()
end
f.state.togglepartyframe = not f.state.togglepartyframe
print(WrapTextInColorCode("Party Frame is ", "FF8C6FFF") .. (f.state.togglepartyframe and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle the boss frame
SLASH_BOSSFRAME1 = "/bossframe"
SlashCmdList.BOSSFRAME = function(msg, editBox)
ToggleBossFrameFunc()
end
function ToggleBossFrameFunc()
if not InCombatLockdown() then
if f.state.togglebossframe then
BossTargetFrameContainer:UnregisterAllEvents()
BossTargetFrameContainer:Hide()
elseif not f.state.togglebossframe then
BossTargetFrameContainer:RegisterAllEvents()
BossTargetFrameContainer:Show()
end
f.state.togglebossframe = not f.state.togglebossframe
print(WrapTextInColorCode("Boss Frame is ", "FF8C6FFF") .. (f.state.togglebossframe and WrapTextInColorCode("Showing", "FF00FF00") or WrapTextInColorCode("Hidden", "FFFF0000")))
else
print(WrapTextInColorCode("Please wait until you are out of Combat to toggle frames", "FFFF0000"))
end
end
--toggle instructions
SLASH_TOGGLE1 = "/HE"
SLASH_TOGGLE2 = "/HideEverything"
SlashCmdList.TOGGLE = function(msg, editBox)
print(WrapTextInColorCode("Below is a list of '/' commands to toggle hiding/showing respective frames.\n\n/castbarframe\n/buffsframe\n/debuffsframe\n/playerframe\n/focusframe\n/petframe\n/targetframe\n/raidframe\n/raidmanagerframe\n/partyframe\n/bossframe", "FF8C6FFF"))
end
-- create options menu
local panel = CreateFrame("Frame")
panel.name = "HideEverything"
InterfaceOptions_AddCategory(panel)
local title = panel:CreateFontString("ARTWORK", nil, "GameFontNormalLarge")
title:SetPoint("TOP")
title:SetText("\n\nHideEverything\n\n\nBy default this addon hides all of the frames listed below.\nUse these '/' commands to toggle hiding and showing respective frames.\nEither toggle them with these buttons, directly in the chat, or make a macro.\nThe world is your oyster!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nYou can also use '/he' or '/hideeverything' in\n the chat for a reminder of all of these.\n\nFYI: When the raid manager frame is hidden, the raid frame must be hidden as well.\n Additionally; after toggling either the raid frame or the raid manager frame \nyou must commit a '/reload' in order to see the changes take effect.\n\ndisclaimer1: When using this addon ensure other addons are not \nhiding the same frames, doing so could result in errors.\n\ndisclaimer2: You cannot toggle frames while in combat.\n An alert will be triggered in the chat if attempting to do so.")
local castbarbtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
castbarbtn.Text:SetText("/castbarframe")
castbarbtn:SetPoint("TOPLEFT", 225, -160)
castbarbtn:SetWidth(200)
castbarbtn:HookScript("OnClick", function()
ToggleCastBarFrameFunc()
end)
local buffbtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
buffbtn.Text:SetText("/buffsframe")
buffbtn:SetPoint("TOPLEFT", 225, -180)
buffbtn:SetWidth(200)
buffbtn:HookScript("OnClick", function()
ToggleBuffFrameFunc()
end)
local debuffbtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
debuffbtn.Text:SetText("/debuffsframe")
debuffbtn:SetPoint("TOPLEFT", 225, -200)
debuffbtn:SetWidth(200)
debuffbtn:HookScript("OnClick", function()
ToggleDebuffFrameFunc()
end)
local playerbtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
playerbtn.Text:SetText("/playerframe")
playerbtn:SetPoint("TOPLEFT", 225, -220)
playerbtn:SetWidth(200)
playerbtn:HookScript("OnClick", function()
TogglePlayerFrameFunc()
end)
local focusbtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
focusbtn.Text:SetText("/focusframe")
focusbtn:SetPoint("TOPLEFT", 225, -240)
focusbtn:SetWidth(200)
focusbtn:HookScript("OnClick", function()
ToggleFocusFrameFunc()
end)
local targetbtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
targetbtn.Text:SetText("/targetframe")
targetbtn:SetPoint("TOPLEFT", 225, -260)
targetbtn:SetWidth(200)
targetbtn:HookScript("OnClick", function()
ToggleTargetFrameFunc()
end)
local petbtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
petbtn.Text:SetText("/petframe")
petbtn:SetPoint("TOPLEFT", 225, -280)
petbtn:SetWidth(200)
petbtn:HookScript("OnClick", function()
TogglePetFrameFunc()
end)
local raidbtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
raidbtn.Text:SetText("/raidframe")
raidbtn:SetPoint("TOPLEFT", 225, -300)
raidbtn:SetWidth(200)
raidbtn:HookScript("OnClick", function()
ToggleRaidFrameFunc()
end)
local raidmanagerbtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
raidmanagerbtn.Text:SetText("/raidmanagerframe")
raidmanagerbtn:SetPoint("TOPLEFT", 225, -320)
raidmanagerbtn:SetWidth(200)
raidmanagerbtn:HookScript("OnClick", function()
ToggleRaidManagerFrameFunc()
end)
local partybtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
partybtn.Text:SetText("/partyframe")
partybtn:SetPoint("TOPLEFT", 225, -340)
partybtn:SetWidth(200)
partybtn:HookScript("OnClick", function()
TogglePartyFrameFunc()
end)
local bossbtn = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate")
bossbtn.Text:SetText("/bossframe")
bossbtn:SetPoint("TOPLEFT", 225, -360)
bossbtn:SetWidth(200)
bossbtn:HookScript("OnClick", function()
ToggleBossFrameFunc()
end)
--EOD