-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathConfig.lua
More file actions
executable file
·264 lines (251 loc) · 9.92 KB
/
Config.lua
File metadata and controls
executable file
·264 lines (251 loc) · 9.92 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
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
------------------------------------------------------------------
-- Modules
------------------------------------------------------------------
---@class Config
local Config = ECSLoader:CreateModule("Config")
local _Config = Config.private
---@type GearInfos
local GearInfos = ECSLoader:ImportModule("GearInfos")
---@type Stats
local Stats = ECSLoader:ImportModule("Stats")
---@type i18n
local i18n = ECSLoader:ImportModule("i18n")
---@type Profile
local Profile = ECSLoader:ImportModule("Profile")
------------------------------------------------------------------
-- Configuration Frame
------------------------------------------------------------------
local AceGUI = LibStub("AceGUI-3.0")
-- Forward declaration
local _CreateGUI, _GeneralTab, _StatsTab
function Config.CreateWindow()
local optionsGUI = _CreateGUI()
LibStub("AceConfig-3.0"):RegisterOptionsTable("ECS", optionsGUI)
ECS.configFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ECS", "Extended Character Stats");
local configFrame = AceGUI:Create("Frame");
LibStub("AceConfigDialog-3.0"):SetDefaultSize("ECS", 440, 590)
LibStub("AceConfigDialog-3.0"):Open("ECS", configFrame)
configFrame:Hide();
ECSConfigFrame = configFrame.frame;
table.insert(UISpecialFrames, "ECSConfigFrame");
end
_CreateGUI = function()
return {
name = "Extended Character Stats",
handler = ECS,
type = "group",
childGroups = "tab",
args = {
general_tab = _GeneralTab(),
stats_tab = _StatsTab(),
}
}
end
_GeneralTab = function()
return {
name = function() return STAT_CATEGORY_GENERAL end,
type = "group",
order = 1,
args = {
generalHeader = {
type = "header",
order = 1,
name = function() return i18n("General Settings") end,
},
statsWindowClosedOnOpen = {
type = "toggle",
order = 1.1,
name = function() return i18n("Hide ECS when opening character tab") end,
desc = function() return i18n("Hides the stats windows when opening the character tab.") end,
width = "full",
get = function () return ExtendedCharacterStats.general.statsWindowClosedOnOpen; end,
set = function (_, value)
ExtendedCharacterStats.general.statsWindowClosedOnOpen = value
end,
},
addColorsToStatTexts = {
type = "toggle",
order = 2,
name = function() return i18n("Colorize Stats") end,
desc = function() return i18n("Adds colors to the stats overview.") end,
width = "full",
get = function () return ExtendedCharacterStats.general.addColorsToStatTexts; end,
set = function (_, value)
ExtendedCharacterStats.general.addColorsToStatTexts = value
Stats.RebuildStatInfos()
end,
},
statColorSelection = {
type = "select",
order = 2.1,
values = {
["full"] = i18n("Full"),
["texts"] = i18n("Stat texts"),
["values"] = i18n("Stat values"),
},
style = "dropdown",
disabled = function() return (not ExtendedCharacterStats.general.addColorsToStatTexts) end,
name = function() return i18n("Stats colorization") end,
get = function()
if (not ExtendedCharacterStats.general.statColorSelection) then
return "full"
else
return ExtendedCharacterStats.general.statColorSelection;
end
end,
set = function(_, selection)
ExtendedCharacterStats.general.statColorSelection = selection
Stats.RebuildStatInfos()
end,
},
showQualityColors = {
type = "toggle",
order = 3,
name = function() return i18n("Show Item Quality Colors") end,
desc = function() return i18n("Shows/Hides the colored frames around equipped items.") end,
width = "full",
get = function () return ExtendedCharacterStats.general.showQualityColors; end,
set = function (_, value)
GearInfos:ToggleColorFrames(value)
ExtendedCharacterStats.general.showQualityColors = value
end,
},
qualityColorsIntensity = {
type = "range",
order = 4,
name = function() return i18n("Quality Colors' Intensity") end,
desc = function() return i18n("Changes the intensity of the colored frames' glow.") end,
width = "double",
min = 0.10,
max = 1.00,
step = 0.01,
get = function() return ExtendedCharacterStats.general.qualityColorsIntensity; end,
set = function (_, value)
ExtendedCharacterStats.general.qualityColorsIntensity = value
GearInfos.UpdateGearColorFrames()
end,
},
headerFontSize = {
type = "range",
order = 5,
name = function() return i18n("Header Font Size") end,
desc = function() return i18n("Changes the font size of the headers (e.g. Melee)") end,
width = "double",
min = 8,
max = 18,
step = 1,
get = function() return ExtendedCharacterStats.general.headerFontSize; end,
set = function (_, value)
ExtendedCharacterStats.general.headerFontSize = value
Stats.RebuildStatInfos()
end,
},
statFontSize = {
type = "range",
order = 6,
name = function() return i18n("Stat Font Size") end,
desc = function() return i18n("Changes the font size of the stat lines (e.g. Crit)") end,
width = "double",
min = 8,
max = 18,
step = 1,
get = function() return ExtendedCharacterStats.general.statFontSize; end,
set = function (_, value)
ExtendedCharacterStats.general.statFontSize = value
Stats.RebuildStatInfos()
end,
},
windowWidth = {
type = "range",
order = 7,
name = function() return i18n("Window Width") end,
desc = function() return i18n("Changes the width of the stats window") end,
width = "double",
min = 12,
max = 25,
step = 0.5,
get = function() return ExtendedCharacterStats.general.window.width / 10; end,
set = function (_, value)
ExtendedCharacterStats.general.window.width = value * 10
Stats:UpdateWindowSize()
end,
},
language = {
type = "select",
order = 8,
values = {
["auto"] = "Auto",
["enUS"] = "English",
["esES"] = "Español",
["esMX"] = "Español (América Latina)",
["ptBR"] = "Português",
["frFR"] = "Français",
["deDE"] = "Deutsch",
["ruRU"] = "Русский",
["zhCN"] = "简体中文",
-- ["zhTW"] = "正體中文",
-- ["koKR"] = "한국어",
},
style = "dropdown",
name = function() return i18n("Language") end,
get = function()
if (not ExtendedCharacterStats.general.language) then
return "auto"
else
return ExtendedCharacterStats.general.language;
end
end,
set = function(_, lang)
i18n:SetLanguage(lang)
Stats.RebuildStatInfos()
Stats:UpdateSettingsButtonText()
end,
},
resetSpacer = {
type = "description",
order = 9,
name = " ",
width = "full"
},
reset = {
type = "execute",
order = 9.1,
name = function() return i18n("Reset ECS") end,
desc = function() return i18n("Restores all default values of ECS."); end,
func = function(_, _)
Profile:Reset()
ReloadUI()
end
}
}
}
end
_StatsTab = function ()
return {
name = function() return i18n("Stats") end,
type = "group",
order = 2,
args = {
statsHeader = {
type = "header",
order = 1,
name = function() return i18n("Stats Settings") end,
},
generalGroup = _Config:LoadGeneralSection(),
meleeGroup = _Config:LoadMeleeSection(),
rangeGroup = _Config:LoadRangeSection(),
defenseGroup = _Config:LoadDefenseSection(),
mp5Group = _Config:LoadManaSection(),
spellSchoolGroup = _Config:SpellSchoolsSection(),
spellGroup = _Config:LoadSpellSection(),
}
}
end
-- Open the configuration window
function Config:ToggleWindow()
if (not ECSConfigFrame:IsShown()) then
ECSConfigFrame:Show()
else
ECSConfigFrame:Hide()
end
end