View Single Post
10-14-10, 02:38 PM   #7
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
I have no way to test this but you could try:
Code:
local frame = CreateFrame('Frame')
frame:Hide()

for index = 1, MAX_RUNES do
	frame[index] = _G['RuneButtonIndividual' .. index]
end

local OnEvent(self, event, arg1, arg2)
	if event == 'RUNE_POWER_UPDATE' then
		local _, _, isReady = GetRuneCooldown(arg1)
		self[arg1]:SetAlpha(isReady and RHaic or RHaoc)
	elseif event == 'PLAYER_REGEN_DISABLED' then
		self:RegisterEvent('RUNE_POWER_UPDATE')
		local isReady, _
		for index = 1, MAX_RUNES do
			_, _, isReady = GetRuneCooldown(index)
			self[index]:SetAlpha(isReady and RHaic or RHaoc)
		end
	elseif event == 'PLAYER_REGEN_ENABLED' then
		self:UnregisterEvent('RUNE_POWER_UPDATE')
		for index = 1, MAX_RUNES do
			self[index]:SetAlpha(RHaoc)
		end
	end
end

frame:SetScript('OnEvent', OnEvent)
frame:RegisterEvent('PLAYER_REGEN_DISABLED')
frame:RegisterEvent('PLAYER_REGEN_ENABLED')

OnEvent(InCombatLockdown() and 'PLAYER_REGEN_DISABLED' or 'PLAYER_REGEN_ENABLED')
  Reply With Quote