Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.39 KB | None | 0 0
  1. local sArena = LibStub("AceAddon-3.0"):GetAddon("sArena")
  2.  
  3. local AuraWatch = {}
  4. LibStub("AceEvent-3.0"):Embed(AuraWatch)
  5.  
  6. sArena.options.plugins = sArena.options.plugins or {}
  7. sArena.options.plugins["AuraWatch"] = {
  8.     aurawatch = {
  9.         name = "AuraWatch",
  10.         type = "group",
  11.         desc = "Displays important buffs and debuffs on the class icon",
  12.         args = {
  13.             enable = {
  14.                 name = "Enable",
  15.                 type = "toggle",
  16.                 order = 1,
  17.                 get = function() return sArena.db.profile.aurawatch.enabled end,
  18.                 set = function(info, val) sArena.db.profile.aurawatch.enabled = val sArena:RefreshConfig() end,
  19.             },
  20.             fontSize = {
  21.                 name = "Font Size",
  22.                 desc = "Font size of Blizzard's built-in cooldown count",
  23.                 type = "range",
  24.                 order = 4,
  25.                 min = 4,
  26.                 max = 32,
  27.                 softMin = 4,
  28.                 softMax = 32,
  29.                 step = 1,
  30.                 bigStep = 1,
  31.                 get = function() return sArena.db.profile.aurawatch.fontSize end,
  32.                 set = function(info, val) sArena.db.profile.aurawatch.fontSize = val sArena:RefreshConfig() end,
  33.             },
  34.         },
  35.     },
  36. }
  37.  
  38. sArena.defaults.profile.aurawatch = {
  39.     enabled = true,
  40.     fontSize = 12,
  41. }
  42.  
  43. local UnitAura, GetSpellInfo, SetPortraitToTexture = UnitAura, GetSpellInfo, SetPortraitToTexture
  44. local _
  45.  
  46. -- Get localized spell names
  47. local burningDetermination = GetSpellInfo(221404)
  48. local calmingWaters = GetSpellInfo(221677)
  49. local castingCircle = GetSpellInfo(221705)
  50. local holyConcentration = GetSpellInfo(221660)
  51.  
  52. local interrupts = {
  53.     [1766] = 5, -- Kick (Rogue)
  54.     [2139] = 6, -- Counterspell (Mage)
  55.     [6552] = 4, -- Pummel (Warrior)
  56.     [19647] = 6,    -- Spell Lock (Warlock)
  57.     [47528] = 3,    -- Mind Freeze (Death Knight)
  58.     [57994] = 3,    -- Wind Shear (Shaman)
  59.     [91802] = 2,    -- Shambling Rush (Death Knight)
  60.     [96231] = 4,    -- Rebuke (Paladin)
  61.     [106839] = 4,   -- Skull Bash (Feral)
  62.     [115781] = 6,   -- Optical Blast (Warlock)
  63.     [116705] = 4,   -- Spear Hand Strike (Monk)
  64.     [132409] = 6,   -- Spell Lock (Warlock)
  65.     [147362] = 3,   -- Countershot (Hunter)
  66.     [171138] = 6,   -- Shadow Lock (Warlock)
  67.     [183752] = 3,   -- Consume Magic (Demon Hunter)
  68.     [187707] = 3,   -- Muzzle (Hunter)
  69.     [212619] = 6,   -- Call Felhunter (Warlock)
  70.     [231665] = 3,   -- Avengers Shield (Paladin)
  71. }
  72.  
  73. local spellList = {
  74.     -- Higher up = higher display priority
  75.  
  76.     -- CCs
  77.     5211,   -- Mighty Bash (Stun)
  78.     108194, -- Asphyxiate (Stun)
  79.     199804, -- Between the Eyes (Stun)
  80.     118905, -- Static Charge (Stun)
  81.     1833,   -- Cheap Shot (Stun)
  82.     853,    -- Hammer of Justice (Stun)
  83.     117526, -- Binding Shot (Stun)
  84.     179057, -- Chaos Nova (Stun)
  85.     207171, -- Winter is Coming (Stun)
  86.     132169, -- Storm Bolt (Stun)
  87.     408,    -- Kidney Shot (Stun)
  88.     163505, -- Rake (Stun)
  89.     119381, -- Leg Sweep (Stun)
  90.     232055, -- Fists of Fury (Stun)
  91.     89766,  -- Axe Toss (Stun)
  92.     30283,  -- Shadowfury (Stun)
  93.     200166, -- Metamorphosis (Stun)
  94.     226943, -- Mind Bomb (Stun)
  95.     24394,  -- Intimidation (Stun)
  96.     211881, -- Fel Eruption (Stun)
  97.     221562, -- Asphyxiate, Blood Spec (Stun)
  98.     91800,  -- Gnaw (Stun)
  99.     91797,  -- Monstrous Blow (Stun)
  100.     205630, -- Illidan's Grasp (Stun)
  101.     208618, -- Illidan's Grasp (Stun)
  102.     203123, -- Maim (Stun)
  103.     200200, -- Holy Word: Chastise, Censure Talent (Stun)
  104.     118345, -- Pulverize (Stun)
  105.     22703,  -- Infernal Awakening (Stun)
  106.     132168, -- Shockwave (Stun)
  107.     20549,  -- War Stomp (Stun)
  108.     199085, -- Warpath (Stun)
  109.     204437, -- Lightning Lasso (Stun)
  110.  
  111.     2637,   -- Hibernate (Disorient)
  112.     33786,  -- Cyclone (Disorient)
  113.     209753, -- Cyclone, Honor Talent (Disorient)
  114.     5246,   -- Intimidating Shout (Disorient)
  115.     238559, -- Bursting Shot (Disorient)
  116.     224729, -- Bursting Shot on NPC's (Disorient)
  117.     8122,   -- Psychic Scream (Disorient)
  118.     2094,   -- Blind (Disorient)
  119.     5484,   -- Howl of Terror (Disorient)
  120.     605,    -- Mind Control (Disorient)
  121.     105421, -- Blinding Light (Disorient)
  122.     207167, -- Blinding Sleet (Disorient)
  123.     31661,  -- Dragon's Breath (Disorient)
  124.     207685, -- Sigil of Misery (Disorient)
  125.     198909, -- Song of Chi-ji (Disorient)
  126.     202274, -- Incendiary Brew (Disorient)
  127.     5782,   -- Fear (Disorient)
  128.     118699, -- Fear (Disorient)
  129.     130616, -- Fear (Disorient)
  130.     115268, -- Mesmerize (Disorient)
  131.     6358,   -- Seduction (Disorient)
  132.     87204,  -- Sin and Punishment (Disorient)
  133.  
  134.     51514,  -- Hex (Incapacitate)
  135.     211004, -- Hex: Spider (Incapacitate)
  136.     210873, -- Hex: Raptor (Incapacitate)
  137.     211015, -- Hex: Cockroach (Incapacitate)
  138.     211010, -- Hex: Snake (Incapacitate)
  139.     196942, -- Hex (Voodoo Totem)
  140.     118,    -- Polymorph (Incapacitate)
  141.     61305,  -- Polymorph: Black Cat (Incapacitate)
  142.     28272,  -- Polymorph: Pig (Incapacitate)
  143.     61721,  -- Polymorph: Rabbit (Incapacitate)
  144.     61780,  -- Polymorph: Turkey (Incapacitate)
  145.     28271,  -- Polymorph: Turtle (Incapacitate)
  146.     161353, -- Polymorph: Polar Bear Cub (Incapacitate)
  147.     126819, -- Polymorph: Porcupine (Incapacitate)
  148.     161354, -- Polymorph: Monkey (Incapacitate)
  149.     161355, -- Polymorph: Penguin (Incapacitate)
  150.     161372, -- Polymorph: Peacock (Incapacitate)
  151.     3355,   -- Freezing Trap (Incapacitate)
  152.     203337, -- Freezing Trap, Diamond Ice Honor Talent (Incapacitate)
  153.     115078, -- Paralysis (Incapacitate)
  154.     213691, -- Scatter Shot (Incapacitate)
  155.     6770,   -- Sap (Incapacitate)
  156.     199743, -- Parley (Incapacitate)
  157.     20066,  -- Repentance (Incapacitate)
  158.     19386,  -- Wyvern Sting (Incapacitate)
  159.     6789,   -- Mortal Coil (Incapacitate)
  160.     200196, -- Holy Word: Chastise (Incapacitate)
  161.     221527, -- Imprison, Detainment Honor Talent (Incapacitate)
  162.     217832, -- Imprison (Incapacitate)
  163.     99,     -- Incapacitating Roar (Incapacitate)
  164.     82691,  -- Ring of Frost (Incapacitate)
  165.     9484,   -- Shackle Undead (Incapacitate)
  166.     64044,  -- Psychic Horror (Incapacitate)
  167.     1776,   -- Gouge (Incapacitate)
  168.     710,    -- Banish (Incapacitate)
  169.     107079, -- Quaking Palm (Incapacitate)
  170.     236025, -- Enraged Maim (Incapacitate)
  171.  
  172.     -- Interrupts
  173.     1766,   -- Kick (Rogue)
  174.     2139,   -- Counterspell (Mage)
  175.     6552,   -- Pummel (Warrior)
  176.     19647,  -- Spell Lock (Warlock)
  177.     47528,  -- Mind Freeze (Death Knight)
  178.     57994,  -- Wind Shear (Shaman)
  179.     91802,  -- Shambling Rush (Death Knight)
  180.     96231,  -- Rebuke (Paladin)
  181.     106839, -- Skull Bash (Feral)
  182.     115781, -- Optical Blast (Warlock)
  183.     116705, -- Spear Hand Strike (Monk)
  184.     132409, -- Spell Lock (Warlock)
  185.     147362, -- Countershot (Hunter)
  186.     171138, -- Shadow Lock (Warlock)
  187.     183752, -- Consume Magic (Demon Hunter)
  188.     187707, -- Muzzle (Hunter)
  189.     212619, -- Call Felhunter (Warlock)
  190.     231665, -- Avengers Shield (Paladin)
  191.  
  192.     -- Immunities
  193.     642,    -- Divine Shield
  194.     186265, -- Aspect of the Turtle
  195.     45438,  -- Ice Block
  196.     47585,  -- Dispersion
  197.     1022,   -- Blessing of Protection
  198.     216113, -- Way of the Crane
  199.     31224,  -- Cloak of Shadows
  200.     212182, -- Smoke Bomb
  201.     212183, -- Smoke Bomb
  202.     8178,   -- Grounding Totem Effect
  203.     199448, -- Blessing of Sacrifice
  204.  
  205.     -- Anti CCs
  206.     23920,  -- Spell Reflection
  207.     216890, -- Spell Reflection (Honor Talent)
  208.     213610, -- Holy Ward
  209.     212295, -- Nether Ward
  210.     48707,  -- Anti-Magic Shell
  211.     5384,   -- Feign Death
  212.     213602, -- Greater Fade
  213.  
  214.     -- Silences
  215.     81261,  -- Solar Beam
  216.     25046,  -- Arcane Torrent
  217.     28730,  -- Arcane Torrent
  218.     50613,  -- Arcane Torrent
  219.     69179,  -- Arcane Torrent
  220.     80483,  -- Arcane Torrent
  221.     129597, -- Arcane Torrent
  222.     155145, -- Arcane Torrent
  223.     202719, -- Arcane Torrent
  224.     202933, -- Spider Sting
  225.     1330,   -- Garrote
  226.     15487,  -- Silence
  227.     199683, -- Last Word
  228.     47476,  -- Strangulate
  229.     31935,  -- Avenger's Shield
  230.     204490, -- Sigil of Silence
  231.  
  232.     -- Roots
  233.     339,    -- Entangling Roots
  234.     122,    -- Frost Nova
  235.     102359, -- Mass Entanglement
  236.     64695,  -- Earthgrab
  237.     200108, -- Ranger's Net
  238.     212638, -- Tracker's Net
  239.     162480, -- Steel Trap
  240.     204085, -- Deathchill
  241.     233582, -- Entrenched in Flame
  242.     201158, -- Super Sticky Tar
  243.     33395,  -- Freeze
  244.     228600, -- Glacial Spike
  245.     116706, -- Disable
  246.  
  247.     236077, -- Disarm
  248.     209749, -- Faerie Swarm (Disarm)
  249.  
  250.     -- Offensive Buffs
  251.     186289, -- Aspect of the Eagle
  252.     193526, -- Trueshot
  253.     19574,  -- Bestial Wrath
  254.     121471, -- Shadow Blades
  255.     102560, -- Incarnation: Chosen of Elune
  256.     194223, -- Celestial Alignment
  257.     1719,   -- Battle Cry
  258.     162264, -- Metamorphosis
  259.     211048, -- Chaos Blades
  260.     190319, -- Combustion
  261.     194249, -- Voidform
  262.     51271,  -- Pillar of Frost
  263.     114051, -- Ascendance (Enhancement)
  264.     114050, -- Ascendance (Elemental)
  265.     107574, -- Avatar
  266.     12292,  -- Bloodbath
  267.     204945, -- Doom Winds
  268.     2825,   -- Bloodlust
  269.     32182,  -- Heroism
  270.     204361, -- Bloodlust (Honor Talent)
  271.     204362, -- Heroism (Honor Talent)
  272.     13750,  -- Adrenaline Rush
  273.     102543, -- Incarnation: King of the Jungle
  274.     137639, -- Storm, Earth, and Fire
  275.     152173, -- Serenity
  276.     12042,  -- Arcane Power
  277.     12472,  -- Icy Veins
  278.     198144, -- Ice Form
  279.     31884,  -- Avenging Wrath (Retribution)
  280.     196098, -- Soul Harvest
  281.     16166,  -- Elemental Mastery
  282.     10060,  -- Power Infusion
  283.  
  284.     -- Defensive Buffs
  285.     210256, -- Blessing of Sanctuary
  286.     6940,   -- Blessing of Sacrifice
  287.     125174, -- Touch of Karma
  288.     47788,  -- Guardian Spirit
  289.     197268, -- Ray of Hope
  290.     5277,   -- Evasion
  291.     199754, -- Riposte
  292.     212800, -- Blur
  293.     102342, -- Ironbark
  294.     22812,  -- Barkskin
  295.     117679, -- Incarnation: Tree of Life
  296.     198065, -- Prismatic Cloak
  297.     198111, -- Temporal Shield
  298.     108271, -- Astral Shift
  299.     114052, -- Ascendance (Restoration)
  300.     207319, -- Corpse Shield
  301.     104773, -- Unending Resolve
  302.     48792,  -- Icebound Fortitude
  303.     55233,  -- Vampiric Blood
  304.     61336,  -- Survival Instincts
  305.     116849, -- Life Cocoon
  306.     33206,  -- Pain Suppression
  307.     197862, -- Archangel
  308.     31850,  -- Ardent Defender
  309.     120954, -- Fortifying Brew
  310.     108416, -- Dark Pact
  311.     216331, -- Avenging Crusader
  312.     31842,  -- Avenging Wrath (Holy)
  313.     118038, -- Die by the Sword
  314.     12975,  -- Last Stand
  315.     205191, -- Eye for an Eye
  316.     498,    -- Divine Protection
  317.     871,    -- Shield Wall
  318.     53480,  -- Roar of Sacrifice
  319.     197690, -- Defensive Stance
  320.  
  321.     -- Miscellaneous
  322.     199450, -- Ultimate Sacrifice
  323.     188501, -- Spectral Sight
  324.     1044,   -- Blessing of Freedom
  325.     41425,  -- Hypothermia
  326. }
  327.  
  328. local priorityList = {}
  329. local testModeClasses = { "ROGUE", "MAGE", "PRIEST" }
  330. local classIcons = {
  331.     ["DRUID"] = 625999,
  332.     ["HUNTER"] = 626000,
  333.     ["MAGE"] = 626001,
  334.     ["MONK"] = 626002,
  335.     ["PALADIN"] = 626003,
  336.     ["PRIEST"] = 626004,
  337.     ["ROGUE"] = 626005,
  338.     ["SHAMAN"] = 626006,
  339.     ["WARLOCK"] = 626007,
  340.     ["WARRIOR"] = 626008,
  341.     ["DEATHKNIGHT"] = 135771,
  342.     ["DEMONHUNTER"] = 1260827,
  343. }
  344.  
  345. function AuraWatch:OnEnable()
  346.     -- Create prioritized aura list. We're simply swapping the keys and values from spellList
  347.     for k, v in ipairs(spellList) do
  348.         priorityList[v] = k
  349.     end
  350.  
  351.     for i = 1, 5 do
  352.         local arenaFrame = _G["ArenaEnemyFrame"..i]
  353.  
  354.         local frame = CreateFrame("Cooldown", nil, arenaFrame, "CooldownFrameTemplate")
  355.         frame:SetSwipeColor(0, 0, 0, 0.6)
  356.         frame:SetDrawBling(false)
  357.         frame:SetReverse(true)
  358.         frame:SetHideCountdownNumbers(false)
  359.         frame:ClearAllPoints()
  360.         frame:SetPoint("TOPLEFT", arenaFrame.classPortrait, "TOPLEFT", 2, -2)
  361.         frame:SetPoint("BOTTOMRIGHT", arenaFrame.classPortrait, "BOTTOMRIGHT", -2, 2)
  362.  
  363.         for _, region in next, {frame:GetRegions()} do
  364.             if ( region:GetObjectType() == "FontString" ) then
  365.                 frame.Text = region
  366.             end
  367.         end
  368.  
  369.         frame.Text:ClearAllPoints()
  370.         frame.Text:SetPoint("CENTER", frame, "CENTER", 0, 1)
  371.  
  372.         frame.classPortrait = arenaFrame.classPortrait
  373.         frame.activeId = nil
  374.         frame.aura = { spellId = nil, icon = nil, start = nil, expire = nil }
  375.         frame.interrupt = { spellId = nil, icon = nil, start = nil, expire = nil }
  376.  
  377.         -- Check for auras when an interrupt lockout expires
  378.         frame:HookScript("OnHide", function(self)
  379.             AuraWatch:UNIT_AURA(nil, "arena"..i)
  380.         end)
  381.  
  382.         self["arena"..i] = frame
  383.     end
  384.  
  385.     self:RegisterEvent("PLAYER_ENTERING_WORLD")
  386. end
  387. sArena.RegisterCallback(AuraWatch, "sArena_OnEnable", "OnEnable")
  388.  
  389. function AuraWatch:RefreshConfig()
  390.     for i = 1, 5 do
  391.         local frame = self["arena"..i]
  392.  
  393.         local fontFace, _, fontFlags = frame.Text:GetFont()
  394.         frame.Text:SetFont(fontFace, sArena.db.profile.aurawatch.fontSize, fontFlags)
  395.     end
  396. end
  397. sArena.RegisterCallback(AuraWatch, "sArena_RefreshConfig", "RefreshConfig")
  398.  
  399. function AuraWatch:TestMode()
  400.     for i = 1, 3 do
  401.         local frame = self["arena"..i]
  402.         if sArena.testMode and sArena.db.profile.aurawatch.enabled then
  403.             CooldownFrame_Set(frame, GetTime(), 30, 1, true)
  404.             frame.classPortrait:SetTexCoord(0, 1, 0, 1)
  405.             if sArena.db.profile.simpleFrames then
  406.                 frame.classPortrait:SetTexture(136184)
  407.             else
  408.                 SetPortraitToTexture(frame.classPortrait, 136184)
  409.             end
  410.         else
  411.             CooldownFrame_Set(frame, 0, 0, 0, true)
  412.         end
  413.     end
  414. end
  415. sArena.RegisterCallback(AuraWatch, "sArena_TestMode", "TestMode")
  416.  
  417. function AuraWatch:ApplyAura(unitID)
  418.     local frame = self[unitID]
  419.  
  420.     local spellId, icon, start, expire
  421.  
  422.     -- Check if an aura was found
  423.     if frame.aura.spellId then
  424.         spellId, icon, start, expire = frame.aura.spellId, frame.aura.icon, frame.aura.start, frame.aura.expire
  425.     end
  426.  
  427.     -- Check if there's an interrupt lockout
  428.     if frame.interrupt.spellId then
  429.         -- Make sure the lockout is still active
  430.         if frame.interrupt.expire < GetTime() then
  431.             frame.interrupt.spellId = nil
  432.         -- Select the greatest priority (aura or interrupt)
  433.         elseif spellId and priorityList[frame.interrupt.spellId] < priorityList[spellId] or not spellId then
  434.             spellId, icon, start, expire = frame.interrupt.spellId, frame.interrupt.icon, frame.interrupt.start, frame.interrupt.expire
  435.         end
  436.     end
  437.  
  438.     -- Set up the icon & cooldown
  439.     if spellId then
  440.         CooldownFrame_Set(frame, start, expire - start, 1, true)
  441.         if spellId ~= frame.activeId then
  442.             frame.activeId = spellId
  443.             frame.classPortrait:SetTexCoord(0,1,0,1)
  444.             if sArena.db.profile.simpleFrames then
  445.                 frame.classPortrait:SetTexture(icon)
  446.             else
  447.                 SetPortraitToTexture(frame.classPortrait, icon)
  448.             end
  449.         end
  450.     -- Remove cooldown & reset icon back to class icon
  451.     elseif frame.activeId then
  452.         frame.activeId = nil
  453.         local _, class = UnitClass(unitID)
  454.         if class then
  455.             CooldownFrame_Set(frame, 0, 0, 0, true)
  456.             if sArena.db.profile.simpleFrames then
  457.                 frame.classPortrait:SetTexture(classIcons[class])
  458.                 frame.classPortrait:SetTexCoord(0,1,0,1)
  459.             else
  460.                 frame.classPortrait:SetTexture("Interface\\TargetingFrame\\UI-Classes-Circles")
  461.                 frame.classPortrait:SetTexCoord(unpack(CLASS_ICON_TCOORDS[class]))
  462.             end
  463.         end
  464.     end
  465. end
  466.  
  467. function AuraWatch:PLAYER_ENTERING_WORLD()
  468.     local _, instanceType = IsInInstance()
  469.     if instanceType == "pvp" or instanceType == "arena" then
  470.         self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  471.         self:RegisterEvent("UNIT_AURA")
  472.     else
  473.         self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  474.         self:UnregisterEvent("UNIT_AURA")
  475.     end
  476. end
  477.  
  478. function AuraWatch:UNIT_AURA(_, unitID)
  479.     if not sArena.db.profile.aurawatch.enabled then return end
  480.     if not self[unitID] then return end
  481.  
  482.     local spellId, filter, buff, debuff, idx
  483.  
  484.     -- Loop through the unit's buffs
  485.     for i = 1, 32 do -- BUFF_MAX_DISPLAY = 32
  486.         _, _, _, _, _, _, _, _, _, buff = UnitAura(unitID, i, "HELPFUL")
  487.         -- Check if this aura is being tracked
  488.         if buff and priorityList[buff] then
  489.             -- Select the greatest priority aura
  490.             if not spellId or priorityList[buff] < priorityList[spellId] then
  491.                 spellId = buff
  492.                 filter = "HELPFUL"
  493.                 idx = i
  494.             end
  495.         end
  496.  
  497.         -- Loop through the unit's debuffs too!
  498.         if i <= 16 then -- DEBUFF_MAX_DISPLAY = 16
  499.             _, _, _, _, _, _, _, _, _, debuff = UnitAura(unitID, i, "HARMFUL")
  500.         end
  501.  
  502.         -- Check if this aura is being tracked
  503.         if debuff and priorityList[debuff] then
  504.             -- Select the greatest priority aura
  505.             if not spellId or priorityList[debuff] < priorityList[spellId] then
  506.                 spellId = debuff
  507.                 filter = "HARMFUL"
  508.                 idx = i
  509.             end
  510.         end
  511.  
  512.         -- Found neither a buff nor debuff at position i, break out of the loop
  513.         if not buff and not debuff then break end
  514.     end
  515.  
  516.     local frame = self[unitID]
  517.  
  518.     if spellId then
  519.         local _, _, icon = GetSpellInfo(spellId)
  520.         local _, _, _, _, duration, expires = UnitAura(unitID, idx, filter)
  521.  
  522.         frame.aura.spellId = spellId
  523.         frame.aura.icon = icon
  524.         frame.aura.start = expires - duration
  525.         frame.aura.expire = expires
  526.     else
  527.         frame.aura.spellId = nil
  528.     end
  529.  
  530.     self:ApplyAura(unitID)
  531. end
  532.  
  533. local CombatLogGetCurrentEventInfo = _G.CombatLogGetCurrentEventInfo
  534. local FindAuraByName = _G.AuraUtil.FindAuraByName
  535.  
  536. function AuraWatch:COMBAT_LOG_EVENT_UNFILTERED()
  537.     if not sArena.db.profile.aurawatch.enabled then return end
  538.  
  539.     local _, event, _, srcGUID, _, _, _, destGUID, destName, destFlags, _, spellId = CombatLogGetCurrentEventInfo()
  540.  
  541.     -- Apparently SPELL_INTERRUPT doesn't capture interrupts that are used on channelled abilities
  542.     if event == "SPELL_INTERRUPT" or event == "SPELL_CAST_SUCCESS" then
  543.         -- Check if the spell is being tracked
  544.         if interrupts[spellId] then
  545.             local unitID
  546.             for i = 1, 5 do
  547.                 if UnitGUID("arena"..i) == destGUID then
  548.                     unitID = "arena"..i
  549.                     break
  550.                 end
  551.             end
  552.  
  553.             -- Only track interrupts that are used on arena opponents
  554.             if unitID then
  555.                 local _, _, _, _, _, _, notInterruptable = UnitChannelInfo(unitID)
  556.                 if event == "SPELL_INTERRUPT" or notInterruptable == false then
  557.                     local frame = self[unitID]
  558.                     local duration = interrupts[spellId]
  559.                     local _, class = UnitClass(unitID)
  560.                     local _, _, icon = GetSpellInfo(spellId)
  561.                     local start = GetTime()
  562.  
  563.                     -- Adjust the lockout duration for some classes
  564.                     if class == "PRIEST" or class == "SHAMAN" or class == "WARLOCK" then
  565.                         duration = duration * 0.7
  566.                     end
  567.  
  568.                     -- Adjust the lockout duration for some talents
  569.                     if FindAuraByName(castingCircle, unitID) then
  570.                         duration = duration * 0.3
  571.                     end
  572.  
  573.                     frame.interrupt.spellId = spellId
  574.                     frame.interrupt.icon = icon
  575.                     frame.interrupt.start = start
  576.                     frame.interrupt.expire = start + duration
  577.  
  578.                     self:ApplyAura(unitID)
  579.                 end
  580.             end
  581.         end
  582.     end
  583. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement