Quantcast

Reuse icons that have been lost.

Christopher Rosell [04-23-10 - 20:18]
Reuse icons that have been lost.
Filename
Kungaloosh.toc
kungaloosh.lua
diff --git a/Kungaloosh.toc b/Kungaloosh.toc
index 3c73502..352ff33 100644
--- a/Kungaloosh.toc
+++ b/Kungaloosh.toc
@@ -1,7 +1,7 @@
 ## Interface: 30300
 ## Title: Kungaloosh
 ## Notes: Automagic raid marking when tanking
-## Version: 1.1
+## Version: 1.2
 ## Author: Christopher Rosell
 ## X-Email: chrippa@gmail.com
 ## X-Category: Combat
diff --git a/kungaloosh.lua b/kungaloosh.lua
index 48afa79..a291c3c 100644
--- a/kungaloosh.lua
+++ b/kungaloosh.lua
@@ -47,14 +47,24 @@ function addon:PLAYER_REGEN_ENABLED()
 	self:ResetState()
 end

-function addon:UNIT_THREAT_LIST_UPDATE()
-	local istanking, status, threatpct, rawthreatpct, threat = UnitDetailedThreatSituation('player', 'target')
-	if GetRaidTargetIndex'target' == nil then
+function addon:UNIT_THREAT_LIST_UPDATE(unit)
+	if not unit then return end
+
+	local icon = self:GetNextIcon()
+	local guid = UnitGUID(unit)
+
+	for i,v in pairs(self.iconstate) do
+		if v == guid then
+			icon = i
+			break
+		end
+	end
+
+	if icon and GetRaidTargetIndex(unit) == nil then
+		local istanking, status, threatpct, rawthreatpct, threat = UnitDetailedThreatSituation('player', unit)
+
 		if threat and threat > (self:GetMinThreat() * 100) then
-			local icon = self:GetNextIcon()
-			if icon then
-				SetRaidTarget('target', icon)
-			end
+			SetRaidTarget(unit, icon)
 		end
 	end
 end