local ElvSkins if ElvUI then local E = unpack(ElvUI) ElvSkins = E:GetModule("Skins") end local function AddClickSound(button) button:HookScript("OnClick", function() PlaySound("igMainMenuOptionCheckBoxOn") end) end local function AddCheckboxFeedback(check) check:HookScript("OnClick", function() PlaySound("igMainMenuOptionCheckBoxOn") end) local text = _G[check:GetName() .. "Text"] if text then local point, relativeTo, relativePoint, xOfs, yOfs = text:GetPoint() check:HookScript("OnMouseDown", function() text:SetPoint(point, relativeTo, relativePoint, xOfs + 1, yOfs - 2) end) check:HookScript("OnMouseUp", function() text:SetPoint(point, relativeTo, relativePoint, xOfs, yOfs) end) end end local panel = CreateFrame("Frame") panel.name = "HideCoAUI" local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") title:SetPoint("TOPLEFT", 16, -16) title:SetText("HideCoAUI") InterfaceOptions_AddCategory(panel) -- CLASSES SUBCATEGORY -- local classesPanel = CreateFrame("Frame") classesPanel.name = "Classes" classesPanel.parent = panel.name local classesTitle = classesPanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") classesTitle:SetPoint("TOPLEFT", 16, -16) classesTitle:SetText("Classes") local classesSubtitle = classesPanel:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") classesSubtitle:SetPoint("TOPLEFT", classesTitle, "BOTTOMLEFT", 0, -4) classesSubtitle:SetTextColor(1, 1, 1) classesSubtitle:SetText("Global class based hiding") local hideAllButton = CreateFrame("Button", "HideCoAUIHideAllButton", classesPanel, "UIPanelButtonTemplate") hideAllButton:SetPoint("TOPLEFT", classesSubtitle, "BOTTOMLEFT", 0, -12) hideAllButton:SetSize(100, 22) hideAllButton:SetText("Hide All") local showAllButton = CreateFrame("Button", "HideCoAUIShowAllButton", classesPanel, "UIPanelButtonTemplate") showAllButton:SetPoint("LEFT", hideAllButton, "RIGHT", 8, 0) showAllButton:SetSize(100, 22) showAllButton:SetText("Show All") if ElvSkins then ElvSkins:HandleButton(hideAllButton) ElvSkins:HandleButton(showAllButton) end local BOX_BACKDROP = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 5, right = 5, top = 5, bottom = 5 }, } local BOX_BACKDROP_ELVUI = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }, } local function SkinBox(box) if ElvUI then box:SetBackdrop(BOX_BACKDROP_ELVUI) box:SetBackdropColor(0.08, 0.10, 0.14, 0.5) else box:SetBackdrop(BOX_BACKDROP) box:SetBackdropColor(0.08, 0.10, 0.14, 0.5) box:SetBackdropBorderColor(0.6, 0.6, 0.6, 1) end end local sidebarBox = CreateFrame("Frame", nil, classesPanel) sidebarBox:SetPoint("TOPLEFT", hideAllButton, "BOTTOMLEFT", 0, -12) sidebarBox:SetPoint("BOTTOMLEFT", classesPanel, "BOTTOMLEFT", 0, 8) sidebarBox:SetWidth(158) SkinBox(sidebarBox) local contentBox = CreateFrame("Frame", nil, classesPanel) contentBox:SetPoint("TOPLEFT", sidebarBox, "TOPRIGHT", 3, 0) contentBox:SetPoint("BOTTOMRIGHT", classesPanel, "BOTTOMRIGHT", -8, 8) SkinBox(contentBox) local classSidebar = CreateFrame("Frame", nil, sidebarBox) classSidebar:SetPoint("TOPLEFT", sidebarBox, "TOPLEFT", 4, -4) classSidebar:SetPoint("BOTTOMRIGHT", sidebarBox, "BOTTOMRIGHT", -4, 4) local classContent = CreateFrame("Frame", nil, contentBox) classContent:SetPoint("TOPLEFT", contentBox, "TOPLEFT", 12, -4) classContent:SetPoint("BOTTOMRIGHT", contentBox, "BOTTOMRIGHT", -12, 4) local classLabelHeader = CreateFrame("Frame", nil, classContent) classLabelHeader:SetPoint("TOPLEFT", classContent, "TOPLEFT", 0, -19) classLabelHeader:SetPoint("TOPRIGHT", classContent, "TOPRIGHT", 0, -19) classLabelHeader:SetHeight(18) local classLabel = classLabelHeader:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") classLabel:SetPoint("TOP") classLabel:SetPoint("BOTTOM") classLabel:SetJustifyH("CENTER") local classLabelLeft = classLabelHeader:CreateTexture(nil, "ARTWORK") classLabelLeft:SetHeight(8) classLabelLeft:SetPoint("LEFT", 0, 0) classLabelLeft:SetPoint("RIGHT", classLabel, "LEFT", -5, 0) classLabelLeft:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") classLabelLeft:SetTexCoord(0.81, 0.94, 0.5, 1) local classLabelRight = classLabelHeader:CreateTexture(nil, "ARTWORK") classLabelRight:SetHeight(8) classLabelRight:SetPoint("RIGHT", 0, 0) classLabelRight:SetPoint("LEFT", classLabel, "RIGHT", 5, 0) classLabelRight:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") classLabelRight:SetTexCoord(0.81, 0.94, 0.5, 1) local overrideNoticeText = classContent:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") overrideNoticeText:SetPoint("TOPLEFT", classLabelHeader, "BOTTOMLEFT", 16, -8) overrideNoticeText:SetTextColor(1, 0.35, 0.35) overrideNoticeText:SetText("These settings are currently overridden") overrideNoticeText:Hide() local checks = {} local selectedClass = nil local previousAnchor = classLabelHeader local previousSpacing = -19 local previousXOffset = 16 for _, frameName in ipairs(HideCoAUI.FRAMES) do local check = CreateFrame("CheckButton", "HideCoAUIClassCheck" .. frameName, classContent, "InterfaceOptionsCheckButtonTemplate") check:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", previousXOffset, previousSpacing) _G[check:GetName() .. "Text"]:SetText("Hide " .. frameName) check.frameName = frameName if ElvSkins then ElvSkins:HandleCheckBox(check) end check:SetScript("OnClick", function(self) if not selectedClass then return end HideCoAUI.GetClassSettings()[selectedClass][self.frameName] = self:GetChecked() and true or false HideCoAUI.ApplySetting() end) AddCheckboxFeedback(check) checks[frameName] = check previousAnchor = check previousSpacing = -8 previousXOffset = 0 end local tabButtons = {} local TAB_HEIGHT = 18 local hideClassButton, showClassButton local function GetOrderedFrameNames(class) local named = {} local generic = {} for _, frameName in ipairs(HideCoAUI.FRAMES) do if HideCoAUI.GetFrameDisplayName(class, frameName) then table.insert(named, frameName) else table.insert(generic, frameName) end end for _, frameName in ipairs(generic) do table.insert(named, frameName) end return named end local function SelectClass(class) selectedClass = class local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class classLabel:SetText(displayName) local color = RAID_CLASS_COLORS and RAID_CLASS_COLORS[class] if color then classLabel:SetTextColor(color.r, color.g, color.b) else classLabel:SetTextColor(1, 1, 1) end local _, ownClass = UnitClass("player") local overridden = (class == ownClass) and HideCoAUI.GetProfileOverride(HideCoAUI.GetActiveProfileName()).enabled if overridden then overrideNoticeText:Show() else overrideNoticeText:Hide() end local previousCheckAnchor = classLabelHeader local previousCheckSpacing = -19 local previousCheckXOffset = 16 for _, frameName in ipairs(GetOrderedFrameNames(class)) do local check = checks[frameName] check:ClearAllPoints() check:SetPoint("TOPLEFT", previousCheckAnchor, "BOTTOMLEFT", previousCheckXOffset, previousCheckSpacing) local customName = HideCoAUI.GetFrameDisplayName(class, frameName) local label = customName and ("Hide " .. customName .. " (" .. frameName .. ")") or ("Hide " .. frameName) _G[check:GetName() .. "Text"]:SetText(label) check:SetChecked(HideCoAUI.GetClassSettings()[class][frameName]) if overridden then check:Disable() _G[check:GetName() .. "Text"]:SetTextColor(0.5, 0.5, 0.5) else check:Enable() _G[check:GetName() .. "Text"]:SetTextColor(1, 1, 1) end previousCheckAnchor = check previousCheckSpacing = -8 previousCheckXOffset = 0 end hideClassButton:ClearAllPoints() hideClassButton:SetPoint("TOPLEFT", previousCheckAnchor, "BOTTOMLEFT", 0, -16) if overridden then hideClassButton:Disable() showClassButton:Disable() else hideClassButton:Enable() showClassButton:Enable() end for tabClass, button in pairs(tabButtons) do if tabClass == class then button.selectedTexture:Show() else button.selectedTexture:Hide() end end end hideClassButton = CreateFrame("Button", "HideCoAUIHideClassButton", classContent, "UIPanelButtonTemplate") hideClassButton:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", 0, -16) hideClassButton:SetSize(140, 22) hideClassButton:SetText("Hide This Class") showClassButton = CreateFrame("Button", "HideCoAUIShowClassButton", classContent, "UIPanelButtonTemplate") showClassButton:SetPoint("LEFT", hideClassButton, "RIGHT", 8, 0) showClassButton:SetSize(140, 22) showClassButton:SetText("Show This Class") if ElvSkins then ElvSkins:HandleButton(hideClassButton) ElvSkins:HandleButton(showClassButton) end hideClassButton:SetScript("OnClick", function() if not selectedClass then return end local classSettings = HideCoAUI.GetClassSettings()[selectedClass] for _, frameName in ipairs(HideCoAUI.FRAMES) do classSettings[frameName] = true end HideCoAUI.ApplySetting() SelectClass(selectedClass) end) AddClickSound(hideClassButton) showClassButton:SetScript("OnClick", function() if not selectedClass then return end local classSettings = HideCoAUI.GetClassSettings()[selectedClass] for _, frameName in ipairs(HideCoAUI.FRAMES) do classSettings[frameName] = false end HideCoAUI.ApplySetting() SelectClass(selectedClass) end) AddClickSound(showClassButton) for index, class in ipairs(HideCoAUI.CUSTOM_CLASSES) do local button = CreateFrame("Button", "HideCoAUIClassTab" .. class, classSidebar) button:SetHeight(TAB_HEIGHT) button:SetPoint("TOPLEFT", classSidebar, "TOPLEFT", 4, -4 - (index - 1) * TAB_HEIGHT) button:SetPoint("RIGHT", classSidebar, "RIGHT", -4, 0) local selectedTexture = button:CreateTexture(nil, "BACKGROUND") selectedTexture:SetAllPoints() selectedTexture:SetTexture(1, 1, 1, 0.2) selectedTexture:Hide() button.selectedTexture = selectedTexture button:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD") local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class local text = button:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") text:SetPoint("LEFT", 4, 0) text:SetText(displayName) local color = RAID_CLASS_COLORS and RAID_CLASS_COLORS[class] if color then text:SetTextColor(color.r, color.g, color.b) end button:SetScript("OnClick", function() SelectClass(class) end) AddClickSound(button) tabButtons[class] = button end hideAllButton:SetScript("OnClick", function() HideCoAUI.HideAllFrames() if selectedClass then SelectClass(selectedClass) end end) AddClickSound(hideAllButton) showAllButton:SetScript("OnClick", function() HideCoAUI.ShowAllFrames() if selectedClass then SelectClass(selectedClass) end end) AddClickSound(showAllButton) classesPanel:SetScript("OnShow", function() if not selectedClass then local _, ownClass = UnitClass("player") if tabButtons[ownClass] then selectedClass = ownClass end end SelectClass(selectedClass or HideCoAUI.CUSTOM_CLASSES[1]) end) InterfaceOptions_AddCategory(classesPanel) -- CHARACTER OVERRIDE SUBCATEGORY -- local characterOverridePanel = CreateFrame("Frame") characterOverridePanel.name = "Character Override" characterOverridePanel.parent = panel.name local characterOverrideTitle = characterOverridePanel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") characterOverrideTitle:SetPoint("TOPLEFT", 16, -16) characterOverrideTitle:SetText("Character Override") local characterOverrideSubtitle = characterOverridePanel:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") characterOverrideSubtitle:SetPoint("TOPLEFT", characterOverrideTitle, "BOTTOMLEFT", 0, -4) characterOverrideSubtitle:SetTextColor(1, 1, 1) characterOverrideSubtitle:SetText("Override class settings for a character") local overrideProfileDropdown = CreateFrame("Frame", "HideCoAUIOverrideProfileDropDown", characterOverridePanel, "UIDropDownMenuTemplate") overrideProfileDropdown:SetPoint("TOPLEFT", characterOverrideSubtitle, "BOTTOMLEFT", -16, -12) if ElvSkins then ElvSkins:HandleDropDownBox(overrideProfileDropdown, 180) end UIDropDownMenu_SetWidth(overrideProfileDropdown, 180) local deleteProfileButton = CreateFrame("Button", "HideCoAUIDeleteProfileButton", characterOverridePanel, "UIPanelButtonTemplate") local overrideProfileDropdownArrow = _G[overrideProfileDropdown:GetName() .. "Button"] deleteProfileButton:SetPoint("LEFT", overrideProfileDropdownArrow or overrideProfileDropdown, "RIGHT", 8, 2) deleteProfileButton:SetSize(110, 22) deleteProfileButton:SetText("Delete Profile") if ElvSkins then ElvSkins:HandleButton(deleteProfileButton) end local deleteProfileBlockedText = characterOverridePanel:CreateFontString(nil, "ARTWORK", "GameFontDisableSmall") deleteProfileBlockedText:SetPoint("TOPLEFT", overrideProfileDropdown, "BOTTOMLEFT", 16, -6) deleteProfileBlockedText:SetText("Can't delete currently logged character profile") deleteProfileBlockedText:Hide() local overrideEnabledCheck = CreateFrame("CheckButton", "HideCoAUIOverrideEnabledCheck", characterOverridePanel, "InterfaceOptionsCheckButtonTemplate") overrideEnabledCheck:SetPoint("TOPLEFT", deleteProfileBlockedText, "BOTTOMLEFT", 0, -28) _G[overrideEnabledCheck:GetName() .. "Text"]:SetText("Override class options for this character") if ElvSkins then ElvSkins:HandleCheckBox(overrideEnabledCheck) end local overrideChecks = {} local selectedOverrideProfile = nil local overridePreviousAnchor = overrideEnabledCheck local overridePreviousSpacing = -16 for _, frameName in ipairs(HideCoAUI.FRAMES) do local check = CreateFrame("CheckButton", "HideCoAUIOverrideCheck" .. frameName, characterOverridePanel, "InterfaceOptionsCheckButtonTemplate") check:SetPoint("TOPLEFT", overridePreviousAnchor, "BOTTOMLEFT", 0, overridePreviousSpacing) _G[check:GetName() .. "Text"]:SetText("Hide " .. frameName) check.frameName = frameName if ElvSkins then ElvSkins:HandleCheckBox(check) end check:SetScript("OnClick", function(self) if selectedOverrideProfile then HideCoAUI.SetProfileOverrideFrameHidden(selectedOverrideProfile, self.frameName, self:GetChecked() and true or false) end end) AddCheckboxFeedback(check) overrideChecks[frameName] = check overridePreviousAnchor = check overridePreviousSpacing = -8 end local function SetOverrideCheckEnabled(check, enabled) if enabled then check:Enable() _G[check:GetName() .. "Text"]:SetTextColor(1, 1, 1) else check:Disable() _G[check:GetName() .. "Text"]:SetTextColor(0.5, 0.5, 0.5) end end local function RefreshCharacterOverrideTab() if not selectedOverrideProfile then return end local override = HideCoAUI.GetProfileOverride(selectedOverrideProfile) overrideEnabledCheck:SetChecked(override.enabled) for _, frameName in ipairs(HideCoAUI.FRAMES) do overrideChecks[frameName]:SetChecked(override.frameSettings[frameName]) SetOverrideCheckEnabled(overrideChecks[frameName], override.enabled) end end local function SelectOverrideProfile(name) selectedOverrideProfile = name UIDropDownMenu_SetText(overrideProfileDropdown, name) RefreshCharacterOverrideTab() if name == HideCoAUI.GetActiveProfileName() then deleteProfileButton:Disable() deleteProfileBlockedText:Show() else deleteProfileButton:Enable() deleteProfileBlockedText:Hide() end end local function OverrideProfileDropDown_OnClick(self) SelectOverrideProfile(self.value) end UIDropDownMenu_Initialize(overrideProfileDropdown, function(self, level) if not (HideCoADB and HideCoADB.profiles) then return end for _, name in ipairs(HideCoAUI.GetProfileNames()) do local info = UIDropDownMenu_CreateInfo() info.text = name info.value = name info.func = OverrideProfileDropDown_OnClick info.checked = (selectedOverrideProfile == name) UIDropDownMenu_AddButton(info, level) end end) overrideEnabledCheck:SetScript("OnClick", function(self) if selectedOverrideProfile then HideCoAUI.SetProfileOverrideEnabled(selectedOverrideProfile, self:GetChecked() and true or false) RefreshCharacterOverrideTab() end end) AddCheckboxFeedback(overrideEnabledCheck) StaticPopupDialogs["HIDECOA_DELETE_PROFILE"] = { text = "Delete profile '%s'?\n\nThis cannot be undone.", button1 = "Delete", button2 = "Cancel", OnAccept = function(self, profileName) HideCoAUI.DeleteProfile(profileName) SelectOverrideProfile(HideCoAUI.GetActiveProfileName()) end, timeout = 0, whileDead = 1, hideOnEscape = 1, } deleteProfileButton:SetScript("OnClick", function() if not selectedOverrideProfile or selectedOverrideProfile == HideCoAUI.GetActiveProfileName() then return end StaticPopup_Show("HIDECOA_DELETE_PROFILE", selectedOverrideProfile, nil, selectedOverrideProfile) end) AddClickSound(deleteProfileButton) characterOverridePanel:SetScript("OnShow", function() SelectOverrideProfile(selectedOverrideProfile or HideCoAUI.GetActiveProfileName()) end) InterfaceOptions_AddCategory(characterOverridePanel) local function OpenOptions() InterfaceOptionsFrame_OpenToCategory(classesPanel) end HideCoAUI.OpenOptions = OpenOptions -- Jump straight to the Classes subcategory when the HideCoAUI parent node itself is opened. panel:SetScript("OnShow", function(self) OpenOptions() self:Hide() end)