Initial commit: HideCoA addon

This commit is contained in:
2026-07-07 19:03:58 +02:00
commit 55e82cf100
3 changed files with 263 additions and 0 deletions
+127
View File
@@ -0,0 +1,127 @@
HideCoA = {}
local f = CreateFrame("Frame")
HideCoA.CUSTOM_CLASSES = {
"NECROMANCER",
"PYROMANCER",
"CULTIST",
"STARCALLER",
"SUNCLERIC",
"TINKER",
"SPIRITMAGE",
"WILDWALKER",
"REAPER",
"PROPHET",
"CHRONOMANCER",
"SONOFARUGAL",
"GUARDIAN",
"STORMBRINGER",
"DEMONHUNTER",
"BARBARIAN",
"WITCHDOCTOR",
"WITCHHUNTER",
"FLESHWARDEN",
"MONK",
"RANGER",
}
HideCoA.FRAMES = {
"CoAResourceSegmentBar",
"CoAResourceOrb",
"CoAResourceBar",
}
local function ShouldHideForClass(playerClass, frameName)
local classSettings = HideCoADB.classSettings[playerClass]
if not classSettings or classSettings[frameName] == nil then
return true
end
return classSettings[frameName]
end
local hookedFrames = {}
local function ApplySetting()
local _, playerClass = UnitClass("player")
for _, frameName in ipairs(HideCoA.FRAMES) do
local frame = _G[frameName]
if frame then
if not hookedFrames[frameName] then
frame:HookScript("OnShow", function(self)
local _, currentClass = UnitClass("player")
if ShouldHideForClass(currentClass, frameName) then
self:Hide()
end
end)
hookedFrames[frameName] = true
end
local hide = ShouldHideForClass(playerClass, frameName)
if hide then
frame:Hide()
else
frame:Show()
end
if frame.EnableMouse then
frame:EnableMouse(not hide)
end
end
end
end
HideCoA.ApplySetting = ApplySetting
f:RegisterEvent("ADDON_LOADED")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function(self, event, arg1)
if event == "ADDON_LOADED" and arg1 == "HideCoA" then
if not HideCoADB then
HideCoADB = {}
end
if not HideCoADB.classSettings then
HideCoADB.classSettings = {}
end
for _, class in ipairs(HideCoA.CUSTOM_CLASSES) do
if type(HideCoADB.classSettings[class]) ~= "table" then
HideCoADB.classSettings[class] = {}
end
for _, frameName in ipairs(HideCoA.FRAMES) do
if HideCoADB.classSettings[class][frameName] == nil then
HideCoADB.classSettings[class][frameName] = true
end
end
end
elseif event == "PLAYER_LOGIN" then
ApplySetting()
end
end)
+9
View File
@@ -0,0 +1,9 @@
## Interface: 30300
## Title: Hide CoA Class UI
## Notes: Hides the Conquest of Azeroth class frame.
## Author: Narcasung
## Version: 1.0
## SavedVariables: HideCoADB
HideCoA.lua
Options.lua
+127
View File
@@ -0,0 +1,127 @@
local panel = CreateFrame("Frame")
panel.name = "HideCoAUI"
local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
title:SetPoint("TOPLEFT", 16, -16)
title:SetText("HideCoAUI")
local subtitle = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
subtitle:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8)
subtitle:SetText("Select a class, then toggle the checkboxes to hide its class resource:")
local sidebar = CreateFrame("Frame", nil, panel)
sidebar:SetPoint("TOPLEFT", subtitle, "BOTTOMLEFT", 0, -12)
sidebar:SetPoint("BOTTOMLEFT", panel, "BOTTOMLEFT", 16, 16)
sidebar:SetWidth(150)
local content = CreateFrame("Frame", nil, panel)
content:SetPoint("TOPLEFT", sidebar, "TOPRIGHT", 16, 0)
content:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", -16, 16)
local classTitle = content:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
classTitle:SetPoint("TOPLEFT", content, "TOPLEFT", 0, 0)
local titleFont, titleSize = classTitle:GetFont()
classTitle:SetFont(titleFont, titleSize + 4, "OUTLINE")
local checks = {}
local selectedClass = nil
local previousAnchor = classTitle
local previousSpacing = -12
for _, frameName in ipairs(HideCoA.FRAMES) do
local check = CreateFrame("CheckButton", "HideCoAClassCheck" .. frameName, content, "InterfaceOptionsCheckButtonTemplate")
check:SetPoint("TOPLEFT", previousAnchor, "BOTTOMLEFT", 0, previousSpacing)
_G[check:GetName() .. "Text"]:SetText("Hide " .. frameName)
check.frameName = frameName
check:SetScript("OnClick", function(self)
if not selectedClass then
return
end
HideCoADB.classSettings[selectedClass][self.frameName] = self:GetChecked() and true or false
HideCoA.ApplySetting()
end)
checks[frameName] = check
previousAnchor = check
previousSpacing = -8
end
local TAB_HEIGHT = 18
local tabButtons = {}
local function SelectClass(class)
selectedClass = class
local displayName = (LOCALIZED_CLASS_NAMES_MALE and LOCALIZED_CLASS_NAMES_MALE[class]) or class
classTitle:SetText(displayName)
local color = RAID_CLASS_COLORS and RAID_CLASS_COLORS[class]
if color then
classTitle:SetTextColor(color.r, color.g, color.b)
else
classTitle:SetTextColor(1, 1, 1)
end
for _, frameName in ipairs(HideCoA.FRAMES) do
checks[frameName]:SetChecked(HideCoADB.classSettings[class][frameName])
end
for tabClass, button in pairs(tabButtons) do
if tabClass == class then
button.selectedTexture:Show()
else
button.selectedTexture:Hide()
end
end
end
for index, class in ipairs(HideCoA.CUSTOM_CLASSES) do
local button = CreateFrame("Button", "HideCoAClassTab" .. class, sidebar)
button:SetHeight(TAB_HEIGHT)
button:SetPoint("TOPLEFT", sidebar, "TOPLEFT", 0, -(index - 1) * TAB_HEIGHT)
button:SetPoint("RIGHT", sidebar, "RIGHT", 0, 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)
tabButtons[class] = button
end
panel:SetScript("OnShow", function()
SelectClass(selectedClass or HideCoA.CUSTOM_CLASSES[1])
end)
InterfaceOptions_AddCategory(panel)