diff gui.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 f62d582c5c52
line wrap: on
line diff
--- 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.",