From a259db6b8a1b47f792ae8318d686d67503e3b3d5 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 18 Sep 2022 15:22:04 -0500 Subject: [PATCH] Use UnitPowerMax where available --- modules/RollTheBones.lua | 18 +++++++++++------- modules/SliceAndDice.lua | 8 ++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/modules/RollTheBones.lua b/modules/RollTheBones.lua index 881de1c..f9ed275 100644 --- a/modules/RollTheBones.lua +++ b/modules/RollTheBones.lua @@ -376,14 +376,18 @@ function RollTheBones.prototype:UpdateDurationBar(event, unit) end local points = RTBGetComboPoints(self.unit) - -- check for Deeper Stratagem - local _, _, _, DeeperStratagem = GetTalentInfoByID(sixComboPointsTalentID, GetActiveSpecGroup()) - - if DeeperStratagem then - -- first, set the cached upper limit of RtB duration - CurrMaxRtBDuration = self:GetMaxBuffTime(maxComboPoints + 1) + if UnitPowerMax then + CurrMaxRtBDuration = self:GetMaxBuffTime(UnitPowerMax(self.unit, SPELL_POWER_COMBO_POINTS)) else - CurrMaxRtBDuration = self:GetMaxBuffTime(maxComboPoints) + -- check for Deeper Stratagem + local _, _, _, DeeperStratagem = GetTalentInfoByID(sixComboPointsTalentID, GetActiveSpecGroup()) + + if DeeperStratagem then + -- first, set the cached upper limit of RtB duration + CurrMaxRtBDuration = self:GetMaxBuffTime(maxComboPoints + 1) + else + CurrMaxRtBDuration = self:GetMaxBuffTime(maxComboPoints) + end end if event then diff --git a/modules/SliceAndDice.lua b/modules/SliceAndDice.lua index e93e6ad..302d80f 100644 --- a/modules/SliceAndDice.lua +++ b/modules/SliceAndDice.lua @@ -95,8 +95,12 @@ function SliceAndDice.prototype:Enable(core) end function SliceAndDice.prototype:CheckMaxComboPoints() - local talentID, name, texture, selected, available, spellID, unknown, row, column, known, grantedByAura = GetTalentInfoByID(sixComboPointsTalentID, GetActiveSpecGroup()) - maxComboPoints = selected and 6 or 5 + if UnitPowerMax then + maxComboPoints = UnitPowerMax(self.unit, SPELL_POWER_COMBO_POINTS) + else + local talentID, name, texture, selected, available, spellID, unknown, row, column, known, grantedByAura = GetTalentInfoByID(sixComboPointsTalentID, GetActiveSpecGroup()) + maxComboPoints = selected and 6 or 5 + end end function SliceAndDice.prototype:Disable(core)