comparison 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
comparison
equal deleted inserted replaced
55:c416c9e6d212 56:2a95f4010c5a
313 313
314 314
315 kb.UpdatePetInfo = function() 315 kb.UpdatePetInfo = function()
316 local hasPetSpells, petType = HasPetSpells() 316 local hasPetSpells, petType = HasPetSpells()
317 317
318 --kb.PetCache.specNum = GetSpecialization(nil, true) 318 -- reconcile saved data if it becomes available
319 --kb.PetCache.specID, kb.PetCache.specName = GetSpecializationInfo(petSpec, nil, true) 319 if kb.db then
320 320 kb.db.petSpellsDB = kb.db.petSpellsDB or {}
321 kb.db.petSpellsDB = kb.db.petSpellsDB or {} 321 kb.db.petSpellsDB.subtext = kb.db.petSpellsDB.subtext or {}
322 kb.db.petSpellsDB.subtext = kb.db.petSpellsDB.subtext or {} 322 kb.db.petSpellsDB.spell = kb.db.petSpellsDB.spell or {}
323 kb.db.petSpellsDB.spell = kb.db.petSpellsDB.spell or {} 323 local spellCache = kb.db.petSpellsDB.spell
324 petSpellCache = kb.db.petSpellsDB.spell 324 local subtextCache = kb.db.petSpellsDB.subtext
325 petSubtextCache = kb.db.petSpellsDB.subtext 325 if petSpellCache then
326 for k,v in pairs(petSpellCache) do
327 if not spellCache[k] then
328 spellCache[k] = v
329 end
330 end
331 petSpellCache = spellCache
332 end
333 if petSubtextCache then
334 for k,v in pairs(petSubtextCache) do
335 if not subtextCache[k] then
336 subtextCache[k] = v
337 end
338 end
339 petSubtextCache = subtextCache
340 end
341 else
342 petSpellCache = {}
343 petSubtextCache = {}
344 end
326 345
327 346
328 347
329 if PetHasSpellbook() then 348 if PetHasSpellbook() then
330 print('PET SPELLBOOK') 349 print('PET SPELLBOOK')