unitframes: extend aggro scanner and fix refresh

This commit is contained in:
shagu
2018-01-22 00:10:28 +01:00
parent d4f1d585b6
commit a72992c012
2 changed files with 8 additions and 3 deletions
+7 -2
View File
@@ -26,7 +26,7 @@ for i=1,40 do pfValidUnits["raidpet" .. i .. "target"] = true end
local aggrodata = { }
function pfUI.api.UnitHasAggro(unit)
if aggrodata[unit] and GetTime() > aggrodata[unit].check + 1 then
if aggrodata[unit] and GetTime() < aggrodata[unit].check + 1 then
return aggrodata[unit].state
end
@@ -36,7 +36,12 @@ function pfUI.api.UnitHasAggro(unit)
for u in pairs(pfValidUnits) do
local t = u .. "target"
local tt = t .. "target"
if UnitExists(tt) and UnitIsUnit(tt, unit) and UnitCanAttack(t, tt) then
if UnitExists(t) and UnitIsUnit(t, unit) and UnitCanAttack(u, unit) then
aggrodata[unit].state = aggrodata[unit].state + 1
end
if UnitExists(tt) and UnitIsUnit(tt, unit) and UnitCanAttack(t, unit) then
aggrodata[unit].state = aggrodata[unit].state + 1
end
end