965e8589c9
I implemented a QuestHelper_GetTime function for the next time Blizzard decides to fiddle with the time functions. It returns debugprofilestop() / 1000, to exactly match the precision of GetTime(). I also re-removed references to Cartographer from the rollback.
30 lignes
887 o
Lua
30 lignes
887 o
Lua
|
|
local GetTime = QuestHelper_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
|