-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.lua
More file actions
216 lines (197 loc) · 7.33 KB
/
settings.lua
File metadata and controls
216 lines (197 loc) · 7.33 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
local LAM = LibAddonMenu2
local settings = {}
--#region COPY OLD DATA TO NEW ADDON
--[[
local dataMapping = {
['ImpPvPMeterSV'] = 'ImpressiveStatsSV',
['ImpPvPMeterCSV'] = 'ImpressiveStatsCSV',
['PvPMeterBattlegroundsData'] = 'ImpressiveStatsMatchesData',
-- ['ImpPvPMeterMatchBackup'] = 'ImpressiveStatsMatchBackup',
['PvPMeterDuelsData'] = 'ImpressiveStatsDuelsData',
['PvPMeterTOTData'] = 'ImpressiveStatsTributeData',
}
local function IsDataFromImpPvPMeterAvailable()
for oldName, _ in pairs(dataMapping) do
if _G[oldName] ~= nil then return true end
end
end
local function CopyDataFromImpPvPMeter()
for oldSV, newSV in pairs(dataMapping) do
_G[newSV] = _G[oldSV]
_G[oldSV] = nil
end
ReloadUI()
end
--]]
--#endregion
function settings:Initialize(addon)
local settingsName = addon.name .. 'Settings'
local settingsDisplayName = addon.displayName
local addonVersion = addon.addonVersion
local sv = addon.sv
local panelData = {
type = 'panel',
name = settingsDisplayName,
author = '@impda',
website = 'https://www.esoui.com/downloads/info4032-ImpressiveStats.html',
version = addonVersion,
}
local panel = LAM:RegisterAddonPanel(settingsName, panelData)
local bm = {} -- battlegroundsModule
bm[#bm+1] = {
type = 'checkbox',
name = 'Enable',
getFunc = function() return sv.battlegrounds.enabled end,
setFunc = function(value) sv.battlegrounds.enabled = value end,
requiresReload = true,
}
-- {
-- type = 'checkbox',
-- name = '[EXPERIMENTAL]Show only U45 matches',
-- getFunc = function() return sv.battlegrounds.showOnlyLastUpdateMatches end,
-- setFunc = function(value) sv.battlegrounds.showOnlyLastUpdateMatches = value end,
-- requiresReload = true,
-- reference = 'IMP_MATCHES_ShowOnlyLastUpdateMatchesCheckbox',
-- }
bm[#bm+1] = {
type = 'checkbox',
name = 'Save build at the end of match',
getFunc = function() return sv.battlegrounds.saveBuilds end,
setFunc = function(value) sv.battlegrounds.saveBuilds = value end,
}
bm[#bm+1] = {
type = 'checkbox',
name = 'Calculate stats over last 150 matches',
getFunc = function() return sv.battlegrounds.last150 end,
setFunc = function(value)
sv.battlegrounds.last150 = value
IMP_STATS_MATCHES_UI:Update()
end,
}
bm[#bm+1] = {
type = "button",
name = "Delete matches data",
func = function()
ImpressiveStatsMatchesData = {}
ReloadUI()
end,
width = "full",
isDangerous = true,
warning = "Тhis is |cee0000DESTRUCTIVE|r action and it will DELETE ALL DATA (and for both EU and NA servers) about BATTLEGROUND MATCHES recorded. There would be |cee0000NO WAY TO RECOVER|r it!\n\n|c00aa00Please consider saving it before, you can help to gather statistics by sending this file to me :)|r\n\nProceed only if you 100% sure about it!\n\nUI will be automatically reloaded.",
}
if sv.battlegrounds.debugging ~= nil or HashString(GetUnitDisplayName('player')) == 1558608849 then
bm[#bm+1] = {
type = 'checkbox',
name = '|cFFA500Debug mode|r',
getFunc = function() return sv.battlegrounds.debugging end,
setFunc = function(value) sv.battlegrounds.debugging = value end,
tooltip = '- Turns character filter off',
requiresReload = true,
}
end
local duelsModule = {
{
type = 'checkbox',
name = 'Enable',
getFunc = function() return sv.duels.enabled end,
setFunc = function(value) sv.duels.enabled = value end,
requiresReload = true,
},
{
type = 'dropdown',
name = 'Naming options',
tooltip = 'How to display names',
choices = {
'Character Name',
'@id',
'@id (Character Name)'
},
choicesValues = {
1, 2, 3
},
getFunc = function() return sv.duels.namingMode end,
setFunc = function(var) sv.duels.namingMode = var end,
width = 'full',
requiresReload = true,
-- warning = 'Will need to reload the UI.', --(optional)
},
{
type = 'checkbox',
name = 'Save build at the end of duel',
getFunc = function() return sv.duels.saveBuilds end,
setFunc = function(value) sv.duels.saveBuilds = value end,
},
{
type = "button",
name = "Delete duels data",
func = function()
ImpressiveStatsDuelsData = {}
ReloadUI()
end,
width = "full",
isDangerous = true,
warning = "Тhis is |cee0000DESTRUCTIVE|r action and it will DELETE ALL DATA (and for both EU and NA servers) about DUELS recorded. There would be |cee0000NO WAY TO RECOVER|r it!\n\nProceed only if you 100% sure about it!\n\nUI will be automatically reloaded.",
},
}
if sv.duels.debugging ~= nil or HashString(GetUnitDisplayName('player')) == 1558608849 then
duelsModule[#duelsModule+1] = {
type = 'checkbox',
name = '|cFFA500Debug mode|r',
getFunc = function() return sv.duels.debugging end,
setFunc = function(value) sv.duels.debugging = value end,
requiresReload = true,
}
end
local tributeModule = {
{
type = 'checkbox',
name = 'Enable',
getFunc = function() return sv.tot.enabled end,
setFunc = function(value) sv.tot.enabled = value end,
requiresReload = true,
},
{
type = 'checkbox',
name = '[EXPERIMENTAL]Add leaderboard',
getFunc = function() return sv.tot.leaderboard end,
setFunc = function(value) sv.tot.leaderboard = value end,
requiresReload = true,
},
}
local optionsData = {
{
type = 'submenu',
name = 'Battlegrounds module',
tooltip = 'This is the tab for battlegrounds panel',
controls = bm,
},
{
type = 'submenu',
name = 'Duels module',
tooltip = 'For braviest',
controls = duelsModule,
},
{
type = 'submenu',
name = 'Tribute module',
tooltip = 'That is real PvP, no doubts allowed!',
controls = tributeModule,
},
--[[
{
type = 'button',
name = 'Copy from ImpPvPMeter',
tooltip = 'For testers! It will make a full copy of saved data.',
func = CopyDataFromImpPvPMeter,
width = 'full',
warning = 'ALL DATA WILL BE IRREVERSIBLY REPLACED\n\nUse it only ONCE and BEFORE any new bgs/duels/tribute games.\n\nUI will be automatically reloaded.',
isDangerous = true,
disabled = function() return not IsDataFromImpPvPMeterAvailable() end,
},
--]]
}
LAM:RegisterOptionControls(settingsName, optionsData)
end
function IMP_STATS_InitializeSettings(...)
settings:Initialize(...)
end