Quantcast

Reuse raid icons from dead mobs.

Christopher Rosell [04-17-10 - 17:53]
Reuse raid icons from dead mobs.
Filename
Kungaloosh.toc
kungaloosh.lua
diff --git a/Kungaloosh.toc b/Kungaloosh.toc
index 5ac3dd6..3c73502 100644
--- a/Kungaloosh.toc
+++ b/Kungaloosh.toc
@@ -1,7 +1,7 @@
 ## Interface: 30300
 ## Title: Kungaloosh
 ## Notes: Automagic raid marking when tanking
-## Version: 1.0
+## Version: 1.1
 ## Author: Christopher Rosell
 ## X-Email: chrippa@gmail.com
 ## X-Category: Combat
diff --git a/kungaloosh.lua b/kungaloosh.lua
index d16c58b..48afa79 100644
--- a/kungaloosh.lua
+++ b/kungaloosh.lua
@@ -59,12 +59,22 @@ function addon:UNIT_THREAT_LIST_UPDATE()
 	end
 end

+function addon:COMBAT_LOG_EVENT(timestamp, event, sguid, sname, sflags, dguid, dname, dflags)
+	if event == 'UNIT_DIED' then
+		for icon, guid in pairs(self.iconstate) do
+			if dguid == guid then
+				self.iconstate[icon] = nil
+			end
+		end
+	end
+end
+
 function addon:RAID_TARGET_UPDATE()
 	local function check(unit)
 		if UnitExists(unit) then
 			local icon = GetRaidTargetIndex(unit)
 			if icon then
-				self.iconstate[icon] = true
+				self.iconstate[icon] = UnitGUID(unit)
 			end
 		end
 	end
@@ -126,6 +136,7 @@ function addon:Enable(msg)
 	self:RegisterEvent'PLAYER_REGEN_ENABLED'
 	self:RegisterEvent'UNIT_THREAT_LIST_UPDATE'
 	self:RegisterEvent'RAID_TARGET_UPDATE'
+	self:RegisterEvent'COMBAT_LOG_EVENT'
 	self.enabled = true

 	self:ResetState()
@@ -139,6 +150,7 @@ function addon:Disable(msg)
 	self:UnregisterEvent'PLAYER_REGEN_ENABLED'
 	self:UnregisterEvent'UNIT_THREAT_LIST_UPDATE'
 	self:UnregisterEvent'RAID_TARGET_UPDATE'
+	self:UnregisterEvent'COMBAT_LOG_EVENT'
 	self.enabled = false

 	if msg then self:Print(msg) end