From 4567bea3f91f170dc11b8bde615f5c21a5d0f848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Rud=C3=A9n?= Date: Thu, 29 Oct 2026 12:54:24 +0100 Subject: [PATCH] Override role as TANK based on MT assignments This is particularly helpful in fights like High King Maulgar, Illidari Council or Kael'Thas where a DPS player is temporarily made into a tank. --- src/types/unitframe.lua | 12 +++++++++++- src/types/unitgroup.lua | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/types/unitframe.lua b/src/types/unitframe.lua index 0767e41..9795856 100644 --- a/src/types/unitframe.lua +++ b/src/types/unitframe.lua @@ -541,10 +541,20 @@ function UnitFrame:UNIT_POWER_UPDATE() self:UpdatePower() end -function UnitFrame:UpdateRole(role) +function UnitFrame:GetRole(role) if role == nil then role = UnitGroupRolesAssigned(self.unit) end + + if GetPartyAssignment("MAINTANK", self.unit) then + role = "TANK" + end + + return role +end + +function UnitFrame:UpdateRole(role) + role = self:GetRole(role) if role == "HEALER" then self:EnablePower(Enum.PowerType.Mana) elseif role == "TANK" and select(3, UnitClass(self.unit)) == 6 then diff --git a/src/types/unitgroup.lua b/src/types/unitgroup.lua index d534451..92cecf9 100644 --- a/src/types/unitgroup.lua +++ b/src/types/unitgroup.lua @@ -53,8 +53,8 @@ local function UnitFrameDefaultCompare(lhs, rhs) end -- tank < healer < damage < ? - local lrole = RoleValue(UnitGroupRolesAssigned(lunit)) - local rrole = RoleValue(UnitGroupRolesAssigned(runit)) + local lrole = RoleValue(lhs:GetRole()) + local rrole = RoleValue(rhs:GetRole()) if lrole ~= rrole then return lrole < rrole -- 2.54.0