comparison BindingsFrame.lua @ 76:6623b7f2c1ca v7.1.5-78-release

Added: - key assignment and unbinding for inactive talents Bug Fixes: - fixed spell access check for talents - fixed detection of Legion PvP talents - fixed unbind command not clearing assigned key text - fixed frame content not loading after combat Miscellaneous: - bindings are determined from the button's assignment list - increment profile version to remove deprecated talents list
author Nenue
date Mon, 23 Jan 2017 20:07:30 -0500
parents 9824d524a661
children d4c100b0fd01
comparison
equal deleted inserted replaced
75:e75a2fd448c0 76:6623b7f2c1ca
166 166
167 self:Update(true) 167 self:Update(true)
168 print(self.zoomScale, self.scrollOffset) 168 print(self.zoomScale, self.scrollOffset)
169 end 169 end
170 170
171 function SkeletonKeyMixin:OnShow()
172 self:Update()
173 end
171 function SkeletonKeyMixin:OnHide() 174 function SkeletonKeyMixin:OnHide()
172 KeyBinderImportLog:Hide() 175
173 end 176 end
174 177
175 178
176 local tabID = 0 179 local tabID = 0
177 local prevTab 180 local prevTab
510 513
511 if not tContains(self.assignedKeys, binding) then 514 if not tContains(self.assignedKeys, binding) then
512 tinsert(self.assignedKeys, 1, binding) 515 tinsert(self.assignedKeys, 1, binding)
513 end 516 end
514 517
515 local talentInfo = kb.DynamicSpells[spellName]
516 if spellName and talentInfo then
517 print('store dynamicType talent')
518 if talentInfo.dynamicType == 'talent' then
519 talentInfo = {
520 macroName = self.macroName,
521 actionName = self.actionName,
522 actionType = self.actionType,
523 actionID = self.actionID,
524 assignedKeys = self.assignedKeys
525 }
526 kb.currentProfile.talents[spellName] = talentInfo
527 end
528 end
529 518
530 for _, key in ipairs(self.assignedKeys) do 519 for _, key in ipairs(self.assignedKeys) do
531 if not kb.currentProfile.bindings[key] then 520 if not kb.currentProfile.bindings[key] then
532 kb.currentProfile.bindings[key] = self.command 521 kb.currentProfile.bindings[key] = self.command
533 end 522 end
536 for level, profile in ipairs(kb.orderedProfiles) do 525 for level, profile in ipairs(kb.orderedProfiles) do
537 if (level > kb.db.bindMode) then 526 if (level > kb.db.bindMode) then
538 profile.bindings[binding] = nil 527 profile.bindings[binding] = nil
539 profile.commands[self.command] = nil 528 profile.commands[self.command] = nil
540 profile.bound[self.command] = nil 529 profile.bound[self.command] = nil
541 if spellName then
542 profile.talents[spellName] = nil
543 end
544 end 530 end
545 end 531 end
546 532
547 kb.UpdateBindingsCache(self.actionType, self.actionID, self.assignedKeys) 533 kb.UpdateBindingsCache(self.actionType, self.actionID, self.assignedKeys)
548 534
564 self:StopMovingOrSizing() 550 self:StopMovingOrSizing()
565 end 551 end
566 552
567 function ActionListPanel:UnbindSlot (button) 553 function ActionListPanel:UnbindSlot (button)
568 554
555 local configTable = kb.currentProfile.buttons[button:GetID()]
569 local button = button or kb.saveTarget 556 local button = button or kb.saveTarget
570 if not button then 557 if not button then
571 return 558 return
572 end 559 end
573 560
574 local command = button.command 561 local command = button.command
575 local actionType = button.actionType 562 local actionType = button.actionType
576 local actionID = button.actionID 563 local actionID = button.actionID
577 564
578 local keys = {GetBindingKey(command) }
579 if #keys >= 1 then
580 kb.UpdateBindingsCache(actionType, actionID, {})
581 end
582 565
583 local talentName = button.actionName 566 local talentName = button.actionName
584 if actionType == 'macro' then 567 if actionType == 'macro' then
585 local spellName, _, spellID = GetMacroSpell(actionID) 568 local spellName, _, spellID = GetMacroSpell(actionID)
586 talentName = spellName 569 talentName = spellName
587 end 570 end
588 571
589 572 local keys = {GetBindingKey(command) }
590 --print('detected', #keys, 'bindings') 573 if configTable and configTable.assignedKeys then
591 for i, key in pairs(keys) do 574 for _, key in ipairs(configTable.assignedKeys) do
592 --print('clearing', key) 575 if not tContains(keys, key) then
593 SetBinding(key, nil) 576 tinsert(keys, key)
577 end
578 end
579 end
580
581 -- only manipulate bindings if its an available ability
582 if button.isAvailable then
583 --print('detected', #keys, 'bindings')
584
585 if #keys >= 1 then
586 kb.UpdateBindingsCache(actionType, actionID, {})
587 end
588
589 for i, key in pairs(keys) do
590 --print('clearing', key)
591 SetBinding(key, nil)
592 kb.bindings[tostring(actionType)..'_'..tostring(actionID)] = nil
593 end
594 SaveBindings(GetCurrentBindingSet()) 594 SaveBindings(GetCurrentBindingSet())
595 if kb.currentProfile.bindings[key] then 595 end
596 --kb:print(L('BINDING_REMOVED', self.actionName, kb.currentHeader)) 596
597 kb.currentProfile.bindings[key] = nil 597
598 end 598 if configTable and configTable.assignedKeys then
599 if kb.currentProfile.talents[talentName] then 599 table.wipe(configTable.assignedKeys)
600 kb.currentProfile.talents[talentName] = nil 600 end
601 end 601
602
603 kb.bindings[tostring(actionType)..'_'..tostring(actionID)] = nil
604 end
605 if kb.currentProfile.bound[command] then 602 if kb.currentProfile.bound[command] then
606 kb.currentProfile.bound[command] = nil 603 kb.currentProfile.bound[command] = nil
607 --kb:print(BINDING_REMOVED:format(self.actionName, configHeaders[db.bindMode])) 604 --kb:print(BINDING_REMOVED:format(self.actionName, configHeaders[db.bindMode]))
608 end 605 end
609 kb.saveTarget = nil 606 kb.saveTarget = nil
610 607 button:UpdateSlot(true)
611 return true 608 return true
612 end 609 end
613 610
614 kb.AcceptAssignment = function(self, ...) 611 kb.AcceptAssignment = function(self, ...)
615 local popup = StaticPopupDialogs["SKELETONKEY_CONFIRM_ASSIGN_SLOT"] 612 local popup = StaticPopupDialogs["SKELETONKEY_CONFIRM_ASSIGN_SLOT"]