My issue is that I'm trying to make my action bars icons desaturate when a spell is on cooldown
I've used this code from a post I've found on reddit and it works fine on the default UI but doesn't on ElvUI:
Code: Select all
local frame = CreateFrame("Frame")
frame.timer = 0;
function greyOut(button)
local name = button:GetName();
local action = button.action;
local Icon = _G[name.."Icon"];
local start, duration, _ = GetActionCooldown(action);
if ( duration >= 1.5 ) then
Icon:SetDesaturated(true);
else
Icon:SetDesaturated(false);
end;
end;
function onUpdate(self, elapsed)
self.timer = self.timer + elapsed; -- throtteling
if self.timer >= 0.1 then
for i=1, 12 do
local button = _G["ActionButton"..i];
greyOut(button);
button = _G["MultiBarBottomLeftButton"..i];
greyOut(button);
button = _G["MultiBarBottomRightButton"..i];
greyOut(button);
button = _G["MultiBarRightButton"..i];
greyOut(button);
button = _G["MultiBarLeftButton"..i];
greyOut(button);
last = 0;
end
end
end;
frame:HookScript("OnUpdate", onUpdate);
When I create a weakaura to desaturate a single button when the action is on cooldown it works, but it would be tedious to do WAs for each button, each class & spec :/
Could I get some help to make this work for ElvUI, if possible, please?
Thank you!