Skip to content

Commit

Permalink
Avoid playing sounds when using druid specs that do not utilize combo…
Browse files Browse the repository at this point in the history
… points or astral power (#7)
  • Loading branch information
Amadeus- authored Aug 29, 2024
1 parent 555b86c commit fdf4ada
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions HearKitty.lua
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ end
function KittyOnAstralPowerChange()
local AstralPower = UnitPower("player", Enum.PowerType.AstralPower)

-- Druids do not need Astral Power change sounds unless in Balance spec. Astral power updates started firing in 11.0 for non-balance specs when using the Elune's Chosen hero class or the Convoke the Spirits talent.
-- Also, ignore astral power changes when in cat form in any spec, since we can only track one resource at a time.
local _, Class = UnitClass("player")
if Class ~= "DRUID" or not GetSpecialization or GetSpecialization() ~= 1 or GetShapeshiftFormID() == 1 then return end

-- Get the relevant talent and Eclipse states.
local _, _, _, SoulOfTheForestSelected = GetTalentInfo(5, 1, 1) -- (surprisingly, this still works in 10.0 where it's no longer in that position)
local SolarActive = KittyAuraStacks("player", "PLAYER HELPFUL", 48517) ~= nil
Expand Down Expand Up @@ -441,6 +446,11 @@ end

function KittyOnComboPointsChange(Unit)
local ComboPoints

-- Ignore combo point changes for druids not in cat form, such as when combo points decay after leaving cat form, or when the Convoke the Spirits uses cat form abilities in other forms.
local _, Class = UnitClass("player")
if Class == "DRUID" and GetShapeshiftFormID() ~= 1 then return end

if GetComboPoints and Unit == "vehicle" then
-- WoW 7.0 (in beta) has a bug where vehicle combo points raise the UNIT_POWER event, but can only be retrieved with the legacy GetComboPoints.
ComboPoints = GetComboPoints(Unit)
Expand Down Expand Up @@ -640,18 +650,18 @@ function KittyComboSound(ComboPoints)
else
-- They lost more than one of the resource since last time, OR they are now completely
-- out of their resource, so play the sound.
KittyPlayOneSound(ComboPoints)
if KittyDebug then VgerCore.Message("Playing single sound " .. ComboPoints) end
KittyPlayOneSound(ComboPoints)
end
else
KittyPlaySoundRange(0, ComboPoints, KittyGetSoundDelay(true))
if KittyDebug then VgerCore.Message("Playing a range from 0 to " .. ComboPoints) end
KittyPlaySoundRange(0, ComboPoints, KittyGetSoundDelay(true))
end
elseif ComboPoints > KittyLastSoundPlayed then
-- If the number of combo points increased, play the new range of sounds. If one's already queued,
-- we'll just queue more instead of playing anything immediately.
KittyPlaySoundRange(KittyLastSoundPlayed + 1, ComboPoints)
if KittyDebug then VgerCore.Message("Playing a range from " .. (KittyLastSoundPlayed + 1) .. " to " .. ComboPoints) end
KittyPlaySoundRange(KittyLastSoundPlayed + 1, ComboPoints)
else
if KittyDebug then VgerCore.Message("Didn't play anything because new combo points were last sound played") end
end
Expand Down
2 changes: 1 addition & 1 deletion Readme.htm
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ <h3>Disabling Hear Kitty sounds when you're in a raid</h3>
<h2>Release history</h2>
<h3>Version 1.11.3</h3>
<ul>
<li></li>
<li>The War Within: Fixed problems where druid talents like Convoke the Spirits could cause Hear Kitty to play sounds for combo points and astral power changes at unhelpful times. (Thanks Amadeus!)</li>
</ul>
<h3>Version 1.11.2</h3>
<ul>
Expand Down

0 comments on commit fdf4ada

Please sign in to comment.