diff 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
line wrap: on
line diff
--- a/BindingsFrame.lua	Mon Jan 23 18:59:02 2017 -0500
+++ b/BindingsFrame.lua	Mon Jan 23 20:07:30 2017 -0500
@@ -168,8 +168,11 @@
   print(self.zoomScale, self.scrollOffset)
 end
 
+function SkeletonKeyMixin:OnShow()
+  self:Update()
+end
 function SkeletonKeyMixin:OnHide()
-  KeyBinderImportLog:Hide()
+
 end
 
 
@@ -512,20 +515,6 @@
     tinsert(self.assignedKeys, 1, binding)
   end
 
-  local talentInfo = kb.DynamicSpells[spellName]
-  if spellName and talentInfo then
-    print('store dynamicType talent')
-    if talentInfo.dynamicType == 'talent' then
-      talentInfo = {
-        macroName = self.macroName,
-        actionName = self.actionName,
-        actionType = self.actionType,
-        actionID = self.actionID,
-        assignedKeys = self.assignedKeys
-      }
-      kb.currentProfile.talents[spellName] = talentInfo
-    end
-  end
 
   for _, key in ipairs(self.assignedKeys) do
     if not kb.currentProfile.bindings[key] then
@@ -538,9 +527,6 @@
       profile.bindings[binding] = nil
       profile.commands[self.command] = nil
       profile.bound[self.command] = nil
-      if spellName then
-        profile.talents[spellName] = nil
-      end
     end
   end
 
@@ -566,6 +552,7 @@
 
 function ActionListPanel:UnbindSlot (button)
 
+  local configTable = kb.currentProfile.buttons[button:GetID()]
   local button = button or kb.saveTarget
   if not button then
     return
@@ -575,10 +562,6 @@
   local actionType = button.actionType
   local actionID = button.actionID
 
-  local keys = {GetBindingKey(command) }
-  if #keys >= 1 then
-    kb.UpdateBindingsCache(actionType, actionID, {})
-  end
 
   local talentName = button.actionName
   if actionType == 'macro' then
@@ -586,28 +569,42 @@
     talentName = spellName
   end
 
+  local keys = {GetBindingKey(command) }
+  if configTable and configTable.assignedKeys then
+    for _, key in ipairs(configTable.assignedKeys) do
+      if not tContains(keys, key) then
+        tinsert(keys, key)
+      end
+    end
+  end
 
-  --print('detected', #keys, 'bindings')
-  for i, key in pairs(keys) do
-    --print('clearing', key)
-    SetBinding(key, nil)
-    SaveBindings(GetCurrentBindingSet())
-    if kb.currentProfile.bindings[key] then
-      --kb:print(L('BINDING_REMOVED', self.actionName, kb.currentHeader))
-      kb.currentProfile.bindings[key] = nil
-    end
-    if kb.currentProfile.talents[talentName] then
-      kb.currentProfile.talents[talentName] = nil
+  -- only manipulate bindings if its an available ability
+  if button.isAvailable then
+    --print('detected', #keys, 'bindings')
+
+    if #keys >= 1 then
+      kb.UpdateBindingsCache(actionType, actionID, {})
     end
 
-    kb.bindings[tostring(actionType)..'_'..tostring(actionID)] = nil
+    for i, key in pairs(keys) do
+      --print('clearing', key)
+      SetBinding(key, nil)
+      kb.bindings[tostring(actionType)..'_'..tostring(actionID)] = nil
+    end
+    SaveBindings(GetCurrentBindingSet())
   end
+
+
+  if configTable and configTable.assignedKeys then
+    table.wipe(configTable.assignedKeys)
+  end
+
   if kb.currentProfile.bound[command] then
     kb.currentProfile.bound[command] = nil
     --kb:print(BINDING_REMOVED:format(self.actionName, configHeaders[db.bindMode]))
   end
   kb.saveTarget = nil
-
+  button:UpdateSlot(true)
   return true
 end