View Single Post
06-02-13, 02:03 AM   #36
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
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:
  1. local function update()
  2.     for questId, questData in pairs(db['quests']) do
  3.         if(questData['minlevel'] <= db['char_db'][player]['level']) then
  4.             db['char_db'][player][questId] = IsQuestFlaggedCompleted(questId) and true or nil
  5.         end
  6.     end
  7. end
  8. local function onupdate(self,dt)
  9.     self['elapsed'] = (self['elapsed'] or 0) - dt
  10.     if(self['elapsed'] < 0) then
  11.         self['elapsed'] = 5
  12.         update()
  13.     end
  14. end
  15. local function event(self,evnt,...)
  16.     print(evnt)
  17.     print(...)
  18.     if(evnt == "PLAYER_REGEN_DISABLED") then
  19.         self:SetScript("OnUpdate", nil)
  20.     elseif(evnt == "PLAYER_REGEN_ENABLED") then
  21.         self:SetScript("OnUpdate", onupdate)
  22.     else
  23.         update()
  24.     end
  25. end
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote