Mercurial > wow > skeletonkey
diff SkeletonKey/BindingsFrame.lua @ 57:9eebce04e69b
- Prevent bind settings from being updated in combat.
- Close the UI during combat.
- Resolve conflicting keybinds and inform the user of any results.
- Resolve conflicts for talents, but only when they are active.
author | Nenue |
---|---|
date | Mon, 22 Aug 2016 09:24:02 -0400 |
parents | 81a7c71c4483 |
children | 2409fe9b81e1 |
line wrap: on
line diff
--- a/SkeletonKey/BindingsFrame.lua Sun Aug 21 07:19:01 2016 -0400 +++ b/SkeletonKey/BindingsFrame.lua Mon Aug 22 09:24:02 2016 -0400 @@ -51,6 +51,7 @@ local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown local GetBindingAction, GetBindingKey, GetCurrentBindingSet = GetBindingAction, GetBindingKey, GetCurrentBindingSet local SetBinding, SaveBindings = SetBinding, SaveBindings +local GetSpellInfo, InCombatLockdown = GetSpellInfo, InCombatLockdown kb.ProcessInput = function(key) if key == 'ESCAPE' then @@ -499,6 +500,12 @@ if not self.command then return end + if InCombatLockdown() then + kb:print(L('Bindings cannot be changed during combat.')) + return + end + + print('|cFFFFFF00received|cFFFFFF00', self:GetID(), '|cFF00FFFF', key) local modifier = '' @@ -544,7 +551,8 @@ for i, key in ipairs(currentHotKeys) do if key == binding then found = true - kb:print('hotkey already assigned') + print('|cFFFF4400key already bound to this') + return true end end if not found then @@ -552,6 +560,34 @@ kb.UpdateBindingsCache(self.actionType, self.actionID, currentHotKeys) end + -- scour profile data for any conflicting binds + local currentAction = GetBindingAction(binding) + if match(currentAction, 'KeyBinder') then + if currentAction ~= self.command then + print('|cFFFF4400removing bindings for:', currentAction) + for profileID, profileData in ipairs(kb.loadedProfiles) do + local buttonID = profileData.commands[currentAction] + if buttonID then + local buttonAction = profileData.buttons[buttonID][2] + if buttonAction then + local talentInfo = profileData.talents[buttonAction] + if talentInfo and GetSpellInfo(buttonAction) then + for i = #talentInfo, 5, -1 do + if binding == talentInfo[i] then + tremove(talentInfo, i) + end + end + kb:print(L('Overwrote talent |cFF88FF00%s|r in |cFF00FFFF%s|r', buttonAction, kb.configHeaders[profileID])) + else + + kb:print(L('Overwrote |cFFFFFF00%s|r in |cFF00FFFF%s|r', buttonAction, kb.configHeaders[profileID])) + end + profileData.bindings[binding] = nil + end + end + end + end + end print('SetBinding', binding, self.command) @@ -588,8 +624,9 @@ end end + kb:print(L('BINDING_ASSIGNED', self.binding, self.actionName, kb.currentHeader)) - kb.UpdateSlot(self, true) + kb.ui() return true end