Advertisement
Guest User

Untitled

a guest
Mar 14th, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.98 KB | None | 0 0
  1. local mSR = CreateFrame('Frame', 'mortSoulReaper', UIParent)
  2. mSR:RegisterEvent('PLAYER_TARGET_CHANGED')
  3. mSR:SetScript('OnEvent', function(self, event, unit)
  4.     if event == 'UNIT_HEALTH' then
  5.         if unit ~= 'target' then return end
  6.         local health, maxHealth = UnitHealth('target'), UnitHealthMax('target')
  7.         if health > 0 and health / maxHealth <= .25 then
  8.             mSR_Glow('Ferocious Bite')
  9.         else
  10.             mSR_Dim('Ferocious Bite')
  11.         end
  12.     else
  13.         if UnitExists('target') and UnitCanAttack('player', 'target') then
  14.             self:RegisterEvent('UNIT_HEALTH')
  15.             self:GetScript('OnEvent')(self, 'UNIT_HEALTH', 'target')
  16.         else
  17.             mSR_Dim('Ferocious Bite')
  18.             self:UnregisterEvent('UNIT_HEALTH')
  19.         end
  20.     end
  21. end)       
  22.  
  23. function mSR_Glow(spell)
  24.     local bars={'Action','MultiBarBottomLeft','MultiBarBottomRight','MultiBarLeft','MultiBarRight'}
  25.     for bar=1,#bars do
  26.         for button=1,NUM_ACTIONBAR_BUTTONS do
  27.             local buttonName = bars[bar]..'Button'..button
  28.             local mtype, id, _ = GetActionInfo(_G[buttonName].action)
  29.             if mtype == 'macro' then
  30.                 local mName, _ = GetMacroSpell(id)
  31.                 if mName == spell then
  32.                     ActionButton_ShowOverlayGlow(_G[buttonName])
  33.                     _G[buttonName].glow = true
  34.                 end
  35.             elseif mtype == 'spell' then
  36.                 local sName, _ = GetSpellInfo(id)
  37.                 if sName == spell then
  38.                     ActionButton_ShowOverlayGlow(_G[buttonName])
  39.                 end
  40.             end
  41.         end
  42.     end
  43. end
  44.  
  45. function mSR_Dim(spell)
  46.     local bars={'Action','MultiBarBottomLeft','MultiBarBottomRight','MultiBarLeft','MultiBarRight'}
  47.     for bar=1,#bars do
  48.         for button=1,NUM_ACTIONBAR_BUTTONS do
  49.             local buttonName = bars[bar]..'Button'..button
  50.             local mtype, id, _ = GetActionInfo(_G[buttonName].action)
  51.             if mtype == 'macro' then
  52.                 local mName, _ = GetMacroSpell(id)
  53.                 if mName == spell then
  54.                     ActionButton_HideOverlayGlow(_G[buttonName])
  55.                 end
  56.             elseif mtype == 'spell' then
  57.                 local sName, _ = GetSpellInfo(id)
  58.                 if sName == spell then
  59.                     ActionButton_HideOverlayGlow(_G[buttonName])
  60.                 end
  61.             end
  62.         end
  63.     end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement