from retail

This commit is contained in:
NoM0Re
2025-01-16 17:04:03 +01:00
parent c133385b44
commit 64a21e9030
5 changed files with 1604 additions and 967 deletions
+11 -2
View File
@@ -461,9 +461,18 @@ local FakeWeakAurasMixin = {
return data and CopyTable(data) or nil
end,
clones = MakeDeprecated(Private.clones, "clones",
L["Using WeakAuras.clones is deprecated. Use WeakAuras.GetRegion(id, cloneId) instead."]),
L["Using WeakAuras.clones is deprecated. Use WeakAuras.GetRegion(id, cloneId) instead."]),
regions = MakeDeprecated(Private.regions, "regions",
L["Using WeakAuras.regions is deprecated. Use WeakAuras.GetRegion(id) instead."])
L["Using WeakAuras.regions is deprecated. Use WeakAuras.GetRegion(id) instead."]),
GetAllDBMTimers = function() return Private.ExecEnv.BossMods.DBM:GetAllTimers() end,
GetDBMTimerById = function(...) return Private.ExecEnv.BossMods.DBM:GetTimerById(...) end,
GetDBMTimer = function(...) return Private.ExecEnv.BossMods.DBM:GetTimer(...) end,
GetBigWigsTimerById = function(...) return Private.ExecEnv.BossMods.BigWigs:GetTimerById(...) end,
GetAllBigWigsTimers = function() return Private.ExecEnv.BossMods.BigWigs:GetAllTimers() end,
GetBigWigsStage = function(...) return Private.ExecEnv.BossMods.BigWigs:GetStage(...) end,
RegisterBigWigsTimer = function() Private.ExecEnv.BossMods.BigWigs:RegisterTimer() end,
RegisterDBMCallback = function() Private.ExecEnv.BossMods.DBM:RegisterTimer() end,
GetBossStage = function() return Private.ExecEnv.BossMods.Generic:GetStage() end
},
blocked = blocked,
setBlocked = function()
File diff suppressed because it is too large Load Diff
-438
View File
@@ -3040,444 +3040,6 @@ function WeakAuras.GetEquipmentSetInfo(itemSetName, partial)
return bestMatchName, bestMatchIcon, bestMatchNumEquipped, bestMatchNumItems;
end
-- DBM
do
local registeredDBMEvents = {}
local bars = {}
local nextExpire -- time of next expiring timer
local recheckTimer -- handle of timer
local currentStage = 0
local function dbmRecheckTimers()
local now = GetTime()
nextExpire = nil
for id, bar in pairs(bars) do
if bar.expirationTime < now then
bars[id] = nil
WeakAuras.ScanEvents("DBM_TimerStop", id)
elseif nextExpire == nil then
nextExpire = bar.expirationTime
elseif bar.expirationTime < nextExpire then
nextExpire = bar.expirationTime
end
end
if nextExpire then
recheckTimer = timer:ScheduleTimer(dbmRecheckTimers, nextExpire - now)
end
end
local function dbmEventCallback(event, ...)
if event == "DBM_TimerStart" then
local id, msg, duration, icon, timerType, spellId, dbmType, _, _, _, _, _, timerCount = ...
local now = GetTime()
local expirationTime = now + duration
bars[id] = bars[id] or {}
local bar = bars[id]
bar.message = msg
bar.expirationTime = expirationTime
bar.duration = duration
bar.icon = icon
bar.timerType = timerType
bar.spellId = tostring(spellId)
bar.count = timerCount and tostring(timerCount) or "0"
bar.dbmType = dbmType
local barOptions = DBM.ReleaseRevision >= 20220412000000 and DBT.Options or DBM.Bars.options
local r, g, b = 0, 0, 0
if dbmType == 1 then
r, g, b = barOptions.StartColorAR, barOptions.StartColorAG, barOptions.StartColorAB
elseif dbmType == 2 then
r, g, b = barOptions.StartColorAER, barOptions.StartColorAEG, barOptions.StartColorAEB
elseif dbmType == 3 then
r, g, b = barOptions.StartColorDR, barOptions.StartColorDG, barOptions.StartColorDB
elseif dbmType == 4 then
r, g, b = barOptions.StartColorIR, barOptions.StartColorIG, barOptions.StartColorIB
elseif dbmType == 5 then
r, g, b = barOptions.StartColorRR, barOptions.StartColorRG, barOptions.StartColorRB
elseif dbmType == 6 then
r, g, b = barOptions.StartColorPR, barOptions.StartColorPG, barOptions.StartColorPB
elseif dbmType == 7 then
r, g, b = barOptions.StartColorUIR, barOptions.StartColorUIG, barOptions.StartColorUIB
else
r, g, b = barOptions.StartColorR, barOptions.StartColorG, barOptions.StartColorB
end
bar.dbmColor = {r, g, b}
WeakAuras.ScanEvents("DBM_TimerStart", id)
if nextExpire == nil then
recheckTimer = timer:ScheduleTimer(dbmRecheckTimers, expirationTime - now)
nextExpire = expirationTime
elseif expirationTime < nextExpire then
timer:CancelTimer(recheckTimer)
recheckTimer = timer:ScheduleTimer(dbmRecheckTimers, expirationTime - now)
nextExpire = expirationTime
end
elseif event == "DBM_TimerStop" then
local id = ...
bars[id] = nil
WeakAuras.ScanEvents("DBM_TimerStop", id)
elseif event == "kill" or event == "wipe" then -- Wipe or kill, removing all timers
local id = ...
bars = {}
WeakAuras.ScanEvents("DBM_TimerStopAll", id)
elseif event == "DBM_TimerUpdate" then
local id, elapsed, duration = ...
local now = GetTime()
local expirationTime = now + duration - elapsed
local bar = bars[id]
if bar then
bar.duration = duration
bar.expirationTime = expirationTime
if expirationTime < nextExpire then
timer:CancelTimer(recheckTimer)
recheckTimer = timer:ScheduleTimer(dbmRecheckTimers, duration - elapsed)
nextExpire = expirationTime
end
end
WeakAuras.ScanEvents("DBM_TimerUpdate", id)
elseif event == "DBM_SetStage" or event == "DBM_Pull" or event == "DBM_Wipe" or event == "DBM_Kill" then
WeakAuras.ScanEvents("DBM_SetStage")
else -- DBM_Announce
WeakAuras.ScanEvents(event, ...)
end
end
function Private.ExecEnv.DBMTimerMatches(timerId, id, message, operator, spellId, dbmType, counter)
if not bars[timerId] then
return false
end
local v = bars[timerId]
if id and id ~= "" and id ~= timerId then
return false
end
if spellId and spellId ~= "" and spellId ~= v.spellId then
return false
end
if message and message ~= "" and operator then
if operator == "==" then
if v.message ~= message then
return false
end
elseif operator == "find('%s')" then
if v.message == nil or not v.message:find(message, 1, true) then
return false
end
elseif operator == "match('%s')" then
if v.message == nil or not v.message:match(message) then
return false
end
end
end
if counter then
counter:SetCount(tonumber(v.count) or 0)
if not counter:Match() then
return false
end
end
if dbmType and dbmType ~= v.dbmType then
return false
end
return true
end
function WeakAuras.GetDBMStage()
if DBM then
return DBM:GetStage()
end
return 0, 0
end
function WeakAuras.GetDBMTimerById(id)
return bars[id]
end
function WeakAuras.GetAllDBMTimers()
return bars
end
function WeakAuras.GetDBMTimer(id, message, operator, spellId, extendTimer, dbmType, count)
local bestMatch
for timerId, bar in pairs(bars) do
if Private.ExecEnv.DBMTimerMatches(timerId, id, message, operator, spellId, dbmType, count)
and (bestMatch == nil or bar.expirationTime < bestMatch.expirationTime)
and bar.expirationTime + extendTimer > GetTime()
then
bestMatch = bar
end
end
return bestMatch
end
function Private.ExecEnv.CopyBarToState(bar, states, id, extendTimer)
extendTimer = extendTimer or 0
if extendTimer + bar.duration < 0 then return end
states[id] = states[id] or {}
local state = states[id]
state.show = true
state.changed = true
state.icon = bar.icon
state.message = bar.message
state.name = bar.message
state.expirationTime = bar.expirationTime + extendTimer
state.progressType = 'timed'
state.duration = bar.duration + extendTimer
state.timerType = bar.timerType
state.spellId = bar.spellId
state.count = bar.count
state.dbmType = bar.dbmType
state.dbmColor = bar.dbmColor
state.extend = extendTimer
if extendTimer ~= 0 then
state.autoHide = true
end
end
function WeakAuras.RegisterDBMCallback(event)
if registeredDBMEvents[event] then
return
end
if DBM then
DBM:RegisterCallback(event, dbmEventCallback)
registeredDBMEvents[event] = true
end
end
function WeakAuras.GetDBMTimers()
return bars
end
local scheduled_scans = {}
local function doDbmScan(fireTime)
scheduled_scans[fireTime] = nil
WeakAuras.ScanEvents("DBM_TimerUpdate")
end
function Private.ExecEnv.ScheduleDbmCheck(fireTime)
if not scheduled_scans[fireTime] then
scheduled_scans[fireTime] = timer:ScheduleTimer(doDbmScan, fireTime - GetTime() + 0.1, fireTime)
end
end
end
-- BigWigs
do
local registeredBigWigsEvents = {}
local bars = {}
local nextExpire -- time of next expiring timer
local recheckTimer -- handle of timer
local function recheckTimers()
local now = GetTime()
nextExpire = nil
for id, bar in pairs(bars) do
if bar.expirationTime < now then
bars[id] = nil
WeakAuras.ScanEvents("BigWigs_StopBar", id)
elseif nextExpire == nil then
nextExpire = bar.expirationTime
elseif bar.expirationTime < nextExpire then
nextExpire = bar.expirationTime
end
end
if nextExpire then
recheckTimer = timer:ScheduleTimer(recheckTimers, nextExpire - now)
end
end
local function bigWigsEventCallback(event, ...)
if event == "BigWigs_Message" then
WeakAuras.ScanEvents("BigWigs_Message", ...)
elseif event == "BigWigs_StartBar" then
local addon, spellId, text, duration, icon, isCD = ...
local now = GetTime()
local expirationTime = now + duration
local newBar
bars[text] = bars[text] or {}
local bar = bars[text]
bar.addon = addon
bar.spellId = tostring(spellId)
bar.text = text
bar.duration = duration
bar.expirationTime = expirationTime
bar.icon = icon
bar.isCooldown = isCD or false
local BWColorModule = BigWigs:GetPlugin("Colors")
bar.bwBarColor = BWColorModule:GetColorTable("barColor", addon, spellId)
bar.bwTextColor = BWColorModule:GetColorTable("barText", addon, spellId)
bar.bwBackgroundColor = BWColorModule:GetColorTable("barBackground", addon, spellId)
local BWEmphasizedModule = BigWigs:GetPlugin("Super Emphasize")
bar.emphasized = BWEmphasizedModule:IsSuperEmphasized(addon, spellId) and true or false
bar.count = text:match("%((%d+)%)") or text:match("(%d+)") or "0"
bar.cast = not(text:match("^[^<]") and true)
WeakAuras.ScanEvents("BigWigs_StartBar", text)
if nextExpire == nil then
recheckTimer = timer:ScheduleTimer(recheckTimers, expirationTime - now)
nextExpire = expirationTime
elseif expirationTime < nextExpire then
timer:CancelTimer(recheckTimer)
recheckTimer = timer:ScheduleTimer(recheckTimers, expirationTime - now)
nextExpire = expirationTime
end
elseif event == "BigWigs_StopBar" then
local addon, text = ...
if bars[text] then
bars[text] = nil
WeakAuras.ScanEvents("BigWigs_StopBar", text)
end
elseif event == "BigWigs_StopBars"
or event == "BigWigs_OnBossDisable"
or event == "BigWigs_OnPluginDisable"
then
local addon = ...
for id, bar in pairs(bars) do
if bar.addon == addon then
bars[id] = nil
WeakAuras.ScanEvents("BigWigs_StopBar", id)
end
end
end
end
function WeakAuras.RegisterBigWigsCallback(event)
if registeredBigWigsEvents[event] then
return
end
if BigWigsLoader then
BigWigsLoader.RegisterMessage(WeakAuras, event, bigWigsEventCallback)
registeredBigWigsEvents[event] = true
if event == "BigWigs_SetStage" then
-- on init of BigWigs_SetStage callback, we want to fetch currentStage in case we are already in an encounter when this is run
if BigWigs and BigWigs.IterateBossModules then
local stage = 0
for _, module in BigWigs:IterateBossModules() do
if module:IsEngaged() then
stage = math.max(stage, module:GetStage() or 1)
end
end
currentStage = stage
end
end
end
end
function WeakAuras.RegisterBigWigsTimer()
WeakAuras.RegisterBigWigsCallback("BigWigs_StartBar")
WeakAuras.RegisterBigWigsCallback("BigWigs_StopBar")
WeakAuras.RegisterBigWigsCallback("BigWigs_StopBars")
WeakAuras.RegisterBigWigsCallback("BigWigs_OnBossDisable")
end
function Private.ExecEnv.CopyBigWigsTimerToState(bar, states, id, extendTimer)
extendTimer = extendTimer or 0
if extendTimer + bar.duration < 0 then return end
states[id] = states[id] or {}
local state = states[id]
state.show = true
state.changed = true
state.addon = bar.addon
state.spellId = bar.spellId
state.text = bar.text
state.name = bar.text
state.duration = bar.duration + extendTimer
state.expirationTime = bar.expirationTime + extendTimer
state.bwBarColor = bar.bwBarColor
state.bwTextColor = bar.bwTextColor
state.bwBackgroundColor = bar.bwBackgroundColor
state.emphasized = bar.emphasized
state.count = bar.count
state.cast = bar.cast
state.progressType = "timed"
state.icon = bar.icon
state.extend = extendTimer
if extendTimer ~= 0 then
state.autoHide = true
end
state.isCooldown = bar.isCooldown
end
function Private.ExecEnv.BigWigsTimerMatches(id, message, operator, spellId, emphasized, counter, cast, cooldown)
if not bars[id] then
return false
end
local v = bars[id]
local bestMatch
if spellId and spellId ~= "" and spellId ~= v.spellId then
return false
end
if message and message ~= "" and operator then
if operator == "==" then
if v.text ~= message then
return false
end
elseif operator == "find('%s')" then
if v.text == nil or not v.text:find(message, 1, true) then
return false
end
elseif operator == "match('%s')" then
if v.text == nil or not v.text:match(message) then
return false
end
end
end
if emphasized ~= nil and v.emphasized ~= emphasized then
return false
end
if counter then
counter:SetCount(tonumber(v.count) or 0)
if not counter:Match() then
return false
end
end
if cast ~= nil and v.cast ~= cast then
return false
end
if cooldown ~= nil and v.isCooldown ~= cooldown then
return false
end
return true
end
function WeakAuras.GetAllBigWigsTimers()
return bars
end
function WeakAuras.GetBigWigsTimerById(id)
return bars[id]
end
function WeakAuras.GetBigWigsTimer(text, operator, spellId, extendTimer, emphasized, counter, cast)
local bestMatch
for id, bar in pairs(bars) do
if Private.ExecEnv.BigWigsTimerMatches(id, text, operator, spellId, emphasized, counter, cast)
and (bestMatch == nil or bar.expirationTime < bestMatch.expirationTime)
and bar.expirationTime + extendTimer > GetTime()
then
bestMatch = bar
end
end
return bestMatch
end
local scheduled_scans = {}
local function doBigWigsScan(fireTime)
scheduled_scans[fireTime] = nil
WeakAuras.ScanEvents("BigWigs_Timer_Update")
end
function Private.ExecEnv.ScheduleBigWigsCheck(fireTime)
if not scheduled_scans[fireTime] then
scheduled_scans[fireTime] = timer:ScheduleTimer(doBigWigsScan, fireTime - GetTime() + 0.1, fireTime)
end
end
end
function Private.ExecEnv.CheckTotemName(totemName, triggerTotemName, triggerTotemPattern, triggerTotemOperator)
if not totemName or totemName == "" then
return false
-526
View File
@@ -3861,532 +3861,6 @@ Private.event_prototypes = {
},
timedrequired = true
},
-- DBM events
["DBM Stage"] = {
type = "addons",
events = {},
internal_events = {
"DBM_SetStage"
},
force_events = "DBM_SetStage",
name = L["DBM Stage"],
init = function(trigger)
WeakAuras.RegisterDBMCallback("DBM_SetStage")
WeakAuras.RegisterDBMCallback("DBM_Pull")
WeakAuras.RegisterDBMCallback("DBM_Kill")
return ""
end,
args = {
{
name = "stage",
init = "WeakAuras.GetDBMStage()",
display = L["Stage"],
type = "number",
conditionType = "number",
store = true,
}
},
automaticrequired = true,
statesParameter = "one",
},
["DBM Announce"] = {
type = "addons",
events = {},
internal_events = {
"DBM_Announce"
},
name = L["DBM Announce"],
init = function(trigger)
WeakAuras.RegisterDBMCallback("DBM_Announce");
local ret = "local use_cloneId = %s;"
return ret:format(trigger.use_cloneId and "true" or "false");
end,
statesParameter = "all",
args = {
{
name = "message",
init = "arg",
display = L["Message"],
type = "longstring",
store = true,
conditionType = "string"
},
{
name = "name",
init = "message",
hidden = true,
test = "true",
store = true,
},
{
name = "icon",
init = "arg",
store = true,
hidden = true,
test = "true"
},
{
name = "cloneId",
display = L["Clone per Event"],
type = "toggle",
test = "true",
init = "use_cloneId and WeakAuras.GetUniqueCloneId() or ''"
},
},
timedrequired = true
},
["DBM Timer"] = {
type = "addons",
events = {},
internal_events = {
"DBM_TimerStart", "DBM_TimerStop", "DBM_TimerStopAll", "DBM_TimerUpdate", "DBM_TimerForce"
},
force_events = "DBM_TimerForce",
name = L["DBM Timer"],
canHaveDuration = "timed",
triggerFunction = function(trigger)
WeakAuras.RegisterDBMCallback("DBM_TimerStart")
WeakAuras.RegisterDBMCallback("DBM_TimerStop")
WeakAuras.RegisterDBMCallback("DBM_TimerUpdate")
WeakAuras.RegisterDBMCallback("wipe")
WeakAuras.RegisterDBMCallback("kill")
local ret = [=[
local triggerCounter = %q
local counter
if triggerCounter and triggerCounter ~= "" then
counter = Private.ExecEnv.CreateTriggerCounter(triggerCounter)
else
counter = Private.ExecEnv.CreateTriggerCounter()
end
return function (states, event, id)
local triggerId = %q
local triggerSpellId = %q
local triggerText = %q
local triggerTextOperator = %q
local useClone = %s
local extendTimer = %s
local triggerUseRemaining = %s
local triggerRemaining = %s
local triggerDbmType = %s
local cloneId = useClone and id or ""
local state = states[cloneId]
local counter = counter
function copyOrSchedule(bar, cloneId)
if triggerUseRemaining then
local remainingTime = bar.expirationTime - GetTime() + extendTimer
if remainingTime %s triggerRemaining then
Private.ExecEnv.CopyBarToState(bar, states, cloneId, extendTimer)
else
local state = states[cloneId]
if state and state.show then
state.show = false
state.changed = true
end
end
if remainingTime >= triggerRemaining then
Private.ExecEnv.ScheduleDbmCheck(bar.expirationTime - triggerRemaining + extendTimer)
end
else
Private.ExecEnv.CopyBarToState(bar, states, cloneId, extendTimer)
end
end
if useClone then
if event == "DBM_TimerStart" then
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, counter) then
local bar = WeakAuras.GetDBMTimerById(id)
if bar then
copyOrSchedule(bar, cloneId)
end
end
elseif event == "DBM_TimerStop" and state then
local bar_remainingTime = GetTime() - state.expirationTime + (state.extend or 0)
if state.extend == 0 or bar_remainingTime > 0.2 then
state.show = false
state.changed = true
end
elseif event == "DBM_TimerUpdate" then
for id, bar in pairs(WeakAuras.GetAllDBMTimers()) do
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, counter) then
copyOrSchedule(bar, id)
else
local state = states[id]
if state then
local bar_remainingTime = GetTime() - state.expirationTime + (state.extend or 0)
if state.extend == 0 or bar_remainingTime > 0.2 then
state.show = false
state.changed = true
end
end
end
end
elseif event == "DBM_TimerForce" then
wipe(states)
for id, bar in pairs(WeakAuras.GetAllDBMTimers()) do
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, counter) then
copyOrSchedule(bar, cloneId)
end
end
end
else
if event == "DBM_TimerStart" or event == "DBM_TimerUpdate" then
if extendTimer ~= 0 then
if Private.ExecEnv.DBMTimerMatches(id, triggerId, triggerText, triggerTextOperator, triggerSpellId, triggerDbmType, counter) then
local bar = WeakAuras.GetDBMTimerById(id)
Private.ExecEnv.ScheduleDbmCheck(bar.expirationTime + extendTimer)
end
end
end
local bar = WeakAuras.GetDBMTimer(triggerId, triggerText, triggerTextOperator, triggerSpellId, extendTimer, triggerDbmType, counter)
if bar then
if extendTimer == 0
or not (state and state.show)
or (state and state.show and state.expirationTime > (bar.expirationTime + extendTimer))
then
copyOrSchedule(bar, cloneId)
end
else
if state and state.show then
local bar_remainingTime = GetTime() - state.expirationTime + (state.extend or 0)
if state.extend == 0 or bar_remainingTime > 0.2 then
state.show = false
state.changed = true
end
end
end
end
return true
end
]=]
return ret:format(
trigger.use_count and trigger.count or "",
trigger.use_id and trigger.id or "",
trigger.use_spellId and tostring(trigger.spellId) or "",
trigger.use_message and trigger.message or "",
trigger.use_message and trigger.message_operator or "",
trigger.use_cloneId and "true" or "false",
trigger.use_extend and tonumber(trigger.extend or 0) or 0,
trigger.use_remaining and "true" or "false",
trigger.remaining and tonumber(trigger.remaining or 0) or 0,
trigger.use_dbmType and trigger.dbmType or "nil",
trigger.remaining_operator or "<"
)
end,
statesParameter = "full",
args = {
{
name = "id",
display = L["Timer Id"],
type = "string",
},
{
name = "spellId",
display = L["Spell Id"],
type = "string",
store = true,
conditionType = "string"
},
{
name = "message",
display = L["Message"],
type = "longstring",
store = true,
conditionType = "string"
},
{
name = "remaining",
display = L["Remaining Time"],
type = "number",
},
{
name = "extend",
display = L["Offset Timer"],
type = "string",
},
{
name = "count",
display = L["Count"],
desc = L["Occurrence of the event, reset when aura is unloaded\nCan be a range of values\nCan have multiple values separated by a comma or a space\n\nExamples:\n2nd 5th and 6th events: 2, 5, 6\n2nd to 6th: 2-6\nevery 2 events: /2\nevery 3 events starting from 2nd: 2/3\nevery 3 events starting from 2nd and ending at 11th: 2-11/3\n\nOnly if DBM shows it on it's bar"],
type = "string",
conditionType = "string",
},
{
name = "dbmType",
display = L["Type"],
type = "select",
values = "dbm_types",
conditionType = "select",
test = "true"
},
{
name = "cloneId",
display = L["Clone per Event"],
type = "toggle"
}
},
automaticrequired = true,
},
-- BigWigs
["BigWigs Message"] = {
type = "addons",
events = {},
internal_events = {
"BigWigs_Message"
},
name = L["BigWigs Message"],
init = function(trigger)
WeakAuras.RegisterBigWigsCallback("BigWigs_Message");
local ret = "local use_cloneId = %s;"
return ret:format(trigger.use_cloneId and "true" or "false");
end,
statesParameter = "all",
args = {
{
name = "addon",
init = "arg",
display = L["BigWigs Addon"],
type = "string"
},
{
name = "spellId",
init = "arg",
display = L["Key"],
desc = L["The 'Key' value can be found in the BigWigs options of a specific spell"],
type = "longstring"
},
{
name = "text",
init = "arg",
display = L["Message"],
type = "longstring",
store = true,
conditionType = "string"
},
{
name = "name",
init = "text",
hidden = true,
test = "true",
store = true
},
{}, -- Importance, might be useful
{
name = "icon",
init = "arg",
hidden = true,
test = "true",
store = true
},
{
name = "cloneId",
display = L["Clone per Event"],
type = "toggle",
test = "true",
init = "use_cloneId and WeakAuras.GetUniqueCloneId() or ''"
},
},
timedrequired = true
},
["BigWigs Timer"] = {
type = "addons",
events = {},
internal_events = {
"BigWigs_StartBar", "BigWigs_StopBar", "BigWigs_Timer_Update",
},
force_events = "BigWigs_Timer_Force",
name = L["BigWigs Timer"],
canHaveDuration = "timed",
triggerFunction = function(trigger)
WeakAuras.RegisterBigWigsTimer()
local ret = [=[
local triggerCounter = %q
local counter
if triggerCounter and triggerCounter ~= "" then
counter = Private.ExecEnv.CreateTriggerCounter(triggerCounter)
else
counter = Private.ExecEnv.CreateTriggerCounter()
end
return function(states, event, id)
local triggerSpellId = %q
local triggerText = %q
local triggerTextOperator = %q
local useClone = %s
local extendTimer = %s
local triggerUseRemaining = %s
local triggerRemaining = %s
local triggerEmphasized = %s
local triggerCast = %s
local triggerIsCooldown = %s
local cloneId = useClone and id or ""
local state = states[cloneId]
local counter = counter
function copyOrSchedule(bar, cloneId)
if triggerUseRemaining then
local remainingTime = bar.expirationTime - GetTime() + extendTimer
if remainingTime %s triggerRemaining then
Private.ExecEnv.CopyBigWigsTimerToState(bar, states, cloneId, extendTimer)
else
local state = states[cloneId]
if state and state.show then
state.show = false
state.changed = true
end
end
if remainingTime >= triggerRemaining then
Private.ExecEnv.ScheduleBigWigsCheck(bar.expirationTime - triggerRemaining + extendTimer)
end
else
Private.ExecEnv.CopyBigWigsTimerToState(bar, states, cloneId, extendTimer)
end
end
if useClone then
if event == "BigWigs_StartBar" then
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, counter, triggerCast, triggerIsCooldown) then
local bar = WeakAuras.GetBigWigsTimerById(id)
if bar then
copyOrSchedule(bar, cloneId)
end
end
elseif event == "BigWigs_StopBar" and state then
local bar_remainingTime = GetTime() - state.expirationTime + (state.extend or 0)
if state.extend == 0 or bar_remainingTime > 0.2 then
state.show = false
state.changed = true
end
elseif event == "BigWigs_Timer_Update" then
for id, bar in pairs(WeakAuras.GetAllBigWigsTimers()) do
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, counter, triggerCast) then
copyOrSchedule(bar, id)
end
end
elseif event == "BigWigs_Timer_Force" then
wipe(states)
for id, bar in pairs(WeakAuras.GetAllBigWigsTimers()) do
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, counter, triggerCast) then
copyOrSchedule(bar, id)
end
end
end
else
if event == "BigWigs_StartBar" then
if extendTimer ~= 0 then
if Private.ExecEnv.BigWigsTimerMatches(id, triggerText, triggerTextOperator, triggerSpellId, triggerEmphasized, counter, triggerCast) then
local bar = WeakAuras.GetBigWigsTimerById(id)
Private.ExecEnv.ScheduleBigWigsCheck(bar.expirationTime + extendTimer)
end
end
end
local bar = WeakAuras.GetBigWigsTimer(triggerText, triggerTextOperator, triggerSpellId, extendTimer, triggerEmphasized, counter, triggerCast)
if bar then
if extendTimer == 0
or not (state and state.show)
or (state and state.show and state.expirationTime > (bar.expirationTime + extendTimer))
then
copyOrSchedule(bar, cloneId)
end
else
if state and state.show then
local bar_remainingTime = GetTime() - state.expirationTime + (state.extend or 0)
if state.extend == 0 or bar_remainingTime > 0.2 then
state.show = false
state.changed = true
end
end
end
end
return true
end
]=]
return ret:format(
trigger.use_count and trigger.count or "",
trigger.use_spellId and tostring(trigger.spellId) or "",
trigger.use_text and trigger.text or "",
trigger.use_text and trigger.text_operator or "",
trigger.use_cloneId and "true" or "false",
trigger.use_extend and tonumber(trigger.extend or 0) or 0,
trigger.use_remaining and "true" or "false",
trigger.remaining and tonumber(trigger.remaining or 0) or 0,
trigger.use_emphasized == nil and "nil" or trigger.use_emphasized and "true" or "false",
trigger.use_cast == nil and "nil" or trigger.use_cast and "true" or "false",
trigger.use_isCooldown == nil and "nil" or trigger.use_isCooldown and "true" or "false",
trigger.remaining_operator or "<"
)
end,
statesParameter = "full",
args = {
{
name = "spellId",
display = L["Key"],
desc = L["The 'Key' value can be found in the BigWigs options of a specific spell"],
type = "string",
conditionType = "string",
},
{
name = "text",
display = L["Message"],
type = "longstring",
store = true,
conditionType = "string"
},
{
name = "remaining",
display = L["Remaining Time"],
type = "number",
},
{
name = "extend",
display = L["Offset Timer"],
type = "string",
},
{
name = "count",
display = L["Count"],
desc = L["Occurrence of the event, reset when aura is unloaded\nCan be a range of values\nCan have multiple values separated by a comma or a space\n\nExamples:\n2nd 5th and 6th events: 2, 5, 6\n2nd to 6th: 2-6\nevery 2 events: /2\nevery 3 events starting from 2nd: 2/3\nevery 3 events starting from 2nd and ending at 11th: 2-11/3\n\nOnly if BigWigs shows it on it's bar"],
type = "string",
conditionType = "string",
},
{
name = "emphasized",
display = L["Emphasized"],
type = "tristate",
desc = L["Emphasized option checked in BigWigs's spell options"],
test = "true",
init = "false",
conditionType = "bool"
},
{
name = "cast",
display = L["Cast Bar"],
desc = L["Filter messages with format <message>"],
type = "tristate",
test = "true",
init = "false",
conditionType = "bool"
},
{
name = "isCooldown",
display = L["Cooldown"],
desc = L["Cooldown bars show time before an ability is ready to be use, BigWigs prefix them with '~'"],
type = "tristate",
test = "true",
init = "false",
conditionType = "bool"
},
{
name = "cloneId",
display = L["Clone per Event"],
type = "toggle",
test = "true",
init = "false"
},
},
automaticrequired = true,
},
["Global Cooldown"] = {
type = "spell",
events = {},
+2 -1
View File
@@ -15,7 +15,7 @@
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariables: WeakAurasSaved
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0, !!AddonLocale, DBM-Core, BigWigs
Templates.lua
Templates.xml
@@ -44,6 +44,7 @@ AnchorToWeakAuras.lua
# Trigger systems
BuffTrigger2.lua
GenericTrigger.lua
BossMods.lua
# Helper Systems
AuraWarnings.lua