add maintank/mainassist trigger options

This commit is contained in:
NoM0Re
2024-07-08 02:01:30 +02:00
parent b7dac42f5a
commit d3eee1e364
4 changed files with 128 additions and 2 deletions
+6
View File
@@ -1032,6 +1032,10 @@ local function TriggerInfoApplies(triggerInfo, unit)
return false
end
if triggerInfo.raidRole and not triggerInfo.raidRole[WeakAuras.UnitRaidRole(unit) or ""] then
return false
end
if triggerInfo.unit == "group" then
local isPet = WeakAuras.UnitIsPet(unit)
if triggerInfo.includePets == "PetsOnly" and not isPet then
@@ -2373,6 +2377,7 @@ function BuffTrigger.Add(data)
local groupTrigger = trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
local effectiveIgnoreSelf = (groupTrigger or trigger.unit == "nameplate") and trigger.ignoreSelf
local effectiveRaidRole = groupTrigger and trigger.useRaidRole and trigger.raid_role or nil
local effectiveClass = groupTrigger and trigger.useClass and trigger.class
local effectiveIgnoreDead = groupTrigger and trigger.ignoreDead
local effectiveIgnoreDisconnected = groupTrigger and trigger.ignoreDisconnected
@@ -2434,6 +2439,7 @@ function BuffTrigger.Add(data)
ignoreDead = effectiveIgnoreDead,
ignoreDisconnected = effectiveIgnoreDisconnected,
ignoreInvisible = effectiveIgnoreInvisible,
raidRole = effectiveRaidRole,
groupSubType = groupSubType,
groupCountFunc = groupCountFunc,
class = effectiveClass,
+11
View File
@@ -2466,6 +2466,7 @@ function WeakAuras.WatchUnitChange(unit)
watchUnitChange = CreateFrame("Frame");
watchUnitChange.unitChangeGUIDS = {}
watchUnitChange.unitRoles = {}
watchUnitChange.unitRaidRole = {}
watchUnitChange.inRaid = IsInRaid()
watchUnitChange.nameplateFaction = {}
watchUnitChange.raidmark = {}
@@ -2473,6 +2474,7 @@ function WeakAuras.WatchUnitChange(unit)
WeakAuras.frames["Unit Change Frame"] = watchUnitChange;
watchUnitChange:RegisterEvent("PLAYER_TARGET_CHANGED")
watchUnitChange:RegisterEvent("PLAYER_FOCUS_CHANGED");
watchUnitChange:RegisterEvent("PLAYER_ROLES_ASSIGNED");
watchUnitChange:RegisterEvent("UNIT_TARGET");
watchUnitChange:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT");
watchUnitChange:RegisterEvent("PARTY_MEMBERS_CHANGED");
@@ -2516,6 +2518,15 @@ function WeakAuras.WatchUnitChange(unit)
watchUnitChange.nameplateFaction[unit] = newReaction
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
end
elseif event == "PLAYER_ROLES_ASSIGNED" then
for unit in pairs(Private.multiUnitUnits.group) do
local oldRaidRole = watchUnitChange.unitRaidRole[unit]
local newRaidRole = WeakAuras.UnitRaidRole(unit)
if oldRaidRole ~= newRaidRole then
WeakAuras.ScanEvents("UNIT_ROLE_CHANGED_" .. unit, unit)
watchUnitChange.unitRaidRole[unit] = newRaidRole
end
end
else
local inRaid = IsInRaid()
local inRaidChanged = inRaid ~= watchUnitChange.inRaid
+83 -1
View File
@@ -87,6 +87,13 @@ local constants = {
nameRealmFilterDesc = L[" Filter formats: 'Name', 'Name-Realm', '-Realm'. \n\nSupports multiple entries, separated by commas\nCan use \\ to escape -."],
}
WeakAuras.UnitRaidRole = function(unit)
local raidID = UnitInRaid(unit)
if raidID then
return select(10, GetRaidRosterInfo(raidID + 1)) or "NONE"
end
end
function WeakAuras.SpellSchool(school)
return Private.combatlog_spell_school_types[school] or ""
end
@@ -1013,6 +1020,24 @@ local function AddUnitChangeInternalEvents(triggerUnit, t, includePets)
end
end
local function AddUnitRoleChangeInternalEvents(triggerUnit, t)
if (triggerUnit == nil) then
return
end
if Private.multiUnitUnits[triggerUnit] then
for unit in pairs(Private.multiUnitUnits[triggerUnit]) do
if not WeakAuras.UnitIsPet(unit) then
tinsert(t, "UNIT_ROLE_CHANGED_" .. string.lower(unit))
end
end
else
if not WeakAuras.UnitIsPet(triggerUnit) then
tinsert(t, "UNIT_ROLE_CHANGED_" .. string.lower(triggerUnit))
end
end
end
local function AddRemainingCastInternalEvents(triggerUnit, t)
if (triggerUnit == nil) then
return
@@ -1169,6 +1194,7 @@ Private.event_prototypes = {
local unit = trigger.unit
local result = {}
AddUnitChangeInternalEvents(unit, result)
AddUnitRoleChangeInternalEvents(unit, result)
if trigger.unitisunit then
AddUnitChangeInternalEvents(trigger.unitisunit, result)
end
@@ -1264,6 +1290,18 @@ Private.event_prototypes = {
store = true,
conditionType = "select"
},
{
name = "raid_role",
display = L["Raid Role"],
type = "select",
init = "WeakAuras.UnitRaidRole(unit)",
values = "raid_role_types",
store = true,
conditionType = "select",
enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
end
},
{
name = "raidMarkIndex",
display = L["Raid Mark"],
@@ -1513,6 +1551,9 @@ Private.event_prototypes = {
local result = {}
local includePets = trigger.use_includePets == true and trigger.includePets or nil
AddUnitChangeInternalEvents(unit, result, includePets)
if includePets ~= "PetsOnly" then
AddUnitRoleChangeInternalEvents(unit, result)
end
return result
end,
force_events = unitHelperFunctions.UnitChangedForceEventsWithPets,
@@ -1636,6 +1677,18 @@ Private.event_prototypes = {
store = true,
conditionType = "select"
},
{
name = "raid_role",
display = L["Raid Role"],
type = "select",
init = "WeakAuras.UnitRaidRole(unit)",
values = "raid_role_types",
store = true,
conditionType = "select",
enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
end
},
{
name = "raidMarkIndex",
display = L["Raid Mark"],
@@ -1751,7 +1804,9 @@ Private.event_prototypes = {
local result = {}
local includePets = trigger.use_includePets == true and trigger.includePets or nil
AddUnitChangeInternalEvents(unit, result, includePets)
if includePets ~= "PetsOnly" then
AddUnitRoleChangeInternalEvents(unit, result)
end
return result
end,
force_events = unitHelperFunctions.UnitChangedForceEventsWithPets,
@@ -1906,6 +1961,18 @@ Private.event_prototypes = {
store = true,
conditionType = "select"
},
{
name = "raid_role",
display = L["Raid Role"],
type = "select",
init = "WeakAuras.UnitRaidRole(unit)",
values = "raid_role_types",
store = true,
conditionType = "select",
enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
end
},
{
name = "raidMarkIndex",
display = L["Raid Mark"],
@@ -5232,6 +5299,9 @@ Private.event_prototypes = {
AddRemainingCastInternalEvents(unit, result)
local includePets = trigger.use_includePets == true and trigger.includePets or nil
AddUnitChangeInternalEvents(unit, result, includePets)
if includePets ~= "PetsOnly" then
AddUnitRoleChangeInternalEvents(unit, result)
end
return result
end,
loadFunc = function(trigger)
@@ -5416,6 +5486,18 @@ Private.event_prototypes = {
return not trigger.use_inverse
end
},
{
name = "raid_role",
display = L["Raid Role"],
type = "select",
init = "WeakAuras.UnitRaidRole(unit)",
values = "raid_role_types",
store = true,
conditionType = "select",
enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" and not trigger.use_inverse
end
},
{
name = "raidMarkIndex",
display = L["Raid Mark"],
+28 -1
View File
@@ -700,7 +700,34 @@ local function GetBuffTriggerOptions(data, triggernum)
and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.use_includePets)
end
},
useRaidRole = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Filter by Raid Role"],
order = 67.4,
hidden = function() return
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"))
end
},
raid_role = {
type = "multiselect",
width = WeakAuras.normalWidth,
name = L["Raid Role"],
values = OptionsPrivate.Private.raid_role_types,
hidden = function() return
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useRaidRole)
end,
order = 67.5
},
raid_roleSpace = {
type = "description",
name = "",
order = 67.6,
width = WeakAuras.normalWidth,
hidden = function() return
not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and not trigger.useRaidRole)
end
},
useClass = {
type = "toggle",
width = WeakAuras.normalWidth,