Mercurial > wow > skeletonkey
comparison SkeletonKey/ActionTemplates.lua @ 54:a545933ddf3d
- pet ability binding macro now contains a /cast line for all known abilities with the same subtext, fixing an issue where swapping pets during combat breaks the key binding
| author | Nenue |
|---|---|
| date | Sun, 21 Aug 2016 03:13:32 -0400 |
| parents | 1aba8a6fd4a9 |
| children | 2a95f4010c5a |
comparison
equal
deleted
inserted
replaced
| 53:29c89dbe07ac | 54:a545933ddf3d |
|---|---|
| 34 [5] = 3, | 34 [5] = 3, |
| 35 [7] = 4, | 35 [7] = 4, |
| 36 [9] = 5, | 36 [9] = 5, |
| 37 [10] = 6 | 37 [10] = 6 |
| 38 } | 38 } |
| 39 local petSpellCache,petSubtextCache | |
| 39 local SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544 | 40 local SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544 |
| 40 | 41 |
| 41 --kb.ChangedBindings = {} | 42 --kb.ChangedBindings = {} |
| 42 --kb.ActionTypes = {} | 43 --kb.ActionTypes = {} |
| 43 | 44 |
| 69 end | 70 end |
| 70 | 71 |
| 71 atype['petaction'] = function(_, name) | 72 atype['petaction'] = function(_, name) |
| 72 -- ID doesn't exist for basic commands, even though they can be picked up | 73 -- ID doesn't exist for basic commands, even though they can be picked up |
| 73 local attributeName, attributeValue = "petaction_" .. tostring(name), "/cast "..tostring(name) | 74 local attributeName, attributeValue = "petaction_" .. tostring(name), "/cast "..tostring(name) |
| 75 | |
| 76 if not petSpellCache then | |
| 77 kb.UpdatePetInfo() | |
| 78 end | |
| 79 -- Compose a multi-macro for subtext abilities | |
| 80 if petSpellCache[name] then | |
| 81 attributeValue = "" | |
| 82 for spellName, enabled in pairs(petSubtextCache[petSpellCache[name]]) do | |
| 83 attributeValue = attributeValue .. "/cast " .. spellName .. "\n" | |
| 84 end | |
| 85 end | |
| 86 | |
| 74 if PETACTION_SCRIPT[name] then | 87 if PETACTION_SCRIPT[name] then |
| 75 attributeName, attributeValue = unpack(PETACTION_SCRIPT[name]) | 88 attributeName, attributeValue = unpack(PETACTION_SCRIPT[name]) |
| 76 elseif kb.PetCache.special[name] then | 89 elseif kb.PetCache.special[name] then |
| 77 attributeName = "petaction_"..kb.PetCache.special[name][3].."_" .. tonumber(kb.PetCache.special[name][6]) | 90 attributeName = "petaction_"..kb.PetCache.special[name][3].."_" .. tonumber(kb.PetCache.special[name][6]) |
| 78 end | 91 end |
| 303 local hasPetSpells, petType = HasPetSpells() | 316 local hasPetSpells, petType = HasPetSpells() |
| 304 | 317 |
| 305 --kb.PetCache.specNum = GetSpecialization(nil, true) | 318 --kb.PetCache.specNum = GetSpecialization(nil, true) |
| 306 --kb.PetCache.specID, kb.PetCache.specName = GetSpecializationInfo(petSpec, nil, true) | 319 --kb.PetCache.specID, kb.PetCache.specName = GetSpecializationInfo(petSpec, nil, true) |
| 307 | 320 |
| 321 kb.db.petSpellsDB = kb.db.petSpellsDB or {} | |
| 322 kb.db.petSpellsDB.subtext = kb.db.petSpellsDB.subtext or {} | |
| 323 kb.db.petSpellsDB.spell = kb.db.petSpellsDB.spell or {} | |
| 324 petSpellCache = kb.db.petSpellsDB.spell | |
| 325 petSubtextCache = kb.db.petSpellsDB.subtext | |
| 326 | |
| 327 | |
| 328 | |
| 308 if PetHasSpellbook() then | 329 if PetHasSpellbook() then |
| 309 print('PET SPELLBOOK') | 330 print('PET SPELLBOOK') |
| 310 local i = 1 | 331 local i = 1 |
| 311 local specialNum = {} | 332 local specialNum = {} |
| 312 repeat | 333 repeat |
| 323 if subText then | 344 if subText then |
| 324 -- make sure that pet specialization subtext maps correctly | 345 -- make sure that pet specialization subtext maps correctly |
| 325 --if match(subText, kb.PetCache.specName) then | 346 --if match(subText, kb.PetCache.specName) then |
| 326 -- subText = 'specialization' | 347 -- subText = 'specialization' |
| 327 --end | 348 --end |
| 328 | |
| 329 kb.PetCache.subtext[subText] = kb.PetCache.subtext[subText] or {} | 349 kb.PetCache.subtext[subText] = kb.PetCache.subtext[subText] or {} |
| 330 specialNum[subText] = (specialNum[subText] or 0) + 1 | 350 specialNum[subText] = (specialNum[subText] or 0) + 1 |
| 331 | 351 |
| 352 petSpellCache[spellName] = subText | |
| 353 petSubtextCache[subText] = petSubtextCache[subText] or {} | |
| 354 | |
| 355 -- add to the list | |
| 356 if not petSubtextCache[subText][spellName] then | |
| 357 petSubtextCache[subText][spellName] = true | |
| 358 | |
| 359 local macrotext = "" | |
| 360 for spellName, enabled in pairs(petSubtextCache[subText]) do | |
| 361 macrotext = macrotext .. "/cast " .. spellName .. "\n" | |
| 362 end | |
| 363 kb.SecureAttribute(KeyBinderMacro, "*macrotext-petaction_"..subText.."_"..specialNum[subText], macrotext) | |
| 364 print('|cFF00FFFFspecial['..spellName..']|r', '\n','|cFF00FFFFsubtext['..subText..']['..specialNum[subText]..']|r', '=>', i, spellName, subText, spellID, texture, specialNum[subText]) | |
| 365 end | |
| 366 | |
| 367 | |
| 368 | |
| 332 local entry = {i, spellName, subText, spellID, texture, specialNum[subText]} | 369 local entry = {i, spellName, subText, spellID, texture, specialNum[subText]} |
| 333 | 370 |
| 334 kb.PetCache.special[spellName] = entry | 371 kb.PetCache.special[spellName] = entry |
| 335 kb.PetCache.subtext[subText][specialNum[subText]] = entry | 372 kb.PetCache.subtext[subText][specialNum[subText]] = entry |
| 336 kb.SecureAttribute(KeyBinderMacro, "*macrotext-petaction_"..subText.."_"..specialNum[subText], "/cast "..spellName) | |
| 337 | |
| 338 print('|cFF00FFFFspecial['..spellName..']|r', '\n','|cFF00FFFFsubtext['..subText..']['..specialNum[subText]..']|r', '=>', i, spellName, subText, spellID, texture, specialNum[subText]) | |
| 339 end | 373 end |
| 340 | 374 |
| 341 if spellID then | 375 if spellID then |
| 342 kb.PetCache.spell[i] = {spellID, spellName, subText} | 376 kb.PetCache.spell[i] = {spellID, spellName, subText} |
| 343 print('|cFF0088FFspell['..i..']|r', '=>', spellID, spellName, subText) | 377 print('|cFF0088FFspell['..i..']|r', '=>', spellID, spellName, subText) |
