Mercurial > wow > skeletonkey
diff ActionTemplates.lua @ 72:c48913c5924c
- Dynamic bindings properly update between talent choices, and the hotkey text is also correctly reflected.
author | Nenue |
---|---|
date | Sat, 07 Jan 2017 12:47:41 -0500 |
parents | ca3118127e5e |
children | 68365bda5ab5 |
line wrap: on
line diff
--- a/ActionTemplates.lua Fri Jan 06 16:21:49 2017 -0500 +++ b/ActionTemplates.lua Sat Jan 07 12:47:41 2017 -0500 @@ -150,23 +150,24 @@ local indexKey = actionType..'_'..actionID local actionPrefix = "*"..actionType.."-" local button = SkeletonKeyKey - local isAvailable = true + local isAvailable local specialButtonType if actionType == 'spell' then - if not GetSpellInfo(actionID) then - isAvailable = nil + cprint(GetSpellInfo(actionID)) + cprint(GetSpellInfo(name)) + if GetSpellInfo(name) then + isAvailable = true end local dynamicInfo = kb.DynamicSpells[name] if dynamicInfo then configTable.assignedKeys = configTable.assignedKeys or {GetBindingKey(configTable.command)} - cprint('|cFF00FFFFDynamicInfo:|r', dynamicInfo.dynamicType, table.concat(configTable.assignedKeys or {}, ',')) + cprint('|cFF00FFFFDynamicInfo:|r', dynamicInfo.dynamicType, table.concat(configTable.assignedKeys, ',')) for k, v in pairs(dynamicInfo) do --cprint(' --', k, v) configTable[k] = v end end - else if actionType ~= 'macro' then actionPrefix = '*macrotext-' @@ -175,20 +176,26 @@ specialButtonType = 'macro' end - local attributeSuffix, attributeValue, command, target, button = kb.RegisterAction(actionType, actionID, name) - local actionKey = actionPrefix .. attributeSuffix - cprint('|cFF00FF88LoadBinding()|r', button:GetName(), "*type-"..attributeSuffix, actionType, '|cFFFFFF00'..actionKey, attributeValue) + if isAvailable then + local attributeSuffix, attributeValue, command, target, button = kb.RegisterAction(actionType, actionID, name) + local actionKey = actionPrefix .. attributeSuffix + cprint('|cFF00FF88LoadBinding()|r', button:GetName(), "*type-"..attributeSuffix, actionType, '|cFFFFFF00'..actionKey, attributeValue, isAvailable) - - if isAvailable then kb.SecureAttribute(button, "*type-"..attributeSuffix, specialButtonType or actionType) kb.SecureAttribute(button, actionKey, attributeValue) + + cprint('|cFFFF4400add', name, isAvailable, indexKey, unpack(configTable.assignedKeys)) kb.bindings[indexKey] = configTable.assignedKeys commandActions[command] = kb.bindings[indexKey] return command, kb.bindings[indexKey] else + if kb.bindings[indexKey] then + cprint('|cFFFF4400remove', name, isAvailable, indexKey, unpack(configTable.assignedKeys)) + kb.bindings[indexKey] = nil + end + return nil end end @@ -304,11 +311,9 @@ if not configTable.assignedKeys then configTable.assignedKeys = {GetBindingKey(configTable.command) } end - configTable.isAvailable = true if configTable.dynamicType then kb:print(table.concat(configTable.assignedKeys, ', ') .. ' bound to '.. configTable.actionName) end - end end end @@ -335,6 +340,7 @@ kb.UpdateProfessionInfo() SaveBindings(GetCurrentBindingSet()) + end end