From f8f0ee93a802aa156cc45fc140181efd05763c4f Mon Sep 17 00:00:00 2001 From: Christopher Rosell Date: Fri, 23 Apr 2010 22:18:57 +0200 Subject: [PATCH] Reuse icons that have been lost. --- Kungaloosh.toc | 2 +- kungaloosh.lua | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) 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 -- 1.7.9.5