From f91c1018a5b23120b72cba348f18d53768579777 Mon Sep 17 00:00:00 2001 From: shagu Date: Tue, 24 Aug 2021 17:17:01 +0200 Subject: [PATCH] nameplate-classcolor: color nameplates by class --- mods/nameplate-classcolor.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 mods/nameplate-classcolor.lua diff --git a/mods/nameplate-classcolor.lua b/mods/nameplate-classcolor.lua new file mode 100644 index 0000000..c83646f --- /dev/null +++ b/mods/nameplate-classcolor.lua @@ -0,0 +1,21 @@ +local _G = _G or getfenv(0) +local GetUnitData = ShaguTweaks.GetUnitData + +local module = ShaguTweaks:register({ + title = "Use Class Colors On Nameplates", + description = "Change the nameplate healthbar color to class colors", + enabled = nil, +}) + +module.enable = function(self) + if ShaguPlates then return end + + table.insert(ShaguTweaks.libnameplate.OnUpdate, function() + local name = this.name:GetText() + local class, _, elite, player = GetUnitData(name, true) + if class and player then + local color = RAID_CLASS_COLORS[class] or { r = .5, g = .5, b = .5, a = 1 } + this.healthbar:SetStatusBarColor(color.r, color.g, color.b, 1) + end + end) +end