Mercurial > wow > skeletonkey
changeset 26:c081f117c19d
- postpone secure frame attributes triggered during combat
author | Nenue |
---|---|
date | Sun, 31 Jul 2016 16:45:02 -0400 |
parents | 74a70720f622 |
children | 73df13211b22 |
files | SkeletonKey/ActionTypes.lua |
diffstat | 1 files changed, 28 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/SkeletonKey/ActionTypes.lua Sat Jul 30 21:08:48 2016 -0400 +++ b/SkeletonKey/ActionTypes.lua Sun Jul 31 16:45:02 2016 -0400 @@ -284,8 +284,9 @@ spellOffset = (spellOffset+j), spellNum = j } - KeyBinderKey:SetAttribute("*type-profession_"..i .. '_' ..j, "spell") - KeyBinderKey:SetAttribute("*spell-profession_"..i .. '_' ..j, spellName) + + kb.SecureAttribute(KeyBinderKey, "*type-profession_"..i .. '_' ..j, "spell") + kb.SecureAttribute(KeyBinderKey, "*spell-profession_"..i .. '_' ..j, spellName) kb.ProfessionCache[i .. '_' .. j] = profInfo kb.ProfessionCache[spellName] = profInfo @@ -325,7 +326,7 @@ kb.PetCache.special[spellName] = entry kb.PetCache.subtext[subText][specialNum[subText]] = entry - KeyBinderMacro:SetAttribute("*macrotext-petaction_"..subText.."_"..specialNum[subText], "/cast "..spellName) + kb.SecureAttribute(KeyBinderMacro, "*macrotext-petaction_"..subText.."_"..specialNum[subText], "/cast "..spellName) print('|cFF00FFFFspecial['..spellName..']|r', '\n','|cFF00FFFFsubtext['..subText..']['..specialNum[subText]..']|r', '=>', i, spellName, subText, spellID, texture, specialNum[subText]) end @@ -389,4 +390,28 @@ kb.UpdateSlot(button, true) end end +end + +kb.pendingAttributes = {} +kb.SecureAttribute = function(target, name, value) + if InCombatLockdown() then + tinsert(kb.pendingAttributes, {target, name, value}) + kb:RegisterEvent('PLAYER_REGEN_ENABLED') + else + + print(target:GetName(), 'attribute', '"'.. tostring(name)..'" = "'..tostring(value)..'"') + target:SetAttribute(name, value) + end +end + +kb.PLAYER_REGEN_ENABLED = function() + if #kb.pendingAttributes >= 1 then + local args = tremove(kb.pendingAttributes) + while args do + local target, name, value = unpack(args) + print(target:GetName(), 'attribute', '"'.. tostring(name)..'" = "'..tostring(value)..'"') + target:SetAttribute(name, value) + args = tremove(kb.pendingAttributes) + end + end end \ No newline at end of file