Quantcast

Changed the way aggro is updated, to ensure its kept up to date. Will only fire on a state change.

James Whitehead II [01-06-07 - 16:58]
Changed the way aggro is updated, to ensure its kept up to date.  Will only fire on a state change.
Filename
PerfectRaid_Aggro.lua
diff --git a/PerfectRaid_Aggro.lua b/PerfectRaid_Aggro.lua
index 6490464..b93edb4 100644
--- a/PerfectRaid_Aggro.lua
+++ b/PerfectRaid_Aggro.lua
@@ -92,17 +92,8 @@ function Aggro.OnUpdate()
 				local victim = victims[unit]
 				if UnitIsUnit(victim, unit) and UnitCanAttack(unit, target) then
 					-- unit is being targeted by a hostile mob
-					if aggro[unit] < 20 then
-						local val = aggro[unit]
-						if val >= 5 and val <= 10 then
-							if not marked[unit] then
-								PerfectRaid:UNIT_HEALTH(nil, unit)
-							end
-						else
-							if marked[unit] then
-								PerfectRaid:UNIT_HEALTH(nil, unit)
-							end
-						end
+					local val = aggro[unit]
+					if val < 20 then
 						aggro[unit] = val + 10
 					end
 				end
@@ -114,7 +105,15 @@ function Aggro.OnUpdate()

 				-- Use this when a unit has aggro
 				if aggro[unit] >= 15 then
-					--self:FlashAggro(unit)
+					if not marked[unit] then
+						PerfectRaid:UNIT_HEALTH(nil, unit)
+						marked[unit] = true
+					end
+				else
+					if marked[unit] then
+						PerfectRaid:UNIT_HEALTH(nil, unit)
+						marked[unit] = nil
+					end
 				end

 				local name = UnitName(unit)