Mercurial > wow > skeletonkey
diff ActionTemplates.lua @ 93:f9df7cd7bfd6 tip
revert pet spell subText collation
remove an empty script handler
author | Nenue |
---|---|
date | Tue, 04 Sep 2018 23:00:21 -0400 |
parents | b80e78f4a17b |
children |
line wrap: on
line diff
--- a/ActionTemplates.lua Tue Jul 17 20:48:19 2018 -0400 +++ b/ActionTemplates.lua Tue Sep 04 23:00:21 2018 -0400 @@ -14,7 +14,7 @@ local GetNumBindings, GetBinding = GetNumBindings, GetBinding local _, kb = ... -local print = (DEVIAN_PNAME == 'SkeletonKey') and function(...) print('SK', ...) end or nop +local print = (DEVIAN_PNAME == 'SkeletonKey') and function(...) print('AT', ...) end or nop local cprint = (DEVIAN_PNAME == 'SkeletonKey') and function(...) _G.print('Cfg', ...) end or nop local CLICK_KEYBINDER_MACRO = "CLICK SkeletonKeyMacro:" @@ -73,24 +73,19 @@ end atype['petaction'] = function(_, name) + print('|cFF00FF00atype:petaction|r', name) -- ID doesn't exist for basic commands, even though they can be picked up - local attributeName, attributeValue = "petaction_" .. tostring(name), "/cast "..tostring(name) + local attributeName, attributeValue = "petaction_" .. tostring(name), "/use "..tostring(name) if not petSpellCache then kb.UpdatePetInfo() end -- Compose a multi-macro for subtext abilities - if petSpellCache[name] then - attributeValue = "" - for spellName, enabled in pairs(petSubtextCache[petSpellCache[name]]) do - attributeValue = attributeValue .. "/cast " .. spellName .. "\n" - end - end if PETACTION_SCRIPT[name] then attributeName, attributeValue = unpack(PETACTION_SCRIPT[name]) - elseif kb.PetCache.special[name] then - attributeName = "petaction_"..kb.PetCache.special[name][3].."_" .. tonumber(kb.PetCache.special[name][6]) + + print(' scripts hit:', name, attributeName, attributeValue) end return CLICK_KEYBINDER_MACRO, attributeName, attributeValue, SkeletonKeyMacro end @@ -598,6 +593,7 @@ kb.UpdatePetInfo = function() + print('|cFFFFFF00kb.UpdatePetInfo()') local hasPetSpells, petType = HasPetSpells() -- reconcile saved data if it becomes available @@ -629,7 +625,7 @@ end if PetHasSpellbook() then - --print('PET SPELLBOOK') + print('PET SPELLBOOK') local spellbookOffset = 1 local specialNum = {} local newSubtextItems = false @@ -639,28 +635,22 @@ local spellType, spellID = GetSpellBookItemInfo(spellbookOffset, BOOKTYPE_PET) local spellName, subText = GetSpellBookItemName(spellbookOffset, BOOKTYPE_PET) local texture = GetSpellBookItemTexture(spellbookOffset, BOOKTYPE_PET) - if (spellType == 'SPELL') and (not IsPassiveSpell(spellbookOffset, BOOKTYPE_PET)) then + + + if (spellType == 'PETACTION') and (not IsPassiveSpell(spellbookOffset, BOOKTYPE_PET)) then + + print('|cFF00FF00#'..spellbookOffset..'|r', spellType, spellID, spellName, subText, texture) local info = kb.PetCache[spellName] or {} kb.PetCache.spellslot[spellName] = {spellbookOffset, spellName, subText, spellID, texture} - --print('|cFF00FF88spellslot['..spellName..']|r', '=>', i, subText) + print('|cFF00FF88spellslot['..spellName..']|r', '=>', spellName, spellID) if subText then kb.PetCache.subtext[subText] = kb.PetCache.subtext[subText] or {} specialNum[subText] = (specialNum[subText] or 0) + 1 petSpellCache[spellName] = subText - petSubtextCache[subText] = petSubtextCache[subText] or {} - -- add to the list - if not petSubtextCache[subText][spellName] then - petSubtextCache[subText][spellName] = true - newSubtextItems = true - --print('|cFF00FFFFspecial['..spellName..']|r', '\n','|cFF00FFFFsubtext['..subText..']['..specialNum[subText]..']|r', '=>', i, spellName, subText, spellID, texture, specialNum[subText]) - end - - - - local entry = {spellbookOffset, spellName, subText, spellID, texture, specialNum[subText] } + --local entry = {spellbookOffset, spellName, subText, spellID, texture, specialNum[subText] } info.spellbookOffset = spellbookOffset @@ -692,19 +682,6 @@ spellbookOffset = spellbookOffset + 1 until spellType == nil - if newSubtextItems then - - local macrotext = "" - for subText, spells in pairs(petSubtextCache) do - if specialNum[subText] then - for spellName, enabled in pairs(spells) do - macrotext = macrotext .. "/cast " .. spellName .. "\n" - end - kb.SecureAttribute(SkeletonKeyMacro, "*macrotext-petaction_"..subText.."_"..specialNum[subText], macrotext) - end - end - end - else --print('NO PET SPELLBOOK') @@ -713,13 +690,15 @@ end if PetHasActionBar() then - --print('PET ACTION BAR') + print('PET ACTION BAR') for i = 1, 10 do + local name, texture, _, _, _, _, spellId = GetPetActionInfo(i) + if name then - local name, subtext, texture, isToken, isActive = GetPetActionInfo(i) - if name then - kb.PetCache.action[i] = {name, subtext, texture, isToken, isActive } + print(i, name, texture, spellId) + + kb.PetCache.action[i] = {name, texture, spellId} end