diff core.lua @ 69:8442272a8418

- Make sure popup dialogs are on top of Ace3's widgets. - Minor code reorganization. Safety hook for future boss-entry code. - Avoid same bug from a couple revs ago when adding manual boss kills. - Ask players about snapshot data when manually entering boss kills. - Blizzard rearranged the button order in 3-entry popups some time ago and I failed to adapt the code until now.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 11 May 2012 03:08:12 +0000
parents 3bed6d51e077
children cdee65c1bd8c
line wrap: on
line diff
--- a/core.lua	Wed May 09 09:38:14 2012 +0000
+++ b/core.lua	Fri May 11 03:08:12 2012 +0000
@@ -40,7 +40,9 @@
                 up; can be 0 if we're outside an instance and the player
                 inside has an older version
 - duration      in seconds; may be missing (only present if local)
-- raidersnap    copy of g_loot.raiders at the time of the boss event
+- raidersnap    copy of g_loot.raiders at the time of the boss event; may be
+                empty for manual snapshots the player didn't want included
+                (not necessarily an "error" if this is missing entirely)
 
 Loot specific g_loot indices:
 - person        recipient
@@ -107,7 +109,7 @@
 
 ------ Constants
 local option_defaults = {
-	['datarev'] = 18,    -- cheating, this isn't actually an option
+	['datarev'] = 19,    -- cheating, this isn't actually an option
 	['popup_on_join'] = true,
 	['register_slashloot'] = true,
 	['scroll_to_bottom'] = true,
@@ -616,6 +618,11 @@
 			end
 		end
 
+		bumpers[18] = bumpers[16]
+			-- In the not-very-many days between 16 and 19, I managed to break
+			-- the exact same data in the exact same way.  At least they're
+			-- not actually running the same loop twice... probably... sigh.
+
 		--[===[
 		local real = bumpers
 		bumpers = newproxy(true)
@@ -997,9 +1004,10 @@
 		-- this is set on various boss interactions, so we've got a kill/wipe
 		-- entry already
 		if addon.latest_instance then return end
-		addon.latest_instance = instance_tag()
-		local ss, max = addon:snapshot_raid()
-		addon:_mark_boss_kill (addon._addLootEntry{
+		--addon.latest_instance = instance_tag()
+		local ss, max, inst = addon:snapshot_raid()
+		addon.latest_instance = inst
+		addon:_mark_boss_kill (addon._addBossEntry{
 			kind='boss', reason='kill', bossname=[[trash]],
 			instance=addon.latest_instance, duration=0,
 			raidersnap=ss, maxsize=max
@@ -1204,8 +1212,8 @@
 		end
 
 	elseif cmd == "fake" then  -- maybe comment this out for real users
-		self:_mark_boss_kill (self._addLootEntry{
-			kind='boss',reason='kill',bossname="Baron Steamroller",instance=instance_tag(),duration=0
+		self:_mark_boss_kill (self._addBossEntry{
+			kind='boss',reason='kill',bossname="Baron Steamroller",duration=0
 		})
 		self:CHAT_MSG_LOOT ('manual', my_name, 54797)
 		if self.display then
@@ -1581,7 +1589,7 @@
 				end
 			end
 		end
-		bossi = addon._addLootEntry(boss)
+		bossi = addon._addBossEntry(boss)
 		-- addon.
 		bossi = addon._adjustBossOrder (bossi, g_boss_signpost) or bossi
 		g_boss_signpost = nil
@@ -1657,6 +1665,7 @@
 		local attempts = 1
 		local first
 
+		-- Maybe redo this to only collapse *contiguous* wipes...?
 		local i,d = 1,g_loot[1]
 		while d ~= e do
 			if d.bossname and
@@ -1820,6 +1829,23 @@
 		return index
 	end
 
+	-- Safety wrapper only.
+	-- XXX Maybe pprint something here.
+	function addon._addBossEntry (e)
+		local ret = addon._addLootEntry(e)
+		assert(e.kind=='boss')
+		local needSize = e.maxsize == nil
+		local needSnap = e.raidersnap == nil
+		local needInst = e.instance == nil
+		if needSize or needSnap then
+			local ss, max, inst = addon:snapshot_raid()
+			if needSize then e.maxsize = max end
+			if needSnap then e.raidersnap = ss end
+			if needInst then e.instance = inst end
+		end
+		return ret
+	end
+
 	-- Problem:  (1) boss kill happens, (2) fast looting happens, (3) boss
 	-- cache cleanup fires.  Result:  loot shows up before boss kill entry.
 	-- Solution:  We need to shuffle the boss entry above any of the loot