From 913fd8c488ae6c9231f0fbb356c34959b16597cd Mon Sep 17 00:00:00 2001 From: funkydude Date: Fri, 20 Jul 2018 22:32:45 +0100 Subject: [PATCH] Clean up hidden aura scanning code and add a "UNIT_NOT_VISIBLE" arg to make potential false positives a bit more obvious. --- Transcriptor.lua | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/Transcriptor.lua b/Transcriptor.lua index fa89c2f..17ae8b3 100644 --- a/Transcriptor.lua +++ b/Transcriptor.lua @@ -1044,42 +1044,26 @@ do for j = 1, #units do local unit = units[j] for i = 1, 100 do - local _, _, _, _, _, _, _, _, _, spellId = UnitAura(unit, i, "HARMFUL") - if spellId then - if not hiddenAuraInitList[spellId] then - hiddenAuraInitList[spellId] = true - end - else - break - end - end - for i = 1, 100 do - local _, _, _, _, _, _, _, _, _, spellId = UnitAura(unit, i, "HELPFUL") - if spellId then - if not hiddenAuraInitList[spellId] then - hiddenAuraInitList[spellId] = true - end - else + local _, _, _, _, _, _, _, _, _, spellId = UnitAura(unit, i, "HARMFUL|HELPFUL") + if not spellId then break + elseif not hiddenAuraInitList[spellId] then + hiddenAuraInitList[spellId] = true end end end end function sh.UNIT_AURA(unit) for i = 1, 100 do - local name, _, _, _, duration, _, _, _, _, spellId = UnitAura(unit, i, "HARMFUL") + local name, _, _, _, duration, _, _, _, _, spellId = UnitAura(unit, i, "HARMFUL|HELPFUL") if not spellId then break elseif not hiddenUnitAuraCollector[spellId] then - hiddenUnitAuraCollector[spellId] = strjoin("#", tostringall("DEBUFF", spellId, name, duration, unit, UnitName(unit))) - end - end - for i = 1, 100 do - local name, _, _, _, duration, _, _, _, _, spellId = UnitAura(unit, i, "HELPFUL") - if not spellId then - break - elseif not hiddenUnitAuraCollector[spellId] then - hiddenUnitAuraCollector[spellId] = strjoin("#", tostringall("BUFF", spellId, name, duration, unit, UnitName(unit))) + if UnitIsVisible(unit) then + hiddenUnitAuraCollector[spellId] = strjoin("#", tostringall("DEBUFF", spellId, name, duration, unit, UnitName(unit))) + else -- If it's not visible it may not show up in CLEU, use this as an indicator of a false positive + hiddenUnitAuraCollector[spellId] = strjoin("#", tostringall("DEBUFF", "UNIT_NOT_VISIBLE", spellId, name, duration, unit, UnitName(unit))) + end end end end