# HG changeset patch # User Nenue # Date 1471872242 14400 # Node ID 9eebce04e69b6c266053f0121abc70e5f5cf42d7 # Parent 2a95f4010c5a1c04a26298100de57f49f8d90ac3 - 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. diff -r 2a95f4010c5a -r 9eebce04e69b LibKraken/LibKraken.lua --- a/LibKraken/LibKraken.lua Sun Aug 21 07:19:01 2016 -0400 +++ b/LibKraken/LibKraken.lua Mon Aug 22 09:24:02 2016 -0400 @@ -281,15 +281,15 @@ end end + local debugFunc = emptyFunc + --@debug@ local debugID = isModule and name or handler - local debugFunc = emptyFunc if (handler.DEVIAN_PNAME and DEVIAN_PNAME == handler.DEVIAN_PNAME) or ((not handler.DEVIAN_PNAME) and DEVIAN_WORKSPACE) then debuggers[debugID] = debuggers[debugID] or function(...) _G.print(name, ...) end debugFunc = debuggers[debugID] end - print(loadedName) - + --@end-debug@ return handler, debugFunc, KT.wrap end diff -r 2a95f4010c5a -r 9eebce04e69b SkeletonKey/ActionTemplates.lua --- a/SkeletonKey/ActionTemplates.lua Sun Aug 21 07:19:01 2016 -0400 +++ b/SkeletonKey/ActionTemplates.lua Mon Aug 22 09:24:02 2016 -0400 @@ -328,23 +328,21 @@ spellCache[k] = v end end - petSpellCache = spellCache end + petSpellCache = spellCache if petSubtextCache then for k,v in pairs(petSubtextCache) do if not subtextCache[k] then subtextCache[k] = v end end - petSubtextCache = subtextCache end + petSubtextCache = subtextCache else petSpellCache = {} petSubtextCache = {} end - - if PetHasSpellbook() then print('PET SPELLBOOK') local i = 1 diff -r 2a95f4010c5a -r 9eebce04e69b SkeletonKey/BindingsFrame.lua --- 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 diff -r 2a95f4010c5a -r 9eebce04e69b SkeletonKey/Events.lua --- a/SkeletonKey/Events.lua Sun Aug 21 07:19:01 2016 -0400 +++ b/SkeletonKey/Events.lua Mon Aug 22 09:24:02 2016 -0400 @@ -25,7 +25,7 @@ end kb.PLAYER_REGEN_DISABLED = function() - kb.ui() + kb:Hide() end kb.UNIT_PORTRAIT_UPDATE = function() diff -r 2a95f4010c5a -r 9eebce04e69b SkeletonKey/HotKey.lua --- a/SkeletonKey/HotKey.lua Sun Aug 21 07:19:01 2016 -0400 +++ b/SkeletonKey/HotKey.lua Mon Aug 22 09:24:02 2016 -0400 @@ -111,7 +111,7 @@ if bindings[indexKey] then --print('|cFFFFFF00'..frame:GetName(), actionType, actionID, hasAction) local binds = bindings[indexKey] - if binds then + if binds and (not frame.HotKey:IsVisible()) then if hasAction then local bindingsText = kb.BindingString(unpack(binds)) @@ -121,6 +121,10 @@ hotkeyText[frame]:SetFont(frame.HotKey:GetFont()) hotkeyText[frame]:SetTextColor(frame.HotKey:GetTextColor()) hotkeyText[frame]:SetPoint('TOPRIGHT', frame.HotKey, 'TOPRIGHT') + + hooksecurefunc(frame.HotKey, 'SetVertexColor', function(self, r,g,b,a) + hotkeyText[frame]:SetTextColor(r,g,b,a) + end) end hotkeyText[frame]:SetText(bindingsText)