# HG changeset patch # User Nenue # Date 1469997902 14400 # Node ID c081f117c19d6318b381043b2ccf570068ed5c4d # Parent 74a70720f622fde3c5def5a60cc00992fe299013 - postpone secure frame attributes triggered during combat diff -r 74a70720f622 -r c081f117c19d SkeletonKey/ActionTypes.lua --- 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