forked from fiskee/DoMeWhen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCore.lua
106 lines (102 loc) · 4.13 KB
/
Core.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
DMW = LibStub("AceAddon-3.0"):NewAddon("DMW", "AceConsole-3.0")
local DMW = DMW
DMW.Tables = {}
DMW.Enums = {}
DMW.Functions = {}
DMW.Rotations = {}
DMW.Player = {}
DMW.UI = {}
DMW.Settings = {}
DMW.Helpers = {}
DMW.Pulses = 0
DMW.Timers = {
OM = {},
Navigation = {},
Trackers = {},
Gatherers = {},
Rotation = {}
}
local Init = false
local DebugStart
local RotationCount = 0
local function FindRotation()
if DMW.Rotations[DMW.Player.Class] and DMW.Rotations[DMW.Player.Class][DMW.Player.Spec] then
DMW.Player.Rotation = DMW.Rotations[DMW.Player.Class][DMW.Player.Spec]
end
end
local function Initialize()
DMW.Init()
DMW.UI.HUD.Init()
InitializeNavigation(function(Result)
if Result then
if DMW.Settings.profile.Navigation.WorldMapHook then
DMW.Helpers.Navigation:InitWorldMap()
end
DMW.UI.InitNavigation()
end
end)
Init = true
end
local f = CreateFrame("Frame", "DoMeWhen", UIParent)
f:SetScript(
"OnUpdate",
function(self, elapsed)
DMW.Time = GetTime()
DMW.Pulses = DMW.Pulses + 1
if EWT ~= nil then
LibStub("LibDraw-1.0").clearCanvas()
if not Init then
Initialize()
end
if not DMW.Player.Name then
DMW.Player = DMW.Classes.LocalPlayer(ObjectPointer("player"))
end
if GetSpecializationInfo(GetSpecialization()) ~= DMW.Player.SpecID then
ReloadUI()
return
end
DebugStart = debugprofilestop()
DMW.UpdateOM()
DMW.Timers.OM.Last = debugprofilestop() - DebugStart
DebugStart = debugprofilestop()
DMW.Helpers.Trackers.Run()
DMW.Timers.Trackers.Last = debugprofilestop() - DebugStart
DebugStart = debugprofilestop()
DMW.Helpers.Gatherers.Run()
DMW.Timers.Gatherers.Last = debugprofilestop() - DebugStart
if not DMW.Player.Rotation then
FindRotation()
else
if DMW.Helpers.Queue.Run() then
return true
end
if DMW.Player.Combat then
RotationCount = RotationCount + 1
DebugStart = debugprofilestop()
end
DMW.Player.Rotation()
if DMW.Player.Combat then
DMW.Timers.Rotation.Last = debugprofilestop() - DebugStart
DMW.Timers.Rotation.Total = DMW.Timers.Rotation.Total and (DMW.Timers.Rotation.Total + DMW.Timers.Rotation.Last) or DMW.Timers.Rotation.Last
DMW.Timers.Rotation.Average = DMW.Timers.Rotation.Total / RotationCount
end
if not DMW.UI.HUD.Loaded then
DMW.UI.HUD.Load()
end
end
DebugStart = debugprofilestop()
DMW.Helpers.Navigation:Pulse()
DMW.Timers.Navigation.Last = debugprofilestop() - DebugStart
DMW.UI.Debug.Run()
DMW.Timers.OM.Total = DMW.Timers.OM.Total and (DMW.Timers.OM.Total + DMW.Timers.OM.Last) or DMW.Timers.OM.Last
DMW.Timers.Navigation.Total = DMW.Timers.Navigation.Total and (DMW.Timers.Navigation.Total + DMW.Timers.Navigation.Last) or DMW.Timers.Navigation.Last
DMW.Timers.Trackers.Total = DMW.Timers.Trackers.Total and (DMW.Timers.Trackers.Total + DMW.Timers.Trackers.Last) or DMW.Timers.Trackers.Last
DMW.Timers.Gatherers.Total = DMW.Timers.Gatherers.Total and (DMW.Timers.Gatherers.Total + DMW.Timers.Gatherers.Last) or DMW.Timers.Gatherers.Last
DMW.Timers.Rotation.Total = DMW.Timers.Rotation.Total and (DMW.Timers.Rotation.Total + DMW.Timers.Rotation.Last) or DMW.Timers.Rotation.Last or nil
DMW.Timers.OM.Average = DMW.Timers.OM.Total / DMW.Pulses
DMW.Timers.Navigation.Average = DMW.Timers.Navigation.Total / DMW.Pulses
DMW.Timers.Trackers.Average = DMW.Timers.Trackers.Total / DMW.Pulses
DMW.Timers.Gatherers.Average = DMW.Timers.Gatherers.Total / DMW.Pulses
end
end
)