comparison SkeletonKey/ActionTemplates.lua @ 50:1aba8a6fd4a9

- fix kb.bindings content and define a generic function for constructing its keystrings - handle hotkey text for actions placed in multiple slots -- hotkey.actionbar generates a cache table for use during binding changes
author Nenue
date Fri, 19 Aug 2016 01:12:56 -0400
parents 9a9d7f2a7c07
children a545933ddf3d
comparison
equal deleted inserted replaced
49:9a9d7f2a7c07 50:1aba8a6fd4a9
147 elseif actionType == 'macro' then 147 elseif actionType == 'macro' then
148 macro:SetAttribute("*macro-"..macroName, actionID) 148 macro:SetAttribute("*macro-"..macroName, actionID)
149 else 149 else
150 macro:SetAttribute("*macrotext-"..macroName, macroText) 150 macro:SetAttribute("*macrotext-"..macroName, macroText)
151 end 151 end
152 152 local indexKey = actionType..'_'..actionID
153 cprint('Loading binding', actionType, actionID) 153 cprint('Loading binding', indexKey)
154 bindings[actionType] = bindings[actionType] or {} 154 bindings[indexKey] = bindings[indexKey] or {}
155 bindings[actionType][actionID] = bindings[actionType][actionID] or {} 155 bindings[command] = bindings[indexKey]
156 bindings[command] = bindings[actionType][actionID] 156 return bindings[indexKey], actionID
157 return bindings[actionType], actionID
158 end 157 end
159 158
160 kb.ApplyBindings = function (profile) 159 kb.ApplyBindings = function (profile)
161 cprint('binding profile', profile) 160 cprint('binding profile', profile)
162 for slot, data in pairs(profile.buttons) do 161 for slot, data in pairs(profile.buttons) do
179 local func = kb.CacheTalentBinding 178 local func = kb.CacheTalentBinding
180 local dest = kb.TalentBindings 179 local dest = kb.TalentBindings
181 if dummy then 180 if dummy then
182 cprint('|cFFBBFF00Active:|r', dummy) 181 cprint('|cFFBBFF00Active:|r', dummy)
183 local macroName, spellName, actionType, actionID = unpack(talentInfo) 182 local macroName, spellName, actionType, actionID = unpack(talentInfo)
184 bindings[actionType] = bindings[actionType] or {} 183 local indexKey = actionType .. '_' .. actionID
185 bindings[actionType][actionID] = {} 184 bindings[indexKey] = {}
186 func = kb.ApplyTalentBinding 185 func = kb.ApplyTalentBinding
187 dest = kb.bindings[actionType][actionID] 186 dest = kb.bindings[indexKey]
188 else 187 else
189 188
190 cprint('|cFFFF4400Inactive:|r', talentInfo[2]) 189 cprint('|cFFFF4400Inactive:|r', talentInfo[2])
191 end 190 end
192 func(talentInfo, dest) 191 func(talentInfo, dest)
440 end 439 end
441 end 440 end
442 end 441 end
443 442
444 kb.UpdateBindingsCache = function(actionType, actionID, bindings) 443 kb.UpdateBindingsCache = function(actionType, actionID, bindings)
445 kb.bindings[actionType] = kb.bindings[actionType] or {} 444 local indexKey = actionType .. '_' .. actionID
446 kb.bindings[actionType][actionID] = bindings 445 kb.bindings[indexKey] = bindings
447 446
448 print('|cFF00FF00'..actionType..'-'..actionID..'|r = {', table.concat(bindings,', '), '}') 447 print('|cFF00FF00'..indexKey..'|r = {', table.concat(bindings,', '), '}')
449 tinsert(kb.ChangedBindings, {actionType, actionID}) 448 tinsert(kb.ChangedBindings, {actionType, actionID})
450 end 449 end