diff core.lua @ 42:4f1e71f62776

Handle moving from one instance kill/loot into a new instance, and then getting loot from trash in the new instance before seeing any bosses.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 13 Jan 2012 01:12:36 +0000
parents d6b8858c1b64
children a561a967b5e6
line wrap: on
line diff
--- a/core.lua	Thu Jan 12 02:24:15 2012 +0000
+++ b/core.lua	Fri Jan 13 01:12:36 2012 +0000
@@ -282,6 +282,7 @@
 	return name .. "(" .. t .. ")"
 end
 addon.instance_tag = instance_tag   -- grumble
+addon.latest_instance = nil         -- spelling reminder, assigned elsewhere
 
 
 ------ Expiring caches
@@ -695,6 +696,16 @@
 
 -- helper for CHAT_MSG_LOOT handler
 do
+	local function maybe_trash_kill_entry()
+		-- 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()
+		addon:_mark_boss_kill (addon._addLootEntry{
+			kind='boss',reason='kill',bosskill=[[trash]],instance=addon.latest_instance,duration=0
+		})
+	end
+
 	-- Recent loot cache
 	local candidates = {}
 	local function prefer_local_loots (cache)
@@ -708,6 +719,7 @@
 			local loot = candidates[sig]
 			if loot then
 				addon.dprint('loot', i, "was found")
+				maybe_trash_kill_entry() -- Generate *some* kind of boss/location entry
 				candidates[sig] = nil
 				local looti = addon._addLootEntry(loot)
 				if (loot.disposition ~= 'shard')
@@ -1264,6 +1276,7 @@
 		-- addon.
 		bossi = addon._adjustBossOrder (bossi, g_boss_signpost) or bossi
 		g_boss_signpost = nil
+		addon.latest_instance = boss.instance
 		addon.dprint('loot', "added boss entry", bossi)
 		if boss.reason == 'kill' then
 			addon:_mark_boss_kill (bossi)