Mercurial > wow > skeletonkey
comparison SkeletonKey/Events.lua @ 6:f6d1c192afc6
Refactored file layout:
- frame display logic in UI.lua
- player data in Cache.lua
- event responses in Events.lua
a lot of local tables are now stored members of KeyBinder for that to work
author | Nenue |
---|---|
date | Thu, 28 Jul 2016 16:45:56 -0400 |
parents | |
children | 8f8917d111c9 |
comparison
equal
deleted
inserted
replaced
5:9ac29fe77455 | 6:f6d1c192afc6 |
---|---|
1 -- KrakTool | |
2 -- Events.lua | |
3 -- Created: 7/24/2016 11:10 PM | |
4 -- %file-revision% | |
5 -- Event handlers, and the init block that sets them up; nothing else should be here | |
6 | |
7 local kb = LibStub("LibKraken").register(KeyBinder) | |
8 | |
9 kb.init = function() | |
10 kb:RegisterEvent('PLAYER_ENTERING_WORLD') | |
11 kb:RegisterEvent('UPDATE_MACROS') | |
12 kb:RegisterUnitEvent('PLAYER_SPECIALIZATION_CHANGED', 'player', 'pet') | |
13 kb:RegisterUnitEvent('UNIT_PORTRAIT_UPDATE', 'player', 'pet') | |
14 kb:RegisterUnitEvent('TALENT_UPDATE', 'player', 'pet') | |
15 kb:RegisterEvent('PLAYER_REGEN_DISABLED') | |
16 kb:RegisterEvent('PLAYER_REGEN_ENABLED') | |
17 end | |
18 | |
19 kb.event = function(event, ...) | |
20 if kb[event] then | |
21 kb[event](kb, event, ...) | |
22 end | |
23 end | |
24 | |
25 kb.PLAYER_REGEN_DISABLED = function() | |
26 kb.ui() | |
27 end | |
28 | |
29 kb.UNIT_PORTRAIT_UPDATE = function() | |
30 SetPortraitTexture(KeyBinderCharacterTab.icon, 'player') | |
31 end | |
32 | |
33 kb.PLAYER_REGEN_ENABLED = function() | |
34 kb.ui() | |
35 end | |
36 | |
37 kb.PLAYER_SPECIALIZATION_CHANGED = function() | |
38 kb.UpdateSpecInfo() | |
39 kb.UpdateTalentInfo() | |
40 kb.ApplyAllBindings() | |
41 kb.ui(true) | |
42 end | |
43 kb.PLAYER_TALENT_UPDATE = function() | |
44 kb.UpdateTalentInfo() | |
45 kb.ApplyAllBindings() | |
46 kb.ui() | |
47 end | |
48 kb.ACTIONBAR_SLOT_CHANGED = function(self, event, slot) | |
49 kb.HotKeyText(slot) | |
50 return true | |
51 end | |
52 | |
53 kb.UNIT_PET = function(self, event, unit) | |
54 if unit ~= 'player' then | |
55 return | |
56 end | |
57 | |
58 kb.UpdatePetInfo() | |
59 end |