-
Notifications
You must be signed in to change notification settings - Fork 0
/
CriteiConfig.lua
550 lines (483 loc) · 21.7 KB
/
CriteiConfig.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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
CriteiConfig = CreateFrame("Frame", "CriteiConfig", UIParent)
CriteiConfig:SetWidth(275)
CriteiConfig:SetHeight(450)
CriteiConfig:SetPoint("CENTER", 0, 60)
CriteiConfig:SetMovable(true)
CriteiConfig:EnableMouse(true)
CriteiConfig:RegisterForDrag("LeftButton")
tinsert(UISpecialFrames, CriteiConfig:GetName())
local activeChat, color, target, channel, shareText, shareText2
local ShareToolTip = CreateFrame("GameTooltip", "ShareToolTip", UIParent, "GameTooltipTemplate")
ShareToolTip:AddLine("")
ShareToolTip:AddLine("")
ShareToolTip:Show()
-- all chat colors
local chatcolors = {
["SAY"] = "|cffFFFFFF",
["EMOTE"] = "|cffFF7E40",
["YELL"] = "|cffFF3F40",
["PARTY"] = "|cffAAABFE",
["GUILD"] = "|cff3CE13F",
["OFFICER"] = "|cff40BC40",
["RAID"] = "|cffFF7D01",
["RAID_WARNING"] = "|cffFF4700",
["BATTLEGROUND"] = "|cffFF7D01",
["WHISPER"] = "|cffFF7EFF",
["CHANNEL"] = "|cffFEC1C0"
}
local function shareToChat()
StaticPopupDialogs["SHARE_DATA"] = {
text = "|cffffffff Send data into /|r" .. color .. string.lower(activeChat) .. " |r?",
button1 = "OK",
button2 = "Cancel",
OnAccept = function()
if activeChat == "WHISPER" then
SendChatMessage(shareText, activeChat, nil, target)
SendChatMessage(shareText2, activeChat, nil, target)
elseif activeChat == "CHANNEL" then
SendChatMessage(shareText, activeChat, nil, channel)
SendChatMessage(shareText2, activeChat, nil, channel)
else
SendChatMessage(shareText, activeChat, nil)
SendChatMessage(shareText2, activeChat, nil)
end
end,
OnCancel = function()
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3
}
end
-- drag start function
CriteiConfig:SetScript("OnDragStart", function()
if not CriteiConfig.isMoving then
CriteiConfig:StartMoving()
CriteiConfig.isMoving = true
end
end)
-- drag stop function
CriteiConfig:SetScript("OnDragStop", function()
if CriteiConfig.isMoving then
CriteiConfig:StopMovingOrSizing()
CriteiConfig.isMoving = false
end
end)
CriteiConfig:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true,
tileSize = 18,
edgeSize = 16,
insets = {
left = 4,
right = 4,
top = 4,
bottom = 4
}
})
CriteiConfig:SetBackdropColor(0.2, 0.2, 0.2, 0.7)
-- print function
function showCritData(instance)
instanceNameText:SetText(string.format("%s", instance))
local instanceData = INSTANCE_RECORDS[instance]
if instanceData then
local spellCRITDamage = instanceData.TOP_CRIT and instanceData.TOP_CRIT.DAMAGE or "Empty"
local targeCRITtName = instanceData.TOP_CRIT and instanceData.TOP_CRIT.TARGET_NAME or "Empty"
local spellCRITName = instanceData.TOP_CRIT and instanceData.TOP_CRIT.SPELL_NAME or "Empty"
local spellHEALDamage = instanceData.TOP_HEAL and instanceData.TOP_HEAL.DAMAGE or "Empty"
local targetHEALName = instanceData.TOP_HEAL and instanceData.TOP_HEAL.TARGET_NAME or "Empty"
local spellHEALName = instanceData.TOP_HEAL and instanceData.TOP_HEAL.SPELL_NAME or "Empty"
local spellDEFDamage = instanceData.TOP_DEF and instanceData.TOP_DEF.DAMAGE or "Empty"
local targetDEFName = instanceData.TOP_DEF and instanceData.TOP_DEF.TARGET_NAME or "Empty"
local spellDEFName = instanceData.TOP_DEF and instanceData.TOP_DEF.SPELL_NAME or "Empty"
highestHealDamage:SetText(string.format("[Heal Amount]|cffffffff %s.", spellHEALDamage))
highestHealTarget:SetText(string.format("[Target Name]|cffffffff %s.", targetHEALName))
highestHealSpell:SetText(string.format("[Spell Name]|cffffffff %s.", spellHEALName))
highestDefDamage:SetText(string.format("[Damage Taken Amount]|cffffffff %s.", spellDEFDamage))
highestDefTarget:SetText(string.format("[Source Name]|cffffffff %s.", targetDEFName))
highestDefSpell:SetText(string.format("[Spell Name]|cffffffff %s.", spellDEFName))
highestCritDamage:SetText(string.format("[Damage Amount]|cffffffff %s", spellCRITDamage))
highestCritTarget:SetText(string.format("[Target Name]|cffffffff %s", targeCRITtName))
highestCritSpell:SetText(string.format("[Spell Name]|cffffffff %s ", spellCRITName))
else
highestCritDamage:SetText("[Damage Amount]|cffffffff Empty")
highestCritTarget:SetText("[Target Name]|cffffffff Empty")
highestCritSpell:SetText("[Spell Name]|cffffffff Empty")
highestHealDamage:SetText("[Damage Amount]|cffffffff Empty.")
highestHealTarget:SetText("[Target Name]|cffffffff Empty.")
highestHealSpell:SetText("[Spell Name]|cffffffff Empty.")
highestDefDamage:SetText("[Damage Taken Amount]|cffffffff Empty.")
highestDefTarget:SetText("[Source Name]|cffffffff Empty.")
highestDefSpell:SetText("[Spell Name]|cffffffff Empty.")
end
end
-- frame title
CriteiConfig.Title = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontHighlightLarge")
CriteiConfig.Title:SetText("Critei")
CriteiConfig.Title:SetPoint("TOPLEFT", 10, -10)
-- Close button
CriteiConfig.CloseButton = CreateFrame("Button", nil, CriteiConfig, "UIPanelCloseButton")
CriteiConfig.CloseButton:SetPoint("TOPRIGHT", -5, -2)
CriteiConfig.CloseButton:SetScript("OnClick", function()
CriteiConfig:Hide()
end)
local separatorLineTitle = CriteiConfig:CreateTexture(nil, "BACKGROUND")
separatorLineTitle:SetTexture(1, 1, 1, 0.3)
separatorLineTitle:SetWidth(270)
separatorLineTitle:SetHeight(2)
separatorLineTitle:SetPoint("TOP", 0, -30)
-- instance title
instanceNameText = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
instanceNameText:SetPoint("TOP", 0, -32)
-- critical record title
highestCrit = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
highestCrit:SetPoint("TOPLEFT", 10, -52)
highestCrit:SetText("|cFFCD853FHighest Critical Damage Amount:|r")
-- share critical damage button
CriteiConfig.ShareDamage = CreateFrame("Button", nil, CriteiConfig, "UIPanelButtonTemplate")
CriteiConfig.ShareDamage:SetPoint("TOPRIGHT", -10, -53)
CriteiConfig.ShareDamage.text = CriteiConfig.ShareDamage:CreateFontString(nil, "OVERLAY", "GameFontNormal")
CriteiConfig.ShareDamage.text:SetFont("Fonts\\FRIZQT__.TTF", 9)
CriteiConfig.ShareDamage.text:SetPoint("CENTER", 0, 0)
CriteiConfig.ShareDamage:SetWidth(40)
CriteiConfig.ShareDamage:SetHeight(12)
CriteiConfig.ShareDamage.text:SetText("Share")
CriteiConfig.ShareDamage:SetScript("OnClick", function()
activeChat = ChatFrameEditBox.chatType
color = chatcolors[activeChat]
if not color then
color = "|cff00FAF6"
end
target = ChatFrameEditBox.tellTarget
channel = ChatFrameEditBox.channelTarget
shareToChat()
StaticPopup_Show("SHARE_DATA")
shareText = "[Critei] Current " .. CriteiConfig.SelectedInstance .. " Damage Record:"
local critInfo = INSTANCE_RECORDS[CriteiConfig.SelectedInstance]["TOP_CRIT"]
if critInfo then
shareText2 = critInfo.DAMAGE .. " critical damage caused by " .. critInfo.SPELL_NAME .. " on " ..
critInfo.TARGET_NAME
else
shareText2 = "No critical damage record available for " .. CriteiConfig.SelectedInstance
end
end)
CriteiConfig.ShareDamage:SetScript("OnEnter", function()
ShareToolTip:SetOwner(CriteiConfig.ShareDamage, "ANCHOR_RIGHT")
ShareToolTip:ClearLines()
ShareToolTip:AddLine("Send to Chat")
ShareToolTip:AddLine("|cffffffffShare your critical damage record to the current chat.")
ShareToolTip:Show()
end)
CriteiConfig.ShareDamage:SetScript("OnLeave", function()
ShareToolTip:Hide()
end)
-- spell name
highestCritSpell = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
highestCritSpell:SetPoint("TOPLEFT", 20, -65)
highestCritSpell:SetText("[Spell Name]|cffffffff Empty.")
-- target name
highestCritTarget = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
highestCritTarget:SetPoint("TOPLEFT", 20, -75)
highestCritTarget:SetText("[Target Name]|cffffffff Empty.")
-- damage amount
highestCritDamage = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
highestCritDamage:SetPoint("TOPLEFT", 20, -85)
highestCritDamage:SetText("[Damage Amount]|cffffffff Empty.")
local separatorLineHEAL = CriteiConfig:CreateTexture(nil, "BACKGROUND")
separatorLineHEAL:SetTexture(1, 1, 1, 0.3)
separatorLineHEAL:SetWidth(230)
separatorLineHEAL:SetHeight(1)
separatorLineHEAL:SetPoint("TOP", 0, -100)
-- heal record title
highestHeal = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
highestHeal:SetPoint("TOPLEFT", 10, -103)
highestHeal:SetText("|cFFADFF2FHighest Critical Heal Amount:|r")
CriteiConfig.ShareHeal = CreateFrame("Button", nil, CriteiConfig, "UIPanelButtonTemplate")
CriteiConfig.ShareHeal:SetPoint("TOPRIGHT", -10, -104)
CriteiConfig.ShareHeal.text = CriteiConfig.ShareHeal:CreateFontString(nil, "OVERLAY", "GameFontNormal")
CriteiConfig.ShareHeal.text:SetFont("Fonts\\FRIZQT__.TTF", 9)
CriteiConfig.ShareHeal.text:SetPoint("CENTER", 0, 0)
CriteiConfig.ShareHeal:SetWidth(40)
CriteiConfig.ShareHeal:SetHeight(12)
CriteiConfig.ShareHeal.text:SetText("Share")
CriteiConfig.ShareHeal:SetScript("OnClick", function()
activeChat = ChatFrameEditBox.chatType
color = chatcolors[activeChat]
if not color then
color = "|cff00FAF6"
end
target = ChatFrameEditBox.tellTarget
channel = ChatFrameEditBox.channelTarget
shareToChat()
StaticPopup_Show("SHARE_DATA")
shareText = "[Critei] Current " .. CriteiConfig.SelectedInstance .. " Heal Record:"
local critInfo = INSTANCE_RECORDS[CriteiConfig.SelectedInstance]["TOP_HEAL"]
if critInfo then
shareText2 = critInfo.DAMAGE .. " critical healing from " .. critInfo.SPELL_NAME .. " on " ..
critInfo.TARGET_NAME
else
shareText2 = "No critical record available for " .. CriteiConfig.SelectedInstance
end
end)
CriteiConfig.ShareHeal:SetScript("OnEnter", function()
ShareToolTip:SetOwner(CriteiConfig.ShareHeal, "ANCHOR_RIGHT")
ShareToolTip:ClearLines()
ShareToolTip:AddLine("Send to Chat")
ShareToolTip:AddLine("|cffffffffShare your critical heal record to the current chat.")
ShareToolTip:Show()
end)
CriteiConfig.ShareHeal:SetScript("OnLeave", function()
ShareToolTip:Hide()
end)
-- spell name
highestHealSpell = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
highestHealSpell:SetPoint("TOPLEFT", 20, -115)
highestHealSpell:SetText("[Spell Name]|cffffffff Empty.")
-- target name
highestHealTarget = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
highestHealTarget:SetPoint("TOPLEFT", 20, -125)
highestHealTarget:SetText("[Target Name]|cffffffff Empty.")
-- heal amount
highestHealDamage = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
highestHealDamage:SetPoint("TOPLEFT", 20, -135)
highestHealDamage:SetText("[Heal Amount]|cffffffff Empty.")
local separatorLineDEF = CriteiConfig:CreateTexture(nil, "BACKGROUND")
separatorLineDEF:SetTexture(1, 1, 1, 0.3)
separatorLineDEF:SetWidth(230)
separatorLineDEF:SetHeight(1)
separatorLineDEF:SetPoint("TOP", 0, -150)
-- def record title
highestDef = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
highestDef:SetPoint("TOPLEFT", 10, -153)
highestDef:SetText("|cFF4169E1Highest Damage Taken Amount:|r")
CriteiConfig.ShareDef = CreateFrame("Button", nil, CriteiConfig, "UIPanelButtonTemplate")
CriteiConfig.ShareDef:SetPoint("TOPRIGHT", -10, -154)
CriteiConfig.ShareDef.text = CriteiConfig.ShareDef:CreateFontString(nil, "OVERLAY", "GameFontNormal")
CriteiConfig.ShareDef.text:SetFont("Fonts\\FRIZQT__.TTF", 9)
CriteiConfig.ShareDef.text:SetPoint("CENTER", 0, 0)
CriteiConfig.ShareDef:SetWidth(40)
CriteiConfig.ShareDef:SetHeight(12)
CriteiConfig.ShareDef.text:SetText("Share")
CriteiConfig.ShareDef:SetScript("OnClick", function()
activeChat = ChatFrameEditBox.chatType
color = chatcolors[activeChat]
if not color then
color = "|cff00FAF6"
end
target = ChatFrameEditBox.tellTarget
channel = ChatFrameEditBox.channelTarget
shareToChat()
StaticPopup_Show("SHARE_DATA")
shareText = "[Critei] Current " .. CriteiConfig.SelectedInstance .. " Damage Taken Record:"
local critInfo = INSTANCE_RECORDS[CriteiConfig.SelectedInstance]["TOP_DEF"]
if critInfo then
shareText2 = critInfo.DAMAGE .. " damage taken from " .. critInfo.SPELL_NAME .. " by " .. critInfo.TARGET_NAME
else
shareText2 = "No critical damage record available for " .. CriteiConfig.SelectedInstance
end
end)
CriteiConfig.ShareDef:SetScript("OnEnter", function()
ShareToolTip:SetOwner(CriteiConfig.ShareDef, "ANCHOR_RIGHT")
ShareToolTip:ClearLines()
ShareToolTip:AddLine("Send to Chat")
ShareToolTip:AddLine("|cffffffffShare your critical damage taken record to the current chat.")
ShareToolTip:Show()
end)
CriteiConfig.ShareDef:SetScript("OnLeave", function()
ShareToolTip:Hide()
end)
-- spell name
highestDefSpell = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
highestDefSpell:SetPoint("TOPLEFT", 20, -165)
highestDefSpell:SetText("[Spell Name]|cffffffff Empty.")
-- source name
highestDefTarget = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
highestDefTarget:SetPoint("TOPLEFT", 20, -175)
highestDefTarget:SetText("[Source Name]|cffffffff Empty.")
-- taken amount
highestDefDamage = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
highestDefDamage:SetPoint("TOPLEFT", 20, -185)
highestDefDamage:SetText("[Taken Amount]|cffffffff Empty.")
local separatorLineFinal = CriteiConfig:CreateTexture(nil, "BACKGROUND")
separatorLineFinal:SetTexture(1, 1, 1, 0.3)
separatorLineFinal:SetWidth(270)
separatorLineFinal:SetHeight(1)
separatorLineFinal:SetPoint("TOP", 0, -205)
-- critical def sound text
local criticalDefDropDown = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
criticalDefDropDown:SetText("Crit Def SFX:")
criticalDefDropDown:SetPoint("BOTTOMLEFT", 15, 140)
-- critical def sound dropdown
CriteiConfig.criticalDefDropDown = CreateFrame("Frame", "criticalDefDropDown", CriteiConfig, "UIDropDownMenuTemplate")
CriteiConfig.criticalDefDropDown:SetPoint("BOTTOMRIGHT", -120, 130)
-- critical heal sound text
local criticalHealDropDown = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
criticalHealDropDown:SetText("Crit Heal SFX:")
criticalHealDropDown:SetPoint("BOTTOMLEFT", 15, 190)
-- critical heal sound dropdown
CriteiConfig.criticalHealDropDown = CreateFrame("Frame", "criticalHealDropDown", CriteiConfig, "UIDropDownMenuTemplate")
CriteiConfig.criticalHealDropDown:SetPoint("BOTTOMRIGHT", -120, 180)
-- critical damage sound sound
local criticalDmgDropDown = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
criticalDmgDropDown:SetText("Cri Damage SFX:")
criticalDmgDropDown:SetPoint("BOTTOMLEFT", 15, 165)
-- critical damage sound dropdown
CriteiConfig.criticalDmgDropDown = CreateFrame("Frame", "criticalDmgDropDown", CriteiConfig, "UIDropDownMenuTemplate")
CriteiConfig.criticalDmgDropDown:SetPoint("BOTTOMRIGHT", -120, 155)
-- Language DropDown text
local languageDropDown = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
languageDropDown:SetText("Language:")
languageDropDown:SetPoint("BOTTOMLEFT", 15, 115) -- text
-- language dropdown
CriteiConfig.languageDropDown = CreateFrame("Frame", "languageDropDown", CriteiConfig, "UIDropDownMenuTemplate")
CriteiConfig.languageDropDown:SetPoint("BOTTOMRIGHT", -120, 105)
-- instance dropdown text
local instanceDropDown = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
instanceDropDown:SetText("Select a Instance:")
instanceDropDown:SetPoint("BOTTOMLEFT", 15, 215)
-- instance dropdown
CriteiConfig.InstanceDropDown = CreateFrame("Frame", "InstanceDropDown", CriteiConfig, "UIDropDownMenuTemplate")
CriteiConfig.InstanceDropDown:SetPoint("BOTTOMRIGHT", -120, 205)
CriteiConfig.SelectedInstance = "OverWorld"
UIDropDownMenu_SetText(CriteiConfig.SelectedInstance, CriteiConfig.InstanceDropDown)
local separatorLineBOTTOM = CriteiConfig:CreateTexture(nil, "BACKGROUND")
separatorLineBOTTOM:SetTexture(1, 1, 1, 0.3)
separatorLineBOTTOM:SetWidth(270)
separatorLineBOTTOM:SetHeight(2)
separatorLineBOTTOM:SetPoint("BOTTOM", 0, 90)
-- clear text
local clearCheckBoxTitle = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
clearCheckBoxTitle:SetText("Crit Reset on Instance Entry")
clearCheckBoxTitle:SetPoint("BOTTOMLEFT", 15, 70)
-- clear checkbox
CriteiConfig.ClearCheckbox = CreateFrame("CheckButton", "ClearCheckBox", CriteiConfig, "UICheckButtonTemplate")
CriteiConfig.ClearCheckbox:SetPoint("BOTTOMRIGHT", -30, 60)
-- yell text
local yellCheckBoxTitle = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
yellCheckBoxTitle:SetText("Yell Message on Crit")
yellCheckBoxTitle:SetPoint("BOTTOMLEFT", 15, 45)
-- yell check box
CriteiConfig.YellCheckbox = CreateFrame("CheckButton", "YellCheckBox", CriteiConfig, "UICheckButtonTemplate")
CriteiConfig.YellCheckbox:SetPoint("BOTTOMRIGHT", -30, 35)
-- sound text
local soundCheckBoxTitle = CriteiConfig:CreateFontString(nil, "ARTWORK", "GameFontNormal")
soundCheckBoxTitle:SetText("Play Sound on Crit")
soundCheckBoxTitle:SetPoint("BOTTOMLEFT", 15, 20)
-- sound checkbox
CriteiConfig.CritSoundCheckbox = CreateFrame("CheckButton", "CritSoundCheckBox", CriteiConfig, "UICheckButtonTemplate")
CriteiConfig.CritSoundCheckbox:SetPoint("BOTTOMRIGHT", -30, 10)
-- Clear checkbox
function OnClearCheckboxChanged()
local isChecked = CriteiConfig.ClearCheckbox:GetChecked()
if isChecked then
CRITEI_CONFIG.isClearOn = true
else
CRITEI_CONFIG.isClearOn = false
end
end
-- Yell checkbox
function OnYellCheckboxChanged()
local isChecked = CriteiConfig.YellCheckbox:GetChecked()
if isChecked then
CRITEI_CONFIG.isYellOn = true
else
CRITEI_CONFIG.isYellOn = false
end
end
-- Sound CheckBox
function OnSoundCheckboxChanged()
local isChecked = CriteiConfig.CritSoundCheckbox:GetChecked()
if isChecked then
CRITEI_CONFIG.isSoundOn = true
else
CRITEI_CONFIG.isSoundOn = false
end
end
CriteiConfig.ClearCheckbox:SetScript("OnClick", OnClearCheckboxChanged)
CriteiConfig.YellCheckbox:SetScript("OnClick", OnYellCheckboxChanged)
CriteiConfig.CritSoundCheckbox:SetScript("OnClick", OnSoundCheckboxChanged)
-- function to select a language
local languageList = {"en-us", "pt-br"}
function InitializeLanguageDropDown(self, level)
local info = {}
for _, language in pairs(languageList) do
local currentLanguage = language
info.text = currentLanguage
info.value = currentLanguage
info.func = function()
CriteiConfig.SelectedLanguage = currentLanguage
UIDropDownMenu_SetText(CriteiConfig.SelectedLanguage, CriteiConfig.languageDropDown)
changeLanguage(CriteiConfig.SelectedLanguage)
end
UIDropDownMenu_AddButton(info, level)
end
end
-- Functin to select a instance
function InitializeInstanceDropDown(self, level)
local info = {}
for _, instanceName in pairs(CRITEI_CONFIG.exploredInstances) do
local currentInstanceName = instanceName
info.text = currentInstanceName
info.value = currentInstanceName
info.func = function()
CriteiConfig.SelectedInstance = currentInstanceName
UIDropDownMenu_SetText(CriteiConfig.SelectedInstance, CriteiConfig.InstanceDropDown)
showCritData(CriteiConfig.SelectedInstance)
end
UIDropDownMenu_AddButton(info, level)
end
end
-- All SFX
soundList = {"-999", "auuu", "bonk", "dks", "minecraft", "omg", "oof", "pipe", "taco", "vineboom", "weLive",
"whoa"}
-- Select the Damage crit sound
function InitializeCriticalDmgDropDown(self, level)
local info = {}
for _, sound in pairs(soundList) do
local currentSound = sound
info.text = currentSound
info.value = currentSound
info.func = function()
CriteiConfig.SelectedCriticalDmgSound = currentSound
UIDropDownMenu_SetText(CriteiConfig.SelectedCriticalDmgSound, CriteiConfig.criticalDmgDropDown)
PlaySound(CriteiConfig.SelectedCriticalDmgSound)
changeCritSound("dmgSound", CriteiConfig.SelectedCriticalDmgSound)
end
UIDropDownMenu_AddButton(info, level)
end
end
-- Select the Heal crit sound
function InitializeCriticalHealDropDown(self, level)
local info = {}
for _, sound in pairs(soundList) do
local currentSound = sound
info.text = currentSound
info.value = currentSound
info.func = function()
CriteiConfig.SelectedCriticalHealSound = currentSound
UIDropDownMenu_SetText(CriteiConfig.SelectedCriticalHealSound, CriteiConfig.criticalHealDropDown)
PlaySound(CriteiConfig.SelectedCriticalHealSound)
changeCritSound("healSound", CriteiConfig.SelectedCriticalHealSound)
end
UIDropDownMenu_AddButton(info, level)
end
end
-- Select the Damage Taken crit sound
function InitializeCriticalDefDropDown(self, level)
local info = {}
for _, sound in pairs(soundList) do
local currentSound = sound
info.text = currentSound
info.value = currentSound
info.func = function()
CriteiConfig.SelectedCriticalDefSound = currentSound
UIDropDownMenu_SetText(CriteiConfig.SelectedCriticalDefSound, CriteiConfig.criticalDefDropDown)
PlaySound(CriteiConfig.SelectedCriticalDefSound)
changeCritSound("defSound", CriteiConfig.SelectedCriticalDefSound)
end
UIDropDownMenu_AddButton(info, level)
end
end
CriteiConfig:Hide()