local addonName, addon = ... local childName = addon['childName'] local child = addon[childName] local events = child['events'] local db LibStub("zzHelper"):Embed(child) local function prepareDB() db = addon['db']['profile'][childName] child['db'] = db addon['callbacks']:Fire(format("Init%s", childName)) end function child:QuestUpdate() local maxNumQuests = C_QuestLog.GetMaxNumQuestsCanAccept() local numEntries, numQuests if(C_QuestLog.GetNumQuestLogEntries) then numEntries, numQuests = C_QuestLog.GetNumQuestLogEntries() else numEntries, numQuests = GetNumQuestLogEntries() end if(db['slots']) then numQuests = maxNumQuests - numQuests end local line = format("%i/%i",numQuests, maxNumQuests) if(numQuests==maxNumQuests or numQuests==0) then line = child:colorize(line, 'ff0000') end child:OnText(childName, line) end child['specs'] = { ['name'] = childName, ['sv'] = true, ['cfg'] = true, ['cfgReset'] = prepareDB, ['ldb'] = child['ldb'], ['defaults'] = { ['profile'] = { [childName] = {} } } } function events:PLAYER_ENTERING_WORLD(event) child:UnregisterEvent('PLAYER_ENTERING_WORLD') child:RegisterEvent({'QUEST_ACCEPTED','QUEST_AUTOCOMPLETE','QUEST_COMPLETE','QUEST_DATA_LOAD_RESULT','QUEST_DETAIL','QUEST_LOG_CRITERIA_UPDATE','QUEST_LOG_UPDATE','QUEST_POI_UPDATE','QUEST_REMOVED','QUEST_TURNED_IN','QUEST_WATCH_LIST_CHANGED','QUEST_WATCH_UPDATE','QUESTLINE_UPDATE','TASK_PROGRESS_UPDATE','TREASURE_PICKER_CACHE_FLUSH','WAYPOINT_UPDATE','WORLD_QUEST_COMPLETED_BY_SPELL'}, child.QuestUpdate) end child:NewAddOn(...)