Mercurial > wow > skeletonkey
comparison ActionTemplates.lua @ 78:d4c100b0fd01 v7.1.5-80-release
- Fixed an issue with talent bindings not loading between specialization changes.
- Fixed action button text corruption that occurred after changing assignments on an inactive spell.
author | Nenue |
---|---|
date | Thu, 26 Jan 2017 20:25:04 -0500 |
parents | 6623b7f2c1ca |
children | b9a53385462c |
comparison
equal
deleted
inserted
replaced
77:4ca4cc031e99 | 78:d4c100b0fd01 |
---|---|
38 [10] = 6 | 38 [10] = 6 |
39 } | 39 } |
40 local petSpellCache,petSubtextCache | 40 local petSpellCache,petSubtextCache |
41 local SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544 | 41 local SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544 |
42 | 42 |
43 --kb.ChangedBindings = {} | |
44 --kb.ActionTypes = {} | |
45 | 43 |
46 local atype = kb.ActionTypes | 44 local atype = kb.ActionTypes |
47 | 45 |
48 --- Caps Lock | 46 --- Caps Lock |
49 atype['mount'] = function(id, name) | 47 atype['mount'] = function(id, name) |
63 return CLICK_KEYBINDER_MACRO, 'equipset_'..tostring(name), "/script UseEquipmentSet("..tostring(id)..")", SkeletonKeyMacro | 61 return CLICK_KEYBINDER_MACRO, 'equipset_'..tostring(name), "/script UseEquipmentSet("..tostring(id)..")", SkeletonKeyMacro |
64 end | 62 end |
65 | 63 |
66 atype['spell'] = function(id, name) | 64 atype['spell'] = function(id, name) |
67 local attributeName = name | 65 local attributeName = name |
68 if kb.ProfessionCache[id] then | 66 local profInfo = kb.DynamicSpells.profession[id] |
69 attributeName = "profession_".. kb.ProfessionCache[id].dynamicIndex .. '_' .. kb.ProfessionCache[id].dynamicSubIndex | 67 if profInfo then |
68 attributeName = "profession_".. profInfo.dynamicIndex .. '_' .. profInfo.dynamicSubIndex | |
70 end | 69 end |
71 return CLICK_KEYBINDER_KEY, attributeName, name, SkeletonKeyKey | 70 return CLICK_KEYBINDER_KEY, attributeName, name, SkeletonKeyKey |
72 end | 71 end |
73 | 72 |
74 atype['petaction'] = function(_, name) | 73 atype['petaction'] = function(_, name) |
176 end | 175 end |
177 | 176 |
178 return info | 177 return info |
179 end | 178 end |
180 | 179 |
181 | |
182 kb.ApplyTalentBinding = function(talentInfo, cache) | |
183 talentInfo.assignedKeys = talentInfo.assignedKeys or {} | |
184 for i , key in pairs(talentInfo.assignedKeys) do | |
185 local command = CLICK_KEYBINDER_KEY.. talentInfo.actionName | |
186 SetBinding(key, command) | |
187 cprint(' **', i, '->', command) | |
188 tinsert(cache, talentInfo) | |
189 end | |
190 end | |
191 kb.CacheTalentBinding = function(talentInfo, cache) | |
192 | |
193 local spellID = talentInfo.actionID | |
194 cache[spellID] = cache[spellID] or {} | |
195 cache[spellID] = talentInfo | |
196 cprint(spellID, unpack(kb.TalentBindings[spellID])) | |
197 end | |
198 | |
199 | |
200 do | 180 do |
201 local PROFILE_VERSION = 320 | 181 local PROFILE_VERSION = 320 |
202 local commandActions = {} | 182 local commandActions = {} |
203 local bindings = kb.bindings | 183 local bindings = kb.bindings |
204 local key, macro = SkeletonKeyKey, SkeletonKeyMacro | 184 local key, macro = SkeletonKeyKey, SkeletonKeyMacro |
391 end | 371 end |
392 end | 372 end |
393 | 373 |
394 kb.ApplyAllBindings =function () | 374 kb.ApplyAllBindings =function () |
395 print('|cFFFFFF00ApplyAllBindings()') | 375 print('|cFFFFFF00ApplyAllBindings()') |
396 wipe(kb.TalentBindings) | |
397 wipe(kb.bindings) | 376 wipe(kb.bindings) |
398 --kb:print('Loading binding profile', kb.profileName) | 377 --kb:print('Loading binding profile', kb.profileName) |
399 | 378 |
400 -- reflect action key settings | 379 -- reflect action key settings |
401 if GetCVarBool("ActionButtonUseKeyDown") then | 380 if GetCVarBool("ActionButtonUseKeyDown") then |
417 | 396 |
418 end | 397 end |
419 end | 398 end |
420 | 399 |
421 | 400 |
422 kb.specInfo = {} | 401 local AddSpellInfo = function(id, name, icon, dynamicType, dynamicID, dynamicIndex, dynamicSubIndex, isAvailable) |
402 local spell = kb.DynamicSpells[id] or {} | |
403 spell.actionName = name | |
404 spell.dynamicType = dynamicType | |
405 spell.dynamicID = dynamicID | |
406 spell.iconPath = icon | |
407 spell.dynamicIndex = dynamicIndex | |
408 spell.dynamicSubIndex = dynamicSubIndex | |
409 spell.isAvailable = isAvailable | |
410 spell.actionType = 'spell' | |
411 spell.spellbookType = BOOKTYPE_SPELL | |
412 kb.DynamicSpells[name] = spell | |
413 | |
414 local spellList = dynamicType and kb.DynamicSpells[dynamicType] | |
415 if spellList then | |
416 spellList[dynamicIndex] = spellList[dynamicIndex] or {} | |
417 spellList[dynamicIndex][dynamicSubIndex] = spell | |
418 end | |
419 | |
420 cprint('|cFF00FFFFSpellInfo:|r', name, isAvailable, dynamicType or 'spell') | |
421 end | |
422 | |
423 kb.UpdateSpecInfo = function() | 423 kb.UpdateSpecInfo = function() |
424 kb.specInfo.id = GetSpecialization() | 424 kb.specInfo.id = GetSpecialization() |
425 kb.specInfo.globalID, kb.specInfo.name, kb.specInfo.desc, kb.specInfo.texture = GetSpecializationInfo(kb.specInfo.id) | 425 kb.specInfo.globalID, kb.specInfo.name, kb.specInfo.desc, kb.specInfo.texture = GetSpecializationInfo(kb.specInfo.id) |
426 end | 426 end |
427 | 427 |
432 kb.SecureAttribute(SkeletonKeyMacro, "*type-macro_"..tostring(name), 'macro') | 432 kb.SecureAttribute(SkeletonKeyMacro, "*type-macro_"..tostring(name), 'macro') |
433 kb.SecureAttribute(SkeletonKeyMacro, "*macro-macro_"..tostring(name), index) | 433 kb.SecureAttribute(SkeletonKeyMacro, "*macro-macro_"..tostring(name), index) |
434 end | 434 end |
435 end | 435 end |
436 | 436 |
437 | |
437 kb.UpdateTalentInfo = function() | 438 kb.UpdateTalentInfo = function() |
438 print('|cFFFFFF00kb.UpdateTalentInfo()|r') | 439 print('|cFFFFFF00kb.UpdateSpells()|r') |
440 cprint('|cFFFFFF00kb.UpdateSpells()|r') | |
439 if kb.talentsPushed then | 441 if kb.talentsPushed then |
440 return | 442 return |
441 end | 443 end |
442 for row =1, MAX_TALENT_TIERS do | 444 for row =1, MAX_TALENT_TIERS do |
443 for col = 1, NUM_TALENT_COLUMNS do | 445 for col = 1, NUM_TALENT_COLUMNS do |
444 local talentID, talentName, icon, selected, available, spellID = GetTalentInfo(row, col, 1) | 446 local talentID, talentName, icon, selected, available, spellID = GetTalentInfo(row, col, 1) |
445 local talentInfo = kb.TalentCache[spellID] or {} | 447 local talentInfo = kb.DynamicSpells[spellID] or {} |
446 if spellID then | 448 if spellID then |
447 talentInfo.actionType = 'spell' | 449 AddSpellInfo(spellID, talentName, icon, 'talent', talentID, row, col, selected) |
448 talentInfo.actionName = talentName | 450 end |
449 talentInfo.dynamicType = 'talent' | 451 |
450 talentInfo.dynamicID = talentID | |
451 talentInfo.dynamicIndex = row | |
452 talentInfo.dynamicSubIndex = col | |
453 talentInfo.actionID = spellID | |
454 talentInfo.isAvailable = selected | |
455 kb.DynamicSpells[spellID] = talentInfo | |
456 kb.DynamicSpells[talentName] = talentInfo | |
457 end | |
458 | |
459 --print('Talent ', row, col, spellID, talentName) | |
460 end | 452 end |
461 end | 453 end |
462 | 454 |
463 for row = 1, MAX_PVP_TALENT_TIERS do | 455 for row = 1, MAX_PVP_TALENT_TIERS do |
464 for col = 1, MAX_PVP_TALENT_COLUMNS do | 456 for col = 1, MAX_PVP_TALENT_COLUMNS do |
465 local id, name, icon, selected, available, spellID, unlocked = GetPvpTalentInfo(row, col, 1) | 457 local talentID, talentName, icon, selected, available, spellID, unlocked = GetPvpTalentInfo(row, col, 1) |
466 if spellID then | 458 if spellID then |
467 local talentInfo = kb.TalentCache[spellID] or {} | 459 AddSpellInfo(spellID, talentName, icon, 'talent', talentID, row, col, selected) |
468 talentInfo.actionType = 'spell' | 460 end |
469 talentInfo.actionName = name | 461 end |
470 talentInfo.dynamicType = 'talent' | 462 end |
471 talentInfo.dynamicID = id | 463 |
472 talentInfo.dynamicIndex = row | 464 local numTabs = GetNumSpellTabs() |
473 talentInfo.dynamicSubIndex = col | 465 for i = 1, numTabs do |
474 talentInfo.actionID = spellID | 466 local name, texture, offset, numSpells = GetSpellTabInfo(i) |
475 talentInfo.isAvailable = selected | 467 for spellLine = offset+1, offset+numSpells do |
476 kb.DynamicSpells[spellID] = talentInfo | 468 local skillType, spellID = GetSpellBookItemInfo(spellLine) |
477 kb.DynamicSpells[name] = talentInfo | 469 if skillType == 'SPELL' then |
478 end | 470 local name, _, icon = GetSpellInfo(spellID) |
479 end | 471 AddSpellInfo(spellID, name, icon, nil, nil, nil, nil, true) |
480 end | 472 elseif skillType == 'FLYOUT' then |
473 local flyoutID = GetFlyoutID(spellLine) | |
474 local _, _, numSlots = GetFlyoutInfo(flyoutID) | |
475 if numSlots then | |
476 for slot = 1, numSlots do | |
477 local spellID, isKnown = GetFlyoutSlotInfo(flyoutID, slot) | |
478 local name, rank, icon = GetSpellInfo(spellID) | |
479 AddSpellInfo(spellID, name, icon, nil, nil, nil, nil, true) | |
480 end | |
481 end | |
482 end | |
483 end | |
484 end | |
485 | |
486 | |
481 | 487 |
482 kb.talentsPushed = true | 488 kb.talentsPushed = true |
483 kb.UpdateDynamicButtons('talent') | 489 kb.UpdateDynamicButtons('talent') |
484 end | 490 end |
491 kb.UpdateSpells = kb.UpdateTalentInfo | |
485 | 492 |
486 kb.UpdateProfessionInfo = function() | 493 kb.UpdateProfessionInfo = function() |
487 wipe(kb.ProfessionCache) | 494 wipe(kb.ProfessionCache) |
488 local profs = {GetProfessions() } | 495 local profs = {GetProfessions() } |
489 --print(GetProfessions()) | 496 --print(GetProfessions()) |
498 end | 505 end |
499 local profNum = SECONDARY_PROFESSIONS[profID] or primaryNum | 506 local profNum = SECONDARY_PROFESSIONS[profID] or primaryNum |
500 cprint(i, profNum) | 507 cprint(i, profNum) |
501 | 508 |
502 | 509 |
503 kb.ProfessionCache[profNum] = kb.ProfessionCache[profNum] or {} | |
504 | |
505 for j = 1, numSpells do | 510 for j = 1, numSpells do |
506 local spellName, _, icon, _, _, _, spellID = GetSpellInfo(spellOffset+j, BOOKTYPE_PROFESSION) | 511 local spellName, _, icon, _, _, _, spellID = GetSpellInfo(spellOffset+j, BOOKTYPE_PROFESSION) |
507 cprint(j, spellName) | 512 cprint(j, spellName) |
508 local profInfo = { | 513 local profInfo = { |
509 actionType = 'spell', | 514 actionType = 'spell', |
510 actionName = spellName, | 515 actionName = spellName, |
511 statusText = 'Profession ' .. i, | |
512 actionID = spellID, | 516 actionID = spellID, |
513 iconPath = icon, | 517 iconPath = icon, |
514 dynamicIndex = i, | 518 dynamicIndex = i, |
515 dynamicSubIndex = j, | 519 dynamicSubIndex = j, |
516 dynamicType = 'profession', | 520 dynamicType = 'profession', |
517 spellbookOffset = (spellOffset+j), | 521 spellbookOffset = (spellOffset+j), |
518 spellbookType = BOOKTYPE_PROFESSION, | 522 spellbookType = BOOKTYPE_PROFESSION, |
519 isAvailable = true, | 523 isAvailable = true, |
520 -- need to check if necessary | 524 dynamicID = profID, |
521 uniqueID = profID, | |
522 } | 525 } |
523 | 526 |
524 kb.SecureAttribute(SkeletonKeyKey, "*type-profession_"..i .. '_' ..j, "spell") | 527 kb.SecureAttribute(SkeletonKeyKey, "*type-profession_"..i .. '_' ..j, "spell") |
525 kb.SecureAttribute(SkeletonKeyKey, "*spell-profession_"..i .. '_' ..j, spellName) | 528 kb.SecureAttribute(SkeletonKeyKey, "*spell-profession_"..i .. '_' ..j, spellName) |
526 | 529 |
527 kb.ProfessionCache[spellName] = profInfo | |
528 kb.ProfessionCache[spellID] = profInfo | |
529 | 530 |
530 kb.DynamicSpells[spellName] = profInfo | 531 kb.DynamicSpells[spellName] = profInfo |
531 kb.DynamicSpells[spellID] = profInfo | 532 kb.DynamicSpells[spellID] = profInfo |
532 | 533 |
534 kb.DynamicSpells.profession[spellName] = profInfo | |
535 kb.DynamicSpells.profession[spellID] = profInfo | |
533 kb.DynamicSpells.profession[i] = kb.DynamicSpells.profession[i] or {} | 536 kb.DynamicSpells.profession[i] = kb.DynamicSpells.profession[i] or {} |
534 kb.DynamicSpells.profession[i][j] = profInfo | 537 kb.DynamicSpells.profession[i][j] = profInfo |
535 --print(' |cFF0088FF['..i..']|r|cFFFF44BB['..spellOffset+i..']|r', spellName, "profession_"..i .. '_' ..j) | 538 --print(' |cFF0088FF['..i..']|r|cFFFF44BB['..spellOffset+i..']|r', spellName, "profession_"..i .. '_' ..j) |
536 end | 539 end |
537 end | 540 end |
619 info.dynamicSubIndex = specialNum[subText] | 622 info.dynamicSubIndex = specialNum[subText] |
620 info.isAvailable = true | 623 info.isAvailable = true |
621 | 624 |
622 kb.PetCache.special[spellName] = info | 625 kb.PetCache.special[spellName] = info |
623 kb.PetCache.subtext[subText][specialNum[subText]] = info | 626 kb.PetCache.subtext[subText][specialNum[subText]] = info |
627 | |
624 kb.DynamicSpells[spellName] = info | 628 kb.DynamicSpells[spellName] = info |
625 kb.DynamicSpells[spellID] = info | 629 kb.DynamicSpells[spellID] = info |
626 | 630 |
627 end | 631 end |
628 | 632 |