-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfig.lua
More file actions
191 lines (159 loc) · 7.88 KB
/
Config.lua
File metadata and controls
191 lines (159 loc) · 7.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
local addonName, addon = ...
addon.configCreated = false
addon.settingsCategory = nil
function addon:CreateConfig()
if self.configCreated then return end
self.configCreated = true
local settingsPanel = CreateFrame("FRAME", "CHETTHelperSettingsPanel")
settingsPanel.name = "CHETT Helper"
-- Title
local title = settingsPanel:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
title:SetPoint("TOP", 0, -16)
title:SetText("|cffffd100Settings|r")
title:SetFontObject("GameFontNormalHuge")
-- Subtitle
local subtitle = settingsPanel:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
subtitle:SetPoint("TOP", title, "BOTTOM", 0, -4)
subtitle:SetText("Configure which quests to track and display preferences")
subtitle:SetTextColor(0.7, 0.7, 0.7, 1)
-- Helper function to create section boxes
local function CreateSection(parent, headerText, descText, yPos, height)
local box = CreateFrame("Frame", nil, parent, "BackdropTemplate")
box:SetPoint("TOPLEFT", 16, yPos)
box:SetPoint("TOPRIGHT", -16, yPos)
box:SetHeight(height)
box:SetBackdrop({
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark",
tile = true, tileSize = 32, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
})
box:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
box:SetBackdropColor(0, 0, 0, 0.8)
local header = box:CreateFontString(nil, "OVERLAY", "GameFontNormal")
header:SetPoint("TOPLEFT", 12, -10)
header:SetText("|cffffd100" .. headerText .. "|r")
header:SetFontObject("GameFontNormalLarge")
if descText then
local desc = box:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
desc:SetPoint("TOPLEFT", header, "BOTTOMLEFT", 0, -2)
desc:SetText(descText)
desc:SetTextColor(0.7, 0.7, 0.7, 1)
end
return box
end
-- Section 1: Quest Tracking
local questBox = CreateSection(settingsPanel, "Quest Tracking", "Select which C.H.E.T.T. List tasks to display", -50, 140)
local colWidth = 145
local rowHeight = 20
local startX = 12
local startY = -42
for i, quest in ipairs(addon.QUESTS) do
local col = (i - 1) % 4
local row = math.floor((i - 1) / 4)
local cb = CreateFrame("CheckButton", "CHETTCheck"..quest.key, questBox, "InterfaceOptionsCheckButtonTemplate")
cb:SetPoint("TOPLEFT", startX + (col * colWidth), startY - (row * rowHeight))
cb.Text:SetText(quest.name)
cb.Text:SetFontObject("GameFontNormalSmall")
cb:SetChecked(self.Settings[quest.key])
cb:SetScript("OnClick", function(selfBtn)
addon.Settings[quest.key] = selfBtn:GetChecked()
CHETTHelperDB[quest.key] = selfBtn:GetChecked()
addon:UpdateQuestList()
end)
end
-- Section 2: Display Options
local displayBox = CreateSection(settingsPanel, "Display Options", "Customize the appearance of the quest list", -200, 95)
-- Font Size
local fontLabel = displayBox:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
fontLabel:SetPoint("TOPLEFT", 12, -40)
fontLabel:SetText("Font Size")
fontLabel:SetTextColor(0.8, 0.8, 0.8, 1)
local fontValue = displayBox:CreateFontString(nil, "OVERLAY", "GameFontNormal")
fontValue:SetPoint("LEFT", fontLabel, "RIGHT", 8, 0)
fontValue:SetText(self.Settings.fontSize or addon.DEFAULT_FONT_SIZE)
fontValue:SetTextColor(1, 0.82, 0, 1)
local slider = CreateFrame("Slider", "CHETTFontSizeSlider", displayBox, "OptionsSliderTemplate")
slider:SetPoint("TOPLEFT", fontLabel, "BOTTOMLEFT", 0, -6)
slider:SetWidth(200)
slider:SetHeight(16)
slider:SetMinMaxValues(10, 32)
slider:SetValueStep(1)
slider:SetObeyStepOnDrag(true)
slider:SetValue(self.Settings.fontSize or addon.DEFAULT_FONT_SIZE)
_G[slider:GetName().."Low"]:SetText("10")
_G[slider:GetName().."High"]:SetText("32")
_G[slider:GetName().."Text"]:SetText("")
slider:SetScript("OnValueChanged", function(selfSlider, value)
value = math.floor(value + 0.5)
addon.Settings.fontSize = value
CHETTHelperDB.fontSize = value
fontValue:SetText(value)
addon:UpdateQuestList()
end)
-- Growth Direction
local growLabel = displayBox:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
growLabel:SetPoint("TOPLEFT", 280, -40)
growLabel:SetText("Growth Direction")
growLabel:SetTextColor(0.8, 0.8, 0.8, 1)
local growDropdown = CreateFrame("Frame", "CHETTGrowDropdown", displayBox, "UIDropDownMenuTemplate")
growDropdown:SetPoint("TOPLEFT", growLabel, "BOTTOMLEFT", -16, -2)
local function GrowDropdown_OnClick(_, arg1)
addon.Settings.growDirection = arg1
CHETTHelperDB.growDirection = arg1
UIDropDownMenu_SetText(growDropdown, arg1 == "UP" and "Grow Up" or "Grow Down")
addon:UpdateQuestList()
end
UIDropDownMenu_SetWidth(growDropdown, 140)
UIDropDownMenu_SetText(growDropdown, (self.Settings.growDirection or "DOWN") == "UP" and "Grow Up" or "Grow Down")
UIDropDownMenu_Initialize(growDropdown, function(_, _, _)
local info = UIDropDownMenu_CreateInfo()
info.text = "Grow Down"
info.arg1 = "DOWN"
info.func = GrowDropdown_OnClick
info.checked = (addon.Settings.growDirection or "DOWN") == "DOWN"
UIDropDownMenu_AddButton(info)
info.text = "Grow Up"
info.arg1 = "UP"
info.func = GrowDropdown_OnClick
info.checked = (addon.Settings.growDirection or "DOWN") == "UP"
UIDropDownMenu_AddButton(info)
end)
-- Section 3: Automation Options
local autoBox = CreateSection(settingsPanel, "Automation Options", "Convenient quality-of-life features for Undermine", -305, 90)
local autoCB1 = CreateFrame("CheckButton", "CHETTAutoTake", autoBox, "InterfaceOptionsCheckButtonTemplate")
autoCB1:SetPoint("TOPLEFT", 12, -38)
autoCB1.Text:SetText("Auto-take free weekly C.H.E.T.T. List")
autoCB1.Text:SetFontObject("GameFontNormalSmall")
autoCB1:SetChecked(self.Settings.autoTake)
autoCB1:SetScript("OnClick", function(selfBtn)
addon.Settings.autoTake = selfBtn:GetChecked()
CHETTHelperDB.autoTake = selfBtn:GetChecked()
end)
local autoCB2 = CreateFrame("CheckButton", "CHETTSkipGossip", autoBox, "InterfaceOptionsCheckButtonTemplate")
autoCB2:SetPoint("TOPLEFT", 320, -38)
autoCB2.Text:SetText("Auto-skip rare/scrap gossip")
autoCB2.Text:SetFontObject("GameFontNormalSmall")
autoCB2:SetChecked(self.Settings.skipGossip)
autoCB2:SetScript("OnClick", function(selfBtn)
addon.Settings.skipGossip = selfBtn:GetChecked()
CHETTHelperDB.skipGossip = selfBtn:GetChecked()
end)
local autoCB3 = CreateFrame("CheckButton", "CHETTSkipDrills", autoBox, "InterfaceOptionsCheckButtonTemplate")
autoCB3:SetPoint("TOPLEFT", 12, -62)
autoCB3.Text:SetText("Auto-skip drill gossip")
autoCB3.Text:SetFontObject("GameFontNormalSmall")
autoCB3:SetChecked(self.Settings.skipDrills)
autoCB3:SetScript("OnClick", function(selfBtn)
addon.Settings.skipDrills = selfBtn:GetChecked()
CHETTHelperDB.skipDrills = selfBtn:GetChecked()
end)
-- Bottom Note
local note = settingsPanel:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
note:SetPoint("BOTTOM", 0, 16)
note:SetText("Note: Settings are saved per character. Use /chb to open this panel.")
note:SetTextColor(0.5, 0.5, 0.5, 1)
local category = Settings.RegisterCanvasLayoutCategory(settingsPanel, settingsPanel.name)
Settings.RegisterAddOnCategory(category)
self.settingsCategory = category
end