In my broker I display the information of all chars. So it would be helpfull when the info is stored the moment it's known to make sure the addon has the right data when the player switches to another char. For now I've added an 5 seconds ooc-onupdate additionally to registering PLAYER_LOGOUT.
Lua Code:
local function update()
for questId, questData in pairs(db['quests']) do
if(questData['minlevel'] <= db['char_db'][player]['level']) then
db['char_db'][player][questId] = IsQuestFlaggedCompleted(questId) and true or nil
end
end
end
local function onupdate(self,dt)
self['elapsed'] = (self['elapsed'] or 0) - dt
if(self['elapsed'] < 0) then
self['elapsed'] = 5
update()
end
end
local function event(self,evnt,...)
print(evnt)
print(...)
if(evnt == "PLAYER_REGEN_DISABLED") then
self:SetScript("OnUpdate", nil)
elseif(evnt == "PLAYER_REGEN_ENABLED") then
self:SetScript("OnUpdate", onupdate)
else
update()
end
end