(feat/BT2): Introduce inRange trigger and fix missing polling for ignoreInvisible (#78)
(cherry picked from commit 67057d6fddb444dc8c205dc99163e9a1e4056326)
This commit is contained in:
+43
-10
@@ -99,6 +99,8 @@ local activeGroupScanFuncs = {}
|
|||||||
|
|
||||||
local raidMarkScanFuncs = {}
|
local raidMarkScanFuncs = {}
|
||||||
|
|
||||||
|
local pollingScanFuncs = {}
|
||||||
|
|
||||||
-- Multi Target tracking
|
-- Multi Target tracking
|
||||||
local scanFuncNameMulti = {}
|
local scanFuncNameMulti = {}
|
||||||
local scanFuncSpellIdMulti = {}
|
local scanFuncSpellIdMulti = {}
|
||||||
@@ -1172,14 +1174,13 @@ local function TriggerInfoApplies(triggerInfo, unit)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if triggerInfo.specId then
|
if triggerInfo.specId then
|
||||||
if not triggerInfo.specId[Private.ExecEnv.GetSpecID(
|
if not triggerInfo.specId[Private.ExecEnv.GetSpecID(
|
||||||
(select(2, UnitClass(controllingUnit)) or "") ..
|
(select(2, UnitClass(controllingUnit)) or "") ..
|
||||||
(Private.ExecEnv.GetUnitTalentSpec(controllingUnit) or ""))] then
|
(Private.ExecEnv.GetUnitTalentSpec(controllingUnit) or ""))] then
|
||||||
return false
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
if triggerInfo.hostility and WeakAuras.GetPlayerReaction(unit) ~= triggerInfo.hostility then
|
if triggerInfo.hostility and WeakAuras.GetPlayerReaction(unit) ~= triggerInfo.hostility then
|
||||||
return false
|
return false
|
||||||
@@ -1228,6 +1229,10 @@ end
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if triggerInfo.inRange and not UnitInRangeFixed(unit) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1996,8 +2001,8 @@ Buff2Frame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
|
|||||||
Buff2Frame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
|
Buff2Frame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
|
||||||
Buff2Frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
Buff2Frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
Buff2Frame:SetScript("OnEvent", EventHandler)
|
Buff2Frame:SetScript("OnEvent", EventHandler)
|
||||||
|
Buff2Frame.elapsed = 0
|
||||||
Buff2Frame:SetScript("OnUpdate", function()
|
Buff2Frame:SetScript("OnUpdate", function(self, elapsed)
|
||||||
if WeakAuras.IsPaused() then
|
if WeakAuras.IsPaused() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -2007,6 +2012,18 @@ Buff2Frame:SetScript("OnUpdate", function()
|
|||||||
UpdateStates(matchDataChanged, time)
|
UpdateStates(matchDataChanged, time)
|
||||||
wipe(matchDataChanged)
|
wipe(matchDataChanged)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if next(pollingScanFuncs) then
|
||||||
|
self.elapsed = self.elapsed + elapsed
|
||||||
|
if self.elapsed >= 1.0 then
|
||||||
|
self.elapsed = 0
|
||||||
|
local deactivatedTriggerInfos = {}
|
||||||
|
for unit in GetAllUnits("group", true, "PlayersAndPets") do
|
||||||
|
RecheckActiveForUnitType("group", unit, deactivatedTriggerInfos)
|
||||||
|
end
|
||||||
|
DeactivateScanFuncs(deactivatedTriggerInfos)
|
||||||
|
end
|
||||||
|
end
|
||||||
Private.StopProfileSystem("bufftrigger2 - OnUpdate")
|
Private.StopProfileSystem("bufftrigger2 - OnUpdate")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -2086,6 +2103,7 @@ function BuffTrigger.UnloadAll()
|
|||||||
wipe(unitExistScanFunc)
|
wipe(unitExistScanFunc)
|
||||||
wipe(groupRoleScanFunc)
|
wipe(groupRoleScanFunc)
|
||||||
wipe(groupScanFuncs)
|
wipe(groupScanFuncs)
|
||||||
|
wipe(pollingScanFuncs)
|
||||||
wipe(raidMarkScanFuncs)
|
wipe(raidMarkScanFuncs)
|
||||||
wipe(matchDataByTrigger)
|
wipe(matchDataByTrigger)
|
||||||
wipe(matchDataMulti)
|
wipe(matchDataMulti)
|
||||||
@@ -2140,7 +2158,7 @@ local function LoadAura(id, triggernum, triggerInfo)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if triggerInfo.fetchRaidMark then
|
if triggerInfo.fetchRaidMark then
|
||||||
raidMarkScanFuncs[id] = raidMarkScanFuncs[id] or {}
|
raidMarkScanFuncs[id] = raidMarkScanFuncs[id] or {}
|
||||||
tinsert(raidMarkScanFuncs[id], triggerInfo)
|
tinsert(raidMarkScanFuncs[id], triggerInfo)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2149,6 +2167,16 @@ local function LoadAura(id, triggernum, triggerInfo)
|
|||||||
tinsert(groupScanFuncs[triggerInfo.unit], triggerInfo)
|
tinsert(groupScanFuncs[triggerInfo.unit], triggerInfo)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if triggerInfo.inRange then
|
||||||
|
pollingScanFuncs[id] = pollingScanFuncs[id] or {}
|
||||||
|
tinsert(pollingScanFuncs[id], triggerInfo)
|
||||||
|
end
|
||||||
|
|
||||||
|
if triggerInfo.ignoreInvisible then
|
||||||
|
pollingScanFuncs[id] = pollingScanFuncs[id] or {}
|
||||||
|
table.insert(pollingScanFuncs[id], triggerInfo)
|
||||||
|
end
|
||||||
|
|
||||||
matchDataChanged[id] = matchDataChanged[id] or {}
|
matchDataChanged[id] = matchDataChanged[id] or {}
|
||||||
matchDataChanged[id][triggernum] = true
|
matchDataChanged[id][triggernum] = true
|
||||||
end
|
end
|
||||||
@@ -2184,6 +2212,7 @@ function BuffTrigger.UnloadDisplays(toUnload)
|
|||||||
|
|
||||||
groupRoleScanFunc[id] = nil
|
groupRoleScanFunc[id] = nil
|
||||||
raidMarkScanFuncs[id] = nil
|
raidMarkScanFuncs[id] = nil
|
||||||
|
pollingScanFuncs[id] = nil
|
||||||
|
|
||||||
for unit, unitData in pairs(matchData) do
|
for unit, unitData in pairs(matchData) do
|
||||||
for filter, filterData in pairs(unitData) do
|
for filter, filterData in pairs(unitData) do
|
||||||
@@ -2265,6 +2294,8 @@ function BuffTrigger.Rename(oldid, newid)
|
|||||||
groupRoleScanFunc[oldid] = nil
|
groupRoleScanFunc[oldid] = nil
|
||||||
raidMarkScanFuncs[newid] = raidMarkScanFuncs[oldid]
|
raidMarkScanFuncs[newid] = raidMarkScanFuncs[oldid]
|
||||||
raidMarkScanFuncs[oldid] = nil
|
raidMarkScanFuncs[oldid] = nil
|
||||||
|
pollingScanFuncs[newid] = pollingScanFuncs[oldid]
|
||||||
|
pollingScanFuncs[oldid] = nil
|
||||||
matchDataChanged[newid] = matchDataChanged[oldid]
|
matchDataChanged[newid] = matchDataChanged[oldid]
|
||||||
matchDataChanged[oldid] = nil
|
matchDataChanged[oldid] = nil
|
||||||
end
|
end
|
||||||
@@ -2630,6 +2661,7 @@ function BuffTrigger.Add(data)
|
|||||||
local effectiveIgnoreInvisible = groupTrigger and trigger.ignoreInvisible
|
local effectiveIgnoreInvisible = groupTrigger and trigger.ignoreInvisible
|
||||||
local effectiveNameCheck = groupTrigger and trigger.useUnitName and trigger.unitName
|
local effectiveNameCheck = groupTrigger and trigger.useUnitName and trigger.unitName
|
||||||
local effectiveNpcId = (trigger.unit == "nameplate" or trigger.unit == "boss") and trigger.useNpcId and Private.ExecEnv.ParseStringCheck(trigger.npcId)
|
local effectiveNpcId = (trigger.unit == "nameplate" or trigger.unit == "boss") and trigger.useNpcId and Private.ExecEnv.ParseStringCheck(trigger.npcId)
|
||||||
|
local effectiveInRange = groupTrigger and trigger.inRange
|
||||||
|
|
||||||
if trigger.unit == "multi" then
|
if trigger.unit == "multi" then
|
||||||
BuffTrigger.InitMultiAura()
|
BuffTrigger.InitMultiAura()
|
||||||
@@ -2685,6 +2717,7 @@ function BuffTrigger.Add(data)
|
|||||||
ignoreDead = effectiveIgnoreDead,
|
ignoreDead = effectiveIgnoreDead,
|
||||||
ignoreDisconnected = effectiveIgnoreDisconnected,
|
ignoreDisconnected = effectiveIgnoreDisconnected,
|
||||||
ignoreInvisible = effectiveIgnoreInvisible,
|
ignoreInvisible = effectiveIgnoreInvisible,
|
||||||
|
inRange = effectiveInRange,
|
||||||
groupRole = effectiveGroupRole,
|
groupRole = effectiveGroupRole,
|
||||||
raidRole = effectiveRaidRole,
|
raidRole = effectiveRaidRole,
|
||||||
specId = effectiveSpecId,
|
specId = effectiveSpecId,
|
||||||
|
|||||||
@@ -1082,6 +1082,14 @@ local function GetBuffTriggerOptions(data, triggernum)
|
|||||||
width = WeakAuras.doubleWidth,
|
width = WeakAuras.doubleWidth,
|
||||||
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
|
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
|
||||||
},
|
},
|
||||||
|
inRange = {
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Ignore out of casting range"],
|
||||||
|
desc = L["Uses UnitInRange() to check if in range. Matches default raid frames out of range behavior, which is between 25 to 40 yards depending on your class and spec."],
|
||||||
|
order = 69.81,
|
||||||
|
width = WeakAuras.doubleWidth,
|
||||||
|
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")) end
|
||||||
|
},
|
||||||
ignoreInvisible = {
|
ignoreInvisible = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Ignore out of checking range"],
|
name = L["Ignore out of checking range"],
|
||||||
|
|||||||
Reference in New Issue
Block a user