From 0b6d4f4123045cdb4cd85f669bcdfd50bfbce64d Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Wed, 7 Aug 2024 15:32:14 +0200 Subject: [PATCH 1/3] health: Add class color for AI units --- .luacheckrc | 1 + elements/health.lua | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index b93b0b7b..167b83be 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -119,6 +119,7 @@ read_globals = { 'UnitHealthMax', 'UnitHonorLevel', 'UnitInParty', + 'UnitInPartyIsAI', 'UnitInRaid', 'UnitInRange', 'UnitIsConnected', diff --git a/elements/health.lua b/elements/health.lua index 081b9275..5aca4418 100644 --- a/elements/health.lua +++ b/elements/health.lua @@ -127,8 +127,8 @@ local function UpdateColor(self, event, unit) color = self.colors.tapped elseif(element.colorThreat and not UnitPlayerControlled(unit) and UnitThreatSituation('player', unit)) then color = self.colors.threat[UnitThreatSituation('player', unit)] - elseif(element.colorClass and UnitIsPlayer(unit)) - or (element.colorClassNPC and not UnitIsPlayer(unit)) + elseif(element.colorClass and (UnitIsPlayer(unit) or UnitInPartyIsAI(unit))) + or (element.colorClassNPC and not (UnitIsPlayer(unit) or UnitInPartyIsAI(unit))) or (element.colorClassPet and UnitPlayerControlled(unit) and not UnitIsPlayer(unit)) then local _, class = UnitClass(unit) color = self.colors.class[class] From 4566600c3a6200da2eee3b86d34f06d732194538 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Wed, 7 Aug 2024 15:33:04 +0200 Subject: [PATCH 2/3] power: Add class color for AI units --- elements/power.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elements/power.lua b/elements/power.lua index 72a3dd6a..bab26240 100644 --- a/elements/power.lua +++ b/elements/power.lua @@ -146,8 +146,8 @@ local function UpdateColor(self, event, unit) else color = self.colors.power[ALTERNATE_POWER_INDEX] end - elseif(element.colorClass and UnitIsPlayer(unit)) - or (element.colorClassNPC and not UnitIsPlayer(unit)) + elseif(element.colorClass and (UnitIsPlayer(unit) or UnitInPartyIsAI(unit))) + or (element.colorClassNPC and not (UnitIsPlayer(unit) or UnitInPartyIsAI(unit))) or (element.colorClassPet and UnitPlayerControlled(unit) and not UnitIsPlayer(unit)) then local _, class = UnitClass(unit) color = self.colors.class[class] From 6f4a30c90ecf76e55a73800db6829564a17bede9 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Wed, 7 Aug 2024 15:33:09 +0200 Subject: [PATCH 3/3] alternativepower: Add class color for AI units --- elements/alternativepower.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elements/alternativepower.lua b/elements/alternativepower.lua index bb76358f..c0ca6bc1 100644 --- a/elements/alternativepower.lua +++ b/elements/alternativepower.lua @@ -88,8 +88,8 @@ local function UpdateColor(self, event, unit, powerType) color = self.colors.threat[UnitThreatSituation('player', unit)] elseif(element.colorPower) then color = self.colors.power[ALTERNATE_POWER_INDEX] - elseif(element.colorClass and UnitIsPlayer(unit)) - or (element.colorClassNPC and not UnitIsPlayer(unit)) then + elseif(element.colorClass and (UnitIsPlayer(unit) or UnitInPartyIsAI(unit))) + or (element.colorClassNPC and not (UnitIsPlayer(unit) or UnitInPartyIsAI(unit))) then local _, class = UnitClass(unit) color = self.colors.class[class] elseif(element.colorSelection and unitSelectionType(unit, element.considerSelectionInCombatHostile)) then