1
0
Bifurcation 0
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.
questhelperredux/QHCollector/collect_notifier.lua
Nathanial.C.Jones 5287a36af4 Working on separating the collector subsystem out from the rest of the system. Initially it will be a required dependency.
Please note that though these files have been added, nothing has changed yet in the main system to support this separation... i.e. no files have been removed and no files have been changed in the main system for this.
2012-01-01 20:46:45 +00:00

29 lignes
895 o
Lua

local GetTime = QuestHelperCollector_GetTime
QuestHelper_File["collect_notifier.lua"] = "4.0.1.$svnversion$"
QuestHelper_Loadtime["collect_notifier.lua"] = GetTime()
local NotificationsPending = {}
local function OnUpdate()
while #NotificationsPending > 0 and GetTime() >= NotificationsPending[1].time do
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