I have something along these lines in a custom addon ... here are the parts that you would probably need. However, I have not tested this code (as standalone). It assumes that any CC effect is on a diminishing return and only shows those.
P.S. Please tell me if this worked for you
Requirements:
1) a place to put the code: If you don't happen to have a dummy addon to stuff code into already, you can create one here:
http://addon.bool.no
2) DRData-1.0 library, which can be found here:
http://www.wowace.com/addons/drdata-1-0/
3) put this in your lua file (or the lua input box on addon.bool.no)
Lua Code:
local DRData = LibStub('DRData-1.0')
local hideDRType = {
["ctrlroot"] = true,
["shortroot"] = true,
["disarm"] = true,
["taunt"] = true,
["knockback"] = true,
}
local isDisabled = nil
local _FRAMES = {}
local function UpdateOverlay(self)
if not self.Overlay then return end
local display, drType = nil, nil
for i = 1, 40 do
local _, _, icon, count, dispelType, _, expires, caster, _, _, spellID, canApplyAura, isBoss = UnitDebuff(self.displayedUnit or self.unit, i)
local drType = DRData:GetSpellCategory(spellID)
if drType and not hideDRType[drType] then
display = true
break
end
end
if display then
self.Overlay.icon:SetTexture(icon)
self.Overlay.icon:SetDesaturated( caster == "player" )
self.Overlay.count:SetText(count == 1 and '' or count)
local now = GetTime()
self.Overlay.cooldown:SetCooldown(now, expires - now)
self.Overlay:Show()
else
self.Overlay:Hide()
end
end
local isHooked = nil
local Disable = function(self)
local overlay = self.Overlay
if overlay then
for k, frame in ipairs(_FRAMES) do
if frame == self then
tremove(_FRAMES, k)
overlay:Hide()
break
end
end
if #_FRAMES == 0 and isHooked then
isDisabled = true
end
end
end
local Enable = function(self)
local overlay = self.Overlay
if overlay then
tinsert(_FRAMES, self)
isDisabled = nil
if not isHooked then
hooksecurefunc("CompactUnitFrame_UpdateDebuffs", UpdateOverlay)
isHooked = true
end
end
end
hooksecurefunc("CompactUnitFrame_UpdateVisible", function(frame)
if not frame.Overlay and frame.unit and not frame.unit:find('pet') then
local overlay = CreateFrame("Button", "$parentCUFOverlay", frame, "CompactAuraTemplate")
overlay:SetPoint('CENTER', 0, 0)
overlay:SetSize(20, 20)
overlay:EnableMouse(false)
overlay:EnableMouseWheel(false)
overlay:Hide()
frame.Overlay = overlay
Enable(frame)
end
end)
4) put this in your toc file (or click 'Show advanced (TOC) options' and add this line to the toc box):
Code:
## Dependencies: DRData-1.0