# HG changeset patch # User Nenue # Date 1473435653 14400 # Node ID 178d489f387c6eec4d093d2626915c709538adcd # Parent 2409fe9b81e18a764f8e9d39fb576442a8e5ea67 - fix wrong attribute names being used for macros bound from a previous profile diff -r 2409fe9b81e1 -r 178d489f387c SkeletonKey/ActionTemplates.lua --- a/SkeletonKey/ActionTemplates.lua Thu Sep 08 16:52:55 2016 -0400 +++ b/SkeletonKey/ActionTemplates.lua Fri Sep 09 11:40:53 2016 -0400 @@ -103,26 +103,10 @@ --- Resolves the SecureActionButton attribute names used for the given action kb.RegisterAction = function(actionType, id, name) - assert(atype[actionType], 'Missing actionType handler for `'..tostring(actionType)..'`') local target, attributeName, attributeValue = atype[actionType](id, name) - local command = target .. attributeName - local baseName, iterative = attributeName, 1 - while (kb.macros[attributeName] and kb.macros[attributeName][1] ~= attributeValue) do - --print(' * cannot use|cFF00FF00', attributeName, '|r"'.. tostring(kb.macros[attributeName][1]) .. '"') - attributeName = baseName .. '_' .. iterative - iterative = iterative + 1 - end - if attributeName ~= baseName then - --print(' * Creating|cFF00FF00', attributeName) - else - --print(' * Re-using|cFF00FF00', attributeName) - end kb.macros[attributeName] = {attributeValue, command} - - - --print('RegisterAction', actionType, id, '->', attributeName, attributeValue, target .. attributeName) return attributeName, attributeValue, command end @@ -202,7 +186,7 @@ for key, command in pairs(profile.bindings) do cprint('|cFF00FFFF'.. key .. '|r to|cFF00FF00', command, commandActions[command]) SetBinding(key, command) - if kb.bindings[command] then + if kb.bindings[command] and not tContains(kb.bindings[command], key) then tinsert(kb.bindings[command], key) end end @@ -259,7 +243,7 @@ end kb.UpdateMacroInfo = function() - for i = 1, GetNumMacros() do + for index = 1, GetNumMacros() do local name = GetMacroInfo(index) kb.SecureAttribute(KeyBinderMacro, "*macro_"..tostring(name), i) end diff -r 2409fe9b81e1 -r 178d489f387c SkeletonKey/Events.lua --- a/SkeletonKey/Events.lua Thu Sep 08 16:52:55 2016 -0400 +++ b/SkeletonKey/Events.lua Fri Sep 09 11:40:53 2016 -0400 @@ -9,6 +9,7 @@ kb.init = function() kb:RegisterEvent('PLAYER_ENTERING_WORLD') kb:RegisterEvent('UPDATE_MACROS') + kb:RegisterEvent('UPDATE_BINDINGS') kb:RegisterUnitEvent('PLAYER_SPECIALIZATION_CHANGED', 'player', 'pet') kb:RegisterUnitEvent('UNIT_PORTRAIT_UPDATE', 'player', 'pet') kb:RegisterUnitEvent('SPELLS_CHANGED') @@ -56,6 +57,10 @@ kb.UpdatePetInfo() end -kb.BINDINGS_UPDATE = function() +kb.UPDATE_MACROS = function() + kb.UpdateMacroInfo() +end + +kb.UPDATE_BINDINGS = function() kb.UpdateSystemBinds() end \ No newline at end of file