Mercurial > wow > skeletonkey
comparison SkeletonKey/BindingsFrame.lua @ 63:2409fe9b81e1
- check macro spells when considering whether a binding should be treated as a talent
- clean up talent binding data when releasing/unbinding slots with a related macro/spell
| author | Nenue |
|---|---|
| date | Thu, 08 Sep 2016 16:52:55 -0400 |
| parents | 9eebce04e69b |
| children | 556e075983a6 |
comparison
equal
deleted
inserted
replaced
| 62:04c23ceaf9e0 | 63:2409fe9b81e1 |
|---|---|
| 593 print('SetBinding', binding, self.command) | 593 print('SetBinding', binding, self.command) |
| 594 SetBinding(binding, self.command) | 594 SetBinding(binding, self.command) |
| 595 SaveBindings(GetCurrentBindingSet()) | 595 SaveBindings(GetCurrentBindingSet()) |
| 596 self.binding = binding | 596 self.binding = binding |
| 597 | 597 |
| 598 local talentName = self.actionName | |
| 599 if self.actionType == 'macro' then | |
| 600 talentName = GetMacroSpell(self.actionID) | |
| 601 end | |
| 602 | |
| 598 local talentInfo | 603 local talentInfo |
| 599 if self.actionType == 'spell' and kb.TalentCache[self.actionID] then | 604 if talentName and kb.TalentCache[talentName] then |
| 600 print('store dynamicType talent') | 605 print('store dynamicType talent') |
| 601 talentInfo = {self.macroName, self.actionName, self.actionType, self.actionID} | 606 talentInfo = {self.macroName, self.actionName, self.actionType, self.actionID} |
| 602 local bindings = {GetBindingKey(self.command) } | 607 local bindings = {GetBindingKey(self.command) } |
| 603 for i, key in ipairs(bindings) do | 608 for i, key in ipairs(bindings) do |
| 604 tinsert(talentInfo, key) | 609 tinsert(talentInfo, key) |
| 611 if talentInfo then | 616 if talentInfo then |
| 612 profile.bindings[self.binding] = nil | 617 profile.bindings[self.binding] = nil |
| 613 else | 618 else |
| 614 profile.bindings[self.binding] = self.command | 619 profile.bindings[self.binding] = self.command |
| 615 end | 620 end |
| 616 profile.talents[self.actionName] = talentInfo | 621 profile.talents[talentName] = talentInfo |
| 617 else | 622 else |
| 618 profile.bindings[self.binding] = nil | 623 profile.bindings[self.binding] = nil |
| 619 profile.bound[self.command] = nil | 624 profile.bound[self.command] = nil |
| 620 kb.currentProfile.talents[self.actionName] = nil | 625 profile.talents[talentName] = nil |
| 621 end | |
| 622 if kb.currentProfile.talents[self.actionID] then | |
| 623 kb.currentProfile.talents[self.actionID] = nil | |
| 624 end | 626 end |
| 625 end | 627 end |
| 626 | 628 |
| 627 | 629 |
| 628 kb:print(L('BINDING_ASSIGNED', self.binding, self.actionName, kb.currentHeader)) | 630 kb:print(L('BINDING_ASSIGNED', self.binding, self.actionName, kb.currentHeader)) |
| 634 kb.UnbindSlot = function(self) | 636 kb.UnbindSlot = function(self) |
| 635 | 637 |
| 636 local keys = {GetBindingKey(self.command) } | 638 local keys = {GetBindingKey(self.command) } |
| 637 if #keys >= 1 then | 639 if #keys >= 1 then |
| 638 kb.UpdateBindingsCache(self.actionType, self.actionID, {}) | 640 kb.UpdateBindingsCache(self.actionType, self.actionID, {}) |
| 641 end | |
| 642 | |
| 643 local talentName = self.actionName | |
| 644 if self.actionType == 'macro' then | |
| 645 local spellName, _, spellID = GetMacroSpell(self.actionID) | |
| 646 talentName = spellName | |
| 639 end | 647 end |
| 640 | 648 |
| 641 | 649 |
| 642 --print('detected', #keys, 'bindings') | 650 --print('detected', #keys, 'bindings') |
| 643 for i, key in pairs(keys) do | 651 for i, key in pairs(keys) do |
| 646 SaveBindings(GetCurrentBindingSet()) | 654 SaveBindings(GetCurrentBindingSet()) |
| 647 if kb.currentProfile.bindings[key] then | 655 if kb.currentProfile.bindings[key] then |
| 648 --kb:print(L('BINDING_REMOVED', self.actionName, kb.currentHeader)) | 656 --kb:print(L('BINDING_REMOVED', self.actionName, kb.currentHeader)) |
| 649 kb.currentProfile.bindings[key] = nil | 657 kb.currentProfile.bindings[key] = nil |
| 650 end | 658 end |
| 651 if kb.currentProfile.talents[self.actionName] then | 659 if kb.currentProfile.talents[talentName] then |
| 652 kb.currentProfile.talents[self.actionName] = nil | 660 kb.currentProfile.talents[talentName] = nil |
| 653 end | 661 end |
| 654 | 662 |
| 655 kb.bindings[tostring(self.actionType)..'_'..tostring(self.actionID)] = nil | 663 kb.bindings[tostring(self.actionType)..'_'..tostring(self.actionID)] = nil |
| 656 end | 664 end |
| 657 if kb.currentProfile.bound[self.command] then | 665 if kb.currentProfile.bound[self.command] then |
