From 0fe848460e0206901379389b7c7b22e7ff8324a6 Mon Sep 17 00:00:00 2001 From: Slivo Date: Mon, 17 Jan 2022 16:18:40 +0100 Subject: [PATCH] Fix incapacitated backup alert --- TranqRotate.toc | 4 ++-- TranqRotate_TBC.toc | 4 ++-- changelog.md | 4 ++++ src/debuff.lua | 23 ++++++++++++++--------- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/TranqRotate.toc b/TranqRotate.toc index 58bd944..86e646a 100644 --- a/TranqRotate.toc +++ b/TranqRotate.toc @@ -1,8 +1,8 @@ ## Interface: 11401 -## Title: TranqRotate |cff00aa002.2.2|r +## Title: TranqRotate |cff00aa002.2.3|r ## Notes: A tranqshot rotation assistant ## Author: Slivo -## Version: 2.2.2 +## Version: 2.2.3 ## SavedVariables: TranqRotateDb ## OptionalDeps: Ace3 diff --git a/TranqRotate_TBC.toc b/TranqRotate_TBC.toc index d4cd08b..d962f94 100644 --- a/TranqRotate_TBC.toc +++ b/TranqRotate_TBC.toc @@ -1,8 +1,8 @@ ## Interface: 20502 -## Title: TranqRotate |cff00aa002.2.2|r +## Title: TranqRotate |cff00aa002.2.3|r ## Notes: A tranqshot rotation assistant ## Author: Slivo -## Version: 2.2.2 +## Version: 2.2.3 ## SavedVariables: TranqRotateDb ## OptionalDeps: Ace3 diff --git a/changelog.md b/changelog.md index b5f9557..858790a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ ## TranqRotate Changelog +#### v2.2.3 + +- Incapacitated backup alert should now work properly + #### v2.2.2 - Bump toc for 1.14.1 diff --git a/src/debuff.lua b/src/debuff.lua index 1454591..5f7bb49 100644 --- a/src/debuff.lua +++ b/src/debuff.lua @@ -1,19 +1,24 @@ -- Checks if player is incapacitated by a debuff for too long function TranqRotate:isPlayedIncapacitatedByDebuff() - for i, debuffId in ipairs(TranqRotate.constants.incapacitatingDebuffs) do + local name, expirationTime = TranqRotate:getPlayerDebuff(debuffId) + if (name and expirationTime - GetTime() > TranqRotate.db.profile.incapacitatedDelay) then + return true + end + end - local name, _, _, _, _, expirationTime, _, _, _, spellId, _, isBossDebuff - = AuraUtil.FindAuraByName(GetSpellInfo(debuffId), "player") + return false +end - if (name) then - print(name, expirationTime - GetTime(), spellId, isBossDebuff) +function TranqRotate:getPlayerDebuff(debuffId) + for i=1, 32, 1 do + local name, icon, count, dispelType, duration, expirationTime, source, isStealable, nameplateShowPersonal, + spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod = UnitDebuff("player", i) - if (expirationTime - GetTime() > TranqRotate.constants.incapacitatedDelay) then - return true - end + if (spellId and spellId == debuffId) then + return name, expirationTime end end - return false + return nil end