From 58079ab3ae414ee6a13183db8ebff5d7954c2e65 Mon Sep 17 00:00:00 2001 From: andrew6180 <16847730+andrew6180@users.noreply.github.com> Date: Wed, 20 Sep 2023 08:40:07 -0700 Subject: [PATCH] ElvUI/Nameplates: Use /elvrole role for nameplate styling. Defer to group role assinged if not manually set elvrole to tank or healer --- ElvUI/Core/API.lua | 18 ++++++++++++++++++ ElvUI/Core/Commands.lua | 1 + ElvUI/Modules/Nameplates/StyleFilter.lua | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ElvUI/Core/API.lua b/ElvUI/Core/API.lua index 1a64403..c8c94ec 100644 --- a/ElvUI/Core/API.lua +++ b/ElvUI/Core/API.lua @@ -49,6 +49,24 @@ function E:GetPlayerRole() return isTank and "TANK" or isHealer and "HEALER" or "DAMAGER" end +function E:GetPlayerDesiredRole() + local myRole = E.Role + if myRole == "Tank" then + myRole = "TANK" + elseif myRole == "Healer" then + myRole = "HEALER" + else + local groupRole = E:GetPlayerRole() + if groupRole then + myRole = groupRole + else + myRole = "DAMAGER" + end + end + + return myRole +end + do --local Masque = E.Libs.Masque local LBFGroupToTableElement = { diff --git a/ElvUI/Core/Commands.lua b/ElvUI/Core/Commands.lua index ebfc410..ad39287 100644 --- a/ElvUI/Core/Commands.lua +++ b/ElvUI/Core/Commands.lua @@ -235,6 +235,7 @@ function E:ChangeRole(role) ["caster"]="Caster", ["ranged"]="Ranged", ["tank"]="Tank", + ["healer"]="Healer", } E.Role = roles[lower(role)] or "Melee" E:Print("Role was changed to "..E.Role) diff --git a/ElvUI/Modules/Nameplates/StyleFilter.lua b/ElvUI/Modules/Nameplates/StyleFilter.lua index 5470974..2cafd56 100644 --- a/ElvUI/Modules/Nameplates/StyleFilter.lua +++ b/ElvUI/Modules/Nameplates/StyleFilter.lua @@ -904,7 +904,7 @@ function mod:StyleFilterConditionCheck(frame, filter, trigger) -- My Role if trigger.role.tank or trigger.role.healer or trigger.role.damager then - if trigger.role[mod.TriggerConditions.roles[E.myrole]] then passed = true else return end + if trigger.role[mod.TriggerConditions.roles[E:GetPlayerDesiredRole()]] then passed = true else return end end -- Unit Role