from retail

This commit is contained in:
NoM0Re
2025-01-17 21:00:15 +01:00
parent efdbb3c46d
commit bd46c605bd
3 changed files with 34 additions and 17 deletions
+29 -16
View File
@@ -466,7 +466,7 @@ local function FindBestMatchDataForUnit(time, id, triggernum, triggerInfo, unit)
return bestMatch, matchCount, stackCount, nextCheck return bestMatch, matchCount, stackCount, nextCheck
end end
local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, unaffected, raidMark) local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, raidMark)
if not triggerStates[cloneId] then if not triggerStates[cloneId] then
triggerStates[cloneId] = { triggerStates[cloneId] = {
show = true, show = true,
@@ -497,7 +497,9 @@ local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, mat
tooltip3 = bestMatch.tooltip3, tooltip3 = bestMatch.tooltip3,
tooltip4 = bestMatch.tooltip4, tooltip4 = bestMatch.tooltip4,
affected = affected, affected = affected,
affectedUnits = affectedUnits,
unaffected = unaffected, unaffected = unaffected,
unaffectedUnits = unaffectedUnits,
totalStacks = totalStacks, totalStacks = totalStacks,
initialTime = time, initialTime = time,
refreshTime = time, refreshTime = time,
@@ -658,11 +660,13 @@ local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, mat
if state.affected ~= affected then if state.affected ~= affected then
state.affected = affected state.affected = affected
state.affectedUnits = affectedUnits
changed = true changed = true
end end
if state.unaffected ~= unaffected then if state.unaffected ~= unaffected then
state.unaffected = unaffected state.unaffected = unaffected
state.unaffectedUnits = unaffectedUnits
changed = true changed = true
end end
@@ -683,7 +687,7 @@ local function UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, mat
end end
end end
local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, unit, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, unaffected, raidMark) local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, unit, matchCount, unitCount, maxUnitCount, matchCountPerUnit, totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, raidMark)
local fallbackName, fallbackIcon = BuffTrigger.GetNameAndIconSimple(WeakAuras.GetData(triggerInfo.id), triggerInfo.triggernum) local fallbackName, fallbackIcon = BuffTrigger.GetNameAndIconSimple(WeakAuras.GetData(triggerInfo.id), triggerInfo.triggernum)
if not triggerStates[cloneId] then if not triggerStates[cloneId] then
triggerStates[cloneId] = { triggerStates[cloneId] = {
@@ -699,7 +703,9 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId,
active = false, active = false,
time = time, time = time,
affected = affected, affected = affected,
affectedUnits = affectedUnits,
unaffected = unaffected, unaffected = unaffected,
unaffectedUnits = unaffectedUnits,
unit = unit, unit = unit,
raidMark = raidMark, raidMark = raidMark,
unitName = unit and GetUnitName(unit, false) or "", unitName = unit and GetUnitName(unit, false) or "",
@@ -832,11 +838,13 @@ local function UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId,
if state.affected ~= affected then if state.affected ~= affected then
state.affected = affected state.affected = affected
state.affectedUnits = affectedUnits
changed = true changed = true
end end
if state.unaffected ~= unaffected then if state.unaffected ~= unaffected then
state.unaffected = unaffected state.unaffected = unaffected
state.unaffectedUnits = unaffectedUnits
changed = true changed = true
end end
@@ -1111,19 +1119,22 @@ end
local function FormatAffectedUnaffected(triggerInfo, matchedUnits) local function FormatAffectedUnaffected(triggerInfo, matchedUnits)
local affected = "" local affected = ""
local unaffected = "" local unaffected = ""
local affectedUnits, unaffectedUnits = {}, {}
for unit in GetAllUnits(triggerInfo.unit, nil, triggerInfo.includePets) do for unit in GetAllUnits(triggerInfo.unit, nil, triggerInfo.includePets) do
if activeGroupScanFuncs[unit] and activeGroupScanFuncs[unit][triggerInfo] then if activeGroupScanFuncs[unit] and activeGroupScanFuncs[unit][triggerInfo] then
if matchedUnits[unit] then if matchedUnits[unit] then
affected = affected .. (GetUnitName(unit, false) or unit) .. ", " affected = affected .. (GetUnitName(unit, false) or unit) .. ", "
tinsert(affectedUnits, unit)
else else
unaffected = unaffected .. (GetUnitName(unit, false) or unit) .. ", " unaffected = unaffected .. (GetUnitName(unit, false) or unit) .. ", "
tinsert(unaffectedUnits, unit)
end end
end end
end end
unaffected = unaffected == "" and L["None"] or unaffected:sub(1, -3) unaffected = unaffected == "" and L["None"] or unaffected:sub(1, -3)
affected = affected == "" and L["None"] or affected:sub(1, -3) affected = affected == "" and L["None"] or affected:sub(1, -3)
return affected, unaffected return affected, affectedUnits, unaffected, unaffectedUnits
end end
local recheckTriggerInfo local recheckTriggerInfo
@@ -1196,18 +1207,18 @@ local function UpdateTriggerState(time, id, triggernum)
end end
if useMatch then if useMatch then
local affected, unaffected local affected, unaffected, affectedUnits, unaffectedUnits
if triggerInfo.useAffected then if triggerInfo.useAffected then
affected, unaffected = FormatAffectedUnaffected(triggerInfo, matchedUnits) affected, affectedUnits, unaffected, unaffectedUnits = FormatAffectedUnaffected(triggerInfo, matchedUnits)
end end
local unit = bestUnit(triggerInfo, bestMatch) local unit = bestUnit(triggerInfo, bestMatch)
local mark = markForTriggerInfo(triggerInfo, unit) local mark = markForTriggerInfo(triggerInfo, unit)
if bestMatch then if bestMatch then
updated = UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCount, totalStacks, affected, unaffected, mark) updated = UpdateStateWithMatch(time, bestMatch, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, matchCount, totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, mark)
else else
updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, unit, 0, 0, maxUnitCount, 0, 0, affected, unaffected, mark) updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, cloneId, unit, 0, 0, maxUnitCount, 0, 0, affected, affectedUnits, unaffected, unaffectedUnits, mark)
end end
else else
updated = RemoveState(triggerStates, cloneId) updated = RemoveState(triggerStates, cloneId)
@@ -1250,9 +1261,9 @@ local function UpdateTriggerState(time, id, triggernum)
if useMatches then if useMatches then
table.sort(auraDatas, SortMatchDataByUnitIndex) table.sort(auraDatas, SortMatchDataByUnitIndex)
local affected, unaffected local affected, affectedUnits, unaffected, unaffectedUnits
if triggerInfo.useAffected then if triggerInfo.useAffected then
affected, unaffected = FormatAffectedUnaffected(triggerInfo, matchedUnits) affected, affectedUnits, unaffected, unaffectedUnits = FormatAffectedUnaffected(triggerInfo, matchedUnits)
end end
local usedCloneIds = {}; local usedCloneIds = {};
@@ -1267,7 +1278,7 @@ local function UpdateTriggerState(time, id, triggernum)
local mark = markForTriggerInfo(triggerInfo, auraData.unit) local mark = markForTriggerInfo(triggerInfo, auraData.unit)
updated = UpdateStateWithMatch(time, auraData, triggerStates, cloneId, matchCount, unitCount, maxUnitCount, updated = UpdateStateWithMatch(time, auraData, triggerStates, cloneId, matchCount, unitCount, maxUnitCount,
matchCountPerUnit[auraData.unit], totalStacks, affected, unaffected, mark) or updated matchCountPerUnit[auraData.unit], totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, mark) or updated
cloneIds[cloneId] = true cloneIds[cloneId] = true
end end
@@ -1275,7 +1286,7 @@ local function UpdateTriggerState(time, id, triggernum)
local unit = bestUnit(triggerInfo, nil) local unit = bestUnit(triggerInfo, nil)
local mark = markForTriggerInfo(triggerInfo, unit) local mark = markForTriggerInfo(triggerInfo, unit)
updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, "", nil, 0, 0, maxUnitCount, 0, totalStacks, updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, "", nil, 0, 0, maxUnitCount, 0, totalStacks,
affected, unaffected, mark) or updated affected, affectedUnits, unaffected, unaffectedUnits, mark) or updated
cloneIds[""] = true cloneIds[""] = true
end end
end end
@@ -1314,9 +1325,9 @@ local function UpdateTriggerState(time, id, triggernum)
local cloneIds = {} local cloneIds = {}
if useMatches then if useMatches then
local affected, unaffected local affected, affectedUnits, unaffected, unaffectedUnits
if triggerInfo.useAffected then if triggerInfo.useAffected then
affected, unaffected = FormatAffectedUnaffected(triggerInfo, matchedUnits) affected, affectedUnits, unaffected, unaffectedUnits = FormatAffectedUnaffected(triggerInfo, matchedUnits)
end end
if triggerInfo.perUnitMode == "affected" then if triggerInfo.perUnitMode == "affected" then
@@ -1324,7 +1335,7 @@ local function UpdateTriggerState(time, id, triggernum)
if bestMatch then if bestMatch then
local mark = markForTriggerInfo(triggerInfo, unit) local mark = markForTriggerInfo(triggerInfo, unit)
updated = UpdateStateWithMatch(time, bestMatch, triggerStates, unit, matchCount, unitCount, maxUnitCount, updated = UpdateStateWithMatch(time, bestMatch, triggerStates, unit, matchCount, unitCount, maxUnitCount,
matchCountPerUnit[unit], totalStacks, affected, unaffected, mark) matchCountPerUnit[unit], totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, mark)
or updated or updated
cloneIds[unit] = true cloneIds[unit] = true
end end
@@ -1338,14 +1349,14 @@ local function UpdateTriggerState(time, id, triggernum)
if bestMatch then if bestMatch then
if triggerInfo.perUnitMode == "all" then if triggerInfo.perUnitMode == "all" then
updated = UpdateStateWithMatch(time, bestMatch, triggerStates, unit, matchCount, unitCount, maxUnitCount, updated = UpdateStateWithMatch(time, bestMatch, triggerStates, unit, matchCount, unitCount, maxUnitCount,
matchCountPerUnit[unit], totalStacks, affected, unaffected, mark) matchCountPerUnit[unit], totalStacks, affected, affectedUnits, unaffected, unaffectedUnits, mark)
or updated or updated
cloneIds[unit] = true cloneIds[unit] = true
end end
else else
updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, unit, unit, matchCount, updated = UpdateStateWithNoMatch(time, triggerStates, triggerInfo, unit, unit, matchCount,
unitCount, maxUnitCount, matchCountPerUnit[unit], totalStacks, unitCount, maxUnitCount, matchCountPerUnit[unit], totalStacks,
affected, unaffected) affected, affectedUnits, unaffected, unaffectedUnits)
or updated or updated
cloneIds[unit] = true cloneIds[unit] = true
end end
@@ -2657,6 +2668,8 @@ function BuffTrigger.GetAdditionalProperties(data, triggernum)
if (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useAffected then if (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party") and trigger.useAffected then
ret = ret .. "|cFFFF0000%".. triggernum .. ".affected|r - " .. L["Names of affected Players"] .. "\n" ret = ret .. "|cFFFF0000%".. triggernum .. ".affected|r - " .. L["Names of affected Players"] .. "\n"
ret = ret .. "|cFFFF0000%".. triggernum .. ".unaffected|r - " .. L["Names of unaffected Players"] .. "\n" ret = ret .. "|cFFFF0000%".. triggernum .. ".unaffected|r - " .. L["Names of unaffected Players"] .. "\n"
ret = ret .. "|cFFFF0000%".. triggernum .. ".affectedUnits|r - " .. L["Units of affected Players in a table format"] .. "\n"
ret = ret .. "|cFFFF0000%".. triggernum .. ".unaffectedUnits|r - " .. L["Units of unaffected Players in a table format"] .. "\n"
end end
return ret return ret
+4
View File
@@ -1465,5 +1465,9 @@ function Private.Modernize(data)
end end
end end
if data.internalVersion < 69 then
migrateToTable(data.load, "itemequiped")
end
data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion()) data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion())
end end
+1 -1
View File
@@ -669,7 +669,7 @@ local function GetBuffTriggerOptions(data, triggernum)
}, },
useAffected = { useAffected = {
type = "toggle", type = "toggle",
name = L["Fetch Affected/Unaffected Names"], name = L["Fetch Affected/Unaffected Names and Units"],
width = WeakAuras.doubleWidth, width = WeakAuras.doubleWidth,
order = 65.1, order = 65.1,
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