forked from Tercioo/Details-Damage-Meter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
window_benchmark.lua
289 lines (221 loc) · 13.4 KB
/
window_benchmark.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
if (true) then
return
end
local Details = _G.Details
local DF = _G.DetailsFramework
local libwindow = LibStub("LibWindow-1.1")
--this function isn't in use
function Details.OpenDpsBenchmark()
--main frame
local DF = Details.gump
local _ = nil
--declaration
local f = CreateFrame("frame", "DetailsBenchmark", UIParent,"BackdropTemplate")
f:SetSize(800, 600)
f:SetPoint("left", UIParent, "left")
f:SetFrameStrata("LOW")
f:EnableMouse(true)
f:SetMovable(true)
f:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
f:SetBackdropColor(0, 0, 0, 0.9)
f:SetBackdropBorderColor(0, 0, 0, 1)
--register to libwindow
local LibWindow = LibStub("LibWindow-1.1")
LibWindow.RegisterConfig(f, Details.benchmark_db.frame)
LibWindow.RestorePosition(f)
LibWindow.MakeDraggable(f)
LibWindow.SavePosition(f)
--titlebar
f.TitleBar = CreateFrame("frame", "$parentTitleBar", f,"BackdropTemplate")
f.TitleBar:SetPoint("topleft", f, "topleft", 2, -3)
f.TitleBar:SetPoint("topright", f, "topright", -2, -3)
f.TitleBar:SetHeight(20)
f.TitleBar:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
f.TitleBar:SetBackdropColor(.2, .2, .2, 1)
f.TitleBar:SetBackdropBorderColor(0, 0, 0, 1)
--close button
f.Close = CreateFrame("button", "$parentCloseButton", f,"BackdropTemplate")
f.Close:SetPoint("right", f.TitleBar, "right", -2, 0)
f.Close:SetSize(16, 16)
f.Close:SetNormalTexture(Details.gump.folder .. "icons")
f.Close:SetHighlightTexture(Details.gump.folder .. "icons")
f.Close:SetPushedTexture(Details.gump.folder .. "icons")
f.Close:GetNormalTexture():SetTexCoord(0, 16/128, 0, 1)
f.Close:GetHighlightTexture():SetTexCoord(0, 16/128, 0, 1)
f.Close:GetPushedTexture():SetTexCoord(0, 16/128, 0, 1)
f.Close:SetAlpha(0.7)
f.Close:SetScript("OnClick", function() f:Hide() end)
--title
f.Title = f.TitleBar:CreateFontString("$parentTitle", "overlay", "GameFontNormal")
f.Title:SetPoint("center", f.TitleBar, "center")
f.Title:SetTextColor(.8, .8, .8, 1)
f.Title:SetText("Details! Benchmark")
DF:InstallTemplate("font", "DETAILS_BENCHMARK_NORMAL", {color = "white", size = 10, font = "Friz Quadrata TT"})
function f.CreateCombatObject()
local t = {}
return t
end
function f.StartNewBenchmark()
end
function f.StopCurrentBenchmark()
end
f.OnTickInterval = 0
function f.UpdateOnTick (self, deltaTime)
f.OnTickInterval = f.OnTickInterval + deltaTime
if (f.OnTickInterval >= 0.024) then
--do the update
--reset the interval
f.OnTickInterval = 0
end
end
function f.StartUpdateOnTick()
f:SetScript("OnUpdate", f.UpdateOnTick)
end
--events
f:RegisterEvent("PLAYER_REGEN_DISABLED")
f:RegisterEvent("PLAYER_REGEN_ENABLED")
f:SetScript("OnEvent", function(self, event, ...)
if (event == "PLAYER_REGEN_DISABLED") then
f.StartNewBenchmark()
elseif (event == "PLAYER_REGEN_ENABLED") then
f.StopCurrentBenchmark()
end
end)
local normal_text_template = DF:GetTemplate("font", "DETAILS_BENCHMARK_NORMAL")
local options_dropdown_template = DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
local options_switch_template = DF:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_slider_template = DF:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")
--locations
f.FrameLocations = {
summary = {10, -30},
auras = {10, -120},
spells = {10, -180},
history = {10, -280},
}
f.FrameSizes = {
default = {300, 200},
}
--summary block
--declaration
local summaryFrame = CreateFrame("frame", "$parentSummaryFrame", f,"BackdropTemplate")
summaryFrame:SetPoint("topleft", f, "topleft", unpack(f.FrameLocations.summary))
summaryFrame:SetSize(unpack(f.FrameSizes.default))
summaryFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
summaryFrame:SetBackdropColor(0, 0, 0, 0.9)
summaryFrame:SetBackdropBorderColor(0, 0, 0, 1)
--time to test string and dropdown
local build_time_list = function()
local t = {
{value = 40, label = "40 seconds"},
{value = 60, label = "60 seconds"},
{value = 90, label = "90 seconds"},
{value = 120, label = "2 minutes"},
{value = 180, label = "3 minutes"},
{value = 300, label = "5 minutes"},
}
return t
end
summaryFrame.TimeToTestLabel = DF:CreateLabel(summaryFrame, "Amount of Time", normal_text_template)
summaryFrame.TimeToTestDropdown = DF:CreateDropDown (summaryFrame, build_time_list, default, 150, 20, _, _, options_dropdown_template)
--description string and text entry
summaryFrame.DescriptionLabel = DF:CreateLabel(summaryFrame, "Description", normal_text_template)
summaryFrame.DescriptionEntry = DF:CreateTextEntry(summaryFrame, function()end, 120, 20, nil, _, nil, options_dropdown_template)
--DPS Amount string
summaryFrame.DPSLabel = DF:CreateLabel(summaryFrame, "100K", normal_text_template)
--TIME ELAPSED string
summaryFrame.TimeElapsedLabel = DF:CreateLabel(summaryFrame, "01:00", normal_text_template)
--boss simulation string and dropdown
local build_bosssimulation_list, default = function()
local t = {
{value = "patchwerk", label = "Patchwerk"},
}
return t
end
summaryFrame.BossSimulationLabel = DF:CreateLabel(summaryFrame, "Boss Simulation", normal_text_template)
summaryFrame.BossSimulationDropdown = DF:CreateDropDown (summaryFrame, build_bosssimulation_list, default, 150, 20, _, _, options_dropdown_template)
--boss records line with a tooltip importing data from the storage
summaryFrame.BossRecordsFrame = CreateFrame("frame", nil, summaryFrame,"BackdropTemplate")
summaryFrame.BossRecordsFrame:SetSize(f.FrameSizes.default[1]-20, 20)
summaryFrame.BossRecordsFrame:SetBackdropColor(0, 0, 0, 0.3)
summaryFrame.BossRecordsFrame:SetScript("OnEnter", function()
end)
summaryFrame.BossRecordsFrame:SetScript("OnLeave", function()
end)
--set the points
do
local x, y = 10, -10
summaryFrame.TimeToTestLabel:SetPoint("topleft", summaryFrame, "topleft", x, y)
summaryFrame.TimeToTestDropdown:SetPoint("topleft", summaryFrame.TimeToTestLabel, "bottomleft", 0, -2)
--y = y - 40
summaryFrame.DescriptionLabel:SetPoint("topleft", summaryFrame, "topleft", x+160, y)
summaryFrame.DescriptionEntry:SetPoint("topleft", summaryFrame.DescriptionLabel, "bottomleft", 0, -2)
y = y - 40
summaryFrame.DPSLabel:SetPoint("topleft", summaryFrame, "topleft", x, y)
summaryFrame.TimeElapsedLabel:SetPoint("topleft", summaryFrame, "topleft", x + 100, y)
y = y - 40
summaryFrame.BossSimulationLabel:SetPoint("topleft", summaryFrame, "topleft", x, y)
summaryFrame.BossSimulationDropdown:SetPoint("topleft", summaryFrame.BossSimulationLabel, "bottomleft", 0, -2)
y = y - 40
summaryFrame.BossRecordsFrame:SetPoint("topleft", summaryFrame, "topleft", 0, 0)
end
--spells block
--declaration
local spellsFrame = CreateFrame("frame", "$parentSpellsFrame", f,"BackdropTemplate")
spellsFrame:SetPoint("topleft", f, "topleft", unpack(f.FrameLocations.spells))
spellsFrame:SetSize(unpack(f.FrameSizes.default))
spellsFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
spellsFrame:SetBackdropColor(0, 0, 0, 0.9)
spellsFrame:SetBackdropBorderColor(0, 0, 0, 1)
--header with the string titles:
--Spell Icon | DPS | Damage | Casts | Criticals | Highest Damage
--scrollpanel
--each line with:
--Texture for the icon
--5 strings for the data
--hover over scripts
--auras block
--declaration
local aurasFrame = CreateFrame("frame", "$parentAurasFrame", f,"BackdropTemplate")
aurasFrame:SetPoint("topleft", f, "topleft", unpack(f.FrameLocations.auras))
aurasFrame:SetSize(unpack(f.FrameSizes.default))
aurasFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
aurasFrame:SetBackdropColor(0, 0, 0, 0.9)
aurasFrame:SetBackdropBorderColor(0, 0, 0, 1)
--will be 9 blocks?
--each block with:
--Texture for the icon
--3 strings for Total Update, Applications and Refreshes
--history block
--declaration
local historyFrame = CreateFrame("frame", "$parentHistoryFrame", f,"BackdropTemplate")
historyFrame:SetPoint("topleft", f, "topleft", unpack(f.FrameLocations.history))
historyFrame:SetSize(unpack(f.FrameSizes.default))
historyFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
historyFrame:SetBackdropColor(0, 0, 0, 0.9)
historyFrame:SetBackdropBorderColor(0, 0, 0, 1)
--header with the string titles:
--Spec | ILevel | DPS | Time | Talents | Crit | Haste | Versatility | Mastery | Int | Description
--scrollpanel
--each line with:
--7 Textures for talent icons
--10 strings for the data
--hover over scripts
--mechanics
--to open the window
--on target a training dummy
--need to be on a specific map / sanctuary
--on start a new combat:
--start the timer
--start the boss script if not patchwerk
--create the graphic tables for *player total damage and *spell damage
--create aura tables / grab auras already applied to the player / auras with no duration wont be added
--on tick:
--*check if the time is gone *update the time string *update the graphic *update the spells *upate the auras
--on finishes:
--stop the timer and check if the elapsed time is done
--create a new benchmark object to store the test
--export the data to this new object
--add this new object to the benchmark storage table
--update the history scrollbar
end