Mercurial > wow > ouroloot
diff core.lua @ 28:a7376e6de73c
Drycoded rebroadcast of entire days/bosses, finally.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Sun, 09 Oct 2011 15:51:24 +0000 |
parents | 68d7b903ee17 |
children | 7d2742727869 |
line wrap: on
line diff
--- a/core.lua Sun Oct 09 01:02:27 2011 +0000 +++ b/core.lua Sun Oct 09 15:51:24 2011 +0000 @@ -1067,6 +1067,7 @@ end -- Generic helpers +-- Returns index and entry at that index, or nil if not found. function addon._find_next_after (kind, index) index = index + 1 while index <= #g_loot do @@ -1076,6 +1077,26 @@ index = index + 1 end end +-- Essentially a _find_next_after('time'-or-'boss'), but if KIND is +-- 'boss', will also stop upon finding a timestamp. Returns nil if +-- appropriate fencepost is not found. +function addon._find_timeboss_fencepost (kind, index) + local fencepost + local closest_time = addon._find_next_after('time',index) + if kind == 'time' then + fencepost = closest_time + elseif kind == 'boss' then + local closest_boss = addon._find_next_after('boss',index) + if not closest_boss then + fencepost = closest_time + elseif not closest_time then + fencepost = closest_boss + else + fencepost = math.min(closest_time,closest_boss) + end + end + return fencepost +end -- Iterate through g_loot entries according to the KIND field. Loop variables -- are g_loot indices and the corresponding entries (essentially ipairs + some