-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCore.lua
More file actions
74 lines (66 loc) · 1.95 KB
/
Copy pathCore.lua
File metadata and controls
74 lines (66 loc) · 1.95 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
local ADDON_NAME, VoxGM = ...
VoxGM.name = ADDON_NAME
VoxGM.version = C_AddOns.GetAddOnMetadata(ADDON_NAME, "Version") or "1.0.0"
-- Sub-namespaces (populated by other files)
VoxGM.Util = {}
VoxGM.State = {}
VoxGM.Cmd = {}
VoxGM.Events = {}
VoxGM.UI = {}
VoxGM.Minimap = {}
VoxGM.Tabs = {}
VoxGM.Data = {}
VoxGM.Favorites = {}
VoxGM.History = {}
VoxGM.PhaseTracker = {}
-- Global reference
_G.VoxGM = VoxGM
-- Main event frame
local frame = CreateFrame("Frame", "VoxGMEventFrame")
VoxGM.eventFrame = frame
-- Initialization chain
frame:RegisterEvent("ADDON_LOADED")
frame:RegisterEvent("PLAYER_LOGIN")
frame:SetScript("OnEvent", function(self, event, ...)
if event == "ADDON_LOADED" then
local name = ...
if name == ADDON_NAME then
VoxGM.State:Init()
VoxGM.Events:Init()
self:UnregisterEvent("ADDON_LOADED")
end
elseif event == "PLAYER_LOGIN" then
VoxGM.UI:Init()
VoxGM.Minimap:Init()
VoxGM.Favorites:Init()
VoxGM.History:Init()
VoxGM.PhaseTracker:Init()
self:UnregisterEvent("PLAYER_LOGIN")
end
end)
-- Slash commands
SLASH_VOXGM1 = "/voxgm"
SLASH_VOXGM2 = "/vgm"
SlashCmdList["VOXGM"] = function(msg)
msg = strtrim(msg or ""):lower()
if msg == "reset" then
VoxGM.State:ResetPosition()
VoxGM.Util:Print("Window position reset.")
elseif msg == "minimap" then
local hidden = not VoxGM.State:GetUI("minimapHidden")
VoxGM.State:SetUI("minimapHidden", hidden)
if hidden then
if VoxGM.Minimap.button then VoxGM.Minimap.button:Hide() end
VoxGM.Util:Print("Minimap button hidden. Use /vgm minimap to restore.")
else
if VoxGM.Minimap.button then
VoxGM.Minimap.button:Show()
else
VoxGM.Minimap:CreateButton()
end
VoxGM.Util:Print("Minimap button shown.")
end
else
VoxGM.UI:Toggle()
end
end