Mercurial > wow > skeletonkey
diff BindingsFrame.lua @ 78:d4c100b0fd01 v7.1.5-80-release
- Fixed an issue with talent bindings not loading between specialization changes.
- Fixed action button text corruption that occurred after changing assignments on an inactive spell.
author | Nenue |
---|---|
date | Thu, 26 Jan 2017 20:25:04 -0500 |
parents | 6623b7f2c1ca |
children | b9a53385462c |
line wrap: on
line diff
--- a/BindingsFrame.lua Mon Jan 23 20:09:08 2017 -0500 +++ b/BindingsFrame.lua Thu Jan 26 20:25:04 2017 -0500 @@ -16,6 +16,7 @@ --]=] SkeletonKeyButtonMixin = {} +local skb = SkeletonKeyButtonMixin local _, kb = ... local print = (DEVIAN_PNAME == 'SkeletonKey') and function(...) _G.print('SKUI', ...) end or nop local gprint = (DEVIAN_PNAME == 'SkeletonKey') and function(...) _G.print('SK', ...) end or nop @@ -423,6 +424,64 @@ return true end +function ActionListPanel:UnbindSlot (button) + + local configTable = kb.currentProfile.buttons[button:GetID()] + local button = button or kb.saveTarget + if not button then + return + end + + local command = button.command + local actionType = button.actionType + local actionID = button.actionID + + + local talentName = button.actionName + if actionType == 'macro' then + local spellName, _, spellID = GetMacroSpell(actionID) + talentName = spellName + end + + local keys = {GetBindingKey(command) } + if configTable and configTable.assignedKeys then + for _, key in ipairs(configTable.assignedKeys) do + if not tContains(keys, key) then + tinsert(keys, key) + end + end + end + + -- only manipulate bindings if its an available ability + if button.isAvailable then + --print('detected', #keys, 'bindings') + + if #keys >= 1 then + kb.UpdateBindingsCache(actionType, actionID, {}) + end + + for i, key in pairs(keys) do + --print('clearing', key) + SetBinding(key, nil) + kb.bindings[tostring(actionType)..'_'..tostring(actionID)] = nil + end + SaveBindings(GetCurrentBindingSet()) + end + + + if configTable and configTable.assignedKeys then + table.wipe(configTable.assignedKeys) + end + + if kb.currentProfile.bound[command] then + kb.currentProfile.bound[command] = nil + --kb:print(BINDING_REMOVED:format(self.actionName, configHeaders[db.bindMode])) + end + kb.saveTarget = nil + button:UpdateSlot(true) + return true +end + function ActionListPanel:OnInput(key) if key == 'ESCAPE' then @@ -448,7 +507,7 @@ end --- Associate processed input with the given slot's metadata -function SkeletonKeyButtonMixin:SaveSlot (key) +function skb:SaveSlot (key) if not self.command then return @@ -505,7 +564,7 @@ SetBinding(binding, self.command) SaveBindings(GetCurrentBindingSet()) self.assignedKeys = {GetBindingKey(self.command) } - + kb.UpdateBindingsCache(self.actionType, self.actionID, self.assignedKeys) kb:print(L('BINDING_ASSIGNED', binding, self.actionName, kb.currentHeader)) else kb:print(L('UNSELECTED_TALENT_ASSIGNED', binding, self.actionName, kb.currentHeader)) @@ -515,7 +574,6 @@ tinsert(self.assignedKeys, 1, binding) end - for _, key in ipairs(self.assignedKeys) do if not kb.currentProfile.bindings[key] then kb.currentProfile.bindings[key] = self.command @@ -530,10 +588,7 @@ end end - kb.UpdateBindingsCache(self.actionType, self.actionID, self.assignedKeys) - self.binding = binding - return true end @@ -550,64 +605,6 @@ self:StopMovingOrSizing() end -function ActionListPanel:UnbindSlot (button) - - local configTable = kb.currentProfile.buttons[button:GetID()] - local button = button or kb.saveTarget - if not button then - return - end - - local command = button.command - local actionType = button.actionType - local actionID = button.actionID - - - local talentName = button.actionName - if actionType == 'macro' then - local spellName, _, spellID = GetMacroSpell(actionID) - talentName = spellName - end - - local keys = {GetBindingKey(command) } - if configTable and configTable.assignedKeys then - for _, key in ipairs(configTable.assignedKeys) do - if not tContains(keys, key) then - tinsert(keys, key) - end - end - end - - -- only manipulate bindings if its an available ability - if button.isAvailable then - --print('detected', #keys, 'bindings') - - if #keys >= 1 then - kb.UpdateBindingsCache(actionType, actionID, {}) - end - - for i, key in pairs(keys) do - --print('clearing', key) - SetBinding(key, nil) - kb.bindings[tostring(actionType)..'_'..tostring(actionID)] = nil - end - SaveBindings(GetCurrentBindingSet()) - end - - - if configTable and configTable.assignedKeys then - table.wipe(configTable.assignedKeys) - end - - if kb.currentProfile.bound[command] then - kb.currentProfile.bound[command] = nil - --kb:print(BINDING_REMOVED:format(self.actionName, configHeaders[db.bindMode])) - end - kb.saveTarget = nil - button:UpdateSlot(true) - return true -end - kb.AcceptAssignment = function(self, ...) local popup = StaticPopupDialogs["SKELETONKEY_CONFIRM_ASSIGN_SLOT"] local source = kb. loadedProfiles[popup.oldProfile]