This commit is contained in:
Bunny67
2020-09-14 10:12:22 +03:00
parent 6c3f9d925e
commit 0f4f16b6f0
71 changed files with 2302 additions and 2431 deletions
+40 -70
View File
@@ -16,9 +16,6 @@ Unloads the aura ids, disabling all buff triggers in the aura.
UnloadAll()
Unloads all auras, disabling all buff triggers.
ScanAll()
Updates all triggers by checking all triggers.
Delete(id)
Removes all data for aura id.
@@ -92,7 +89,7 @@ local groupScanFuncs = {}
local activeGroupScanFuncs = {}
-- Mutli Target tracking
-- Multi Target tracking
local scanFuncNameMulti = {}
local scanFuncSpellIdMulti = {}
local cleanupTimerMulti = {}
@@ -237,10 +234,10 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name
duration = duration,
expirationTime = expirationTime,
unitCaster = unitCaster,
casterName = unitCaster and UnitName(unitCaster) or "",
casterName = unitCaster and GetUnitName(unitCaster, false) or "",
spellId = spellId,
unit = unit,
unitName = UnitName(unit) or "",
unitName = GetUnitName(unit, false) or "",
isStealable = isStealable,
time = time,
lastChanged = time,
@@ -290,7 +287,7 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name
changed = true
end
local casterName = unitCaster and UnitName(unitCaster) or ""
local casterName = unitCaster and GetUnitName(unitCaster, false) or ""
if data.casterName ~= casterName then
data.casterName = casterName
changed = true
@@ -306,7 +303,7 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name
changed = true
end
local unitName = UnitName(unit) or ""
local unitName = GetUnitName(unit, false) or ""
if data.unitName ~= unitName then
data.unitName = unitName
changed = true
@@ -617,7 +614,7 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId,
affected = affected,
unaffected = unaffected,
unit = unit,
unitName = unit and UnitName(unit) or "",
unitName = unit and GetUnitName(unit, false) or "",
destName = "",
name = fallbackName,
icon = fallbackIcon,
@@ -669,7 +666,7 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId,
changed = true
end
local unitName = unit and UnitName(unit) or ""
local unitName = unit and GetUnitName(unit, false) or ""
if state.unitName ~= unitName then
state.unitName = unitName
changed = true
@@ -881,7 +878,7 @@ local function TriggerInfoApplies(triggerInfo, unit)
if triggerInfo.unit == "group" and triggerInfo.groupSubType == "party" then
if IsInRaid() then
-- Filter our player/party# while in raid and keep only raid units that are correct
if not WeakAuras.multiUnitUnits.raid[unit] or not UnitIsUnit("player", unit) then
if not Private.multiUnitUnits.raid[unit] or not UnitIsUnit("player", unit) then
return false
end
else
@@ -892,11 +889,11 @@ local function TriggerInfoApplies(triggerInfo, unit)
end
-- Filter our player/party# while in raid
if (triggerInfo.unit == "group" and triggerInfo.groupSubType == "group" and IsInRaid() and not WeakAuras.multiUnitUnits.raid[unit]) then
if (triggerInfo.unit == "group" and triggerInfo.groupSubType == "group" and IsInRaid() and not Private.multiUnitUnits.raid[unit]) then
return false
end
if triggerInfo.unit == "group" and triggerInfo.groupSubType == "raid" and not WeakAuras.multiUnitUnits.raid[unit] then
if triggerInfo.unit == "group" and triggerInfo.groupSubType == "raid" and not Private.multiUnitUnits.raid[unit] then
return false
end
@@ -917,9 +914,9 @@ local function FormatAffectedUnaffected(triggerInfo, matchedUnits)
for unit in GetAllUnits(triggerInfo.unit) do
if activeGroupScanFuncs[unit] and activeGroupScanFuncs[unit][triggerInfo] then
if matchedUnits[unit] then
affected = affected .. (UnitName(unit) or unit) .. ", "
affected = affected .. (GetUnitName(unit, false) or unit) .. ", "
else
unaffected = unaffected .. (UnitName(unit) or unit) .. ", "
unaffected = unaffected .. (GetUnitName(unit, false) or unit) .. ", "
end
end
end
@@ -1295,15 +1292,15 @@ end
local function UpdateStates(matchDataChanged, time)
for id, auraData in pairs(matchDataChanged) do
WeakAuras.StartProfileAura(id)
Private.StartProfileAura(id)
local updated = false
for triggernum in pairs(auraData) do
updated = UpdateTriggerState(time, id, triggernum) or updated
end
if updated then
WeakAuras.UpdatedTriggerState(id)
Private.UpdatedTriggerState(id)
end
WeakAuras.StopProfileAura(id)
Private.StopProfileAura(id)
end
end
@@ -1361,7 +1358,7 @@ end
local function ScanAllGroup(time, matchDataChanged)
-- We iterate over all raid/player unit ids here because ScanGroupUnit also
-- handles the cases where a unit existance changes.
-- handles the cases where a unit existence changes.
for unit in GetAllUnits("group") do
ScanGroupUnit(time, matchDataChanged, "group", unit)
end
@@ -1375,13 +1372,13 @@ end
local function ScanUnit(time, arg1)
if not arg1 then return end
if (WeakAuras.multiUnitUnits.raid[arg1] and IsInRaid()) then
if (Private.multiUnitUnits.raid[arg1] and IsInRaid()) then
ScanGroupUnit(time, matchDataChanged, "group", arg1)
elseif (WeakAuras.multiUnitUnits.party[arg1] and not IsInRaid()) then
elseif (Private.multiUnitUnits.party[arg1] and not IsInRaid()) then
ScanGroupUnit(time, matchDataChanged, "group", arg1)
elseif WeakAuras.multiUnitUnits.boss[arg1] then
elseif Private.multiUnitUnits.boss[arg1] then
ScanGroupUnit(time, matchDataChanged, "boss", arg1)
elseif WeakAuras.multiUnitUnits.arena[arg1] then
elseif Private.multiUnitUnits.arena[arg1] then
ScanGroupUnit(time, matchDataChanged, "arena", arg1)
else
ScanGroupUnit(time, matchDataChanged, nil, arg1)
@@ -1488,7 +1485,7 @@ WeakAuras.frames["WeakAuras Buff2 Frame"] = frame
local function EventHandler(frame, event, arg1, arg2, ...)
WeakAuras.StartProfileSystem("bufftrigger2")
Private.StartProfileSystem("bufftrigger2")
local deactivatedTriggerInfos = {}
local unitsToRemove = {}
@@ -1534,7 +1531,7 @@ local function EventHandler(frame, event, arg1, arg2, ...)
end
end
elseif event == "UNIT_FLAGS" or event == "UNIT_NAME_UPDATE" or event == "PLAYER_FLAGS_CHANGED" then
if WeakAuras.multiUnitUnits.group[arg1] then
if Private.multiUnitUnits.group[arg1] then
RecheckActiveForUnitType("group", arg1, deactivatedTriggerInfos)
end
elseif event == "UNIT_ENTERED_VEHICLE" or event == "UNIT_EXITED_VEHICLE" then
@@ -1560,7 +1557,7 @@ local function EventHandler(frame, event, arg1, arg2, ...)
matchDataUpToDate[unit] = nil
end
WeakAuras.StopProfileSystem("bufftrigger2")
Private.StopProfileSystem("bufftrigger2")
end
frame:RegisterEvent("UNIT_AURA")
@@ -1583,42 +1580,15 @@ frame:SetScript("OnUpdate", function()
if WeakAuras.IsPaused() then
return
end
WeakAuras.StartProfileSystem("bufftrigger2")
Private.StartProfileSystem("bufftrigger2")
if next(matchDataChanged) then
local time = GetTime()
UpdateStates(matchDataChanged, time)
wipe(matchDataChanged)
end
WeakAuras.StopProfileSystem("bufftrigger2")
Private.StopProfileSystem("bufftrigger2")
end)
function BuffTrigger.ScanAll()
local units = {}
local time = GetTime()
for unit in pairs(scanFuncName) do
units[unit] = true
end
for unit in pairs(scanFuncSpellId) do
units[unit] = true
end
for unit in pairs(scanFuncGeneral) do
units[unit] = true
end
for unit in pairs(units) do
if unit == "group" then
ScanAllGroup(time, matchDataChanged)
elseif unit == "boss" then
ScanAllBoss(time, matchDataChanged)
else
ScanGroupUnit(time, matchDataChanged, nil, unit)
end
end
end
local function UnloadAura(scanFuncName, id)
for unit, unitData in pairs(scanFuncName) do
for debuffType, debuffData in pairs(unitData) do
@@ -1909,7 +1879,7 @@ local function createScanFunc(trigger)
return false
end
]]
ret = ret .. ret2:format(trigger.debuffClass and type(trigger.debuffClass) == "table" and WeakAuras.SerializeTable(trigger.debuffClass) or "{}")
ret = ret .. ret2:format(trigger.debuffClass and type(trigger.debuffClass) == "table" and Private.SerializeTable(trigger.debuffClass) or "{}")
end
if trigger.ownOnly then
@@ -2088,7 +2058,7 @@ function BuffTrigger.Add(data)
local remFunc
if trigger.unit ~= "multi" and not IsSingleMissing(trigger) and trigger.useRem then
local remFuncStr = WeakAuras.function_strings.count:format(trigger.remOperator or ">=", tonumber(trigger.rem) or 0)
local remFuncStr = Private.function_strings.count:format(trigger.remOperator or ">=", tonumber(trigger.rem) or 0)
remFunc = WeakAuras.LoadFunction(remFuncStr)
end
@@ -2109,15 +2079,15 @@ function BuffTrigger.Add(data)
local groupCountFunc
if effectiveUseGroupCount then
local group_countFuncStr
local count, countType = WeakAuras.ParseNumber(trigger.group_count)
local count, countType = Private.ParseNumber(trigger.group_count)
if trigger.group_countOperator and count and countType then
if countType == "whole" then
group_countFuncStr = WeakAuras.function_strings.count:format(trigger.group_countOperator, count)
group_countFuncStr = Private.function_strings.count:format(trigger.group_countOperator, count)
else
group_countFuncStr = WeakAuras.function_strings.count_fraction:format(trigger.group_countOperator, count)
group_countFuncStr = Private.function_strings.count_fraction:format(trigger.group_countOperator, count)
end
else
group_countFuncStr = WeakAuras.function_strings.count:format(">", 0)
group_countFuncStr = Private.function_strings.count:format(">", 0)
end
groupCountFunc = WeakAuras.LoadFunction(group_countFuncStr)
end
@@ -2125,7 +2095,7 @@ function BuffTrigger.Add(data)
local matchCountFunc
if HasMatchCount(trigger) and trigger.match_countOperator and trigger.match_count then
local count = tonumber(trigger.match_count)
local match_countFuncStr = WeakAuras.function_strings.count:format(trigger.match_countOperator, count)
local match_countFuncStr = Private.function_strings.count:format(trigger.match_countOperator, count)
matchCountFunc = WeakAuras.LoadFunction(match_countFuncStr)
elseif IsGroupTrigger(trigger) then
if trigger.showClones and not trigger.combinePerUnit then
@@ -2369,7 +2339,7 @@ function BuffTrigger.GetTriggerConditions(data, triggernum)
result["debuffClass"] = {
display = L["Debuff Type"],
type = "select",
values = WeakAuras.debuff_class_types
values = Private.debuff_class_types
}
result["unitCaster"] = {
@@ -2475,7 +2445,7 @@ function BuffTrigger.GetName(triggerType)
end
end
function WeakAuras.CanConvertBuffTrigger2(trigger)
function Private.CanConvertBuffTrigger2(trigger)
if trigger.type ~= "aura" then
return false
end
@@ -2505,8 +2475,8 @@ function WeakAuras.CanConvertBuffTrigger2(trigger)
return true
end
function WeakAuras.ConvertBuffTrigger2(trigger)
if not WeakAuras.CanConvertBuffTrigger2(trigger) then
function Private.ConvertBuffTrigger2(trigger)
if not Private.CanConvertBuffTrigger2(trigger) then
return
end
trigger.type = "aura2"
@@ -2842,7 +2812,7 @@ local function AugmentMatchDataMultiWith(matchData, unit, name, icon, stacks, de
changed = true
end
local casterName = UnitName(unitCaster) or ""
local casterName = GetUnitName(unitCaster, false) or ""
if matchData.casterName ~= casterName then
matchData.casterName = casterName
changed = true
@@ -2853,7 +2823,7 @@ local function AugmentMatchDataMultiWith(matchData, unit, name, icon, stacks, de
changed = true
end
local unitName = UnitName(unit) or ""
local unitName = GetUnitName(unit, false) or ""
if matchData.unitName ~= unitName then
matchData.unitName = unitName
changed = true
@@ -3023,7 +2993,7 @@ function BuffTrigger.InitMultiAura()
end
function BuffTrigger.HandleMultiEvent(frame, event, ...)
WeakAuras.StartProfileSystem("bufftrigger2 - multi")
Private.StartProfileSystem("bufftrigger2 - multi")
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
CombatLog(...)
elseif event == "UNIT_TARGET" then
@@ -3049,7 +3019,7 @@ function BuffTrigger.HandleMultiEvent(frame, event, ...)
end
wipe(matchDataMulti)
end
WeakAuras.StopProfileSystem("bufftrigger2 - multi")
Private.StopProfileSystem("bufftrigger2 - multi")
end
function BuffTrigger.GetTriggerDescription(data, triggernum, namestable)