rework BT2, fix talentwidget on login didn't fire events

This commit is contained in:
NoM0Re
2025-02-26 11:17:13 +01:00
parent c48ce524f8
commit dd54cdb4e9
3 changed files with 116 additions and 125 deletions
+90 -105
View File
@@ -46,6 +46,18 @@ Returns the potential conditions for a trigger
if not WeakAuras.IsLibsOK() then return end if not WeakAuras.IsLibsOK() then return end
local AddonName, Private = ... local AddonName, Private = ...
local function FixDebuffClass(debuffClass)
if debuffClass == nil then
debuffClass = "none"
elseif debuffClass == "" then
debuffClass = "enrage"
else
debuffClass = string.lower(debuffClass)
end
return debuffClass
end
-- Lua APIs -- Lua APIs
local tinsert, wipe = table.insert, wipe local tinsert, wipe = table.insert, wipe
local pairs, next, type = pairs, next, type local pairs, next, type = pairs, next, type
@@ -240,6 +252,24 @@ local function MatchesTriggerInfoMulti(triggerInfo, sourceGUID)
end end
end end
local function CheckScanFuncs(scanFuncs, unit, filter, key)
if scanFuncs then
for triggerInfo in pairs(scanFuncs) do
if triggerInfo.fetchTooltip then
local md = matchData[unit][filter][key]
md:UpdateTooltip(GetTime())
end
if not triggerInfo.scanFunc or triggerInfo.scanFunc(time, matchData[unit][filter][key]) then
local id = triggerInfo.id
local triggernum = triggerInfo.triggernum
ReferenceMatchData(id, triggernum, unit, filter, key)
matchDataChanged[id] = matchDataChanged[id] or {}
matchDataChanged[id][triggernum] = true
end
end
end
end
local function UpdateToolTipDataInMatchData(matchData, time) local function UpdateToolTipDataInMatchData(matchData, time)
if matchData.tooltipUpdated == time then if matchData.tooltipUpdated == time then
return return
@@ -257,15 +287,15 @@ local function UpdateToolTipDataInMatchData(matchData, time)
return changed return changed
end end
local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId) local function UpdateMatchData(time, matchDataChanged, unit, key, filter, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId)
if not matchData[unit] then if not matchData[unit] then
matchData[unit] = {} matchData[unit] = {}
end end
if not matchData[unit][filter] then if not matchData[unit][filter] then
matchData[unit][filter] = {} matchData[unit][filter] = {}
end end
if not matchData[unit][filter][index] then if not matchData[unit][filter][key] then
matchData[unit][filter][index] = { matchData[unit][filter][key] = {
name = name, name = name,
icon = icon, icon = icon,
stacks = stacks, stacks = stacks,
@@ -281,7 +311,7 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name
time = time, time = time,
lastChanged = time, lastChanged = time,
filter = filter, filter = filter,
index = index, index = key,
UpdateTooltip = UpdateToolTipDataInMatchData, UpdateTooltip = UpdateToolTipDataInMatchData,
auras = {} auras = {}
} }
@@ -289,7 +319,7 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name
return true return true
end end
local data = matchData[unit][filter][index] local data = matchData[unit][filter][key]
local changed = false local changed = false
if data.name ~= name then if data.name ~= name then
@@ -362,11 +392,11 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name
for id, triggerData in pairs(data.auras) do for id, triggerData in pairs(data.auras) do
for triggernum in pairs(triggerData) do for triggernum in pairs(triggerData) do
if matchDataByTrigger[id] if matchDataByTrigger[id]
and matchDataByTrigger[id][triggernum] and matchDataByTrigger[id][triggernum]
and matchDataByTrigger[id][triggernum][unit] and matchDataByTrigger[id][triggernum][unit]
and matchDataByTrigger[id][triggernum][unit][index] and matchDataByTrigger[id][triggernum][unit][key]
then then
matchDataByTrigger[id][triggernum][unit][index] = nil matchDataByTrigger[id][triggernum][unit][key] = nil
matchDataChanged[id] = matchDataChanged[id] or {} matchDataChanged[id] = matchDataChanged[id] or {}
matchDataChanged[id][triggernum] = true matchDataChanged[id][triggernum] = true
end end
@@ -375,7 +405,7 @@ local function UpdateMatchData(time, matchDataChanged, unit, index, filter, name
wipe(data.auras) wipe(data.auras)
end end
data.index = index data.index = key
data.time = time data.time = time
data.unit = unit data.unit = unit
@@ -471,18 +501,18 @@ local function FindBestMatchDataForUnit(time, id, triggernum, triggerInfo, unit)
end end
local GetTexCoordsForRole = function(role) local GetTexCoordsForRole = function(role)
local textureHeight, textureWidth = 256, 256; local textureHeight, textureWidth = 256, 256
local roleHeight, roleWidth = 67, 67; local roleHeight, roleWidth = 67, 67
if ( role == "GUIDE" ) then if ( role == "GUIDE" ) then
return GetTexCoordsByGrid(1, 1, textureWidth, textureHeight, roleWidth, roleHeight); return GetTexCoordsByGrid(1, 1, textureWidth, textureHeight, roleWidth, roleHeight)
elseif ( role == "TANK" ) then elseif ( role == "TANK" ) then
return GetTexCoordsByGrid(1, 2, textureWidth, textureHeight, roleWidth, roleHeight); return GetTexCoordsByGrid(1, 2, textureWidth, textureHeight, roleWidth, roleHeight)
elseif ( role == "HEALER" ) then elseif ( role == "HEALER" ) then
return GetTexCoordsByGrid(2, 1, textureWidth, textureHeight, roleWidth, roleHeight); return GetTexCoordsByGrid(2, 1, textureWidth, textureHeight, roleWidth, roleHeight)
elseif ( role == "DAMAGER" ) then elseif ( role == "DAMAGER" ) then
return GetTexCoordsByGrid(2, 2, textureWidth, textureHeight, roleWidth, roleHeight); return GetTexCoordsByGrid(2, 2, textureWidth, textureHeight, roleWidth, roleHeight)
end end
end end
local roleIcons = { local roleIcons = {
@@ -1266,7 +1296,7 @@ local function UpdateTriggerState(time, id, triggernum)
local cloneId = "" local cloneId = ""
local useMatch = true local useMatch = true
if triggerInfo.unitExists ~= nil and not existingUnits[triggerInfo.unit] then if triggerInfo.unitExists ~= nil and not UnitExistsFixed(triggerInfo.unit) then
useMatch = triggerInfo.unitExists useMatch = triggerInfo.unitExists
else else
useMatch = SatisfiesGroupMatchCount(triggerInfo, unitCount, maxUnitCount, matchCount) useMatch = SatisfiesGroupMatchCount(triggerInfo, unitCount, maxUnitCount, matchCount)
@@ -1322,7 +1352,7 @@ local function UpdateTriggerState(time, id, triggernum)
end end
local useMatches = true local useMatches = true
if triggerInfo.unitExists ~= nil and not existingUnits[triggerInfo.unit] then if triggerInfo.unitExists ~= nil and not UnitExistsFixed(triggerInfo.unit) then
useMatches = triggerInfo.unitExists useMatches = triggerInfo.unitExists
else else
useMatches = SatisfiesGroupMatchCount(triggerInfo, unitCount, maxUnitCount, matchCount) useMatches = SatisfiesGroupMatchCount(triggerInfo, unitCount, maxUnitCount, matchCount)
@@ -1488,14 +1518,7 @@ local function PrepareMatchData(unit, filter)
break break
end end
if debuffClass == nil then local debuffClass = FixDebuffClass(debuffClass)
debuffClass = "none"
elseif debuffClass == "" then
debuffClass = "enrage"
else
debuffClass = string.lower(debuffClass)
end
local updatedMatchData = UpdateMatchData(time, matchDataChanged, unit, index, filter, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId) local updatedMatchData = UpdateMatchData(time, matchDataChanged, unit, index, filter, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId)
index = index + 1 index = index + 1
end end
@@ -1510,7 +1533,7 @@ local function CleanUpOutdatedMatchData(removeIndex, unit, filter)
if matchData[unit] and matchData[unit][filter] then if matchData[unit] and matchData[unit][filter] then
for index = removeIndex, #matchData[unit][filter] do for index = removeIndex, #matchData[unit][filter] do
local data = matchData[unit][filter][index] local data = matchData[unit][filter][index]
if data.index >= removeIndex or not UnitExistsFixed(unit) then if (data and data.index >= removeIndex) or not UnitExistsFixed(unit) then
matchData[unit][filter][index] = nil matchData[unit][filter][index] = nil
for id, triggerData in pairs(data.auras) do for id, triggerData in pairs(data.auras) do
for triggernum in pairs(triggerData) do for triggernum in pairs(triggerData) do
@@ -1563,23 +1586,6 @@ local function DeactivateScanFuncs(toDeactivate)
end end
end end
local function CheckScanFuncs(scanFuncs, unit, filter, index)
if scanFuncs then
for triggerInfo in pairs(scanFuncs) do
if triggerInfo.fetchTooltip then
matchData[unit][filter][index]:UpdateTooltip(GetTime())
end
if not triggerInfo.scanFunc or triggerInfo.scanFunc(time, matchData[unit][filter][index]) then
local id = triggerInfo.id
local triggernum = triggerInfo.triggernum
ReferenceMatchData(id, triggernum, unit, filter, index)
matchDataChanged[id] = matchDataChanged[id] or {}
matchDataChanged[id][triggernum] = true
end
end
end
end
local function ScanUnitWithFilter(matchDataChanged, time, unit, filter, local function ScanUnitWithFilter(matchDataChanged, time, unit, filter,
scanFuncNameGroup, scanFuncSpellIdGroup, scanFuncGeneralGroup, scanFuncNameGroup, scanFuncSpellIdGroup, scanFuncGeneralGroup,
scanFuncName, scanFuncSpellId, scanFuncGeneral) scanFuncName, scanFuncSpellId, scanFuncGeneral)
@@ -1591,22 +1597,14 @@ local function ScanUnitWithFilter(matchDataChanged, time, unit, filter,
return return
end end
local index = 1
if UnitExistsFixed(unit) then if UnitExistsFixed(unit) then
local index = 1
while true do while true do
local name, rank, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId = UnitAura(unit, index, filter) local name, rank, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId = UnitAura(unit, index, filter)
if not name then if not name then
break break
end end
debuffClass = FixDebuffClass(debuffClass)
if debuffClass == nil then
debuffClass = "none"
elseif debuffClass == "" then
debuffClass = "enrage"
else
debuffClass = string.lower(debuffClass)
end
local updatedMatchData = UpdateMatchData(time, matchDataChanged, unit, index, filter, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId) local updatedMatchData = UpdateMatchData(time, matchDataChanged, unit, index, filter, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId)
@@ -1620,9 +1618,9 @@ local function ScanUnitWithFilter(matchDataChanged, time, unit, filter,
end end
index = index + 1 index = index + 1
end end
end
CleanUpOutdatedMatchData(index, unit, filter) CleanUpOutdatedMatchData(index, unit, filter)
end
matchDataUpToDate[unit] = matchDataUpToDate[unit] or {} matchDataUpToDate[unit] = matchDataUpToDate[unit] or {}
matchDataUpToDate[unit][filter] = true matchDataUpToDate[unit][filter] = true
@@ -1711,23 +1709,26 @@ local function ScanGroupUnit(time, matchDataChanged, unitType, unit)
end end
end end
local function ScanUnit(time, arg1) local function UnitToUnitType(unit)
if not arg1 then return end if (Private.multiUnitUnits.raid[unit] and IsInRaid()) then
if (Private.multiUnitUnits.raid[arg1] and IsInRaid()) then return "group"
ScanGroupUnit(time, matchDataChanged, "group", arg1) elseif (Private.multiUnitUnits.party[unit] and not IsInRaid()) then
elseif (Private.multiUnitUnits.party[arg1] and not IsInRaid()) then return "group"
ScanGroupUnit(time, matchDataChanged, "group", arg1) elseif Private.multiUnitUnits.boss[unit] then
elseif Private.multiUnitUnits.boss[arg1] then return "boss", unit
ScanGroupUnit(time, matchDataChanged, "boss", arg1) elseif Private.multiUnitUnits.arena[unit] then
elseif Private.multiUnitUnits.arena[arg1] then return "arena"
ScanGroupUnit(time, matchDataChanged, "arena", arg1) elseif unit:sub(1, 9) == "nameplate" then
elseif arg1:sub(1, 9) == "nameplate" then return "nameplate"
ScanGroupUnit(time, matchDataChanged, "nameplate", arg1)
else else
ScanGroupUnit(time, matchDataChanged, nil, arg1) return nil
end end
end end
local function ScanUnit(time, unit, unitAuraUpdateInfo)
ScanGroupUnit(time, matchDataChanged, UnitToUnitType(unit), unit)
end
local function AddScanFuncs(triggerInfo, filter, unit, scanFuncName, scanFuncSpellId, scanFuncGeneral) local function AddScanFuncs(triggerInfo, filter, unit, scanFuncName, scanFuncSpellId, scanFuncGeneral)
if triggerInfo.auranames then if triggerInfo.auranames then
for _, name in ipairs(triggerInfo.auranames) do for _, name in ipairs(triggerInfo.auranames) do
@@ -1843,15 +1844,11 @@ local function EventHandler(frame, event, arg1, arg2, ...)
local unitsToRemove = {} local unitsToRemove = {}
local time = GetTime() local time = GetTime()
if event == "PLAYER_TARGET_CHANGED" then local targetUnit = Private.player_target_events[event]
ScanGroupUnit(time, matchDataChanged, nil, "target") if targetUnit then
if not UnitExistsFixed("target") then ScanGroupUnit(time, matchDataChanged, nil, targetUnit)
tinsert(unitsToRemove, "target") if not UnitExistsFixed(targetUnit) then
end tinsert(unitsToRemove, targetUnit)
elseif event == "PLAYER_FOCUS_CHANGED" then
ScanGroupUnit(time, matchDataChanged, nil, "focus")
if not UnitExistsFixed("focus") then
tinsert(unitsToRemove, "focus")
end end
elseif event == "UNIT_PET" then elseif event == "UNIT_PET" then
local pet = WeakAuras.unitToPetUnit[arg1] local pet = WeakAuras.unitToPetUnit[arg1]
@@ -1893,8 +1890,8 @@ local function EventHandler(frame, event, arg1, arg2, ...)
local exists = UnitExistsFixed(unit) local exists = UnitExistsFixed(unit)
if not exists then if not exists then
tinsert(unitsToRemove, unit) tinsert(unitsToRemove, unit)
elseif exists ~= existingUnits[unit] then else
ScanGroupUnit(time, matchDataChanged, "group", unit) ScanGroupUnit(time, matchDataChanged, "group", unit, nil)
end end
end end
ScanGroupRoleScanFunc(matchDataChanged) ScanGroupRoleScanFunc(matchDataChanged)
@@ -2477,7 +2474,7 @@ function BuffTrigger.Add(data)
triggerInfos[id] = nil triggerInfos[id] = nil
for triggernum, triggerData in ipairs(data.triggers) do for triggernum, triggerData in ipairs(data.triggers) do
local trigger, untrigger = triggerData.trigger, triggerData.untrigger local trigger = triggerData.trigger
if trigger.type == "aura2" then if trigger.type == "aura2" then
trigger.unit = trigger.unit or "player" trigger.unit = trigger.unit or "player"
@@ -2567,10 +2564,10 @@ function BuffTrigger.Add(data)
local effectiveRaidRole = groupTrigger and trigger.useRaidRole and trigger.raid_role or nil local effectiveRaidRole = groupTrigger and trigger.useRaidRole and trigger.raid_role or nil
local effectiveClass = groupTrigger and trigger.useClass and trigger.class local effectiveClass = groupTrigger and trigger.useClass and trigger.class
local effectiveSpecId = groupTrigger and trigger.useActualSpec and trigger.actualSpec or nil local effectiveSpecId = groupTrigger and trigger.useActualSpec and trigger.actualSpec or nil
local effectiveHostility = (groupTrigger or trigger.unit == "nameplate") and trigger.useHostility and trigger.hostility
local effectiveIgnoreDead = groupTrigger and trigger.ignoreDead local effectiveIgnoreDead = groupTrigger and trigger.ignoreDead
local effectiveIgnoreDisconnected = groupTrigger and trigger.ignoreDisconnected local effectiveIgnoreDisconnected = groupTrigger and trigger.ignoreDisconnected
local effectiveIgnoreInvisible = groupTrigger and trigger.ignoreInvisible local effectiveIgnoreInvisible = groupTrigger and trigger.ignoreInvisible
local effectiveHostility = (groupTrigger or trigger.unit == "nameplate") and trigger.useHostility and trigger.hostility
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)
@@ -3453,13 +3450,8 @@ local function AugmentMatchDataMulti(matchData, unit, filter, sourceGUID, nameKe
return false return false
end end
if debuffClass == nil then debuffClass = FixDebuffClass(debuffClass)
debuffClass = "none"
elseif debuffClass == "" then
debuffClass = "enrage"
else
debuffClass = string.lower(debuffClass)
end
local auraSourceGuid = unitCaster and UnitGUID(unitCaster) local auraSourceGuid = unitCaster and UnitGUID(unitCaster)
if (name == nameKey or spellId == spellKey) and sourceGUID == auraSourceGuid then if (name == nameKey or spellId == spellKey) and sourceGUID == auraSourceGuid then
local changed = AugmentMatchDataMultiWith(matchData, unit, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId) local changed = AugmentMatchDataMultiWith(matchData, unit, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId)
@@ -3543,13 +3535,8 @@ local function CheckAurasMulti(base, unit, filter)
return false return false
end end
if debuffClass == nil then debuffClass = FixDebuffClass(debuffClass)
debuffClass = "none"
elseif debuffClass == "" then
debuffClass = "enrage"
else
debuffClass = string.lower(debuffClass)
end
local auraCasterGUID = unitCaster and UnitGUID(unitCaster) local auraCasterGUID = unitCaster and UnitGUID(unitCaster)
if base[name] and base[name][auraCasterGUID] then if base[name] and base[name][auraCasterGUID] then
local changed = AugmentMatchDataMultiWith(base[name][auraCasterGUID], unit, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId) local changed = AugmentMatchDataMultiWith(base[name][auraCasterGUID], unit, name, icon, stacks, debuffClass, duration, expirationTime, unitCaster, isStealable, _, spellId)
@@ -3611,10 +3598,8 @@ function BuffTrigger.HandleMultiEvent(frame, event, ...)
CombatLog(...) CombatLog(...)
elseif event == "UNIT_TARGET" then elseif event == "UNIT_TARGET" then
TrackUid(...) TrackUid(...)
elseif event == "PLAYER_TARGET_CHANGED" then elseif Private.player_target_events[event] then
TrackUid("target") TrackUid(Private.player_target_events[event])
elseif event == "PLAYER_FOCUS_CHANGED" then
TrackUid("focus")
elseif event == "NAME_PLATE_UNIT_ADDED" then elseif event == "NAME_PLATE_UNIT_ADDED" then
TrackUid(...) TrackUid(...)
elseif event == "NAME_PLATE_UNIT_REMOVED" then elseif event == "NAME_PLATE_UNIT_REMOVED" then
+21 -20
View File
@@ -5,21 +5,21 @@ local AddonName, Private = ...
local tinsert, tsort = table.insert, table.sort local tinsert, tsort = table.insert, table.sort
local tostring = tostring local tostring = tostring
local select, pairs, type = select, pairs, type local select, pairs, type = select, pairs, type
local ceil, min = ceil, min local ceil = ceil
-- WoW APIs -- WoW APIs
local GetTalentInfo = GetTalentInfo local GetTalentInfo = GetTalentInfo
local UnitClass = UnitClass local UnitClass = UnitClass
local GetSpellInfo, GetItemInfo, GetItemCount, GetItemIcon = GetSpellInfo, GetItemInfo, GetItemCount, GetItemIcon local GetSpellInfo, GetItemInfo, GetItemCount, GetItemIcon = GetSpellInfo, GetItemInfo, GetItemCount, GetItemIcon
local GetShapeshiftFormInfo, GetShapeshiftForm = GetShapeshiftFormInfo, GetShapeshiftForm local GetShapeshiftFormInfo, GetShapeshiftForm = GetShapeshiftFormInfo, GetShapeshiftForm
local GetRuneCooldown, UnitCastingInfo, UnitChannelInfo = GetRuneCooldown, UnitCastingInfo, UnitChannelInfo
local UnitDetailedThreatSituation = UnitDetailedThreatSituation local UnitDetailedThreatSituation = UnitDetailedThreatSituation
local MAX_NUM_TALENTS = MAX_NUM_TALENTS or 40
local MONEY = MONEY local MONEY = MONEY
local WeakAuras = WeakAuras local WeakAuras = WeakAuras
local L = WeakAuras.L local L = WeakAuras.L
local LibGroupTalents = LibStub("LibGroupTalents-1.0")
local SpellRange = LibStub("SpellRange-1.0") local SpellRange = LibStub("SpellRange-1.0")
function WeakAuras.IsSpellInRange(spellId, unit) function WeakAuras.IsSpellInRange(spellId, unit)
return SpellRange.IsSpellInRange(spellId, unit) return SpellRange.IsSpellInRange(spellId, unit)
@@ -807,7 +807,7 @@ function WeakAuras.GetSpellCritChance()
return spellCrit return spellCrit
end end
function WeakAuras.GetSpecString(unit) function WeakAuras.SpecForUnit(unit)
local spec = WeakAuras.LGT:GetUnitTalentSpec(unit) local spec = WeakAuras.LGT:GetUnitTalentSpec(unit)
local class = select(2, UnitClass(unit)) local class = select(2, UnitClass(unit))
return spec and class and (class .. spec) return spec and class and (class .. spec)
@@ -1050,7 +1050,7 @@ Private.load_prototype = {
return WeakAuras.CheckTalentByIndex(talent, arg) ~= nil return WeakAuras.CheckTalentByIndex(talent, arg) ~= nil
end, end,
multiConvertKey = nil, multiConvertKey = nil,
events = {"PLAYER_TALENT_UPDATE", "SPELL_UPDATE_USABLE"}, events = {"PLAYER_TALENT_UPDATE", "SPELL_UPDATE_USABLE", "WA_DELAYED_PLAYER_ENTERING_WORLD"},
inverse = nil, inverse = nil,
extraOption = nil, extraOption = nil,
control = "WeakAurasMiniTalent", control = "WeakAurasMiniTalent",
@@ -1076,7 +1076,7 @@ Private.load_prototype = {
return WeakAuras.CheckTalentByIndex(talent, arg) ~= nil return WeakAuras.CheckTalentByIndex(talent, arg) ~= nil
end, end,
multiConvertKey = nil, multiConvertKey = nil,
events = {"PLAYER_TALENT_UPDATE", "SPELL_UPDATE_USABLE"}, events = {"PLAYER_TALENT_UPDATE", "SPELL_UPDATE_USABLE", "WA_DELAYED_PLAYER_ENTERING_WORLD"},
inverse = nil, inverse = nil,
extraOption = nil, extraOption = nil,
control = "WeakAurasMiniTalent", control = "WeakAurasMiniTalent",
@@ -1106,7 +1106,7 @@ Private.load_prototype = {
return WeakAuras.CheckTalentByIndex(talent, arg) ~= nil return WeakAuras.CheckTalentByIndex(talent, arg) ~= nil
end, end,
multiConvertKey = nil, multiConvertKey = nil,
events = {"PLAYER_TALENT_UPDATE", "SPELL_UPDATE_USABLE"}, events = {"PLAYER_TALENT_UPDATE", "SPELL_UPDATE_USABLE", "WA_DELAYED_PLAYER_ENTERING_WORLD"},
inverse = nil, inverse = nil,
extraOption = nil, extraOption = nil,
control = "WeakAurasMiniTalent", control = "WeakAurasMiniTalent",
@@ -1603,7 +1603,7 @@ Private.event_prototypes = {
name = "unitisunit", name = "unitisunit",
display = L["Unit is Unit"], display = L["Unit is Unit"],
type = "unit", type = "unit",
init = "UnitIsUnit(unit, extraUnit) == 1 and true or false", init = "UnitIsUnit(unit, extraUnit)",
values = function(trigger) values = function(trigger)
if Private.multiUnitUnits[trigger.unit] then if Private.multiUnitUnits[trigger.unit] then
return Private.actual_unit_types return Private.actual_unit_types
@@ -1684,7 +1684,7 @@ Private.event_prototypes = {
store = true, store = true,
conditionType = "select", conditionType = "select",
enable = function(trigger) enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" or trigger.unit == "player"
end end
}, },
{ {
@@ -1808,7 +1808,7 @@ Private.event_prototypes = {
name = "attackable", name = "attackable",
display = L["Attackable"], display = L["Attackable"],
type = "tristate", type = "tristate",
init = "UnitCanAttack('player', unit) == 1 and true or false", init = "UnitCanAttack('player', unit)",
store = true, store = true,
conditionType = "bool" conditionType = "bool"
}, },
@@ -1816,7 +1816,7 @@ Private.event_prototypes = {
name = "inCombat", name = "inCombat",
display = L["In Combat"], display = L["In Combat"],
type = "tristate", type = "tristate",
init = "UnitAffectingCombat(unit) == 1 and true or false", init = "UnitAffectingCombat(unit)",
store = true, store = true,
conditionType = "bool" conditionType = "bool"
}, },
@@ -1824,7 +1824,7 @@ Private.event_prototypes = {
name = "afk", name = "afk",
display = L["Afk"], display = L["Afk"],
type = "tristate", type = "tristate",
init = "UnitIsAFK(unit) == 1 and true or false", init = "UnitIsAFK(unit)",
store = true, store = true,
conditionType = "bool" conditionType = "bool"
}, },
@@ -1832,7 +1832,7 @@ Private.event_prototypes = {
name = "dnd", name = "dnd",
display = L["Do Not Disturb"], display = L["Do Not Disturb"],
type = "tristate", type = "tristate",
init = "UnitIsDND(unit) == 1 and true or false", init = "UnitIsDND(unit)",
store = true, store = true,
conditionType = "bool" conditionType = "bool"
}, },
@@ -2170,7 +2170,7 @@ Private.event_prototypes = {
end, end,
operator_types = "none", operator_types = "none",
desc = L["Supports multiple entries, separated by commas. Prefix with '-' for negation."] desc = L["Supports multiple entries, separated by commas. Prefix with '-' for negation."]
}, },
{ {
name = "class", name = "class",
display = L["Class"], display = L["Class"],
@@ -2184,7 +2184,7 @@ Private.event_prototypes = {
name = "specId", name = "specId",
display = L["Specialization"], display = L["Specialization"],
type = "multiselect", type = "multiselect",
init = "WeakAuras.GetSpecString(unit)", init = "WeakAuras.SpecForUnit(unit)",
values = "spec_types_all", values = "spec_types_all",
store = true, store = true,
conditionType = "select", conditionType = "select",
@@ -2202,7 +2202,7 @@ Private.event_prototypes = {
store = true, store = true,
conditionType = "select", conditionType = "select",
enable = function(trigger) enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" or trigger.unit == "player"
end end
}, },
{ {
@@ -2605,7 +2605,7 @@ Private.event_prototypes = {
name = "specId", name = "specId",
display = L["Specialization"], display = L["Specialization"],
type = "multiselect", type = "multiselect",
init = "WeakAuras.GetSpecString(unit)", init = "WeakAuras.SpecForUnit(unit)",
values = "spec_types_all", values = "spec_types_all",
store = true, store = true,
conditionType = "select", conditionType = "select",
@@ -2623,7 +2623,7 @@ Private.event_prototypes = {
store = true, store = true,
conditionType = "select", conditionType = "select",
enable = function(trigger) enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" or trigger.unit == "player"
end end
}, },
{ {
@@ -2707,7 +2707,6 @@ Private.event_prototypes = {
{ {
name = "inRange", name = "inRange",
display = L["In Range"], display = L["In 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."],
type = "toggle", type = "toggle",
width = WeakAuras.doubleWidth, width = WeakAuras.doubleWidth,
enable = function(trigger) enable = function(trigger)
@@ -4462,6 +4461,7 @@ Private.event_prototypes = {
text = function() text = function()
return L["Note: Due to how complicated the swing timer behavior is and the lack of APIs from Blizzard, results are inaccurate in edge cases."] return L["Note: Due to how complicated the swing timer behavior is and the lack of APIs from Blizzard, results are inaccurate in edge cases."]
end, end,
}, },
{ {
name = "hand", name = "hand",
@@ -4738,6 +4738,7 @@ Private.event_prototypes = {
events = { events = {
["events"] = {"PLAYER_TALENT_UPDATE", "SPELL_UPDATE_USABLE"} ["events"] = {"PLAYER_TALENT_UPDATE", "SPELL_UPDATE_USABLE"}
}, },
internal_events = {"WA_DELAYED_PLAYER_ENTERING_WORLD"},
force_events = "PLAYER_TALENT_UPDATE", force_events = "PLAYER_TALENT_UPDATE",
name = L["Talent Known"], name = L["Talent Known"],
init = function(trigger) init = function(trigger)
@@ -6638,7 +6639,7 @@ Private.event_prototypes = {
conditionType = "select", conditionType = "select",
enable = function(trigger) enable = function(trigger)
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
and not trigger.use_inverse or trigger.unit == "player" and not trigger.use_inverse
end end
}, },
{ {
+5
View File
@@ -972,6 +972,11 @@ Private.debuff_class_types = {
none = L["None"] none = L["None"]
} }
Private.player_target_events = {
PLAYER_TARGET_CHANGED = "target",
PLAYER_FOCUS_CHANGED = "focus",
}
Private.unit_types = { Private.unit_types = {
player = L["Player"], player = L["Player"],
target = L["Target"], target = L["Target"],