diff KeyButton.lua @ 71:ca3118127e5e

- Talent change detection - Use stored assignments for inactive talent slots
author Nenue
date Fri, 06 Jan 2017 16:21:49 -0500
parents 131d9190db6b
children c48913c5924c
line wrap: on
line diff
--- a/KeyButton.lua	Wed Dec 28 16:31:15 2016 -0500
+++ b/KeyButton.lua	Fri Jan 06 16:21:49 2017 -0500
@@ -356,16 +356,14 @@
         self.bindingText ='?'
       end
     elseif self.dynamicType == 'talent' then
-
       self.statusText = '|cFF00FFFF'.. TALENT .. '|r'
       if self.isAvailable then
         self.bindingText = kb.BindingString(GetBindingKey(self.command))
       else
-        if kb.TalentBindings[self.actionID] then
-          print(self.actionID, #kb.TalentBindings[self.actionID])
-          self.bindingText= kb.BindingString(unpack(kb.TalentBindings[self.actionID]))
-        end
 
+        print('|cFFFF4400', self.actionName, #self.assignedKeys, self.assignedKeys)
+        print(self.actionID)
+        self.bindingText= kb.BindingString(self.assignedKeys)
       end
     elseif self.dynamicType == 'petaction' then
       self.bindingText = kb.BindingString(GetBindingKey(self.command))
@@ -534,9 +532,9 @@
   end
   info.isAvailable = isAvailable
 
-  cprint('|cFF00FF88SpellDetails:|r', info.actionName, info.actionID, info.dynamicType)
+  cprint('|cFF00FF88SpellDetails:|r', info.actionName, info.actionID, info.dynamicType, info.isAvailable)
   for k,v in pairs(info) do
-    cprint(' ',k,v)
+    --cprint(' ',k,v)
     self[k] = v
   end
 
@@ -565,7 +563,7 @@
     if actionType == 'spell' then
       local info = SkeletonKey_GetSpellDetails(self)
       name, icon, actionType, actionID, macroName, macroText, pickupSlot, pickupBook = self.actionName, self.iconPath, self.actionType, self.actionID, self.macroName, self.macroText, self.spellbookSlot, self.spellbookType
-
+      self.isAvailable = info and info.isAvailable
     elseif actionType == 'petaction' then
       self.dynamicType = 'petaction'
       local specialType, specialNum = command:match(actionType..'_([%a%s]+)_(%d)')
@@ -642,6 +640,10 @@
     self:EnableKeyboard(true)
 
     -- this is done to keep legacy key-values from breaking algorithm assumptions
+    print(slotInfo.assignedKeys)
+    print(GetBindingKey(command))
+    self.assignedKeys = slotInfo.assignedKeys or {GetBindingKey(command)}
+
     local slotInfo = {
       command = command,
       actionName = name,
@@ -652,7 +654,11 @@
       macroText = macroText,
       spellbookSlot = pickupSlot,
       spellbookType = pickupBook,
-      assignedKeys = {GetBindingKey(command)}
+      assignedKeys = slotInfo.assignedKeys,
+      dynamicType = self.dynamicType,
+      dynamicID = self.dynamicID,
+      dynamicIndex = self.dynamicIndex,
+      dynamicSubIndex = self.dynamicSubIndex
     }
     kb.currentProfile.buttons[slot] = slotInfo
 
@@ -681,8 +687,7 @@
     kb.currentProfile.commands[command] = slot
   end
 
-
-
+  --self.assignedKeys = slotInfo.assignedKeys
   self.isBound = isBound
   self.pickupSlot = pickupSlot
   self.pickupBook = pickupBook