From 89a5511fb93f577998725d672b992f2c257c1918 Mon Sep 17 00:00:00 2001 From: Sumsebrum Date: Fri, 14 Jan 2022 03:06:02 +0100 Subject: [PATCH] perception cd tracking improved (rogue out of stealth) --- EventListener.lua | 9 +++++++++ Modules/Racial.lua | 8 ++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/EventListener.lua b/EventListener.lua index 23cd832..4d97d35 100644 --- a/EventListener.lua +++ b/EventListener.lua @@ -86,6 +86,9 @@ function Gladdy:SpotEnemy(unit, auraScan) end end end + if Gladdy.cooldownBuffs.racials[spellName] then + Gladdy:SendMessage("RACIAL_USED", unit, expirationTime, spellName) + end if Gladdy.specBuffs[spellName] 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 @@ -216,6 +219,9 @@ Gladdy.exceptionNames = { -- TODO MOVE ME TO CLASSBUFFS LIB Gladdy.cooldownBuffs = { [GetSpellInfo(6346)] = { cd = 180, spellId = 6346 }, -- Fear Ward + racials = { + [GetSpellInfo(20600)] = { cd = 180, spellId = 20600 }, -- Perception + } } function EventListener:UNIT_AURA(unit) @@ -243,6 +249,9 @@ function EventListener:UNIT_AURA(unit) end end end + if Gladdy.cooldownBuffs.racials[spellName] then + Gladdy:SendMessage("RACIAL_USED", unit, spellName, expirationTime, spellName) + end if not button.spec and Gladdy.specBuffs[spellName] then local unitPet = string_gsub(unit, "%d$", "pet%1") if unitCaster and (UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster)) then diff --git a/Modules/Racial.lua b/Modules/Racial.lua index 7838b9b..ec5e237 100644 --- a/Modules/Racial.lua +++ b/Modules/Racial.lua @@ -165,13 +165,17 @@ function Racial:JOINED_ARENA() end) end -function Racial:RACIAL_USED(unit) +function Racial:RACIAL_USED(unit, expirationTime, spellName) local racial = self.frames[unit] local button = Gladdy.buttons[unit] if (not racial or not button or not button.race) then return end - Racial:Used(unit, GetTime(), Gladdy:Racials()[button.race].duration) + if expirationTime and Gladdy:Racials()[button.race].spellName ~= spellName then + return + end + local startTime = (expirationTime and expirationTime - Gladdy:Racials()[button.race].duration) or GetTime() + Racial:Used(unit, startTime, Gladdy:Racials()[button.race].duration) end function Racial:Used(unit, startTime, duration)