Mercurial > wow > skeletonkey
comparison ActionTemplates.lua @ 76:6623b7f2c1ca v7.1.5-78-release
Added:
- key assignment and unbinding for inactive talents
Bug Fixes:
- fixed spell access check for talents
- fixed detection of Legion PvP talents
- fixed unbind command not clearing assigned key text
- fixed frame content not loading after combat
Miscellaneous:
- bindings are determined from the button's assignment list
- increment profile version to remove deprecated talents list
author | Nenue |
---|---|
date | Mon, 23 Jan 2017 20:07:30 -0500 |
parents | e75a2fd448c0 |
children | d4c100b0fd01 |
comparison
equal
deleted
inserted
replaced
75:e75a2fd448c0 | 76:6623b7f2c1ca |
---|---|
196 cprint(spellID, unpack(kb.TalentBindings[spellID])) | 196 cprint(spellID, unpack(kb.TalentBindings[spellID])) |
197 end | 197 end |
198 | 198 |
199 | 199 |
200 do | 200 do |
201 local PROFILE_VERSION = 320 | |
201 local commandActions = {} | 202 local commandActions = {} |
202 local bindings = kb.bindings | 203 local bindings = kb.bindings |
203 local key, macro = SkeletonKeyKey, SkeletonKeyMacro | 204 local key, macro = SkeletonKeyKey, SkeletonKeyMacro |
204 kb.LoadBinding = function( configTable) | 205 kb.LoadBinding = function( configTable) |
205 if configTable.command then | 206 if configTable.command then |
216 local button = SkeletonKeyKey | 217 local button = SkeletonKeyKey |
217 local isAvailable | 218 local isAvailable |
218 local specialButtonType | 219 local specialButtonType |
219 if actionType == 'spell' then | 220 if actionType == 'spell' then |
220 cprint(GetSpellInfo(actionID)) | 221 cprint(GetSpellInfo(actionID)) |
221 if GetSpellInfo(actionID) then | |
222 isAvailable = true | |
223 end | |
224 local dynamicInfo = kb.DynamicSpells[name] | 222 local dynamicInfo = kb.DynamicSpells[name] |
225 if dynamicInfo then | 223 if dynamicInfo then |
226 configTable.assignedKeys = configTable.assignedKeys or {GetBindingKey(configTable.command)} | 224 configTable.assignedKeys = configTable.assignedKeys or {GetBindingKey(configTable.command) } |
225 | |
227 cprint('|cFF00FFFFDynamicInfo:|r', dynamicInfo.dynamicType, table.concat(configTable.assignedKeys, ',')) | 226 cprint('|cFF00FFFFDynamicInfo:|r', dynamicInfo.dynamicType, table.concat(configTable.assignedKeys, ',')) |
228 for k, v in pairs(dynamicInfo) do | 227 for k, v in pairs(dynamicInfo) do |
229 --cprint(' --', k, v) | 228 --cprint(' --', k, v) |
230 configTable[k] = v | 229 configTable[k] = v |
231 end | 230 end |
231 isAvailable = configTable.isAvailable | |
232 elseif GetSpellInfo(actionID) then | |
233 isAvailable = true | |
234 | |
232 end | 235 end |
233 elseif actionType == 'item' then | 236 elseif actionType == 'item' then |
234 actionID = configTable.actionName | 237 actionID = configTable.actionName |
235 isAvailable = true | 238 isAvailable = true |
236 else | 239 else |
343 if not usedSlots[command] then | 346 if not usedSlots[command] then |
344 cprint('|cFFFF4400Unslotted command entry', command) | 347 cprint('|cFFFF4400Unslotted command entry', command) |
345 profile.commands[command] = nil | 348 profile.commands[command] = nil |
346 end | 349 end |
347 end | 350 end |
351 | |
352 if profile.talents then | |
353 profile.talents = nil | |
354 end | |
355 | |
356 | |
357 profile.versionID = PROFILE_VERSION | |
348 end | 358 end |
349 | 359 |
350 kb.ApplyBindings = function (profile) | 360 kb.ApplyBindings = function (profile) |
351 cprint('|cFF0088FFApplyBindings()') | 361 cprint('|cFF0088FFApplyBindings()') |
352 --cprint('binding profile', profile) | 362 --cprint('binding profile', profile) |
353 | 363 |
354 local version = profile.versionID or 0 | 364 local version = profile.versionID or 0 |
355 if version < 310 then | 365 if version < PROFILE_VERSION then |
356 kb.UpgradeProfile(profile) | 366 kb.UpgradeProfile(profile) |
357 end | 367 end |
358 | 368 |
359 -- do flat bindings to start | |
360 for key, command in pairs(profile.bindings) do | |
361 command = command:gsub('KeyBinder', 'SkeletonKey') | |
362 profile.bindings[key] = command | |
363 cprint('|cFF00FFFF'.. key .. '|r to|cFF00FF00', command) | |
364 SetBinding(key, command) | |
365 if commandActions[command] and not tContains(commandActions[command], key) then | |
366 tinsert(commandActions[command], key) | |
367 end | |
368 end | |
369 | 369 |
370 -- then buttons | 370 -- then buttons |
371 for slot, configTable in pairs(profile.buttons) do | 371 for slot, configTable in pairs(profile.buttons) do |
372 -- convert old style table | 372 -- convert old style table |
373 if kb.LoadBinding(configTable) then | 373 if kb.LoadBinding(configTable) then |
374 local talent = profile.talents[configTable.actionName] | 374 |
375 if talent then | |
376 configTable.assignedKeys = talent.assignedKeys | |
377 end | |
378 if not configTable.assignedKeys then | 375 if not configTable.assignedKeys then |
379 configTable.assignedKeys = {GetBindingKey(configTable.command)} | 376 configTable.assignedKeys = {GetBindingKey(configTable.command)} |
380 end | 377 end |
381 --if configTable.dynamicType == 'talent' then | 378 --if configTable.dynamicType == 'talent' then |
382 -- kb:print(table.concat(configTable.assignedKeys, ', ') .. ' bound to '.. configTable.actionName) | 379 -- kb:print(table.concat(configTable.assignedKeys, ', ') .. ' bound to '.. configTable.actionName) |
383 --end | 380 --end |
384 for _, key in pairs(configTable.assignedKeys) do | 381 for _, key in pairs(configTable.assignedKeys) do |
385 | 382 local command = configTable.command |
386 SetBinding(key, configTable.command) | 383 cprint('|cFF00FFFF'.. key .. '|r to|cFF00FF00', command) |
384 SetBinding(key, command) | |
385 if commandActions[command] and not tContains(commandActions[command], key) then | |
386 tinsert(commandActions[command], key) | |
387 end | |
387 end | 388 end |
388 | 389 |
389 end | 390 end |
390 end | 391 end |
391 end | 392 end |
461 | 462 |
462 for row = 1, MAX_PVP_TALENT_TIERS do | 463 for row = 1, MAX_PVP_TALENT_TIERS do |
463 for col = 1, MAX_PVP_TALENT_COLUMNS do | 464 for col = 1, MAX_PVP_TALENT_COLUMNS do |
464 local id, name, icon, selected, available, spellID, unlocked = GetPvpTalentInfo(row, col, 1) | 465 local id, name, icon, selected, available, spellID, unlocked = GetPvpTalentInfo(row, col, 1) |
465 if spellID then | 466 if spellID then |
466 local talentInfo = kb.TalentCache[spellID] or {} | 467 local talentInfo = kb.TalentCache[spellID] or {} |
467 talentInfo.actionType = 'spell' | 468 talentInfo.actionType = 'spell' |
468 talentInfo.actionName = name | 469 talentInfo.actionName = name |
469 talentInfo.dynamicType = 'talent' | 470 talentInfo.dynamicType = 'talent' |
470 talentInfo.dynamicID = id | 471 talentInfo.dynamicID = id |
472 talentInfo.dynamicIndex = row | |
473 talentInfo.dynamicSubIndex = col | |
471 talentInfo.actionID = spellID | 474 talentInfo.actionID = spellID |
472 talentInfo.isAvailable = selected | 475 talentInfo.isAvailable = selected |
473 kb.DynamicSpells[spellID] = talentInfo | 476 kb.DynamicSpells[spellID] = talentInfo |
474 kb.DynamicSpells[name] = talentInfo | 477 kb.DynamicSpells[name] = talentInfo |
475 end | 478 end |