Mercurial > wow > ouroloot
changeset 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 |
files | core.lua gui.lua |
diffstat | 2 files changed, 40 insertions(+), 18 deletions(-) [+] |
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
--- a/gui.lua Sun Oct 09 01:02:27 2011 +0000 +++ b/gui.lua Sun Oct 09 15:51:24 2011 +0000 @@ -437,22 +437,9 @@ --gone.itemlink or gone.bosskill or gone.startday.text) end, - -- if kind is boss, also need to stop at new timestamp ["Delete remaining entries for this day"] = function(rowi,kind) - local fencepost - local closest_time = addon._find_next_after('time',rowi) - if kind == 'time' then - fencepost = closest_time - elseif kind == 'boss' then - local closest_boss = addon._find_next_after('boss',rowi) - 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 + -- if kind is boss, also need to stop at new timestamp + local fencepost = addon._find_timeboss_fencepost (kind, rowi) local count = fencepost and (fencepost-rowi) or (#g_loot-rowi+1) repeat dropdownfuncs.df_DELETE(rowi) @@ -464,11 +451,25 @@ local e = g_loot[rowi] -- This only works because GetItemInfo accepts multiple argument formats addon:broadcast('loot', e.person, e.itemlink, e.count, e.cols[3].value) - addon:Print("Rebroadcast entry",rowi,e.itemlink) + addon:Print("Rebroadcast entry", rowi, e.itemlink) end, ["Rebroadcast this boss"] = function(rowi,kind) - addon:Print("not implemented yet") -- TODO + -- if kind is boss, also need to stop at new timestamp + local fencepost = addon._find_timeboss_fencepost (kind, rowi) or #g_loot + -- this could be a lot of traffic, but frankly it's counterproductive + -- to try to micromanage when ChatThrottleLib is already doing so + repeat + local e = g_loot[rowi] + if e.kind == 'boss' then + addon:broadcast('boss', e.reason, e.bosskill, e.instance) + elseif e.kind == 'loot' then + -- This only works because GetItemInfo accepts multiple argument formats + addon:broadcast('loot', e.person, e.itemlink, e.count, e.cols[3].value) + end + addon:Print("Rebroadcast entry", rowi, e.itemlink or e.bosskill or UNKNOWN) + rowi = rowi + 1 + until rowi >= fencepost end, ["Mark as normal"] = function(rowi,disp) -- broadcast the change? ugh @@ -581,7 +582,7 @@ }}, { "Change from 'wipe' to 'kill'|Also collapses other wipe entries.", - "Rebroadcast this boss|Broadcasts the kill event and all subsequent loot until next boss.", + "Rebroadcast this boss%boss|Broadcasts the kill event and all subsequent loot until next boss.", "Delete this boss event|Permanent, no going back!", "Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day.", "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.",