comparison ActionTemplates.lua @ 75:e75a2fd448c0

- binding slot mixin: - store key binding definitions under their slot's data table - apply action button attributes when a slot is assigned - obtain correct macro body text when a macro is slotted - fix algorithm for resolving renamed macro indices - move spell detail lookup code out of mixin script - event chains: - initialize addon from PLAYER_LOGIN - reload keybinds from PLAYER_SPECIALIZATION_CHANGED, after spec profile is resolved - refresh interface content from SPELLS_CHANGED - hard refresh after PLAYER_SPECIALIZATION_CHANGED - hotkey text: - restore communication and detection of key binding updates and reflect them accordingly - properly respond to dynamic bindings that result from talent updates
author Nenue
date Mon, 23 Jan 2017 18:59:02 -0500
parents 9824d524a661
children 6623b7f2c1ca
comparison
equal deleted inserted replaced
74:9824d524a661 75:e75a2fd448c0
97 atype['battlepet'] = function(id, name) 97 atype['battlepet'] = function(id, name)
98 return CLICK_KEYBINDER_MACRO, 'battlepet_' .. tostring(name), SLASH_SUMMON_BATTLE_PET1 .. " " .. tostring(name), SkeletonKeyMacro 98 return CLICK_KEYBINDER_MACRO, 'battlepet_' .. tostring(name), SLASH_SUMMON_BATTLE_PET1 .. " " .. tostring(name), SkeletonKeyMacro
99 end 99 end
100 100
101 atype['item'] = function(id, name) 101 atype['item'] = function(id, name)
102 return CLICK_KEYBINDER_KEY, tostring(name), id, SkeletonKeyKey 102 return CLICK_KEYBINDER_KEY, tostring(name), tostring(name), SkeletonKeyKey
103 end 103 end
104 104
105 105
106 --- Resolves the SecureActionButton attribute names used for the given action 106 --- Resolves the SecureActionButton attribute names used for the given action
107 kb.RegisterAction = function(actionType, id, name) 107 kb.RegisterAction = function(actionType, id, name)
216 local button = SkeletonKeyKey 216 local button = SkeletonKeyKey
217 local isAvailable 217 local isAvailable
218 local specialButtonType 218 local specialButtonType
219 if actionType == 'spell' then 219 if actionType == 'spell' then
220 cprint(GetSpellInfo(actionID)) 220 cprint(GetSpellInfo(actionID))
221 cprint(GetSpellInfo(name)) 221 if GetSpellInfo(actionID) then
222 if GetSpellInfo(name) then
223 isAvailable = true 222 isAvailable = true
224 end 223 end
225 local dynamicInfo = kb.DynamicSpells[name] 224 local dynamicInfo = kb.DynamicSpells[name]
226 if dynamicInfo then 225 if dynamicInfo then
227 configTable.assignedKeys = configTable.assignedKeys or {GetBindingKey(configTable.command)} 226 configTable.assignedKeys = configTable.assignedKeys or {GetBindingKey(configTable.command)}
229 for k, v in pairs(dynamicInfo) do 228 for k, v in pairs(dynamicInfo) do
230 --cprint(' --', k, v) 229 --cprint(' --', k, v)
231 configTable[k] = v 230 configTable[k] = v
232 end 231 end
233 end 232 end
234 233 elseif actionType == 'item' then
234 actionID = configTable.actionName
235 isAvailable = true
235 else 236 else
237
236 if actionType ~= 'macro' then 238 if actionType ~= 'macro' then
237 actionPrefix = '*macrotext-' 239 actionPrefix = '*macrotext-'
238 end 240 end
239 241
240 specialButtonType = 'macro' 242 specialButtonType = 'macro'
372 local talent = profile.talents[configTable.actionName] 374 local talent = profile.talents[configTable.actionName]
373 if talent then 375 if talent then
374 configTable.assignedKeys = talent.assignedKeys 376 configTable.assignedKeys = talent.assignedKeys
375 end 377 end
376 if not configTable.assignedKeys then 378 if not configTable.assignedKeys then
377 configTable.assignedKeys = {GetBindingKey(configTable.command) } 379 configTable.assignedKeys = {GetBindingKey(configTable.command)}
378 end 380 end
379 if configTable.dynamicType == 'talent' then 381 --if configTable.dynamicType == 'talent' then
380 --kb:print(table.concat(configTable.assignedKeys, ', ') .. ' bound to '.. configTable.actionName) 382 -- kb:print(table.concat(configTable.assignedKeys, ', ') .. ' bound to '.. configTable.actionName)
381 end 383 --end
382 for _, key in pairs(configTable.assignedKeys) do 384 for _, key in pairs(configTable.assignedKeys) do
383 385
384 SetBinding(key, configTable.command) 386 SetBinding(key, configTable.command)
385 end 387 end
386 388
408 end 410 end
409 -- do this after to ensure that profession binds are properly overridden 411 -- do this after to ensure that profession binds are properly overridden
410 kb.UpdateProfessionInfo() 412 kb.UpdateProfessionInfo()
411 413
412 SaveBindings(GetCurrentBindingSet()) 414 SaveBindings(GetCurrentBindingSet())
415
413 416
414 end 417 end
415 end 418 end
416 419
417 420