Updated to hide SnD unless we have the SnD ability (which implies Outlaw spec in 7.0)

Theoretically we could reuse this module for Roll the Bones as well, but the nature of its effects makes the duration bar portion difficult and not terribly informative to the user since each of the 6 possible buffs can be activated with different durations depending on when RtB was used.
This commit is contained in:
Parnic
2016-05-29 00:08:03 -05:00
parent c75ffcc6fc
commit 2646481d11

View File

@ -244,7 +244,7 @@ end
local function SNDGetComboPoints(unit)
if IceHUD.WowVer >= 60000 then
return UnitPower(unit, 4)
return UnitPower(unit, SPELL_POWER_COMBO_POINTS)
elseif IceHUD.WowVer >= 30000 then
return GetComboPoints(unit, "target")
else
@ -252,6 +252,20 @@ local function SNDGetComboPoints(unit)
end
end
-- use this to figure out if Roll the Bones is available or not. neither IsSpellKnown nor IsPlayerSpell are correct for it
-- when SnD is known, but this is.
local function HasSpell(id)
local spell = GetSpellInfo(id)
return spell == GetSpellInfo(spell)
end
local function ShouldHide()
return --[[(IceHUD.WowVer < 70000 or not IsSpellKnown(193316)) and]] not IsPlayerSpell(5171) -- IsSpellKnown returns incorrect info for SnD in 7.0
-- commented code is here in case we decide we'd like to use this module for Roll the Bones.
-- if we do, though, the "active" check gets way more complicated since it can activate any number of 6 different abilities
-- with different durations
end
function SliceAndDice.prototype:UpdateSliceAndDice(event, unit, fromUpdate)
if unit and unit ~= self.unit then
return
@ -284,12 +298,12 @@ function SliceAndDice.prototype:UpdateSliceAndDice(event, unit, fromUpdate)
else
self:UpdateBar(0, "SliceAndDice")
if SNDGetComboPoints(self.unit) == 0 or (not UnitExists("target") and not self.moduleSettings.bShowWithNoTarget) then
if SNDGetComboPoints(self.unit) == 0 or (not UnitExists("target") and not self.moduleSettings.bShowWithNoTarget) or ShouldHide() then
if self.bIsVisible then
self.bUpdateSnd = nil
end
if not self.moduleSettings.alwaysFullAlpha then
if not self.moduleSettings.alwaysFullAlpha or ShouldHide() then
self:Show(false)
end
end
@ -329,7 +343,8 @@ function SliceAndDice.prototype:UpdateDurationBar(event, unit)
end
-- player doesn't want to show the percent of max or the alpha is zeroed out, so don't bother with the duration bar
if not self.moduleSettings.showAsPercentOfMax or self.moduleSettings.durationAlpha == 0 or (points == 0 and not self:IsVisible()) then
if not self.moduleSettings.showAsPercentOfMax or self.moduleSettings.durationAlpha == 0 or (points == 0 and not self:IsVisible())
or ShouldHide() then
self.durationFrame:Hide()
return
end