Mercurial > wow > skeletonkey
comparison HotKey.lua @ 72:c48913c5924c
- Dynamic bindings properly update between talent choices, and the hotkey text is also correctly reflected.
| author | Nenue |
|---|---|
| date | Sat, 07 Jan 2017 12:47:41 -0500 |
| parents | 131d9190db6b |
| children |
comparison
equal
deleted
inserted
replaced
| 71:ca3118127e5e | 72:c48913c5924c |
|---|---|
| 32 ["ACTIONBAR_PAGE_CHANGED"] = {"actionbar"}, | 32 ["ACTIONBAR_PAGE_CHANGED"] = {"actionbar"}, |
| 33 ["ACTIONBAR_SLOT_CHANGED"] = {"actionslot"}, | 33 ["ACTIONBAR_SLOT_CHANGED"] = {"actionslot"}, |
| 34 ["PLAYER_ENTERING_WORLD"] = {"world","all"}, | 34 ["PLAYER_ENTERING_WORLD"] = {"world","all"}, |
| 35 ["PET_UI_UPDATE"] = {"pet"}, | 35 ["PET_UI_UPDATE"] = {"pet"}, |
| 36 ["PLAYER_SPECIALIZATION_CHANGED"] = {"player"}, | 36 ["PLAYER_SPECIALIZATION_CHANGED"] = {"player"}, |
| 37 ["PLAYER_TALENTS_UPDATED"] = {"player"}, | |
| 38 } | 37 } |
| 39 | 38 |
| 40 | 39 |
| 41 function hotkey:wrapEvent (event, ...) | 40 function hotkey:wrapEvent (event, ...) |
| 42 self:RegisterEvent(event) | 41 self:RegisterEvent(event) |
| 89 function hotkey:OnLoad() | 88 function hotkey:OnLoad() |
| 90 hooksecurefunc("ActionBarButtonEventsFrame_RegisterFrame", hotkey.RegisterFrame) | 89 hooksecurefunc("ActionBarButtonEventsFrame_RegisterFrame", hotkey.RegisterFrame) |
| 91 | 90 |
| 92 end | 91 end |
| 93 | 92 |
| 93 | |
| 94 function hotkey:Update() | 94 function hotkey:Update() |
| 95 print('--|cFF00FF00ui|r') | 95 print('--|cFF00FF00ui|r') |
| 96 self:player() | 96 self:player() |
| 97 hotkey:pet() | 97 hotkey:pet() |
| 98 hotkey:binding() | 98 hotkey:binding() |
| 99 end | 99 kb.UpdateHotKeys = function() self:Update() end |
| 100 | 100 end |
| 101 | 101 |
| 102 function hotkey:world() | 102 function hotkey:world() |
| 103 print('--|cFF00FF00world|r') | 103 print('--|cFF00FF00world|r') |
| 104 -- needs to be delayed so it isn't fired 50 times at login | 104 -- needs to be delayed so it isn't fired 50 times at login |
| 105 if not hotkeyEvents["UPDATE_BINDINGS"] then | 105 if not hotkeyEvents["UPDATE_BINDINGS"] then |
| 113 end | 113 end |
| 114 | 114 |
| 115 -- requires all these arguments since non-actionbar buttons don't have all of said methods | 115 -- requires all these arguments since non-actionbar buttons don't have all of said methods |
| 116 local kprint = (DEVIAN_WORKSPACE and function(...) _G.print('HotKeyUpdate', ...) end) or function() end | 116 local kprint = (DEVIAN_WORKSPACE and function(...) _G.print('HotKeyUpdate', ...) end) or function() end |
| 117 function hotkey:UpdateHotKey(frame, actionType, actionID, hasAction) | 117 function hotkey:UpdateHotKey(frame, actionType, actionID, hasAction) |
| 118 bindings = kb.GetBindings() | 118 |
| 119 | 119 |
| 120 if hasAction then | 120 if hasAction then |
| 121 local indexKey = kb.FormatActionID(actionType, actionID) | 121 local indexKey = kb.FormatActionID(actionType, actionID) |
| 122 | 122 |
| 123 | 123 |
| 132 elseif actionType == 'item' then | 132 elseif actionType == 'item' then |
| 133 actionName = GetItemInfo(actionID) | 133 actionName = GetItemInfo(actionID) |
| 134 end | 134 end |
| 135 kprint(' actionKey:', indexKey) | 135 kprint(' actionKey:', indexKey) |
| 136 | 136 |
| 137 local binds = bindings[indexKey] | 137 local binds = kb.bindings[indexKey] |
| 138 if binds and (not frame.HotKey:IsVisible()) then | 138 if binds and (not frame.HotKey:IsVisible()) then |
| 139 kprint(frame:GetName(), '|cFF88FF00'..indexKey..'|r', hasAction, actionName) | 139 kprint(frame:GetName(), '|cFF88FF00'..indexKey..'|r', hasAction, actionName) |
| 140 local bindingsText = kb.BindingString(unpack(binds)) | 140 local bindingsText = kb.BindingString(unpack(binds)) |
| 141 | 141 |
| 142 if not hotkeyText[frame] then | 142 if not hotkeyText[frame] then |
