Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mSR = CreateFrame('Frame', 'mortSoulReaper', UIParent)
- mSR:RegisterEvent('PLAYER_TARGET_CHANGED')
- mSR:SetScript('OnEvent', function(self, event, unit)
- if event == 'UNIT_HEALTH' then
- if unit ~= 'target' then return end
- local health, maxHealth = UnitHealth('target'), UnitHealthMax('target')
- if health > 0 and health / maxHealth <= .25 then
- mSR_Glow('Ferocious Bite')
- else
- mSR_Dim('Ferocious Bite')
- end
- else
- if UnitExists('target') and UnitCanAttack('player', 'target') then
- self:RegisterEvent('UNIT_HEALTH')
- self:GetScript('OnEvent')(self, 'UNIT_HEALTH', 'target')
- else
- mSR_Dim('Ferocious Bite')
- self:UnregisterEvent('UNIT_HEALTH')
- end
- end
- end)
- function mSR_Glow(spell)
- local bars={'Action','MultiBarBottomLeft','MultiBarBottomRight','MultiBarLeft','MultiBarRight'}
- for bar=1,#bars do
- for button=1,NUM_ACTIONBAR_BUTTONS do
- local buttonName = bars[bar]..'Button'..button
- local mtype, id, _ = GetActionInfo(_G[buttonName].action)
- if mtype == 'macro' then
- local mName, _ = GetMacroSpell(id)
- if mName == spell then
- ActionButton_ShowOverlayGlow(_G[buttonName])
- _G[buttonName].glow = true
- end
- elseif mtype == 'spell' then
- local sName, _ = GetSpellInfo(id)
- if sName == spell then
- ActionButton_ShowOverlayGlow(_G[buttonName])
- end
- end
- end
- end
- end
- function mSR_Dim(spell)
- local bars={'Action','MultiBarBottomLeft','MultiBarBottomRight','MultiBarLeft','MultiBarRight'}
- for bar=1,#bars do
- for button=1,NUM_ACTIONBAR_BUTTONS do
- local buttonName = bars[bar]..'Button'..button
- local mtype, id, _ = GetActionInfo(_G[buttonName].action)
- if mtype == 'macro' then
- local mName, _ = GetMacroSpell(id)
- if mName == spell then
- ActionButton_HideOverlayGlow(_G[buttonName])
- end
- elseif mtype == 'spell' then
- local sName, _ = GetSpellInfo(id)
- if sName == spell then
- ActionButton_HideOverlayGlow(_G[buttonName])
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement