-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevents.lua
30 lines (25 loc) · 872 Bytes
/
events.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
local _, _addon = ...
local L = _addon:GetLocalization()
local frame = CreateFrame("Frame")
local spellsCache
local timeElapsed = 0
local function UpdateTimer(self, diff)
timeElapsed = timeElapsed + diff
if timeElapsed < 0.5 then return end
print(L["CHATLINE_SPELLS_AVAILABLE"])
_addon:OutputSpellList(spellsCache, true)
spellsCache = nil
frame:SetScript("OnUpdate", nil)
end
frame:SetScript( "OnEvent",function(self, event, arg1)
-- Prit spells on level up, if there are any
-- Delay print so it's after the default level up stuff
if event == "PLAYER_LEVEL_UP" then
local spells, count = _addon:GetSpellsForLevel(arg1)
if spells == nil then return end
spellsCache = spells
timeElapsed = 0
frame:SetScript("OnUpdate", UpdateTimer)
end
end)
frame:RegisterEvent("PLAYER_LEVEL_UP")