detect spec before CD used

This commit is contained in:
Sumsebrum 2022-03-26 18:22:21 +01:00
parent 6f50bc96ef
commit 73a54b4489

View File

@ -73,6 +73,12 @@ function Gladdy:SpotEnemy(unit, auraScan)
if ( not spellName ) then if ( not spellName ) then
break break
end end
if Gladdy.specBuffs[spellName] and unitCaster then -- Check for auras that detect a spec
local unitPet = string_gsub(unit, "%d$", "pet%1")
if UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster) then
EventListener:DetectSpec(unit, Gladdy.specBuffs[spellName])
end
end
if Gladdy.cooldownBuffs[spellName] and unitCaster then -- Check for auras that detect used CDs (like Fear Ward) if Gladdy.cooldownBuffs[spellName] and unitCaster then -- Check for auras that detect used CDs (like Fear Ward)
for arenaUnit,v in pairs(self.buttons) do for arenaUnit,v in pairs(self.buttons) do
if (UnitIsUnit(arenaUnit, unitCaster)) then if (UnitIsUnit(arenaUnit, unitCaster)) then
@ -84,12 +90,6 @@ function Gladdy:SpotEnemy(unit, auraScan)
if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then
Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName) Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName)
end end
if Gladdy.specBuffs[spellName] and unitCaster then -- Check for auras that detect a spec
local unitPet = string_gsub(unit, "%d$", "pet%1")
if UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster) then
EventListener:DetectSpec(unit, Gladdy.specBuffs[spellName])
end
end
end end
end end
end end
@ -126,6 +126,12 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
if (not UnitExists(srcUnit)) then if (not UnitExists(srcUnit)) then
return return
end end
if not Gladdy.buttons[srcUnit].class or not Gladdy.buttons[srcUnit].race then
Gladdy:SpotEnemy(srcUnit, true)
end
if not Gladdy.buttons[srcUnit].spec then
self:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
end
if (eventType == "SPELL_CAST_SUCCESS" or eventType == "SPELL_AURA_APPLIED") then if (eventType == "SPELL_CAST_SUCCESS" or eventType == "SPELL_AURA_APPLIED") then
local unitRace = Gladdy.buttons[srcUnit].race local unitRace = Gladdy.buttons[srcUnit].race
-- cooldown tracker -- cooldown tracker
@ -147,13 +153,6 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
Gladdy:SendMessage("RACIAL_USED", srcUnit) Gladdy:SendMessage("RACIAL_USED", srcUnit)
end end
end end
if not Gladdy.buttons[srcUnit].class or not Gladdy.buttons[srcUnit].race then
Gladdy:SpotEnemy(srcUnit, true)
end
if not Gladdy.buttons[srcUnit].spec then
self:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
end
end end
end end
@ -250,6 +249,12 @@ function EventListener:UNIT_AURA(unit)
Gladdy:SendMessage("AURA_GAIN_LIMIT", unit, auraType, n - 1) Gladdy:SendMessage("AURA_GAIN_LIMIT", unit, auraType, n - 1)
break break
end end
if not button.spec and Gladdy.specBuffs[spellName] and unitCaster then
local unitPet = string_gsub(unit, "%d$", "pet%1")
if unitCaster and (UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster)) then
self:DetectSpec(unit, Gladdy.specBuffs[spellName])
end
end
if Gladdy.cooldownBuffs[spellName] and unitCaster then -- Check for auras that hint used CDs (like Fear Ward) if Gladdy.cooldownBuffs[spellName] and unitCaster then -- Check for auras that hint used CDs (like Fear Ward)
for arenaUnit,v in pairs(Gladdy.buttons) do for arenaUnit,v in pairs(Gladdy.buttons) do
if (UnitIsUnit(arenaUnit, unitCaster)) then if (UnitIsUnit(arenaUnit, unitCaster)) then
@ -260,12 +265,6 @@ function EventListener:UNIT_AURA(unit)
if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then
Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName) Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName)
end end
if not button.spec and Gladdy.specBuffs[spellName] and unitCaster then
local unitPet = string_gsub(unit, "%d$", "pet%1")
if unitCaster and (UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster)) then
self:DetectSpec(unit, Gladdy.specBuffs[spellName])
end
end
if Gladdy.exceptionNames[spellID] then if Gladdy.exceptionNames[spellID] then
spellName = Gladdy.exceptionNames[spellID] spellName = Gladdy.exceptionNames[spellID]
end end