Author SHA1 Message Date
Andreas 4567bea3f9 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.
2026-10-29 12:54:24 +01:00
3 changed files with 34 additions and 68 deletions

No files matched your search

-47
View File
@@ -26,8 +26,6 @@ local colors = {
disease = { 0.4, 0.2, 0.0 },
poison = { 0.0, 0.7, 0.7 },
curse = { 0.7, 0.0, 0.7 },
immune = { 0.0, 0.2, 0.4 },
bomb = { 1.0, 0.7, 0.7 },
red = { 1, 0, 0 },
blue = { 0.4, 0.4, 1 },
light_blue = { 0.7, 0.7, 1 },
@@ -835,51 +833,6 @@ local function TriggerConfig()
return triggers
end
local function StatusColorClassConfig()
local _, class = UnitClass("player")
if class == "DRUID" then
return {
{ status = "Curse", color = colors.curse },
{ status = "Poison", color = colors.poison },
}
elseif class == "MAGE" then
return {
{ status = "Curse", color = colors.curse },
}
elseif class == "PALADIN" then
return {
{ status = "Magic", color = colors.magic },
{ status = "Poison", color = colors.poison },
{ status = "Disease", color = colors.disease },
}
elseif class == "PRIEST" then
return {
{ status = "Magic", color = colors.magic },
{ status = "Disease", color = colors.disease },
}
elseif class == "SHAMAN" then
return {
{ status = "Poison", color = colors.poison },
{ status = "Disease", color = colors.disease },
}
end
return {}
end
local function StatusColorConfig()
local statusColors = {
{ status = "Immune", color = colors.immune },
{ status = "Bomb", color = colors.bomb },
}
for _, entry in ipairs(StatusColorClassConfig()) do
table.insert(statusColors, entry)
end
return statusColors
end
local types = omif.GetModule("types")
local UnitFrame = types.UnitFrame
local UnitGroup = types.UnitGroup
+32 -19
View File
@@ -50,6 +50,12 @@ local colors = {
low = { 1.0, 0.0, 0 },
offline = { 0.7, 0.7, 0.7 },
dead = { 0.7, 0.7, 0.7 },
magic = { 0.4, 0.4, 1.0 },
disease = { 0.4, 0.2, 0.0 },
poison = { 0.0, 0.7, 0.7 },
curse = { 0.7, 0.0, 0.7 },
immune = { 0.0, 0.2, 0.4 },
bomb = { 1.0, 0.7, 0.7 },
cyan = { 0.0, 0.8, 0.8 },
white = { 1.0, 1.0, 1.0 },
shield = { 0.85, 0.95, 1.0 },
@@ -84,8 +90,6 @@ function UnitFrame:Init(unit, config)
self.rangeEnemy = config.range.enemy
self.rangeFade = config.range.fade
self.statusColors = config.statusColors
local secure = self:CreateSecureFrame(width, height)
secure:Hide()
@@ -537,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
@@ -648,24 +662,23 @@ function UnitFrame:UpdateHealthColor()
if not isFriend then
self.hp:SetColor(unpack(colors.hostile))
return
end
local statusColor = nil
for _, entry in ipairs(self.statusColors) do
if self.auras.statusCount[entry.status] then
statusColor = entry.color
break
end
end
if statusColor then
self.hp:SetColor(unpack(statusColor))
elseif UnitIsDead(unit) then
elseif self.auras.statusCount["Immune"] then
self.hp:SetColor(unpack(colors.immune))
elseif self.auras.statusCount["Bomb"] then
self.hp:SetColor(unpack(colors.bomb))
elseif self.auras.statusCount["Magic"] then
self.hp:SetColor(unpack(colors.magic))
elseif self.auras.statusCount["Curse"] then
self.hp:SetColor(unpack(colors.curse))
elseif self.auras.statusCount["Poison"] then
self.hp:SetColor(unpack(colors.poison))
elseif self.auras.statusCount["Disease"] then
self.hp:SetColor(unpack(colors.disease))
elseif isFriend and UnitIsDead(unit) then
self.hp:SetColor(unpack(colors.dead))
elseif pct >= 0.90 then
elseif isFriend and pct >= 0.90 then
self.hp:SetColor(unpack(colors.healthy))
elseif pct >= 0.75 then
elseif isFriend and pct >= 0.75 then
local progress = (pct - 0.75) / (0.90 - 0.75)
self.hp:SetInterpolatedColor(colors.mid, colors.high, progress)
else
+2 -2
View File
@@ -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