Ce dépôt a été archivé le 2020-03-15 . Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
2012-01-01 04:01:18 +01:00
local GetTime = QuestHelper_GetTime
2010-11-08 14:28:59 +01:00
QuestHelper_File [ " collect_notifier.lua " ] = " 4.0.1.$svnversion$ "
2010-10-24 23:17:33 +02:00
QuestHelper_Loadtime [ " collect_notifier.lua " ] = GetTime ( )
local NotificationsPending = { }
local function OnUpdate ( )
2012-01-01 03:22:56 +01:00
while # NotificationsPending > 0 and GetTime ( ) >= NotificationsPending [ 1 ] . time do
2010-10-24 23:17:33 +02:00
NotificationsPending [ 1 ] . func ( )
table.remove ( NotificationsPending , 1 ) -- okay okay n^2 deal with it
end
end
local function AddItem ( time , func )
QuestHelper : Assert ( time )
QuestHelper : Assert ( func )
table.insert ( NotificationsPending , { time = time , func = func } )
table.sort ( NotificationsPending , function ( a , b ) return a.time < b.time end ) -- haha who cares about efficiency anyway, NOT ME that is for certain
end
function QH_Collect_Notifier_Init ( _ , API )
API.Utility_Notifier = AddItem
API.Registrar_OnUpdateHook ( OnUpdate )
end
-- grrrr
QH_AddNotifier = AddItem