Skip to content

Commit e13ba2e

Browse files
committed
option to show high threat but not as primary target
1 parent 769260d commit e13ba2e

File tree

3 files changed

+39
-25
lines changed

3 files changed

+39
-25
lines changed

ElvUI/Core/Defaults/Profile.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,7 @@ local UF_SubGroup = {
16511651
width = 120,
16521652
height = 28,
16531653
threatStyle = 'GLOW',
1654+
threatPrimary = true,
16541655
colorOverride = 'USE_DEFAULT',
16551656
name = CopyTable(UF_Name),
16561657
raidicon = CopyTable(UF_RaidIcon),
@@ -1857,6 +1858,7 @@ P.unitframe = {
18571858
height = 54,
18581859
lowmana = 30,
18591860
threatStyle = 'GLOW',
1861+
threatPrimary = true,
18601862
smartAuraPosition = 'DISABLED',
18611863
colorOverride = 'USE_DEFAULT',
18621864
disableMouseoverGlow = false,
@@ -1913,6 +1915,7 @@ P.unitframe = {
19131915
height = 54,
19141916
orientation = 'RIGHT',
19151917
threatStyle = 'GLOW',
1918+
threatPrimary = true,
19161919
threatPlayer = false,
19171920
smartAuraPosition = 'DISABLED',
19181921
colorOverride = 'USE_DEFAULT',
@@ -1946,6 +1949,7 @@ P.unitframe = {
19461949
targettarget = {
19471950
enable = true,
19481951
threatStyle = 'NONE',
1952+
threatPrimary = true,
19491953
orientation = 'MIDDLE',
19501954
smartAuraPosition = 'DISABLED',
19511955
colorOverride = 'USE_DEFAULT',
@@ -1971,6 +1975,7 @@ P.unitframe = {
19711975
focus = {
19721976
enable = true,
19731977
threatStyle = 'GLOW',
1978+
threatPrimary = true,
19741979
threatPlayer = false,
19751980
orientation = 'MIDDLE',
19761981
smartAuraPosition = 'DISABLED',
@@ -2003,6 +2008,7 @@ P.unitframe = {
20032008
enable = true,
20042009
orientation = 'MIDDLE',
20052010
threatStyle = 'GLOW',
2011+
threatPrimary = true,
20062012
smartAuraPosition = 'DISABLED',
20072013
colorOverride = 'USE_DEFAULT',
20082014
width = 130,
@@ -2031,6 +2037,7 @@ P.unitframe = {
20312037
boss = {
20322038
enable = true,
20332039
threatStyle = 'NONE',
2040+
threatPrimary = true,
20342041
growthDirection = 'DOWN',
20352042
orientation = 'RIGHT',
20362043
smartAuraPosition = 'DISABLED',
@@ -2097,6 +2104,7 @@ P.unitframe = {
20972104
party = {
20982105
enable = true,
20992106
threatStyle = 'GLOW',
2107+
threatPrimary = true,
21002108
orientation = 'LEFT',
21012109
visibility = '[@raid6,exists][@party1,noexists] hide;show',
21022110
growthDirection = 'UP_RIGHT',
@@ -2148,6 +2156,7 @@ P.unitframe = {
21482156
enable = true,
21492157
orientation = 'LEFT',
21502158
threatStyle = 'GLOW',
2159+
threatPrimary = true,
21512160
colorOverride = 'USE_DEFAULT',
21522161
middleClickFocus = false,
21532162
width = 120,

ElvUI/Core/Modules/UnitFrames/Elements/Threat.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,13 @@ end
154154

155155
function UF:UpdateThreat(unit, status, r, g, b)
156156
local parent = self:GetParent()
157-
local db = parent.db and parent.db.threatStyle
158-
local badunit = not unit or parent.unit ~= unit
159157

160-
if not badunit and status and status > 1 then
161-
UF:ThreatHandler(self, parent, db, status, r, g, b)
158+
local db = parent.db
159+
if not db then return end
160+
161+
if (unit and parent.unit == unit) and status and status > (db.threatPrimary and 1 or 0) then
162+
UF:ThreatHandler(self, parent, db.threatStyle, status, r, g, b)
162163
else
163-
UF:ThreatHandler(self, parent, db, nil, unpack(E.media.unitframeBorderColor))
164+
UF:ThreatHandler(self, parent, db.threatStyle, nil, unpack(E.media.unitframeBorderColor))
164165
end
165166
end

ElvUI_Options/Core/UnitFrames.lua

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -956,32 +956,34 @@ local function GetOptionsTable_ClassBar(updateFunc, groupName, numUnits)
956956
end
957957

958958
local function GetOptionsTable_GeneralGroup(updateFunc, groupName, numUnits)
959-
local config = ACH:Group(L["General"], nil, 1)
959+
local config = ACH:Group(L["General"], nil, 1, 'tab')
960960
config.args.orientation = ACH:Select(L["Frame Orientation"], L["Set the orientation of the UnitFrame."], 1, orientationValues)
961-
config.args.disableMouseoverGlow = ACH:Toggle(L["Block Mouseover Glow"], L["Forces Mouseover Glow to be disabled for these frames"], 2)
962-
config.args.disableTargetGlow = ACH:Toggle(L["Block Target Glow"], L["Forces Target Glow to be disabled for these frames"], 3)
963-
config.args.disableFocusGlow = ACH:Toggle(L["Block Focus Glow"], L["Forces Focus Glow to be disabled for these frames"], 4)
961+
config.args.disableMouseoverGlow = ACH:Toggle(L["Block Mouseover Glow"], L["Forces Mouseover Glow to be disabled for these frames"], 3)
962+
config.args.disableTargetGlow = ACH:Toggle(L["Block Target Glow"], L["Forces Target Glow to be disabled for these frames"], 4)
963+
config.args.disableFocusGlow = ACH:Toggle(L["Block Focus Glow"], L["Forces Focus Glow to be disabled for these frames"], 5)
964964

965965
if groupName ~= 'tank' and groupName ~= 'assist' then
966-
config.args.hideonnpc = ACH:Toggle(L["Text Toggle On NPC"], L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."], 5, nil, nil, nil, function() return E.db.unitframe.units[groupName].power.hideonnpc end, function(_, value) E.db.unitframe.units[groupName].power.hideonnpc = value updateFunc(UF, groupName, numUnits) end)
966+
config.args.hideonnpc = ACH:Toggle(L["Text Toggle On NPC"], L["Power text will be hidden on NPC targets, in addition the name text will be repositioned to the power texts anchor point."], 6, nil, nil, nil, function() return E.db.unitframe.units[groupName].power.hideonnpc end, function(_, value) E.db.unitframe.units[groupName].power.hideonnpc = value updateFunc(UF, groupName, numUnits) end)
967967
end
968968

969969
if groupName ~= 'party' and groupName ~= 'assist' and groupName ~= 'tank' and not strmatch(groupName, '^raid') then
970-
config.args.smartAuraPosition = ACH:Select(L["Smart Aura Position"], L["Will show Buffs in the Debuff position when there are no Debuffs active, or vice versa."], 6, C.Values.SmartAuraPositions)
970+
config.args.smartAuraPosition = ACH:Select(L["Smart Aura Position"], L["Will show Buffs in the Debuff position when there are no Debuffs active, or vice versa."], 2, C.Values.SmartAuraPositions)
971971
end
972972

973973
if groupName == 'arena' then
974-
config.args.pvpSpecIcon = ACH:Toggle(L["Spec Icon"], L["Display icon on arena frame indicating the units talent specialization or the units faction if inside a battleground."], 5, nil, nil, nil, nil, nil, function() return E.db.unitframe.units[groupName].orientation == 'MIDDLE' end)
974+
config.args.pvpSpecIcon = ACH:Toggle(L["Spec Icon"], L["Display icon on arena frame indicating the units talent specialization or the units faction if inside a battleground."], 6, nil, nil, nil, nil, nil, function() return E.db.unitframe.units[groupName].orientation == 'MIDDLE' end)
975975
else
976-
config.args.threatStyle = ACH:Select(L["Threat Display Mode"], nil, 7, threatValues)
977-
end
976+
config.args.threatGroup = ACH:Group(L["Threat"], nil, 50)
977+
config.args.threatGroup.args.threatStyle = ACH:Select(L["Display Mode"], nil, 1, threatValues)
978+
config.args.threatGroup.args.threatPrimary = ACH:Toggle(L["Primary Unit"], L["Requires the unit to be the primary target to display."], 2)
979+
config.args.threatGroup.inline = true
978980

979-
if groupName == 'target' or groupName == 'focus' then
980-
config.args.threatPlayer = ACH:Toggle(L["Player Threat"], L["Threat similar to Blizzard, which displays your threat from the unit."], 8)
981+
if groupName == 'target' or groupName == 'focus' then
982+
config.args.threatGroup.args.threatPlayer = ACH:Toggle(L["My Threat"], L["Threat similar to Blizzard, which displays your threat from the unit."], 3)
983+
end
981984
end
982985

983-
config.args.positionsGroup = ACH:Group(L["Size and Positions"], nil, 100, nil, nil, function(info, value) E.db.unitframe.units[groupName][info[#info]] = value updateFunc(UF, groupName, numUnits) end)
984-
config.args.positionsGroup.inline = true
986+
config.args.positionsGroup = ACH:Group(L["Size and Positions"], nil, 200, nil, nil, function(info, value) E.db.unitframe.units[groupName][info[#info]] = value updateFunc(UF, groupName, numUnits) end)
985987
config.args.positionsGroup.args.width = ACH:Range(L["Width"], nil, 1, { min = 15, max = 1000, step = 1 })
986988
config.args.positionsGroup.args.height = ACH:Range(L["Height"], nil, 2, { min = 5, max = 500, step = 1 })
987989

@@ -993,34 +995,33 @@ local function GetOptionsTable_GeneralGroup(updateFunc, groupName, numUnits)
993995
config.args.positionsGroup.args.verticalSpacing = ACH:Range(L["Vertical Spacing"], nil, 10, spacingNormal)
994996
config.args.positionsGroup.args.groupSpacing = ACH:Range(L["Group Spacing"], L["Additional spacing between each individual group."], 11, spacingNormal, nil, nil, nil, nil, groupName == 'party')
995997

996-
config.args.visibilityGroup = ACH:Group(L["Visibility"], nil, 200, nil, nil, function(info, value) E.db.unitframe.units[groupName][info[#info]] = value updateFunc(UF, groupName, numUnits) end)
997-
config.args.visibilityGroup.inline = true
998+
config.args.visibilityGroup = ACH:Group(L["Visibility"], nil, 100, nil, nil, function(info, value) E.db.unitframe.units[groupName][info[#info]] = value updateFunc(UF, groupName, numUnits) end)
998999
config.args.visibilityGroup.args.showPlayer = ACH:Toggle(L["Display Player"], L["When true, the header includes the player when not in a raid."], 0)
9991000
config.args.visibilityGroup.args.defaults = ACH:Execute(L["Restore Defaults"], function() return P.unitframe.units[groupName].visibility end, 1, function() E.db.unitframe.units[groupName].visibility = P.unitframe.units[groupName].visibility updateFunc(UF, groupName, numUnits) end, nil, true)
10001001
config.args.visibilityGroup.args.visibility = ACH:Input(L["Visibility"], L["VISIBILITY_DESC"], 2, nil, 'full')
10011002

10021003
config.args.sortingGroup = ACH:Group(L["Grouping & Sorting"], nil, 300, nil, nil, function(info, value) E.db.unitframe.units[groupName][info[#info]] = value updateFunc(UF, groupName, numUnits) end)
1003-
config.args.sortingGroup.inline = true
10041004
config.args.sortingGroup.args.raidWideSorting = ACH:Toggle(L["Raid-Wide Sorting"], L["Enabling this allows raid-wide sorting however you will not be able to distinguish between groups."], 1, nil, nil, nil, nil, nil, nil, groupName == 'party')
10051005
config.args.sortingGroup.args.invertGroupingOrder = ACH:Toggle(L["Invert Grouping Order"], L["Enabling this inverts the grouping order when the raid is not full, this will reverse the direction it starts from."], 2, nil, nil, nil, nil, nil, nil, function() return not E.db.unitframe.units[groupName].raidWideSorting end)
10061006
config.args.sortingGroup.args.startFromCenter = ACH:Toggle(L["Start Near Center"], L["The initial group will start near the center and grow out."], 3, nil, nil, nil, nil, nil, nil, function() return groupName ~= 'party' and not E.db.unitframe.units[groupName].raidWideSorting end)
10071007
config.args.sortingGroup.args.groupBy = ACH:Select(L["Group By"], L["Set the order that the group will sort."], 4, { CLASS = L["CLASS"], ROLE = L["ROLE"], NAME = L["Name"], GROUP = L["GROUP"], INDEX = L["Index"] })
10081008
config.args.sortingGroup.args.sortDir = ACH:Select(L["Sort Direction"], nil, 5, { ASC = L["Ascending"], DESC = L["Descending"] })
10091009
config.args.sortingGroup.args.sortMethod = ACH:Select(L["Sort Method"], nil, 6, { NAME = L["Name"], INDEX = L["Index"] }, nil, nil, nil, nil, nil, function() return E.db.unitframe.units[groupName].groupBy == 'INDEX' or E.db.unitframe.units[groupName].groupBy == 'NAME' end)
10101010

1011-
config.args.sortingGroup.args.roleSetup = ACH:Group(L["Role Order"], nil, 7, nil, nil, nil, nil, function() return E.db.unitframe.units[groupName].groupBy ~= 'ROLE' end)
1012-
config.args.sortingGroup.args.roleSetup.inline = true
1011+
config.args.sortingGroup.args.roleSetup = ACH:Group(L["Role Order"], nil, 400, nil, nil, nil, nil, function() return E.db.unitframe.units[groupName].groupBy ~= 'ROLE' end)
10131012
config.args.sortingGroup.args.roleSetup.args.ROLE1 = ACH:Select(' ', nil, 1, roles)
10141013
config.args.sortingGroup.args.roleSetup.args.ROLE2 = ACH:Select(' ', nil, 2, roles)
10151014
config.args.sortingGroup.args.roleSetup.args.ROLE3 = ACH:Select(' ', nil, 3, roles)
1015+
config.args.sortingGroup.args.roleSetup.inline = true
10161016

1017-
config.args.sortingGroup.args.classSetup = ACH:Group(L["Class Order"], nil, 7, nil, nil, nil, nil, function() return E.db.unitframe.units[groupName].groupBy ~= 'CLASS' end)
1017+
config.args.sortingGroup.args.classSetup = ACH:Group(L["Class Order"], nil, 500, nil, nil, nil, nil, function() return E.db.unitframe.units[groupName].groupBy ~= 'CLASS' end)
10181018
config.args.sortingGroup.args.classSetup.inline = true
10191019

10201020
for i = 1, NUM_CLASSES do
10211021
config.args.sortingGroup.args.classSetup.args['CLASS'..i] = ACH:Select(' ', nil, i, classTable)
10221022
end
10231023
else
1024+
config.args.positionsGroup.inline = true -- inline for others
10241025
config.args.positionsGroup.args.width.set = function(info, value) if E.db.unitframe.units[groupName].castbar and E.db.unitframe.units[groupName].castbar.width == E.db.unitframe.units[groupName][info[#info]] then E.db.unitframe.units[groupName].castbar.width = value end E.db.unitframe.units[groupName][info[#info]] = value updateFunc(UF, groupName, numUnits) end
10251026

10261027
if groupName == 'boss' or groupName == 'arena' then
@@ -1418,7 +1419,10 @@ local function GetUnitSettings(unitType, updateFunc, numUnits)
14181419
group.args.anchorPoint = ACH:Select(L["Position"], nil, 5, C.Values.AllPoints)
14191420
group.args.xOffset = ACH:Range(L["X-Offset"], nil, 6, { min = -500, max = 500, step = 1 })
14201421
group.args.yOffset = ACH:Range(L["Y-Offset"], nil, 7, { min = -500, max = 500, step = 1 })
1421-
group.args.threatStyle = ACH:Select(L["Threat Display Mode"], nil, 8, threatValues)
1422+
1423+
group.args.threatGroup = ACH:Group(L["Threat"], nil, 20)
1424+
group.args.threatGroup.args.threatStyle = ACH:Select(L["Display Mode"], nil, 1, threatValues)
1425+
group.args.threatGroup.args.threatPrimary = ACH:Toggle(L["Primary Unit"], L["Requires the unit to be the primary target to display."], 2)
14221426

14231427
for subElement in pairs(defaults[element]) do
14241428
if subElement == 'colorPetByUnitClass' then

0 commit comments

Comments
 (0)