-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCore.lua
More file actions
82 lines (77 loc) · 2.73 KB
/
Copy pathCore.lua
File metadata and controls
82 lines (77 loc) · 2.73 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
local addonName, WE = ...
local eventFrame = CreateFrame("Frame")
WE.eventFrame = eventFrame
local function RefreshEnvironmentState()
WE.state.inCombat = InCombatLockdown() or false
WE.state.mounted = IsMounted() or false
local inInstance, instanceType = IsInInstance()
WE.state.inInstance = inInstance or false
WE.state.instanceType = inInstance and instanceType or "none"
end
local function ApplyIfReady()
if not WE.initialized or not SuperTrackedFrame then
return
end
if WE.GetDB().enabled then
WE.ApplyAll()
else
WE.RestoreBlizzardLikeStyle()
end
end
eventFrame:SetScript("OnEvent", function(_, event, ...)
if event == "ADDON_LOADED" then
local loadedAddon = ...
if loadedAddon == addonName then
WE.InitializeDB()
WE.RegisterSettings()
WE.RegisterSlashCommands()
WE.CreatePreview()
WE.initialized = true
elseif WE.initialized then
WE.RefreshCompatibility()
end
elseif event == "PLAYER_LOGIN" then
RefreshEnvironmentState()
WE.CaptureNativeStyle()
WE.EnsureRegions()
WE.HookSuperTrackedFrame()
WE.RefreshCompatibility()
ApplyIfReady()
elseif event == "PLAYER_ENTERING_WORLD" or event == "ZONE_CHANGED_NEW_AREA" then
RefreshEnvironmentState()
ApplyIfReady()
elseif event == "PLAYER_REGEN_DISABLED" then
WE.state.inCombat = true
WE.ApplyVisibility()
elseif event == "PLAYER_REGEN_ENABLED" then
WE.state.inCombat = false
WE.ApplyVisibility()
elseif event == "PLAYER_MOUNT_DISPLAY_CHANGED" then
WE.state.mounted = IsMounted() or false
WE.ApplyVisibility()
elseif event == "NAVIGATION_FRAME_CREATED" then
ApplyIfReady()
elseif event == "NAVIGATION_FRAME_DESTROYED" then
WE.state.cachedDistance = nil
WE.hot.wasClamped = false
WE.InvalidateHotState()
elseif event == "SUPER_TRACKING_CHANGED" then
WE.state.cachedDistance = nil
WE.hot.wasClamped = false
WE.InvalidateHotState()
ApplyIfReady()
if WE.GetDB().enabled and WE.GetDB().icon.pulseOnChange then
WE.PlayPulse("ICON")
end
end
end)
eventFrame:RegisterEvent("ADDON_LOADED")
eventFrame:RegisterEvent("PLAYER_LOGIN")
eventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
eventFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
eventFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
eventFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
eventFrame:RegisterEvent("PLAYER_MOUNT_DISPLAY_CHANGED")
eventFrame:RegisterEvent("NAVIGATION_FRAME_CREATED")
eventFrame:RegisterEvent("NAVIGATION_FRAME_DESTROYED")
eventFrame:RegisterEvent("SUPER_TRACKING_CHANGED")