-
Notifications
You must be signed in to change notification settings - Fork 4
/
ClassTargetSelectors.lua
79 lines (69 loc) · 2.16 KB
/
ClassTargetSelectors.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---@class AddonNamespace
local addon = select(2, ...)
local ClassTargetSelectors = {}
addon.ClassTargetSelectors = ClassTargetSelectors
local TargetSelector = addon.TargetSelector
local TargetSelectionFilter = addon.TargetSelectionFilter
---@type fun(method: string): TargetSelector
local getTankSelector
do
local tankSelectionFactories = {
tankRoleOnly = function()
return TargetSelector.Sort(TargetSelector.PartyOrRaid(TargetSelectionFilter.Role("TANK")))
end,
tanksAndMainTanks = function()
return TargetSelector.Sort(TargetSelector.PartyOrRaid(
TargetSelectionFilter.Any({
TargetSelectionFilter.MainTank(),
TargetSelectionFilter.Role("TANK"),
})
))
end,
prioritizeMainTanks = function()
return TargetSelector.Chain({
TargetSelector.Sort(TargetSelector.PartyOrRaid(TargetSelectionFilter.MainTank())),
TargetSelector.Sort(TargetSelector.PartyOrRaid(TargetSelectionFilter.Role("TANK"))),
})
end,
mainTanksOnly = function()
return TargetSelector.Sort(TargetSelector.PartyOrRaid(TargetSelectionFilter.MainTank()))
end,
}
getTankSelector = function(method)
return (tankSelectionFactories[method] or tankSelectionFactories.tankRoleOnly)()
end
end
---@param selector TargetSelector
---@return TargetSelector
local function chainWithFocus(selector)
if addon.db.profile.prioritizeFocus then
return TargetSelector.Chain({
TargetSelector.Focus(),
selector,
})
end
return selector
end
function ClassTargetSelectors.HUNTER()
return chainWithFocus(TargetSelector.Chain({
getTankSelector(addon.db.profile.tankSelectionMethod),
TargetSelector.Pet()
}))
end
function ClassTargetSelectors.ROGUE()
return chainWithFocus(getTankSelector(addon.db.profile.tankSelectionMethod))
end
function ClassTargetSelectors.PALADIN()
return chainWithFocus(getTankSelector(addon.db.profile.tankSelectionMethod))
end
function ClassTargetSelectors.EVOKER()
return chainWithFocus(TargetSelector.Chain({
getTankSelector(addon.db.profile.tankSelectionMethod),
TargetSelector.Player(),
}))
end
function ClassTargetSelectors.DRUID()
return chainWithFocus(
TargetSelector.Sort(TargetSelector.PartyOrRaid(TargetSelectionFilter.Role("HEALER")))
)
end