forked from fiskee/DoMeWhen-Classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCore.lua
123 lines (119 loc) · 4.65 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
DMW = LibStub("AceAddon-3.0"):NewAddon("DMW", "AceConsole-3.0")
local DMW = DMW
DMW.Tables = {}
DMW.Enums = {}
DMW.Functions = {}
DMW.Rotations = {}
DMW.Player = {}
DMW.Plugins = {}
DMW.UI = {}
DMW.Settings = {}
DMW.Helpers = {}
DMW.Timers = {
OM = {},
QuestieHelper = {},
Trackers = {},
Gatherers = {},
Rotation = {}
}
DMW.Pulses = 0
if QuestieLoader then
DMW.QuestieTooltips = QuestieLoader:ImportModule("QuestieTooltips")
end
local Initialized = false
local DebugStart
local RotationCount = 0
local function FindRotation()
if DMW.Rotations[DMW.Player.Class] and DMW.Rotations[DMW.Player.Class].Rotation then
DMW.Player.Rotation = DMW.Rotations[DMW.Player.Class].Rotation
if DMW.Rotations[DMW.Player.Class].Settings then
DMW.Rotations[DMW.Player.Class].Settings()
end
DMW.UI.HUD.Load()
end
end
local function Init()
DMW.InitSettings()
DMW.UI.Init()
DMW.UI.HUD.Init()
DMW.Player = DMW.Classes.LocalPlayer(ObjectPointer("player"))
DMW.UI.InitQueue()
DMW.Helpers.HealComm:OnInitialize()
InitializeNavigation(function(Result)
if Result then
if DMW.Settings.profile.Navigation.WorldMapHook then
DMW.Helpers.Navigation:InitWorldMap()
end
DMW.UI.InitNavigation()
end
end)
Initialized = true
end
local function ExecutePlugins()
for _, Plugin in pairs(DMW.Plugins) do
if type(Plugin) == "function" then
Plugin()
end
end
end
local f = CreateFrame("Frame", "DoMeWhen", UIParent)
f:SetScript(
"OnUpdate",
function(self, elapsed)
if GetObjectWithGUID then
LibStub("LibDraw-1.0").clearCanvas()
DMW.Time = GetTime()
DMW.Pulses = DMW.Pulses + 1
if not Initialized and not DMW.UI.MinimapIcon then
Init()
end
DebugStart = debugprofilestop()
DMW.UpdateOM()
DMW.Timers.OM.Last = debugprofilestop() - DebugStart
DMW.UI.Debug.Run()
DebugStart = debugprofilestop()
DMW.Helpers.QuestieHelper.Run()
DMW.Timers.QuestieHelper.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
DMW.Helpers.Swing.Run(elapsed)
ExecutePlugins()
if not DMW.Player.Rotation then
FindRotation()
return
else
if DMW.Helpers.Queue.Run() then
return
end
if DMW.Helpers.Rotation.Active() then
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
end
end
DMW.Helpers.Navigation:Pulse()
DMW.Timers.OM.Total = DMW.Timers.OM.Total and (DMW.Timers.OM.Total + DMW.Timers.OM.Last) or DMW.Timers.OM.Last
DMW.Timers.QuestieHelper.Total = DMW.Timers.QuestieHelper.Total and (DMW.Timers.QuestieHelper.Total + DMW.Timers.QuestieHelper.Last) or DMW.Timers.QuestieHelper.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.QuestieHelper.Average = DMW.Timers.QuestieHelper.Total / DMW.Pulses
DMW.Timers.Trackers.Average = DMW.Timers.Trackers.Total / DMW.Pulses
DMW.Timers.Gatherers.Average = DMW.Timers.Gatherers.Total / DMW.Pulses
elseif wmbapi then
LoadMiniBotAPI()
end
end
)