-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvm.lua
71 lines (61 loc) · 2.09 KB
/
vm.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
local addonName, vm = ...
vm.Astrolabe = {}
-- local functions
local event, init, start
function event(self, event, ...)
if event == "ADDON_LOADED" and ... == addonName then
init()
elseif event == "WORLD_MAP_UPDATE" then
if (vm.Astrolabe and vm.Astrolabe.WorldMapVisible) then
vm.WorldMap.display()
end
elseif event == 'CHAT_MSG_ADDON' then
addonMessage(...)
end
end
function addonMessage(prefix, message, type, sender)
if prefix == 'VadeMecum' then
vm.Notes.importRequest(message, sender)
end
end
function init ()
SlashCmdList["VADEMECUM"] = function(msg)
if msg == '' then
vm.Notes.display()
elseif msg == 'assist' then
vm.Assistant.settings()
elseif msg == 'assist next' then
vm.Assistant.next()
elseif msg == 'assist switch' then
vm.Assistant.switchRestype()
elseif msg == 'assist go' then
vm.Assistant.go()
elseif msg == 'find' then
vm.Find.form()
elseif msg == 'debug' then
-- local round = vm.Utils.round
-- print(UIParent:GetEffectiveScale())
-- print(GetCursorPosition())
-- print(round(Minimap:GetWidth(),2 ), round(Minimap:GetHeight(),2))
-- print(round(Minimap:GetLeft(),2 ), round(Minimap:GetTop(),2))
-- print(round(Minimap:GetLeft() * UIParent:GetEffectiveScale() + UIParent:GetEffectiveScale() * Minimap:GetWidth() / 2, 2))
-- vm.Assistant.go()
end
end
SLASH_VADEMECUM1 = '/vm'
VadeMecum_Notes = VadeMecum_Notes or {}
VadeMecum_Settings = VadeMecum_Settings or {}
vm.Astrolabe = DongleStub("Astrolabe-0.4")
SetMapToCurrentZone()
vm.MiniMap.display()
print(addonName .. " Loaded. Type /vm for notes list")
end
-- +++
function start()
local main = CreateFrame("Frame", "VadeMecum")
main:RegisterEvent("ADDON_LOADED")
main:RegisterEvent("WORLD_MAP_UPDATE")
main:RegisterEvent("CHAT_MSG_ADDON")
main:SetScript("OnEvent", event)
end
start();