diff --git a/rules/Deathknight.lua b/rules/Deathknight.lua index fb188e6..fa789a6 100644 --- a/rules/Deathknight.lua +++ b/rules/Deathknight.lua @@ -24,125 +24,9 @@ local _, addon = ... if not addon.isClass('DEATHKNIGHT') then return end AdiButtonAuras:RegisterRules(function() - Debug('Adding deathknight rules') + Debug('Rules', 'Adding deathknight rules') return { - ImportPlayerSpells { - -- import all spells for - 'DEATHKNIGHT', - -- except for - 194879, -- Icy Talons - 207203, -- Frost Shield (Frost talent) - 273977, -- Grip of the Dead (Blood talent) - 281209, -- Cold Heart (Frost talent) - 287254, -- Dead of Winter (Frost honor talent) - }, - - ShowStacks { - 219809, -- Tombstone (Blood talent) - 195181, -- Bone Shield (Blood) - 5, - }, - - ShowStacks { - { - 55090, -- Scourge Strike (Unholy) - 207311, -- Clawing Shadows (Unholy talent) - 223829, -- Necrotic Strike (Unholy honor talent) - 275699, -- Apocalypse (Unholy) - }, - 194310, - 6, - 'enemy', - }, - - ShowStacks { - 45524, -- Chains of Ice - 281209, -- Cold Heart (Frost talent) - 20, - 'player', - 1, - 'hint', - 281208, -- Cold Heart (Frost talent) - }, - - Configure { - 'IcyTalons', - BuildDesc('HELPFUL PLAYER', 'good', 'player', 194879), -- Icy Talons - 49143, -- Frost Strike (Frost) - 'player', - 'UNIT_AURA', - function(_, model) - local found, count, expiration = GetPlayerBuff('player', 194879) -- Icy Talons - if found then - model.highlight = 'good' - model.expiration = expiration - if count and count > 1 then - model.count = count - end - end - end, - 194878, -- Icy Talons (Frost talent) - }, - - Configure { - 'RaiseDeadUnholy', - format(L["%s when you don't have a summoned ghoul."], DescribeHighlight('hint')), - 46584, -- Rank 2 Unholy - 'player', - 'UNIT_PET', - function(_, model) - if HasPetSpells() then - model.highlight = 'good' - else - model.hint = true - end - end, - }, - - Configure { - 'RaiseDead', - L['Show the remaining duration of @NAME.'], - 46585, -- Rank 1 Blood/Frost - 'player', - 'PLAYER_TOTEM_UPDATE', - function(_, model) - local found, _, startTime, duration = GetTotemInfo(1) -- Risen Ghoul is always the first totem - if found then - model.highlight = 'good' - model.expiration = startTime + duration - end - end, - }, - - Configure { - 'SummonGargoyle', - L['Show the remaining duration of @NAME.'], - 49206, -- Summon Gargoyle (Unholy talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - function(_, model) - local found, _, startTime, duration = GetTotemInfo(3) -- Gargoyle is always the third totem - if found then - model.highlight = 'good' - model.expiration = startTime + duration - end - end, - }, - - Configure { - 'RaiseAbomination', - L['Show the remaining duration of @NAME.'], - 288853, -- Summon Gargoyle (Unholy talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - function(_, model) - local found, _, startTime, duration = GetTotemInfo(1) -- Raise Abomination is always the first totem - if found then - model.highlight = 'good' - model.expiration = startTime + duration - end - end, - }, + ImportPlayerSpells { 'DEATHKNIGHT' }, } end) diff --git a/rules/Demonhunter.lua b/rules/Demonhunter.lua index ebcbfeb..fdf2c3a 100644 --- a/rules/Demonhunter.lua +++ b/rules/Demonhunter.lua @@ -24,18 +24,9 @@ local _, addon = ... if not addon.isClass('DEMONHUNTER') then return end AdiButtonAuras:RegisterRules(function() - Debug('Adding demonhunter rules') + Debug('Rules', 'Adding demonhunter rules') + return { - ImportPlayerSpells { - -- import all spells for - 'DEMONHUNTER' - }, - - ShowDispellable { - 258920, -- Immolation Aura (Vengeance) - 'player', - 'Magic', - 205625, -- Cleansed by Flame (Vengeance honor talent) - }, + ImportPlayerSpells { 'DEMONHUNTER' }, } end) diff --git a/rules/Druid.lua b/rules/Druid.lua index 78138c7..c1624c4 100644 --- a/rules/Druid.lua +++ b/rules/Druid.lua @@ -27,159 +27,6 @@ AdiButtonAuras:RegisterRules(function() Debug('Rules', 'Adding druid rules') return { - ImportPlayerSpells { - -- import all spells for - 'DRUID', - -- except for - 114108, -- Soul of the Forest (Restoration talent) - 135700, -- Clearcasting (Feral) - 145152, -- Bloodtalons (Feral talent) - 155777, -- Germination (Restoration talent) - 203059, -- King of the Jungle (Feral honor talent) - 203407, -- Reactive Resin (Restoration honor talent) - 203554, -- Focused Growth (Restoration honor talent) - 207386, -- Spring Blossoms (Restoration talent) - 207640, -- Abundance (Restoration talent) - 209746, -- Moonkin Aura (Balance honor talent) - 236187, -- Master Shapeshifter (Guardian honor talent) - 279709, -- Starfond (Balance talent) - 285646, -- Scent of Blood (Feral talent) - }, - - -- show combo points on spenders - ShowPower { - { - 1079, -- Rip - 22568, -- Ferocious Bite - 22570, -- Maim (Feral) - 52610, -- Savage Roar (Feral talent) - 236026, -- Enraged Maim (Feral honor talent) - 285381, -- Primal Wrath (Feral talent) - }, - 'ComboPoints' - }, - - -- don't show Clearcasting (Feral) on Thrash - SelfBuffAliases { - { - 5221, -- Shred - 106785, -- Swipe - 202028, -- Brutal Slash (Feral talent) - }, - 135700, -- Clearcasting (Feral) - }, - - -- show Soul of the Forest on Swiftmend - PassiveModifier { - 158478, -- Soul of the Forest (Restoration talent) - 18562, -- Swiftmend - 114108, -- Soul of the Forest - }, - - -- show the stacks of Focused Growth on Lifebloom - ShowStacks { - 33763, -- Lifebloom - 203554, -- Focused Growth - nil, - 'player', - nil, - nil, - 203553, -- Focused Growth (Restoration honor talent) - }, - - -- show the stacks of Nature's Grasp on Ironbark - ShowStacks { - 102342, -- Ironbark - 247563, -- Nature's Grasp - nil, - 'player', - nil, - nil, - 247543, -- Entangling Bark (Restoration honor talent) - }, - - -- show the stacks of Abundance on Regrowth - ShowStacks { - 8936, -- Regrowth - 207640, -- Abundance - nil, - 'player', - nil, - nil, - 207383, -- Abundance (Restoration talent) - }, - - -- show the stacks of Reactive Resin on Rejuvenation - ShowStacks { - 774, -- Rejuvenation - 203407, -- Reactive Resin - nil, - 'ally', - nil, - nil, - 203399, -- Abundance (Restoration talent) - }, - - -- show the stacks of Bloodtalons on Rip, Primal Wrath and Ferocious Bite - ShowStacks { - { - 1079, -- Rip - 22568, -- Ferocious Bite - 285381, -- Primal Wrath - }, - 145152, -- Bloodtalons - nil, - 'player', - nil, - nil, - 319439, -- Bloodtalons (Feral talent) - }, - - Configure { - 'Rejuvenation', - L['Show stacks of @NAME, Germination, Renewing Bloom and Reactive Resin.'], - 774, - 'player', - 'UNIT_AURA', - function(units, model) - local hasRejuvenation = BuildAuraHandler_Single("HELPFUL", "good", "ally", 774) -- Rejuvenation - local hasGermination = BuildAuraHandler_Single("HELPFUL", "good", "ally", 155777) -- Germination - local count = (hasRejuvenation(units, model) and 1 or 0) + (hasGermination(units, model) and 1 or 0) - model.count = model.count + count - end, - 155675, -- Germination (Restoration talent) - }, - - Configure { - 'Efflorescence', - L['Show the duration of @NAME.'], - 145205, - 'player', - 'PLAYER_TOTEM_UPDATE', - function(_, model) - local present, _, startTime, duration = GetTotemInfo(1) - if present then - model.highlight = 'good' - model.expiration = startTime + duration - end - end, - }, - - -- show Scent of Blood on Swipe - Configure { - 'ScentOfBlood', - BuildDesc(), - 106785, -- Swipe - 'player', - 'UNIT_AURA', - function(_, model) - local found, _, expiration = GetPlayerBuff('player', 285646) -- Scent of Blood (Feral talent) - if found then - model.highlight = 'good' - model.expiration = expiration - end - end, - 285564, -- Scent of Blood (Feral talent) - }, + ImportPlayerSpells { 'DRUID' }, } end) diff --git a/rules/Evoker.lua b/rules/Evoker.lua index 85a96d0..54b36bd 100644 --- a/rules/Evoker.lua +++ b/rules/Evoker.lua @@ -21,27 +21,12 @@ along with AdiButtonAuras. If not, see . local _, addon = ... -if not addon.isClass('EVOKER') then - return -end +if not addon.isClass('EVOKER') then return end AdiButtonAuras:RegisterRules(function() Debug('Rules', 'Adding evoker rules') return { - ImportPlayerSpells { - -- import all spells for - 'EVOKER', - -- except for - }, - - -- show essence on spenders - ShowPower { - { - 356995, -- Disintegrate - 357211, -- Pyre - }, - 'Essence', - }, + ImportPlayerSpells { 'EVOKER' }, } end) diff --git a/rules/Hunter.lua b/rules/Hunter.lua index 61a2284..52882fa 100644 --- a/rules/Hunter.lua +++ b/rules/Hunter.lua @@ -24,16 +24,9 @@ local _, addon = ... if not addon.isClass('HUNTER') then return end AdiButtonAuras:RegisterRules(function() - Debug('Adding hunter rules') + Debug('Rules', 'Adding hunter rules') return { ImportPlayerSpells { 'HUNTER' }, - - ShowDispellable { - 5384, -- Feign Death - 'player', - 'Magic', - 202746, -- Survival Tactics (honor talent) - }, } end) diff --git a/rules/Mage.lua b/rules/Mage.lua index 5b76d78..e25cadb 100644 --- a/rules/Mage.lua +++ b/rules/Mage.lua @@ -24,146 +24,9 @@ local _, addon = ... if not addon.isClass('MAGE') then return end AdiButtonAuras:RegisterRules(function() - Debug('Adding mage rules') + Debug('Rules', 'Adding mage rules') return { - ImportPlayerSpells { - -- import all spell for - 'MAGE', - -- except for - 1459, -- Arcane Intellect - 12654, -- Ignite (Fire) - 41425, -- Hypothermia - 45438, -- Ice Block - 116014, -- Rune of Power (talent) - 205473, -- Icicles (Frost) - 205708, -- Chilled (Frost) - 205766, -- Bone Chilling (Frost talent) - }, - - ShowPower { - 44425, -- Arcane Barrage (Arcane) - 'ArcaneCharges', - }, - - -- show the stacks of Icicles on Glacial Spike and Ice Lance - ShowStacks { - { - 30455, -- Ice Lance (Frost) - 199786, -- Glacial Spike (Frost talent) - }, - 205473, -- Icicles (Frost) - 5, - 'player', - nil, - nil, - 76613, -- Mastery: Icicles (Frost) - }, - - -- show Heating Up on Fire Blast if Hot Streak! is known - SelfBuffAliases { - 108853, -- Fire Blast (Fire) - 48107, -- Heating Up (Fire) - 195283, -- Hot Streak! (Fire) - }, - - Configure { - 'IceBlockHypothermia', - format( - '%s %s', - BuildDesc('HELPFUL PLAYER', 'good', 'player', 45438), -- Ice Block - BuildDesc('HARMFUL PLAYER', 'bad', 'player', 41425) -- Hypothermia - ), - 45438, -- Ice Block - 'player', - 'UNIT_AURA', - (function() - local hasIceBlock = BuildAuraHandler_Single('HELPFUL PLAYER', 'good', 'player', 45438) - local hasHypothermia = BuildAuraHandler_Single('HARMFUL PLAYER', 'bad', 'player', 41425) - return function(_, model) - return hasIceBlock(_, model) or hasHypothermia(_, model) - end - end)(), - }, - - -- track if the player is in range of Rune of Power - Configure { - 'RuneOfPower', - format( - '%s %s', - BuildDesc('HELPFUL PLAYER', 'good', 'player', 116014), -- Rune of Power - format(L['Show the "bad" border when your buff %s is not found on yourself.'], GetSpellInfo(116014)) - ), - 116011, -- Rune of Power (talent) - 'player', - { 'UNIT_AURA', 'PLAYER_TOTEM_UPDATE' }, - function(_, model) - local hasTotem, _, start, duration = GetTotemInfo(1) -- Rune of Power is always the first totem - - if hasTotem then - local hasBuff = GetPlayerBuff('player', 116014) -- Rune of Power - model.highlight = hasBuff and 'good' or 'bad' - model.expiration = start + duration - end - end, - }, - - -- prioritize Bone Chilling (Frost talent) over Chilled (Frost) - Configure { - 'ChilledBoneChilling', - format( - '%s %s', - BuildDesc('HELPFUL PLAYER', 'good', 'player', 205766), -- Bone Chilling (Frost talent) - BuildDesc('HARMFUL PLAYER', 'bad', 'enemy', 205708) -- Chilled (Frost) - ), - { - 116, -- Frostbolt - 84714, -- Frozen Orb - 190356, -- Blizzard - }, - { 'player', 'enemy' }, - 'UNIT_AURA', - (function() - local hasBoneChilling = BuildAuraHandler_Single('HELPFUL PLAYER', 'good', 'player', 205766) - local isChilled = BuildAuraHandler_Single('HARMFUL PLAYER', 'bad', 'enemy', 205708) - return function(units, model) - return hasBoneChilling(units, model) or isChilled(units, model) - end - end)(), - }, - - Configure { - 'ArcaneIntellect', - L['Show the number of group members missing @NAME.'], - 1459, -- Arcane Intellect - 'group', - {'GROUP_ROSTER_UPDATE', 'UNIT_AURA'}, - function(units, model) - local missing = 0 - local shortest - for unit in next, units.group do - if UnitIsPlayer(unit) and not UnitIsDeadOrGhost(unit) then - local found, _, expiration = GetBuff(unit, 1459) - if found then - if not shortest or expiration < shortest then - shortest = expiration - end - else - missing = missing + 1 - end - end - end - - if shortest then - model.expiration = shortest - model.highlight = 'good' - end - if missing > 0 then - model.count = missing - model.maxCount = missing - model.hint = true - end - end, - }, + ImportPlayerSpells { 'MAGE' }, } end) diff --git a/rules/Monk.lua b/rules/Monk.lua index dd219d1..0faa748 100644 --- a/rules/Monk.lua +++ b/rules/Monk.lua @@ -24,129 +24,9 @@ local _, addon = ... if not addon.isClass('MONK') then return end AdiButtonAuras:RegisterRules(function() - Debug('Adding monk rules') - - local function BuildTotemHandler(totem) - return function(_, model) - -- statues fill the first free slot when re-cast - -- due to statues' cooldowns the highest totem slot is 3 - for slot = 1, 3 do - local found, _, start, duration, texture = GetTotemInfo(slot) - if found and texture == totem then - model.highlight = 'good' - model.expiration = start + duration - return - end - end - end - end + Debug('Rules', 'Adding monk rules') return { - ImportPlayerSpells { - -- import all spells for - 'MONK', - -- except - 116680, -- Thunder Focus Tea (Mistweaver) - 195630, -- Elusive Brawler (Brewmaster) - 201447, -- Ride the Wind (Windwalker pvp talent) - 202090, -- Teachings of the Monastery (Mistweaver) - 215479, -- Shuffle (Brewmaster) - 228563, -- Blackout Combo (Brewmaster talent) - 261769, -- Inner Strength (Windwalker talent) - }, - - SelfBuffAliases { - 116680, -- Thunder Focus Tea (Mistweaver) - }, - - SelfBuffAliases { - { - 205523, -- Blackout Kick - 322729, -- Spinning Crane Kick - }, - 215479, -- Shuffle (Brewmaster) - 322120, -- Shuffle (Brewmaster passive) - }, - - ShowPower { - { - 100784, -- Blackout Kick - 101546, -- Spinning Crane Kick - 107428, -- Rising Sun Kick - 113656, -- Fists of Fury - }, - 'Chi', - }, - - ShowStacks { - 100784, -- Blackout Kick - 202090, -- Teachings of the Monastery (Mistweaver) - 3, - 'player', - 3, - 'hint', - 116645, -- Teachings of the Monastery (Mistweaver) - }, - - Configure { - 'BlackoutCombo', - BuildDesc('HELPFUL PLAYER', 'good', 'player', 228563), - 205523, -- Blackout Kick (Brewmaster) - 'player', - 'UNIT_AURA', - function(_, model) - local found, _, expiration = GetPlayerBuff('player', 228563) -- Blackout Combo - if found then - model.highlight = 'good' - model.expiration = expiration - end - end, - 196736, -- Blackout Combo (Brewmaster talent) - }, - - Configure { - 'WhiteTigerPet', - L['Show the duration of @NAME.'], - 123904, -- Invoke Xuen, the White Tiger (Windwalker talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(620832) - }, - - Configure { - 'JadeSerpentPet', - L['Show the duration of @NAME.'], - 322118, -- Invoke Yu'lon, the Jade Serpent (Mistweaver) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(574571) - }, - - Configure { - 'RedCranePet', - L['Show the duration of @NAME.'], - 325197, -- Invoke Chi-Ji, the Red Crane (Mistweaver talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(877514) - }, - - Configure { - 'BlackOxStatue', - L['Show the duration of @NAME.'], - 115315, - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(627607), - }, - - Configure { - 'JadeSerpentStatue', - L['Show the duration of @NAME.'], - 115313, - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(620831), - }, + ImportPlayerSpells { 'MONK' }, } end) diff --git a/rules/Paladin.lua b/rules/Paladin.lua index d0e8910..d914001 100644 --- a/rules/Paladin.lua +++ b/rules/Paladin.lua @@ -24,177 +24,9 @@ local _, addon = ... if not addon.isClass('PALADIN') then return end AdiButtonAuras:RegisterRules(function() - Debug('Adding paladin rules') - - local forbearanceDesc = BuildDesc('HARMFUL', 'bad', 'ally', 25771) - local hasForbearance = BuildAuraHandler_Single('HARMFUL', 'bad', 'ally', 25771) + Debug('Rules', 'Adding paladin rules') return { - ImportPlayerSpells { - -- import all spells for - 'PALADIN', - -- except for - 642, -- Divine Shield - 1022, -- Blessing of Protection - 25771, -- Forbearance - 31935, -- Avenger's Shield (Protection) - 188370, -- Consecration (Protection) - 204018, -- Blessing of Spellwarding (Protection talent) - 209785, -- Fires of Justice (Retribution talent) - 269571, -- Zeal (Retribution talent) - }, - - -- show Holy Power on spenders - ShowPower { - { - 85256, -- Templar's Verdict (Retribution) - 53385, -- Divine Storm (Retribution) - 84963, -- Inquisition (Retribution talent) - 215661, -- Justicar's Vengeance (Retribution talent) - }, - 'HolyPower' - }, - - -- show Fires of Justice on Crusader Strike - SelfBuffAliases { - 35395, -- Crusader Strike - 209785, -- Fires of Justice - 203316, -- Fires of Justice (Retribution talent) - }, - - Configure { - 'DivineShield', - format(L['%s %s'], - BuildDesc('HELPFUL PLAYER', 'good', 'player', 642), -- Divine Shield - BuildDesc('HARMFUL', 'bad', 'player', 25771) -- Forbearance - ), - 642, -- Divine Shield - 'player', - 'UNIT_AURA', - (function() - local hasForbearanceOnSelf = BuildAuraHandler_Single('HARMFUL', 'bad', 'player', 25771) - local hasDivineShield = BuildAuraHandler_Single('HELPFUL', 'good', 'player', 642) - return function(units, model) - return hasDivineShield(units, model) or hasForbearanceOnSelf(units, model) - end - end)(), - }, - - Configure { - 'BlessingOfProtection', - format(L['%s %s'], - BuildDesc('HELPFUL', 'good', 'ally', 1022), - forbearanceDesc - ), - 1022, - 'ally', - 'UNIT_AURA', - (function() - local hasBlessingOfProtection = BuildAuraHandler_Single('HELPFUL', 'good', 'ally', 1022) - return function(units, model) - return hasBlessingOfProtection(units, model) or hasForbearance(units, model) - end - end)(), - }, - - Configure { - 'BlessingOfSpellwarding', - format(L['%s %s'], - BuildDesc('HELPFUL', 'good', 'ally', 204018), - forbearanceDesc - ), - 204018, - 'ally', - 'UNIT_AURA', - (function() - local hasBlessingOfSpellwarding = BuildAuraHandler_Single('HELPFUL', 'good', 'ally', 204018) - return function(units, model) - return hasBlessingOfSpellwarding(units, model) or hasForbearance(units, model) - end - end)(), - }, - - Configure { - 'LayOnHands', - forbearanceDesc, - 633, -- Lay on Hands - 'ally', - 'UNIT_AURA', - (function() - return function(units, model) - return hasForbearance(units, model) - end - end)(), - }, - - Configure { - 'AvengersShieldInterrupt', - format(L['%s when %s is casting/channelling a spell that you can interrupt.'], - DescribeHighlight('flash'), - DescribeAllTokens('enemy') - ), - 31935, -- Avenger's Shield (Protection) - 'enemy', - { -- Events - 'UNIT_SPELLCAST_CHANNEL_START', - 'UNIT_SPELLCAST_CHANNEL_STOP', - 'UNIT_SPELLCAST_CHANNEL_UPDATE', - 'UNIT_SPELLCAST_DELAYED', - 'UNIT_SPELLCAST_INTERRUPTIBLE', - 'UNIT_SPELLCAST_NOT_INTERRUPTIBLE', - 'UNIT_SPELLCAST_START', - 'UNIT_SPELLCAST_STOP', - }, - -- Handler - function(units, model) - local unit = units.enemy - if unit and UnitCanAttack('player', unit) and not UnitIsPlayer(unit) then - local name, _, _, _, _, endTime, _, _, notInterruptible = UnitCastingInfo(unit) - if name and not notInterruptible then - model.flash, model.expiration = true, endTime / 1000 - return - end - name, _, _, _, _, endTime, _, notInterruptible = UnitChannelInfo(unit) - if name and not notInterruptible then - model.flash, model.expiration = true, endTime / 1000 - end - end - end, - 231665, -- Avenger's Shield (Rank 2) (Protection) - }, - - Configure { - 'LightsHammer', - L['Show the duration of @NAME.'], - 114158, -- Light's Hammer (Holy talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - function(_, model) - local found, _, start, duration = GetTotemInfo(2) -- Light's Hammer is always the 2nd totem - if found then - model.highlight = 'good' - model.expiration = start + duration - end - end, - }, - - Configure { - 'ProtectionConsecration', - format( - '%s %s', - L['Show the duration of @NAME.'], - BuildDesc('HELPFUL PLAYER', 'good', 'player', 188370) - ), - 26573, - 'player', - {'PLAYER_TOTEM_UPDATE', 'UNIT_AURA'}, - function(_, model) - local found, _, start, duration = GetTotemInfo(1) -- Consecration is always the 1st totem - if found then - model.expiration = start + duration - model.highlight = GetPlayerBuff('player', 188370) and 'good' or nil - end - end, - }, + ImportPlayerSpells { 'PALADIN' }, } end) diff --git a/rules/Priest.lua b/rules/Priest.lua index f99cbd4..41bc4d1 100644 --- a/rules/Priest.lua +++ b/rules/Priest.lua @@ -23,132 +23,10 @@ local _, addon = ... if not addon.isClass('PRIEST') then return end -local function BuildGuardianHandler(guardian) - return function(_, model) - for slot = 1, 5 do - local found, name, start, duration = GetTotemInfo(slot) - if found and name == guardian then - model.expiration = start + duration - model.highlight = 'good' - return - end - end - end -end - AdiButtonAuras:RegisterRules(function() - Debug('Adding priest rules') - - local mindbender = GetSpellInfo(123040) - local shadowfiend = GetSpellInfo(34433) - - local hasWeakenedSoul = BuildAuraHandler_Single('HARMFUL', 'bad', 'ally', 6788) -- Weakened Soul - local isShielded = BuildAuraHandler_Single('HELPFUL', 'good', 'ally', 17) -- Power Word: Shield + Debug('Rules', 'Adding priest rules') return { - ImportPlayerSpells { - -- import all spells for - 'PRIEST', - -- except for - 17, -- Power Word: Shield - 605, -- Mind Control - 21562, -- Power Word: Fortitude - 194384, -- Atonement (Discipline) - 196773, -- Inner Focus (Holy honor talent) - 263406, -- Surrendered to Madness (Shadow) - }, - - SelfBuffAliases { - 196762, -- Inner Focus (Holy honor talent) - 196773, -- Inner Focus - }, - - -- TODO: crowd control rules are evaluated after class rules - Configure { - 'MindControl', - L['Show the duration of @NAME.'], - 605, -- Mind Control - 'pet', - { 'UNIT_AURA', 'UNIT_PET' }, - function(_, model) - local found, _, expiration = GetPlayerDebuff('pet', 605) - if found then - model.expiration = expiration - model.highlight = 'good' - end - end, - }, - - Configure { - 'Shadowfiend', - L['Show the duration of @NAME.'], - 34433, -- Shadowfiend (Discipline/Shadow) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildGuardianHandler(shadowfiend) - }, - - Configure { - 'Mindbender', - L['Show the duration of @NAME.'], - { - 123040, -- Mindbender (Discipline/Shadow talent) - 200174, -- Mindbender (Shadow talent) - }, - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildGuardianHandler(mindbender) - }, - - Configure { - 'PowerWordFortitude', - L['Show the number of group members missing @NAME.'], - 21562, -- Power Word: Fortitude - 'group', - {'GROUP_ROSTER_UPDATE', 'UNIT_AURA'}, - function(units, model) - local missing = 0 - local shortest - for unit in next, units.group do - if UnitIsPlayer(unit) and not UnitIsDeadOrGhost(unit) then - local found, _, expiration = GetBuff(unit, 21562) - if found then - if not shortest or expiration < shortest then - shortest = expiration - end - else - missing = missing + 1 - end - end - end - - if shortest then - model.expiration = shortest - model.highlight = 'good' - end - if missing > 0 then - model.count = missing - model.hint = true - end - end, - }, - - Configure { - 'PowerWordShieldRapture', - format( - '%s %s', - BuildDesc('HARMFUL', 'bad', 'ally', 6788), -- Weakened Soul - BuildDesc('HELPFUL', 'good', 'ally', 17) -- Power Word: Shield - ), - 17, -- Power Word: Shield - 'ally', - 'UNIT_AURA', - (function() - return function(units, model) - local hasRapture = GetPlayerBuff('player', 47536) - return not hasRapture and hasWeakenedSoul(units, model) or isShielded(units, model) - end - end)(), - } + ImportPlayerSpells { 'PRIEST' }, } end) diff --git a/rules/Rogue.lua b/rules/Rogue.lua index 2a34097..9d1d03c 100644 --- a/rules/Rogue.lua +++ b/rules/Rogue.lua @@ -24,51 +24,9 @@ local _, addon = ... if not addon.isClass('ROGUE') then return end AdiButtonAuras:RegisterRules(function() - Debug('Adding rogue rules') + Debug('Rules', 'Adding rogue rules') return { - ImportPlayerSpells { - -- import all spells for - 'ROGUE', - -- except for - 193538, -- Alacrity - 193641, -- Elaborate Planning (Assassination talent) - 196980, -- Master of Shadows (Subtlety) - 354827, -- Thief's Bargain (Subtlety pvp talent) - }, - - ShowPower { - { - 408, -- Kidney Shot - 1943, -- Rupture (Assasination/Subtlety) - 2098, -- Dispatch (Outlaw) - 32645, -- Envenom (Assassination) - 121411, -- Crimson Tempest (Assassination talent) - 196819, -- Eviscerate (Subtlety) - 269513, -- Death from Above (honor talent) - 280719, -- Secret Technique (Subtlety talent) - 315341, -- Between the Eyes (Outlaw) - 315496, -- Slice and Dice - 319175, -- Black Powder (Subtlety) - }, - 'ComboPoints', - }, - - -- don't show Master of Shadows (Subtlety) on Shadow Dance - SelfBuffAliases { - { - 1784, -- Stealth - 115191, -- Stealth (with Subterfuge talent) - }, - 196980, -- Master of Shadows (Subtlety) - }, - - SelfBuffAliases { - { - 2098, -- Dispatch (Outlaw) - 196819, -- Eviscerate (Subtlety) - }, - 193538, -- Alacrity - }, + ImportPlayerSpells { 'ROGUE' }, } end) diff --git a/rules/Shaman.lua b/rules/Shaman.lua index ef7f299..6399228 100755 --- a/rules/Shaman.lua +++ b/rules/Shaman.lua @@ -23,338 +23,10 @@ local _, addon = ... if not addon.isClass('SHAMAN') then return end --- primal elementals' GUIDs -local primalEarthElemental = 61056 -local primalFireElemental = 61029 -local primalStormElemental = 77942 - --- guardians' totem textures -local earthElemental = 136024 -local fireElemental = 135790 -local stormElemental = 1020304 -local feralSpirit = 237577 - -local function BuildTempPetHandler(id) - return function(_, model) - local guid = UnitGUID('pet') - if guid and guid:match('%-' .. id .. '%-') then - local remaining = GetPetTimeRemaining() - if remaining then - model.expiration = GetTime() + remaining / 1000 - model.highlight = 'good' - end - end - end -end - -local function BuildTotemHandler(totem) - return function(_, model) - for slot = 1, 5 do - local found, name, start, duration = GetTotemInfo(slot) - if found and name == totem then - model.expiration = start + duration - model.highlight = 'good' - break - end - end - end -end - --- matches the totems by texture instead of name --- because of spell name - totem name disparity for elementals --- i.e. Fire Elemental spawns Greater Fire Elemental --- Feral Spirit spawns Spirit Wolf -local function BuildGuardianHandler(guardian) - return function(_, model) - for slot = 1, 5 do - local found, _, start, duration, texture = GetTotemInfo(slot) - if found and texture == guardian then - model.expiration = start + duration - model.highlight = 'good' - end - end - end -end - -local function BuildWeaponEnchantHandler(enchantId) - return function(_, model) - local hasMainHandEnchant, mainHandExpiration, _, mainBuffId, - hasOffHandEnchant, offHandExpiration, _, offBuffId = GetWeaponEnchantInfo() - - if hasMainHandEnchant and mainBuffId == enchantId then - model.highlight = 'good' - model.expiration = GetTime() + mainHandExpiration / 1000 - elseif hasOffHandEnchant and offBuffId == enchantId then - model.highlight = 'good' - model.expiration = GetTime() + offHandExpiration / 1000 - end - end -end - AdiButtonAuras:RegisterRules(function() - Debug('Adding shaman rules') - - local ancestralProtTotem = GetSpellInfo(207399) - local capacitorTotem = GetSpellInfo(192058) - local cloudBurstTotem = GetSpellInfo(157153) - local counterstrikeTotem = GetSpellInfo(204331) - local earthbindTotem = GetSpellInfo(2484) - local earthgrabTotem = GetSpellInfo(51485) - local earthenWallTotem = GetSpellInfo(198838) - local groundingTotem = GetSpellInfo(204336) - local healingTideTotem = GetSpellInfo(108280) - local healingStreamTotem = GetSpellInfo(5394) - local liquidMagmaTotem = GetSpellInfo(192222) - local skyfuryTotem = GetSpellInfo(204330) - local spiritLinkTotem = GetSpellInfo(98008) - local totemMastery = GetSpellInfo(262395) - local tremorTotem = GetSpellInfo(8143) - local windRushTotem = GetSpellInfo(192077) + Debug('Rules', 'Adding shaman rules') return { - ImportPlayerSpells { - -- import all spells for - 'SHAMAN', - -- except for - 197211, -- Fury of Air (Enhancement talent) - 207400, -- Ancestral Vigor (Restoration talent) - 224125, -- Molten Weapon (Enhancement talent) - 224127, -- Crackling Surge (Enhancement talent) - 262652, -- Forceful Winds (Enhancement talent) - 263806, -- Wind Gust (Elemental talent) - 280815, -- Flash Flood (Restoration talent) - }, - - Configure { - 'AncestralProtectionTotem', - L['Show the duration of @NAME.'], - 207399, -- Ancestral Protection Totem (Restoration talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(ancestralProtTotem), - }, - - Configure { - 'CapacitorTotem', - L['Show the duration of @NAME.'], - 192058, - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(capacitorTotem), - }, - - Configure { - 'CloudburstTotem', - L['Show the duration of @NAME.'], - 201764, -- Recall Cloudburst Totem - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(cloudBurstTotem), - 157153, -- Cloudburst Totem (Restoration talent) - }, - - Configure { - 'CounterstrikeTotem', - L['Show the duration of @NAME.'], - 204331, -- Counterstrike Totem (talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(counterstrikeTotem), - }, - - Configure { - 'EarthbindTotem', - L['Show the duration of @NAME.'], - 2484, -- Earthbind Totem - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(earthbindTotem), - }, - - Configure { - 'EarthgrabTotem', - L['Show the duration of @NAME.'], - 51485, -- Earthgrab Totem (Restoration talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(earthgrabTotem), - }, - - Configure { - 'EarthenWallTotem', - L['Show the duration of @NAME.'], - 198838, -- Earthen Wall Totem (Restoration talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(earthenWallTotem), - }, - - Configure { - 'GroundingTotem', - L['Show the duration of @NAME.'], - 204336, -- Grounding Totem (honor talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(groundingTotem), - }, - - Configure { - 'HealingTideTotem', - L['Show the duration of @NAME.'], - 108280, -- Healing Tide Totem (Restoration) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(healingTideTotem), - }, - - Configure { - 'HealingStreamTotem', - L['Show the duration of @NAME.'], - 5394, -- Healing Stream Totem (Restoration) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(healingStreamTotem), - }, - - Configure { - 'LiquidMagmaTotem', - L['Show the duration of @NAME.'], - 192222, -- Liquid Magma Totem (Elemental talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(liquidMagmaTotem), - }, - - Configure { - 'SkyfuryTotem', - L['Show the duration of @NAME.'], - 204330, -- Skyfury Totem (honor talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(skyfuryTotem), - }, - - Configure { - 'SpiritLinkTotem', - L['Show the duration of @NAME.'], - 98008, -- Spirit Link Totem (Restoration) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(spiritLinkTotem), - }, - - Configure { - 'TotemMastery', - L['Show the duration of @NAME.'], - { - 210643, -- Totem Mastery (Elemental talent) - 262395, -- Totem Mastery (Enhancement talent) - }, - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(totemMastery), - }, - - Configure { - 'TremorTotem', - L['Show the duration of @NAME.'], - 8143, - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(tremorTotem), - }, - - Configure { - 'WindRushTotem', - L['Show the duration of @NAME.'], - 192077, -- Wind Rush Totem (talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildTotemHandler(windRushTotem), - }, - - Configure { - 'EarthElemental', - L['Show the duration of @NAME.'], - 198103, - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildGuardianHandler(earthElemental), - }, - - Configure { - 'FireElemental', - L['Show the duration of @NAME.'], - 198067, -- Fire Elemental (Elemental) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildGuardianHandler(fireElemental), - }, - - Configure { - 'StormElemental', - L['Show the duration of @NAME.'], - 192249, -- Storm Elemental (Elemental talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildGuardianHandler(stormElemental), - }, - - Configure { - 'FeralSpirit', - L['Show the duration of @NAME.'], - 51533, -- Feral Spirit (Enhancement) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildGuardianHandler(feralSpirit), - }, - - Configure { - 'PrimalEarthElemental', - L['Show the duration of @NAME.'], - 198103, -- Earth Elemental - 'player', - 'UNIT_PET', - BuildTempPetHandler(primalEarthElemental), - 117013, -- Primal Elementalist (Elemental talent) - }, - - Configure { - 'PrimalFireElemental', - L['Show the duration of @NAME.'], - 198067, -- Fire Elemental - 'player', - 'UNIT_PET', - BuildTempPetHandler(primalFireElemental), - 117013, -- Primal Elementalist (Elemental talent) - }, - - Configure { - 'PrimalStormElemental', - L['Show the duration of @NAME.'], - 192249, -- Storm Elemental (Elemental talent) - 'player', - 'UNIT_PET', - BuildTempPetHandler(primalStormElemental), - 117013, -- Primal Elementalist (Elemental talent) - }, - - Configure { - 'FlametongueWeapon', - L['Show if @NAME up on your Weapon.'], - 318038, -- Flametongue Weapon - 'player', - 'UNIT_INVENTORY_CHANGED', - BuildWeaponEnchantHandler(5400), - }, - - Configure { - 'WindfuryWeapon', - L['Show if @NAME up on your Weapon.'], - 33757, -- Windfury Weapon - 'player', - 'UNIT_INVENTORY_CHANGED', - BuildWeaponEnchantHandler(5401), - }, + ImportPlayerSpells { 'SHAMAN' }, } end) diff --git a/rules/Warlock.lua b/rules/Warlock.lua index 9d2feec..9f02578 100644 --- a/rules/Warlock.lua +++ b/rules/Warlock.lua @@ -23,100 +23,10 @@ local _, addon = ... if not addon.isClass('WARLOCK') then return end -local darkglare = 1416161 -local felLord = 1113433 -local infernal = 136219 -local observer = 538445 - -local function BuildDemonHandler(demon) - return function(_, model) - for slot = 1, 5 do - local _, _, start, duration, texture = GetTotemInfo(slot) - if texture == demon then - model.expiration = start + duration - model.highlight = 'good' - end - end - end -end - AdiButtonAuras:RegisterRules(function() - Debug('Adding warlock rules') + Debug('Rules', 'Adding warlock rules') return { - ImportPlayerSpells { - -- import all spells for - 'WARLOCK', - -- except - 111400, -- Burning Rush (talent) - 212580, -- Eye of the Observer (Demonology honor talent) - }, - - -- show Soul Shards on consumers - ShowPower { - { - 5740, -- Rain of Fire (Destruction) - 27243, -- Seed of Corruption (Affliction) - -- 30108, -- Unstable Affliction (Affliction) - 104316, -- Call Dreadstalkers (Demonology) - 105174, -- Hand of Gul'dan (Demonology) - 116858, -- Chaos Bolt (Destruction) - 212459, -- Call Fel Lord (Demonology honor talent) - 267211, -- Bilescourge Bombers (Demonology talent) - 267217, -- Nether Portal (Demonology talent) - }, - 'SoulShards', - }, - - Configure { - 'DemonicGateway', - BuildDesc('HARMFUL', 'bad', 'player', 113942), - 111771, -- Demonic Gateway - 'player', - 'UNIT_AURA', - function(_, model) - local found, _, expiration = GetDebuff('player', 113942) - if found then - model.expiration = expiration - model.highlight = 'bad' - end - end, - }, - - Configure { - 'SummonInfernal', - L['Show the duration of @NAME.'], - 1122, -- Summon Infernal (Destruction) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildDemonHandler(infernal), - }, - - Configure { - 'CallFelLord', - L['Show the duration of @NAME.'], - 212459, -- Call Fel Lord (Demonology honor talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildDemonHandler(felLord), - }, - - Configure { - 'Observer', - L['Show the duration of @NAME.'], - 201996, -- Call Observer (Demonology honor talent) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildDemonHandler(observer), - }, - - Configure { - 'Darkglare', - L['Show the duration of @NAME.'], - 205180, -- Summon Darkglare (Affliction) - 'player', - 'PLAYER_TOTEM_UPDATE', - BuildDemonHandler(darkglare), - }, + ImportPlayerSpells { 'WARLOCK' }, } end) diff --git a/rules/Warrior.lua b/rules/Warrior.lua index 12ea53d..44d6ddd 100644 --- a/rules/Warrior.lua +++ b/rules/Warrior.lua @@ -24,71 +24,9 @@ local _, addon = ... if not addon.isClass('WARRIOR') then return end AdiButtonAuras:RegisterRules(function() - Debug('Adding warrior rules') + Debug('Rules', 'Adding warrior rules') return { - ImportPlayerSpells { - -- add all spells for - 'WARRIOR', - -- except for - 6673, -- Battle Shout - 115767, -- Deep Wounds (Protection) - 236321, -- War Banner (Arms honor talent) - 262115, -- Deep Wounds (Arms) - }, - - DebuffAliases { - 20243, -- Devastate (Protection) - 115767, -- Deep Wounds - 115768, -- Deep Wounds (Protection) - }, - - Configure { - 'WarBanner', - L['Show the duration of %NAME.'], - 236320, -- War Banner (Arms honor talent) - 'player', - { 'PLAYER_TOTEM_UPDATE', 'UNIT_AURA' }, - function(_, model) - local found, _, start, duration = GetTotemInfo(1) - if found then - model.expiration = start + duration - model.highlight = GetPlayerBuff('player', 236321) and 'good' or nil - end - end, - }, - - Configure { - 'BattleShout', - L['Show the number of group members missing @NAME.'], - 6673, -- Battle Shout - 'group', - {'GROUP_ROSTER_UPDATE', 'UNIT_AURA'}, - function(units, model) - local missing = 0 - local shortest - for unit in next, units.group do - if UnitIsPlayer(unit) and not UnitIsDeadOrGhost(unit) then - local found, _, expiration = GetBuff(unit, 6673) - if found then - if not shortest or expiration < shortest then - shortest = expiration - end - else - missing = missing + 1 - end - end - end - - if shortest then - model.expiration = shortest - model.highlight = 'good' - end - if missing > 0 then - model.count = missing - model.hint = true - end - end, - }, + ImportPlayerSpells { 'WARRIOR' }, } end)