Thread Tools Display Modes
12-25-22, 09:48 AM   #1
Crawmode
A Defias Bandit
Join Date: Dec 2022
Posts: 2
Shadowed Unit Frames - Abbreviated class colord raid frames

Hi lovely community!

I have a unique issue which I could not solve on my own after hours and hours of google research. I am no LUA programming expert and a complete noob in this regard and was hoping for help in sorting this special issue out:

I would love to customize my raid frames in Shadowed Unit Frames in such a way that names are abbreviated after 7 characters and those names are also class colored.

I do have LUA snippets for both separate tags but I am unfortunately unsuccessful in combining those two snippets as I am a complete noob.

Class Colored tag:

Code:
function(unit, unitOwner)
local color = ShadowUF:GetClassColor(unitOwner)
local name = UnitName(unitOwner) or UNKNOWN
if( not color ) then
return name
end

return string.format("%s%s|r", color, name)
end
Abbreviated name tag that I found online and which seems to work:

Code:
function(unit)
    local name = UnitName(unit) or unit
    if (name and string.len(name) > 15) then
       name = name:gsub('(%S+) ',function(t) return t:sub(1,1)..'. ' end)
    end
    name = name:sub(1,15)
    return name
end
Would anyone be able to help here?

Many thanks in advance.
  Reply With Quote
12-25-22, 02:46 PM   #2
Crawmode
A Defias Bandit
Join Date: Dec 2022
Posts: 2
Found the solution:

Code:
function(unit)
    local name = UnitName(unit) or unit
    if (name and string.len(name) > 5) then
       name = name:gsub('(%S+) ',function(t) return t:sub(1,1)..'. ' end)
    end
    name = name:sub(1,5)
    return GetClassColoredTextForUnit(unit, name)
end
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Shadowed Unit Frames - Abbreviated class colord raid frames

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off