Enhanced Raid Frames

Enhanced Raid Frames

940k Downloads

Improve ugly selection highlight and aggro highlight

tcournollet opened this issue ยท 0 comments

commented

Hello, I like this addon a lot ! So first thx for your amazing job.

I want to help if I can. I did several time aggo a little snippet to improve look of selection highlight and aggro highlight.

Here is the code:

    local TEX_COORDS = {
	    ["aggro"] = { 0.548, 0.014, 0.548, 0.295 },
	    ["selection"] = { 0.546, 0.018, 0.546, 0.297 },
    }

    local function updateSelectionHighlight(frame)
        frame.selectionHighlight:SetTexCoord(unpack(TEX_COORDS["selection"]))
    end

    -- Update existing frame to handle the reload
    for _, CompactFrame in ipairs({CompactPartyFrame, CompactRaidFrame}) do
        if CompactFrame then
            for i, frame in ipairs(CompactFrame.memberUnitFrames) do
                if isValidCompactFrame(frame) then 
                    updateSelectionHighlight(frame)
                end
            end
        end
    end

    -- Hooks to update compact frames ugly selection highlight
    hooksecurefunc("DefaultCompactUnitFrameSetup", function(frame) 
        if isValidCompactFrame(frame) then
            updateSelectionHighlight(frame)
        end 
    end)

    -- Hooks to update ugly selection highlight
    hooksecurefunc("DefaultCompactMiniFrameSetup", function(frame) 
        if isValidCompactFrame(frame) then
            updateSelectionHighlight(frame)
        end
    end)

    -- Hooks to update ugly selection highlight
    -- Have to be in UpdateAll because when frame are added and removed like in epic battelground
    hooksecurefunc("CompactUnitFrame_UpdateAll", function(frame)
        if isValidCompactFrame(frame) then
            updateSelectionHighlight(frame)
        end
    end)
    
    -- Improve aggro highlight look
    hooksecurefunc("CompactUnitFrame_UpdateAggroHighlight", function(frame)
        if isValidCompactFrame(frame) then 
            updateAggroHighlight(frame) 
        end
    end)

PS: I don't link the function isValidCompactFrame which is only some tests :)

Have a good day