Skip to content

Commit

Permalink
oUF update for AI players
Browse files Browse the repository at this point in the history
  • Loading branch information
Wutname1 committed Aug 17, 2024
1 parent 2084946 commit 52483d3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions libs/oUF/elements/alternativepower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions libs/oUF/elements/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions libs/oUF/elements/power.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion libs/oUF/elements/range.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ local function Disable(self)
end
end

oUF:AddElement('Range', nil, Enable, Disable)
oUF:AddElement('Range', Path, Enable, Disable)
19 changes: 14 additions & 5 deletions libs/oUF/oUF.lua
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ do
(string?)
* visibility - macro conditional(s) which define when to display the header (string).
* ... - further argument pairs. Consult [Group Headers](https://warcraft.wiki.gg/wiki/SecureGroupHeaderTemplate)
for possible values.
for possible values. If preferred, the attributes can be an associative table.
In addition to the standard group headers, oUF implements some of its own attributes. These can be supplied by the
layout, but are optional. PingableUnitFrameTemplate is inherited for Ping support.
Expand All @@ -640,10 +640,19 @@ do
local header = CreateFrame('Frame', name, PetBattleFrameHider, template)

header:SetAttribute('template', 'SecureUnitButtonTemplate, SecureHandlerStateTemplate, SecureHandlerEnterLeaveTemplate, PingableUnitFrameTemplate')
for i = 1, select('#', ...), 2 do
local att, val = select(i, ...)
if(not att) then break end
header:SetAttribute(att, val)

if(...) then
if(type(...) == 'table') then
for att, val in next, (...) do
header:SetAttribute(att, val)
end
else
for i = 1, select('#', ...), 2 do
local att, val = select(i, ...)
if(not att) then break end
header:SetAttribute(att, val)
end
end
end

header.style = style
Expand Down

0 comments on commit 52483d3

Please sign in to comment.