diff 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
line wrap: on
line diff
--- a/SkeletonKey/BindingsFrame.lua	Mon Sep 05 14:56:38 2016 -0400
+++ b/SkeletonKey/BindingsFrame.lua	Thu Sep 08 16:52:55 2016 -0400
@@ -595,8 +595,13 @@
   SaveBindings(GetCurrentBindingSet())
   self.binding = binding
 
+  local talentName = self.actionName
+  if self.actionType == 'macro' then
+    talentName = GetMacroSpell(self.actionID)
+  end
+
   local talentInfo
-  if self.actionType == 'spell' and kb.TalentCache[self.actionID] then
+  if talentName and kb.TalentCache[talentName] then
     print('store dynamicType talent')
     talentInfo = {self.macroName, self.actionName, self.actionType, self.actionID}
     local bindings = {GetBindingKey(self.command) }
@@ -613,14 +618,11 @@
       else
         profile.bindings[self.binding] = self.command
       end
-      profile.talents[self.actionName] = talentInfo
+      profile.talents[talentName] = talentInfo
     else
       profile.bindings[self.binding] = nil
       profile.bound[self.command] = nil
-      kb.currentProfile.talents[self.actionName] = nil
-    end
-    if kb.currentProfile.talents[self.actionID] then
-      kb.currentProfile.talents[self.actionID] = nil
+      profile.talents[talentName] = nil
     end
   end
 
@@ -638,6 +640,12 @@
     kb.UpdateBindingsCache(self.actionType, self.actionID, {})
   end
 
+  local talentName = self.actionName
+  if self.actionType == 'macro' then
+    local spellName, _, spellID = GetMacroSpell(self.actionID)
+    talentName = spellName
+  end
+
 
   --print('detected', #keys, 'bindings')
   for i, key in pairs(keys) do
@@ -648,8 +656,8 @@
       --kb:print(L('BINDING_REMOVED', self.actionName, kb.currentHeader))
       kb.currentProfile.bindings[key] = nil
     end
-    if kb.currentProfile.talents[self.actionName] then
-      kb.currentProfile.talents[self.actionName] = nil
+    if kb.currentProfile.talents[talentName] then
+      kb.currentProfile.talents[talentName] = nil
     end
 
     kb.bindings[tostring(self.actionType)..'_'..tostring(self.actionID)] = nil