from retail

This commit is contained in:
Bunny67
2020-07-11 00:19:17 +03:00
parent bbb4ac1c37
commit 6a7003b535
27 changed files with 2317 additions and 647 deletions
+33 -16
View File
@@ -82,7 +82,7 @@ local scanFuncNameGroup = {}
local scanFuncSpellIdGroup = {}
local scanFuncGeneralGroup = {}
-- Contains all scanFuncs that should be check if the exitance of a unit changed
-- Contains all scanFuncs that should be check if the existence of a unit changed
local unitExistScanFunc = {}
-- Which units exist
local existingUnits = {}
@@ -870,6 +870,10 @@ local function TriggerInfoApplies(triggerInfo, unit)
return false
end
if triggerInfo.ignoreInvisible and not UnitIsVisible(unit) then
return false
end
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
@@ -895,6 +899,11 @@ local function TriggerInfoApplies(triggerInfo, unit)
if triggerInfo.class and not triggerInfo.class[select(2, UnitClass(unit))] then
return false
end
if triggerInfo.nameChecker and not triggerInfo.nameChecker:Check(WeakAuras.UnitNameWithRealm(unit)) then
return false
end
return true
end
@@ -1012,8 +1021,8 @@ local function UpdateTriggerState(time, id, triggernum)
useMatches = SatisfiesGroupMatchCount(triggerInfo, unitCount, maxUnitCount, matchCount)
end
local cloneIds = {}
if useMatches then
table.sort(auraDatas, SortMatchDataByUnitIndex)
local affected, unaffected
@@ -1022,7 +1031,6 @@ local function UpdateTriggerState(time, id, triggernum)
end
local usedCloneIds = {};
for index, auraData in ipairs(auraDatas) do
local cloneId = (auraData.GUID or auraData.unit or "unknown") .. " " .. auraData.spellId
if usedCloneIds[cloneId] then
@@ -1033,15 +1041,17 @@ local function UpdateTriggerState(time, id, triggernum)
end
updated = UpdateStateWithMatch(time, auraData, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCountPerUnit[auraData.unit], totalStacks, affected, unaffected) or updated
cloneIds[cloneId] = true
end
if matchCount == 0 then
updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, "", nil, 0, 0, maxUnitCount, 0, totalStacks, affected, unaffected) or updated
cloneIds[""] = true
end
end
for cloneId, state in pairs(triggerStates) do
if state.show and state.time < time then
if not cloneIds[cloneId] then
updated = RemoveState(triggerStates, cloneId) or updated
end
end
@@ -1069,6 +1079,7 @@ local function UpdateTriggerState(time, id, triggernum)
local useMatches = SatisfiesGroupMatchCount(triggerInfo, unitCount, maxUnitCount, matchCount)
local cloneIds = {}
if useMatches then
local affected, unaffected
if triggerInfo.useAffected then
@@ -1079,6 +1090,7 @@ local function UpdateTriggerState(time, id, triggernum)
for unit, bestMatch in pairs(matches) do
if bestMatch then
updated = UpdateStateWithMatch(time, bestMatch, triggerStates, unit, matchCount, unitCount, maxUnitCount, matchCountPerUnit[unit], totalStacks, affected, unaffected) or updated
cloneIds[unit] = true
end
end
else
@@ -1089,9 +1101,11 @@ local function UpdateTriggerState(time, id, triggernum)
if bestMatch then
if triggerInfo.perUnitMode == "all" then
updated = UpdateStateWithMatch(time, bestMatch, triggerStates, unit, matchCount, unitCount, maxUnitCount, matchCountPerUnit[unit], totalStacks, affected, unaffected) or updated
cloneIds[unit] = true
end
else
updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, unit, unit, matchCount, unitCount, maxUnitCount, matchCountPerUnit[unit], totalStacks, affected, unaffected) or updated
cloneIds[unit] = true
end
end
end
@@ -1099,7 +1113,7 @@ local function UpdateTriggerState(time, id, triggernum)
end
for cloneId, state in pairs(triggerStates) do
if state.show and state.time < time then
if not cloneIds[cloneId] then
updated = RemoveState(triggerStates, cloneId) or updated
end
end
@@ -1156,11 +1170,12 @@ local function PrepareMatchData(unit, filter)
end
end
local function CleanUpOutdatedMatchData(time, unit, filter)
local function CleanUpOutdatedMatchData(removeIndex, unit, filter)
-- Figure out if any matchData is outdated
if matchData[unit] and matchData[unit][filter] then
for index, data in pairs(matchData[unit][filter]) do
if data.time < time or not UnitExists(unit) then
for index = removeIndex, #matchData[unit][filter] do
local data = matchData[unit][filter][index]
if data.index >= removeIndex or not UnitExists(unit) then
matchData[unit][filter][index] = nil
for id, triggerData in pairs(data.auras) do
for triggernum in pairs(triggerData) do
@@ -1233,7 +1248,7 @@ local function ScanUnitWithFilter(matchDataChanged, time, unit, filter,
if matchDataUpToDate[unit] then
matchDataUpToDate[unit][filter] = nil
end
CleanUpOutdatedMatchData(time, unit, filter)
CleanUpOutdatedMatchData(1, unit, filter)
return
end
@@ -1268,7 +1283,7 @@ local function ScanUnitWithFilter(matchDataChanged, time, unit, filter,
end
end
CleanUpOutdatedMatchData(time, unit, filter)
CleanUpOutdatedMatchData(index, unit, filter)
matchDataUpToDate[unit] = matchDataUpToDate[unit] or {}
matchDataUpToDate[unit][filter] = true
@@ -1514,11 +1529,7 @@ local function EventHandler(frame, event, arg1, arg2, ...)
tinsert(unitsToRemove, unit)
end
end
elseif event == "UNIT_FLAGS" then
if WeakAuras.multiUnitUnits.group[arg1] then
RecheckActiveForUnitType("group", arg1, deactivatedTriggerInfos)
end
elseif event == "PLAYER_FLAGS_CHANGED" then
elseif event == "UNIT_FLAGS" or event == "UNIT_NAME_UPDATE" or event == "PLAYER_FLAGS_CHANGED" then
if WeakAuras.multiUnitUnits.group[arg1] then
RecheckActiveForUnitType("group", arg1, deactivatedTriggerInfos)
end
@@ -1549,6 +1560,7 @@ local function EventHandler(frame, event, arg1, arg2, ...)
end
frame:RegisterEvent("UNIT_AURA")
frame:RegisterEvent("UNIT_NAME_UPDATE")
frame:RegisterEvent("UNIT_FLAGS")
frame:RegisterEvent("PLAYER_FLAGS_CHANGED")
frame:RegisterEvent("UNIT_PET")
@@ -2128,6 +2140,8 @@ function BuffTrigger.Add(data)
local effectiveClass = groupTrigger and trigger.useClass and trigger.class
local effectiveIgnoreDead = groupTrigger and trigger.ignoreDead
local effectiveIgnoreDisconnected = groupTrigger and trigger.ignoreDisconnected
local effectiveIgnoreInvisible = groupTrigger and trigger.ignoreInvisible
local effectiveNameCheck = groupTrigger and trigger.useUnitName and trigger.unitName
if trigger.unit == "multi" then
BuffTrigger.InitMultiAura()
@@ -2180,12 +2194,14 @@ function BuffTrigger.Add(data)
ignoreSelf = effectiveIgnoreSelf,
ignoreDead = effectiveIgnoreDead,
ignoreDisconnected = effectiveIgnoreDisconnected,
ignoreInvisible = effectiveIgnoreInvisible,
groupSubType = groupSubType,
groupCountFunc = groupCountFunc,
class = effectiveClass,
matchCountFunc = matchCountFunc,
useAffected = unit == "group" and trigger.useAffected,
isMulti = trigger.unit == "multi",
nameChecker = effectiveNameCheck and WeakAuras.ParseNameCheck(trigger.unitName)
}
triggerInfos[id] = triggerInfos[id] or {}
triggerInfos[id][triggernum] = triggerInformation
@@ -2322,6 +2338,7 @@ function BuffTrigger.GetAdditionalProperties(data, triggernum)
ret = ret .. "|cFFFF0000%".. triggernum .. ".debuffClass|r - " .. L["Debuff Class"] .. "\n"
ret = ret .. "|cFFFF0000%".. triggernum .. ".unitCaster|r - " .. L["Caster Unit"] .. "\n"
ret = ret .. "|cFFFF0000%".. triggernum .. ".casterName|r - " .. L["Caster Name"] .. "\n"
ret = ret .. "|cFFFF0000%".. triggernum .. ".unit|r - " .. L["Unit"] .. "\n"
ret = ret .. "|cFFFF0000%".. triggernum .. ".unitName|r - " .. L["Unit Name"] .. "\n"
ret = ret .. "|cFFFF0000%".. triggernum .. ".matchCount|r - " .. L["Match Count"] .. "\n"
ret = ret .. "|cFFFF0000%".. triggernum .. ".matchCountPerUnit|r - " .. L["Match Count per Unit"] .. "\n"
@@ -2385,7 +2402,7 @@ function BuffTrigger.GetTriggerConditions(data, triggernum)
result["spellId"] = {
display = L["Spell Id"],
type = "number",
operator_types_only_equal = true
operator_types = "only_equal"
}
result["matchCount"] = {