- fix cooldowns not showing when spec detected

- fix nature's swiftness cd starts when buff fades (shaman + druid)
- change order (always detect spec before cd usage)
This commit is contained in:
Sumsebrum 2022-03-27 18:50:02 +02:00
parent f1fde07e6c
commit 29c3a7596c
3 changed files with 27 additions and 20 deletions

View File

@ -107,6 +107,7 @@ local specBuffs = {
-- WARLOCK
[GetSpellInfo(19028)] = L["Demonology"], -- Soul Link
[GetSpellInfo(23759)] = L["Demonology"], -- Master Demonologist
[GetSpellInfo(35696)] = L["Demonology"], -- Demonic Knowledge
[GetSpellInfo(30302)] = L["Destruction"], -- Nether Protection
[GetSpellInfo(34935)] = L["Destruction"], -- Backlash
@ -125,7 +126,7 @@ local specSpells = {
[GetSpellInfo(33983)] = L["Feral"], -- Mangle (Cat)
[GetSpellInfo(33987)] = L["Feral"], -- Mangle (Bear)
[GetSpellInfo(18562)] = L["Restoration"], -- Swiftmend
[GetSpellInfo(16188)] = L["Restoration"], -- Nature's Swiftness
[GetSpellInfo(17116)] = L["Restoration"], -- Nature's Swiftness
[GetSpellInfo(33891)] = L["Restoration"], -- Tree of Life
-- HUNTER
@ -182,7 +183,7 @@ local specSpells = {
[GetSpellInfo(17364)] = L["Enhancement"], -- Stormstrike
[GetSpellInfo(16190)] = L["Restoration"], -- Mana Tide Totem
[GetSpellInfo(32594)] = L["Restoration"], -- Earth Shield
--[GetSpellInfo(16188)] = L["Restoration"], -- Nature's Swiftness
[GetSpellInfo(16188)] = L["Restoration"], -- Nature's Swiftness
-- WARLOCK
[GetSpellInfo(30405)] = L["Affliction"], -- Unstable Affliction
@ -190,6 +191,7 @@ local specSpells = {
--[GetSpellInfo(30911)] = L["Affliction"], -- Siphon Life
[GetSpellInfo(30414)] = L["Destruction"], -- Shadowfury
[GetSpellInfo(30912)] = L["Destruction"], -- Conflagrate
[GetSpellInfo(18708)] = L["Demonology"], -- Fel Domination
-- WARRIOR
[GetSpellInfo(30330)] = L["Arms"], -- Mortal Strike

View File

@ -57,13 +57,15 @@ function Gladdy:SpotEnemy(unit, auraScan)
if not unit or not button then
return
end
button.raceLoc = UnitRace(unit)
button.race = select(2, UnitRace(unit))
button.classLoc = select(1, UnitClass(unit))
button.class = select(2, UnitClass(unit))
button.name = UnitName(unit)
button.stealthed = false
Gladdy.guids[UnitGUID(unit)] = unit
if UnitExists(unit) then
button.raceLoc = UnitRace(unit)
button.race = select(2, UnitRace(unit))
button.classLoc = select(1, UnitClass(unit))
button.class = select(2, UnitClass(unit))
button.name = UnitName(unit)
Gladdy.guids[UnitGUID(unit)] = unit
end
if button.class and button.race then
Gladdy:SendMessage("ENEMY_SPOTTED", unit)
end
@ -138,14 +140,19 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
if Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName] then
local unitClass
local spellId = Cooldowns.cooldownSpellIds[spellName] -- don't use spellId from combatlog, in case of different spellrank
if spellID == 16188 or spellID == 17116 then -- Nature's Swiftness (same name for druid and shaman)
spellId = spellID
end
if Gladdy.db.cooldownCooldowns[tostring(spellId)] then
if (Gladdy:GetCooldownList()[Gladdy.buttons[srcUnit].class][spellId]) then
unitClass = Gladdy.buttons[srcUnit].class
else
unitClass = Gladdy.buttons[srcUnit].race
end
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId)
self:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
if spellID ~= 16188 and spellID ~= 17116 then -- Nature's Swiftness CD starts when buff fades
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId)
end
end
end
@ -153,6 +160,9 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
Gladdy:SendMessage("RACIAL_USED", srcUnit)
end
end
if (eventType == "SPELL_AURA_REMOVED" and (spellID ~= 16188 or spellID ~= 17116) and Gladdy.buttons[srcUnit].class) then
Cooldowns:CooldownUsed(srcUnit, Gladdy.buttons[srcUnit].class, spellID)
end
end
end
@ -333,8 +343,9 @@ end
function EventListener:Test(unit)
local button = Gladdy.buttons[unit]
if (Gladdy.testData[unit].testSpec) then
if (button and Gladdy.testData[unit].testSpec) then
button.spec = nil
Gladdy:SpotEnemy(unit, false)
self:DetectSpec(unit, button.testSpec)
end
end

View File

@ -91,7 +91,7 @@ function Cooldowns:Initialize()
end
end
self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("SPEC_DETECTED")
self:RegisterMessage("UNIT_SPEC")
self:RegisterMessage("UNIT_DEATH")
self:RegisterMessage("UNIT_DESTROYED")
end
@ -299,21 +299,14 @@ end
function Cooldowns:Test(unit)
if Gladdy.frame.testing then
local button = Gladdy.buttons[unit]
if Gladdy.db.cooldown then
button.spellCooldownFrame:Show()
else
button.spellCooldownFrame:Hide()
end
self:UpdateTestCooldowns(unit)
end
end
function Cooldowns:UpdateTestCooldowns(unit)
local button = Gladdy.buttons[unit]
self:UpdateCooldowns(button)
local orderedIcons = {}
for _,icon in pairs(button.spellCooldownFrame.icons) do
tinsert(orderedIcons, icon)
end
@ -337,7 +330,7 @@ function Cooldowns:ENEMY_SPOTTED(unit)
self:UpdateCooldowns(Gladdy.buttons[unit])
end
function Cooldowns:SPEC_DETECTED(unit)
function Cooldowns:UNIT_SPEC(unit)
if (not Gladdy.buttons[unit]) then
return
end
@ -854,6 +847,7 @@ function Cooldowns:GetCooldownOptions()
Gladdy.db.cooldownCooldowns[tostring(spellId)] = value
for unit in pairs(Gladdy.buttons) do
Cooldowns:ResetUnit(unit)
Cooldowns:UpdateCooldowns(Gladdy.buttons[unit])
Cooldowns:Test(unit)
end
Gladdy:UpdateFrame()