-
Notifications
You must be signed in to change notification settings - Fork 1
/
HonorAssistOptionsUi.lua
314 lines (257 loc) · 16.7 KB
/
HonorAssistOptionsUi.lua
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
local addonName, addonTable = ...
HonorAssist = addonTable
HonorAssist.OptionsUi = {}
local optionsTitleYOffset = -16
local scrollBarYOffset = -12
local scrollBarXOffset = 20
local scrollBarOffset = 24
local historyTitleYOffset = -242
local historyNavButtonsYOffset = -242
local historyPadding = 7
local historyYOffset = -280
local historyDescriptionYOffset = -265
local historyHeight = 282
local historyWidth = 201
local messageHeight = 10
function HonorAssist:LoadOptionsUi()
HonorAssist.OptionsUi.trackerUiEnable:SetChecked(HonorAssistShowTrackerUi)
HonorAssist.OptionsUi.nameplateEnable:SetChecked(HonorAssistNameplateToggle)
HonorAssist.OptionsUi.shortKillMsgEnable:SetChecked(HonorAssistShortKillMessageToggle)
HonorAssist.OptionsUi.BattlegroundFramesEnable:SetChecked(HonorAssistBattlegroundFramesToggle)
HonorAssist.OptionsUi.BattlegroundFramesLockEnable:SetChecked(HonorAssistBattlegroundFramesLockToggle)
end
HonorAssist.OptionsUi.optionsFrame = CreateFrame("Frame", addonName .. "Options", InterfaceOptionsFramePanelContainer)
HonorAssist.OptionsUi.optionsFrame.name = addonName
InterfaceOptions_AddCategory(HonorAssist.OptionsUi.optionsFrame)
HonorAssist.OptionsUi.optionsFrame:SetScript("OnShow",
function()
HonorAssist:PushHistoryDataToUi()
end
);
-- Start Title Section
HonorAssist.OptionsUi.optionsTitle = HonorAssist.OptionsUi.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
HonorAssist.OptionsUi.optionsTitle:SetPoint("TOP", 0, optionsTitleYOffset)
HonorAssist.OptionsUi.optionsTitle:SetText(HonorAssist:GetTranslation("HONOR_ASSIST"))
-- End Title Section
-- Start Enable Tracker CheckButton Section
HonorAssist.OptionsUi.trackerUiEnable = CreateFrame("CheckButton", nil, HonorAssist.OptionsUi.optionsFrame, "ChatConfigCheckButtonTemplate")
HonorAssist.OptionsUi.trackerUiEnable:SetPoint("TOPLEFT", 16, -32)
HonorAssist.OptionsUi.trackerUiEnable:SetScript("OnClick",
function()
HonorAssistShowTrackerUi = not HonorAssistShowTrackerUi
HonorAssist:ShowTrackerUi(HonorAssistShowTrackerUi)
HonorAssist.OptionsUi.trackerUiEnable:SetChecked(HonorAssistShowTrackerUi)
end
);
HonorAssist.OptionsUi.trackerUiEnableLabel = HonorAssist.OptionsUi.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
HonorAssist.OptionsUi.trackerUiEnableLabel:SetPoint("TOPLEFT", 42, -38)
HonorAssist.OptionsUi.trackerUiEnableLabel:SetText(HonorAssist:GetTranslation("OPTIONS_ENABLE_TRACKER_LABEL"))
-- End Enable Tracker CheckButton Section
-- Start Enable Nameplate CheckButton Section
HonorAssist.OptionsUi.nameplateEnable = CreateFrame("CheckButton", nil, HonorAssist.OptionsUi.optionsFrame, "ChatConfigCheckButtonTemplate")
HonorAssist.OptionsUi.nameplateEnable:SetPoint("TOPLEFT", 16, -54)
HonorAssist.OptionsUi.nameplateEnable:SetScript("OnClick",
function()
HonorAssistNameplateToggle = not HonorAssistNameplateToggle
HonorAssist.OptionsUi.nameplateEnable:SetChecked(HonorAssistNameplateToggle)
end
);
HonorAssist.OptionsUi.nameplateEnableLabel = HonorAssist.OptionsUi.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
HonorAssist.OptionsUi.nameplateEnableLabel:SetPoint("TOPLEFT", 42, -60)
HonorAssist.OptionsUi.nameplateEnableLabel:SetText(HonorAssist:GetTranslation("OPTIONS_ENABLE_NAMEPLATE_LABEL"))
-- End Enable Nameplate CheckButton Section
-- Start Short Kill Message CheckButton Section
HonorAssist.OptionsUi.shortKillMsgEnable = CreateFrame("CheckButton", nil, HonorAssist.OptionsUi.optionsFrame, "ChatConfigCheckButtonTemplate")
HonorAssist.OptionsUi.shortKillMsgEnable:SetPoint("TOPLEFT", 16, -76)
HonorAssist.OptionsUi.shortKillMsgEnable:SetScript("OnClick",
function()
HonorAssistShortKillMessageToggle = not HonorAssistShortKillMessageToggle
HonorAssist.OptionsUi.shortKillMsgEnable:SetChecked(HonorAssistShortKillMessageToggle)
end
);
HonorAssist.OptionsUi.shortKillMsgEnableLabel = HonorAssist.OptionsUi.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
HonorAssist.OptionsUi.shortKillMsgEnableLabel:SetPoint("TOPLEFT", 42, -82)
HonorAssist.OptionsUi.shortKillMsgEnableLabel:SetText(HonorAssist:GetTranslation("OPTIONS_ENABLE_SHORT_KILL_MSG"))
-- End Short Kill Message CheckButton Section
-- Start Battleground Frames Section
HonorAssist.OptionsUi.BattlegroundFramesEnable = CreateFrame("CheckButton", nil, HonorAssist.OptionsUi.optionsFrame, "ChatConfigCheckButtonTemplate")
HonorAssist.OptionsUi.BattlegroundFramesEnable:SetPoint("TOPLEFT", 16, -98)
HonorAssist.OptionsUi.BattlegroundFramesEnable:SetScript("OnClick",
function()
HonorAssistBattlegroundFramesToggle = not HonorAssistBattlegroundFramesToggle
HonorAssist.OptionsUi.BattlegroundFramesEnable:SetChecked(HonorAssistBattlegroundFramesToggle)
if not HonorAssistBattlegroundFramesToggle then
HonorAssist:ClearAllBgFrames()
end
end
);
HonorAssist.OptionsUi.BattlegroundFramesEnableLabel = HonorAssist.OptionsUi.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
HonorAssist.OptionsUi.BattlegroundFramesEnableLabel:SetPoint("TOPLEFT", 42, -104)
HonorAssist.OptionsUi.BattlegroundFramesEnableLabel:SetText(HonorAssist:GetTranslation("OPTIONS_ENABLE_BATTLEGROUND_FRAMES"))
-- End Battleground Frames Section
-- Start Battleground Frames Lock Section
HonorAssist.OptionsUi.BattlegroundFramesLockEnable = CreateFrame("CheckButton", nil, HonorAssist.OptionsUi.optionsFrame, "ChatConfigCheckButtonTemplate")
HonorAssist.OptionsUi.BattlegroundFramesLockEnable:SetPoint("TOPLEFT", 16, -120)
HonorAssist.OptionsUi.BattlegroundFramesLockEnable:SetScript("OnClick",
function()
HonorAssistBattlegroundFramesLockToggle = not HonorAssistBattlegroundFramesLockToggle
HonorAssist.OptionsUi.BattlegroundFramesLockEnable:SetChecked(HonorAssistBattlegroundFramesLockToggle)
HonorAssist:LockBattlegroundFramesWindow()
end
);
HonorAssist.OptionsUi.BattlegroundFramesLockEnableLabel = HonorAssist.OptionsUi.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
HonorAssist.OptionsUi.BattlegroundFramesLockEnableLabel:SetPoint("TOPLEFT", 42, -126)
HonorAssist.OptionsUi.BattlegroundFramesLockEnableLabel:SetText(HonorAssist:GetTranslation("OPTIONS_ENABLE_BATTLEGROUND_FRAMES_LOCK"))
-- End Battleground Frames Lock Section
-- Start History Section
-- History Title
HonorAssist.OptionsUi.historyTitle = HonorAssist.OptionsUi.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
HonorAssist.OptionsUi.historyTitle:SetPoint("TOP", 0, historyTitleYOffset)
HonorAssist.OptionsUi.historyTitle:SetText(HonorAssist:GetTranslation("HISTORY"))
-- Previous Button
HonorAssist.OptionsUi.historyPreviousButton = CreateFrame("Button", nil, HonorAssist.OptionsUi.optionsFrame, "OptionsButtonTemplate")
HonorAssist.OptionsUi.historyPreviousButton:SetSize(24, 18)
HonorAssist.OptionsUi.historyPreviousButton:SetPoint("TOPLEFT", historyPadding, historyNavButtonsYOffset);
HonorAssist.OptionsUi.historyPreviousButton:SetText("<")
HonorAssist.OptionsUi.historyPreviousButton:SetScript("OnClick",
function()
HonorAssist:MoveOneDayBack()
end
);
-- Next Button
HonorAssist.OptionsUi.historyNextButton = CreateFrame("Button", nil, HonorAssist.OptionsUi.optionsFrame, "OptionsButtonTemplate")
HonorAssist.OptionsUi.historyNextButton:SetSize(24, 18)
HonorAssist.OptionsUi.historyNextButton:SetPoint("TOPRIGHT", -historyPadding, historyNavButtonsYOffset);
HonorAssist.OptionsUi.historyNextButton:SetText(">")
HonorAssist.OptionsUi.historyNextButton:SetScript("OnClick",
function()
HonorAssist:MoveOneDayForward()
end
);
----------------------------------------------------
HonorAssist.OptionsUi.previousHistoryDescription = HonorAssist.OptionsUi.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
HonorAssist.OptionsUi.previousHistoryDescription:SetPoint("TOPLEFT", historyPadding, historyDescriptionYOffset)
HonorAssist.OptionsUi.previousHistoryDescription:SetText("Yesterday") -- Localize
HonorAssist.OptionsUi.previousFrame = CreateFrame("Frame", "HonorAssistPreviousFrame", HonorAssist.OptionsUi.optionsFrame, "OptionsBoxTemplate")
HonorAssist.OptionsUi.previousFrame:SetPoint("TOPLEFT", historyPadding, historyYOffset)
HonorAssist.OptionsUi.previousFrame:SetHeight(historyHeight)
HonorAssist.OptionsUi.previousFrame:SetWidth(historyWidth)
HonorAssist.OptionsUi.previousHistory = CreateFrame("ScrollFrame", "HonorAssistPreviousHistoryScrollFrame", HonorAssist.OptionsUi.previousFrame, "UIPanelScrollFrameTemplate")
HonorAssist.OptionsUi.previousHistory:SetSize(HonorAssist.OptionsUi.previousFrame:GetWidth() - 12, HonorAssist.OptionsUi.previousFrame:GetHeight() - 8)
HonorAssist.OptionsUi.previousHistory:SetPoint("CENTER")
HonorAssist.OptionsUi.previousHistory:SetClipsChildren(true)
HonorAssist.OptionsUi.previousHistory.ScrollBar:ClearAllPoints()
HonorAssist.OptionsUi.previousHistory.ScrollBar:SetPoint("TOPLEFT", HonorAssist.OptionsUi.previousHistory, "TOPRIGHT", scrollBarYOffset, -scrollBarXOffset)
HonorAssist.OptionsUi.previousHistory.ScrollBar:SetPoint("BOTTOMRIGHT", HonorAssist.OptionsUi.previousHistory, "BOTTOMRIGHT", scrollBarYOffset, scrollBarXOffset)
HonorAssist.OptionsUi.previousHistoryContent = CreateFrame("ScrollingMessageFrame", nil, HonorAssist.OptionsUi.previousHistory)
HonorAssist.OptionsUi.previousHistoryContent:SetInsertMode(1)
HonorAssist.OptionsUi.previousHistoryContent:SetMaxLines(100000)
HonorAssist.OptionsUi.previousHistoryContent:SetWidth(HonorAssist.OptionsUi.previousHistory:GetWidth() - scrollBarOffset)
HonorAssist.OptionsUi.previousHistoryContent:SetHeight(HonorAssist.OptionsUi.previousHistory:GetHeight())
HonorAssist.OptionsUi.previousHistoryContent:SetPoint("TOP", 0, 0)
HonorAssist.OptionsUi.previousHistoryContent:SetFont("Fonts\\FRIZQT__.TTF", 8)
HonorAssist.OptionsUi.previousHistoryContent:SetFading(false)
HonorAssist.OptionsUi.previousHistoryContent:SetJustifyH("LEFT")
HonorAssist.OptionsUi.previousHistory:SetScrollChild(HonorAssist.OptionsUi.previousHistoryContent)
function HonorAssist:UpdatePreviousHistoryDescription(description)
HonorAssist.OptionsUi.previousHistoryDescription:SetText(description)
end
local previousHistoryCount = 0
function HonorAssist:AddPreviousHistoryMessage(message)
HonorAssist.OptionsUi.previousHistoryContent:AddMessage(message)
previousHistoryCount = previousHistoryCount + 1
local newContentHeight = previousHistoryCount * messageHeight
if (newContentHeight > HonorAssist.OptionsUi.previousHistoryContent:GetHeight()) then
HonorAssist.OptionsUi.previousHistoryContent:SetHeight(newContentHeight)
end
end
function HonorAssist:ClearPreviousHistoryMessages()
HonorAssist.OptionsUi.previousHistoryContent:Clear()
HonorAssist.OptionsUi.previousHistoryContent:SetHeight(HonorAssist.OptionsUi.previousHistory:GetHeight())
previousHistoryCount = 0
end
----------------------------------------------------
HonorAssist.OptionsUi.currentHistoryDescription = HonorAssist.OptionsUi.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
HonorAssist.OptionsUi.currentHistoryDescription:SetPoint("TOP", 0, historyDescriptionYOffset)
HonorAssist.OptionsUi.currentHistoryDescription:SetText("Today") -- Localize
HonorAssist.OptionsUi.currentFrame = CreateFrame("Frame", "HonorAssistCurrentFrame", HonorAssist.OptionsUi.optionsFrame, "OptionsBoxTemplate")
HonorAssist.OptionsUi.currentFrame:SetPoint("TOP", 0, historyYOffset)
HonorAssist.OptionsUi.currentFrame:SetHeight(historyHeight)
HonorAssist.OptionsUi.currentFrame:SetWidth(historyWidth)
HonorAssist.OptionsUi.currentHistory = CreateFrame("ScrollFrame", "HonorAssistCurrentHistoryScrollFrame", HonorAssist.OptionsUi.currentFrame, "UIPanelScrollFrameTemplate")
HonorAssist.OptionsUi.currentHistory:SetSize(HonorAssist.OptionsUi.currentFrame:GetWidth() - 12, HonorAssist.OptionsUi.currentFrame:GetHeight() - 8)
HonorAssist.OptionsUi.currentHistory:SetPoint("CENTER")
HonorAssist.OptionsUi.currentHistory:SetClipsChildren(true)
HonorAssist.OptionsUi.currentHistory.ScrollBar:ClearAllPoints()
HonorAssist.OptionsUi.currentHistory.ScrollBar:SetPoint("TOPLEFT", HonorAssist.OptionsUi.currentHistory, "TOPRIGHT", scrollBarYOffset, -scrollBarXOffset)
HonorAssist.OptionsUi.currentHistory.ScrollBar:SetPoint("BOTTOMRIGHT", HonorAssist.OptionsUi.currentHistory, "BOTTOMRIGHT", scrollBarYOffset, scrollBarXOffset)
HonorAssist.OptionsUi.currentHistoryContent = CreateFrame("ScrollingMessageFrame", nil, HonorAssist.OptionsUi.currentHistory)
HonorAssist.OptionsUi.currentHistoryContent:SetInsertMode(1)
HonorAssist.OptionsUi.currentHistoryContent:SetMaxLines(100000)
HonorAssist.OptionsUi.currentHistoryContent:SetWidth(HonorAssist.OptionsUi.currentHistory:GetWidth() - scrollBarOffset)
HonorAssist.OptionsUi.currentHistoryContent:SetHeight(HonorAssist.OptionsUi.currentHistory:GetHeight())
HonorAssist.OptionsUi.currentHistoryContent:SetPoint("TOP", 0, 0)
HonorAssist.OptionsUi.currentHistoryContent:SetFont("Fonts\\FRIZQT__.TTF", 8)
HonorAssist.OptionsUi.currentHistoryContent:SetFading(false)
HonorAssist.OptionsUi.currentHistoryContent:SetJustifyH("LEFT")
HonorAssist.OptionsUi.currentHistory:SetScrollChild(HonorAssist.OptionsUi.currentHistoryContent)
function HonorAssist:UpdateCurrentHistoryDescription(description)
HonorAssist.OptionsUi.currentHistoryDescription:SetText(description)
end
local currentHistoryCount = 0
function HonorAssist:AddCurrentHistoryMessage(message)
HonorAssist.OptionsUi.currentHistoryContent:AddMessage(message)
currentHistoryCount = currentHistoryCount + 1
local newContentHeight = currentHistoryCount * messageHeight
if (newContentHeight > HonorAssist.OptionsUi.currentHistoryContent:GetHeight()) then
HonorAssist.OptionsUi.currentHistoryContent:SetHeight(newContentHeight)
end
end
function HonorAssist:ClearCurrentHistoryMessages()
HonorAssist.OptionsUi.currentHistoryContent:Clear()
HonorAssist.OptionsUi.currentHistoryContent:SetHeight(HonorAssist.OptionsUi.currentHistory:GetHeight())
currentHistoryCount = 0
end
----------------------------------------------------
HonorAssist.OptionsUi.nextHistoryDescription = HonorAssist.OptionsUi.optionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
HonorAssist.OptionsUi.nextHistoryDescription:SetPoint("TOPRIGHT", -historyPadding, historyDescriptionYOffset)
HonorAssist.OptionsUi.nextHistoryDescription:SetText("This Week") -- Localize
HonorAssist.OptionsUi.nextFrame = CreateFrame("Frame", "HonorAssistNextFrame", HonorAssist.OptionsUi.optionsFrame, "OptionsBoxTemplate")
HonorAssist.OptionsUi.nextFrame:SetPoint("TOPRIGHT", -historyPadding, historyYOffset)
HonorAssist.OptionsUi.nextFrame:SetHeight(historyHeight)
HonorAssist.OptionsUi.nextFrame:SetWidth(historyWidth)
HonorAssist.OptionsUi.nextHistory = CreateFrame("ScrollFrame", "HonorAssistNextHistoryScrollFrame", HonorAssist.OptionsUi.nextFrame, "UIPanelScrollFrameTemplate")
HonorAssist.OptionsUi.nextHistory:SetSize(HonorAssist.OptionsUi.nextFrame:GetWidth() - 12, HonorAssist.OptionsUi.nextFrame:GetHeight() - 8)
HonorAssist.OptionsUi.nextHistory:SetPoint("CENTER")
HonorAssist.OptionsUi.nextHistory:SetClipsChildren(true)
HonorAssist.OptionsUi.nextHistory.ScrollBar:ClearAllPoints()
HonorAssist.OptionsUi.nextHistory.ScrollBar:SetPoint("TOPLEFT", HonorAssist.OptionsUi.nextHistory, "TOPRIGHT", scrollBarYOffset, -scrollBarXOffset)
HonorAssist.OptionsUi.nextHistory.ScrollBar:SetPoint("BOTTOMRIGHT", HonorAssist.OptionsUi.nextHistory, "BOTTOMRIGHT", scrollBarYOffset, scrollBarXOffset)
HonorAssist.OptionsUi.nextHistoryContent = CreateFrame("ScrollingMessageFrame", nil, HonorAssist.OptionsUi.nextHistory)
HonorAssist.OptionsUi.nextHistoryContent:SetInsertMode(1)
HonorAssist.OptionsUi.nextHistoryContent:SetMaxLines(100000)
HonorAssist.OptionsUi.nextHistoryContent:SetWidth(HonorAssist.OptionsUi.nextHistory:GetWidth() - scrollBarOffset)
HonorAssist.OptionsUi.nextHistoryContent:SetHeight(HonorAssist.OptionsUi.nextHistory:GetHeight())
HonorAssist.OptionsUi.nextHistoryContent:SetPoint("TOP", 0, 0)
HonorAssist.OptionsUi.nextHistoryContent:SetFont("Fonts\\FRIZQT__.TTF", 8)
HonorAssist.OptionsUi.nextHistoryContent:SetFading(false)
HonorAssist.OptionsUi.nextHistoryContent:SetJustifyH("LEFT")
HonorAssist.OptionsUi.nextHistory:SetScrollChild(HonorAssist.OptionsUi.nextHistoryContent)
function HonorAssist:UpdateNextHistoryDescription(description)
HonorAssist.OptionsUi.nextHistoryDescription:SetText(description)
end
local nextHistoryCount = 0
function HonorAssist:AddNextHistoryMessage(message)
HonorAssist.OptionsUi.nextHistoryContent:AddMessage(message)
nextHistoryCount = nextHistoryCount + 1
local newContentHeight = nextHistoryCount * messageHeight
if (newContentHeight > HonorAssist.OptionsUi.nextHistoryContent:GetHeight()) then
HonorAssist.OptionsUi.nextHistoryContent:SetHeight(newContentHeight)
end
end
function HonorAssist:ClearNextHistoryMessages()
HonorAssist.OptionsUi.nextHistoryContent:Clear()
HonorAssist.OptionsUi.nextHistoryContent:SetHeight(HonorAssist.OptionsUi.nextHistory:GetHeight())
nextHistoryCount = 0
end
-- End History Section