Mercurial > wow > skeletonkey
diff SkeletonKey/ActionTemplates.lua @ 56:2a95f4010c5a
- initialize pet cache internally, reconcile later
author | Nenue |
---|---|
date | Sun, 21 Aug 2016 07:19:01 -0400 |
parents | a545933ddf3d |
children | 9eebce04e69b |
line wrap: on
line diff
--- a/SkeletonKey/ActionTemplates.lua Sun Aug 21 03:33:39 2016 -0400 +++ b/SkeletonKey/ActionTemplates.lua Sun Aug 21 07:19:01 2016 -0400 @@ -315,14 +315,33 @@ kb.UpdatePetInfo = function() local hasPetSpells, petType = HasPetSpells() - --kb.PetCache.specNum = GetSpecialization(nil, true) - --kb.PetCache.specID, kb.PetCache.specName = GetSpecializationInfo(petSpec, nil, true) - - kb.db.petSpellsDB = kb.db.petSpellsDB or {} - kb.db.petSpellsDB.subtext = kb.db.petSpellsDB.subtext or {} - kb.db.petSpellsDB.spell = kb.db.petSpellsDB.spell or {} - petSpellCache = kb.db.petSpellsDB.spell - petSubtextCache = kb.db.petSpellsDB.subtext + -- reconcile saved data if it becomes available + if kb.db then + kb.db.petSpellsDB = kb.db.petSpellsDB or {} + kb.db.petSpellsDB.subtext = kb.db.petSpellsDB.subtext or {} + kb.db.petSpellsDB.spell = kb.db.petSpellsDB.spell or {} + local spellCache = kb.db.petSpellsDB.spell + local subtextCache = kb.db.petSpellsDB.subtext + if petSpellCache then + for k,v in pairs(petSpellCache) do + if not spellCache[k] then + spellCache[k] = v + end + end + petSpellCache = spellCache + end + if petSubtextCache then + for k,v in pairs(petSubtextCache) do + if not subtextCache[k] then + subtextCache[k] = v + end + end + petSubtextCache = subtextCache + end + else + petSpellCache = {} + petSubtextCache = {} + end