diff --git a/WeakAuras/BossMods.lua b/WeakAuras/BossMods.lua index 91023aa..158f10c 100644 --- a/WeakAuras/BossMods.lua +++ b/WeakAuras/BossMods.lua @@ -6,11 +6,6 @@ local L = WeakAuras.L Private.ExecEnv.BossMods = {} --- TODO! remove this -WeakAuras.IsTWW = function() - return false -end - -- DBM Private.ExecEnv.BossMods.DBM = { registeredEvents = {}, @@ -358,331 +353,327 @@ Private.ExecEnv.BossMods.DBM = { end } -if not WeakAuras.IsTWW() then - Private.event_prototypes["DBM Stage"] = { - type = "addons", - events = {}, - internal_events = { - "DBM_SetStage" +Private.event_prototypes["DBM Stage"] = { + type = "addons", + events = {}, + internal_events = { + "DBM_SetStage" + }, + force_events = "DBM_SetStage", + name = L["DBM Stage"], + init = function(trigger) + Private.ExecEnv.BossMods.DBM:RegisterStage() + return "" + end, + args = { + { + name = "stage", + init = "Private.ExecEnv.BossMods.DBM:GetStage()", + display = L["Stage"], + desc = L["Matches stage number of encounter journal.\nIntermissions are .5\nE.g. 1;2;1;2;2.5;3"], + type = "number", + conditionType = "number", + store = true, }, - force_events = "DBM_SetStage", - name = L["DBM Stage"], - init = function(trigger) - Private.ExecEnv.BossMods.DBM:RegisterStage() - return "" - end, - args = { - { - name = "stage", - init = "Private.ExecEnv.BossMods.DBM:GetStage()", - display = L["Journal Stage"], - desc = L["Matches stage number of encounter journal.\nIntermissions are .5\nE.g. 1;2;1;2;2.5;3"], - type = "number", - conditionType = "number", - store = true, - }, - { - name = "stageTotal", - init = "select(2, Private.ExecEnv.BossMods.DBM:GetStage())", - display = L["Stage Counter"], - desc = L["Increases by one per stage or intermission."], - type = "number", - conditionType = "number", - store = true, - }, + { + name = "stageTotal", + init = "select(2, Private.ExecEnv.BossMods.DBM:GetStage())", + display = L["Stage Counter"], + desc = L["Increases by one per stage or intermission."], + type = "number", + conditionType = "number", + store = true, }, - automaticrequired = true, - statesParameter = "one", - progressType = "none" - } - Private.category_event_prototype.addons["DBM Stage"] = L["DBM Stage"] + }, + automaticrequired = true, + statesParameter = "one", + progressType = "none" +} +Private.category_event_prototype.addons["DBM Stage"] = L["DBM Stage"] - Private.event_prototypes["DBM Announce"] = { - type = "addons", - events = {}, - internal_events = { - "DBM_Announce" +Private.event_prototypes["DBM Announce"] = { + type = "addons", + events = {}, + internal_events = { + "DBM_Announce" + }, + name = L["DBM Announce"], + init = function(trigger) + Private.ExecEnv.BossMods.DBM:RegisterMessage(); + local ret = "local use_cloneId = %s;" + return ret:format(trigger.use_cloneId and "true" or "false"); + end, + statesParameter = "all", + args = { + { + name = "spellId", + init = "arg", + display = L["Spell Id"], + type = "spell", + noValidation = true, + showExactOption = false, }, - name = L["DBM Announce"], - init = function(trigger) - Private.ExecEnv.BossMods.DBM:RegisterMessage(); - local ret = "local use_cloneId = %s;" - return ret:format(trigger.use_cloneId and "true" or "false"); - end, - statesParameter = "all", - args = { - { - name = "spellId", - init = "arg", - display = L["Spell Id"], - type = "spell", - noValidation = true, - showExactOption = false, - negativeIsEJ = true - }, - { - 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 ''" - }, + { + name = "message", + init = "arg", + display = L["Message"], + type = "longstring", + store = true, + conditionType = "string" }, - timedrequired = true, - progressType = "timed" - } - Private.category_event_prototype.addons["DBM Announce"] = L["DBM Announce"] + { + 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, + progressType = "timed" +} +Private.category_event_prototype.addons["DBM Announce"] = L["DBM Announce"] - Private.event_prototypes["DBM Timer"] = { - type = "addons", - events = {}, - internal_events = { - "DBM_TimerStart", "DBM_TimerStop", "DBM_TimerUpdate", "DBM_TimerForce", "DBM_TimerResume", "DBM_TimerPause", - "DBM_TimerUpdateIcon" - }, - force_events = "DBM_TimerForce", - name = L["DBM Timer"], - progressType = "timed", - triggerFunction = function(trigger) - Private.ExecEnv.BossMods.DBM:RegisterTimer() - 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, timerId) - 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 timerId or "" - local state = states[cloneId] - local counter = counter +Private.event_prototypes["DBM Timer"] = { + type = "addons", + events = {}, + internal_events = { + "DBM_TimerStart", "DBM_TimerStop", "DBM_TimerUpdate", "DBM_TimerForce", "DBM_TimerResume", "DBM_TimerPause", + "DBM_TimerUpdateIcon" + }, + force_events = "DBM_TimerForce", + name = L["DBM Timer"], + progressType = "timed", + triggerFunction = function(trigger) + Private.ExecEnv.BossMods.DBM:RegisterTimer() + 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, timerId) + 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 timerId or "" + local state = states[cloneId] + local counter = counter - function copyOrSchedule(bar, cloneId) - local remainingTime - local changed - if bar.paused then - remainingTime = bar.remaining + extendTimer + function copyOrSchedule(bar, cloneId) + local remainingTime + local changed + if bar.paused then + remainingTime = bar.remaining + extendTimer + else + remainingTime = bar.expirationTime - GetTime() + extendTimer + end + if triggerUseRemaining then + if remainingTime > 0 and remainingTime %s triggerRemaining then + Private.ExecEnv.BossMods.DBM:CopyBarToState(bar, states, cloneId, extendTimer) + changed = true else - remainingTime = bar.expirationTime - GetTime() + extendTimer - end - if triggerUseRemaining then - if remainingTime > 0 and remainingTime %s triggerRemaining then - Private.ExecEnv.BossMods.DBM:CopyBarToState(bar, states, cloneId, extendTimer) + local state = states[cloneId] + if state and state.show then + state.show = false + state.changed = true changed = true - else - local state = states[cloneId] - if state and state.show then - state.show = false - state.changed = true - changed = true - end end - if not bar.paused then - if extendTimer > 0 then - bar.scheduledScanExpireAt = math.max(bar.scheduledScanExpireAt or 0, bar.expirationTime + extendTimer) - end - if remainingTime >= triggerRemaining then - Private.ExecEnv.BossMods.DBM:ScheduleCheck(bar.expirationTime - triggerRemaining + extendTimer) - end - end - else - if not bar.paused and extendTimer > 0 then + end + if not bar.paused then + if extendTimer > 0 then bar.scheduledScanExpireAt = math.max(bar.scheduledScanExpireAt or 0, bar.expirationTime + extendTimer) end - if remainingTime > 0 then - Private.ExecEnv.BossMods.DBM:CopyBarToState(bar, states, cloneId, extendTimer) - changed = true + if remainingTime >= triggerRemaining then + Private.ExecEnv.BossMods.DBM:ScheduleCheck(bar.expirationTime - triggerRemaining + extendTimer) + end + end + else + if not bar.paused and extendTimer > 0 then + bar.scheduledScanExpireAt = math.max(bar.scheduledScanExpireAt or 0, bar.expirationTime + extendTimer) + end + if remainingTime > 0 then + Private.ExecEnv.BossMods.DBM:CopyBarToState(bar, states, cloneId, extendTimer) + changed = true + end + end + return changed + end + + if useClone then + if event == "DBM_TimerStart" + or event == "DBM_TimerPause" + or event == "DBM_TimerResume" + then + if Private.ExecEnv.BossMods.DBM:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerId, triggerDbmType) then + local bar = Private.ExecEnv.BossMods.DBM:GetTimerById(timerId) + if bar then + return copyOrSchedule(bar, cloneId) + end + end + elseif event == "DBM_TimerStop" and state then + local bar_remainingTime = state.expirationTime - GetTime() + (state.extend or 0) + if state.extend == 0 or bar_remainingTime <= 0 then + state.show = false + state.changed = true + return true + end + elseif event == "DBM_TimerUpdate" or event == "DBM_TimerUpdateIcon" then + local changed + for timerId, bar in pairs(Private.ExecEnv.BossMods.DBM:GetAllTimers()) do + if Private.ExecEnv.BossMods.DBM:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerId, triggerDbmType) then + changed = copyOrSchedule(bar, timerId) or changed + else + local state = states[timerId] + if state then + local bar_remainingTime = state.expirationTime - GetTime() + (state.extend or 0) + if state.extend == 0 or bar_remainingTime <= 0 then + state.show = false + state.changed = true + changed = true + end + end + end + end + return changed + elseif event == "DBM_TimerForce" then + local changed + for _, state in pairs(states) do + state.show = false + state.changed = true + changed = true + end + for timerId, bar in pairs(Private.ExecEnv.BossMods.DBM:GetAllTimers()) do + if Private.ExecEnv.BossMods.DBM:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerId, triggerDbmType) then + changed = copyOrSchedule(bar, timerId) or changed end end return changed end - - if useClone then - if event == "DBM_TimerStart" - or event == "DBM_TimerPause" - or event == "DBM_TimerResume" - then + else + if event == "DBM_TimerStart" or event == "DBM_TimerUpdate" then + if extendTimer ~= 0 then if Private.ExecEnv.BossMods.DBM:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerId, triggerDbmType) then local bar = Private.ExecEnv.BossMods.DBM:GetTimerById(timerId) - if bar then - return copyOrSchedule(bar, cloneId) - end + Private.ExecEnv.BossMods.DBM:ScheduleCheck(bar.expirationTime + extendTimer) end - elseif event == "DBM_TimerStop" and state then + end + end + local bar = Private.ExecEnv.BossMods.DBM:GetTimer(triggerText, triggerTextOperator, triggerSpellId, extendTimer, counter, triggerId, triggerDbmType) + if bar then + if extendTimer == 0 + or not (state and state.show) + or (state and state.show and state.expirationTime > (bar.expirationTime + extendTimer)) + then + return copyOrSchedule(bar, cloneId) + end + else + if state and state.show then local bar_remainingTime = state.expirationTime - GetTime() + (state.extend or 0) if state.extend == 0 or bar_remainingTime <= 0 then state.show = false state.changed = true return true end - elseif event == "DBM_TimerUpdate" or event == "DBM_TimerUpdateIcon" then - local changed - for timerId, bar in pairs(Private.ExecEnv.BossMods.DBM:GetAllTimers()) do - if Private.ExecEnv.BossMods.DBM:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerId, triggerDbmType) then - changed = copyOrSchedule(bar, timerId) or changed - else - local state = states[timerId] - if state then - local bar_remainingTime = state.expirationTime - GetTime() + (state.extend or 0) - if state.extend == 0 or bar_remainingTime <= 0 then - state.show = false - state.changed = true - changed = true - end - end - end - end - return changed - elseif event == "DBM_TimerForce" then - local changed - for _, state in pairs(states) do - state.show = false - state.changed = true - changed = true - end - for timerId, bar in pairs(Private.ExecEnv.BossMods.DBM:GetAllTimers()) do - if Private.ExecEnv.BossMods.DBM:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerId, triggerDbmType) then - changed = copyOrSchedule(bar, timerId) or changed - end - end - return changed - end - else - if event == "DBM_TimerStart" or event == "DBM_TimerUpdate" then - if extendTimer ~= 0 then - if Private.ExecEnv.BossMods.DBM:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerId, triggerDbmType) then - local bar = Private.ExecEnv.BossMods.DBM:GetTimerById(timerId) - Private.ExecEnv.BossMods.DBM:ScheduleCheck(bar.expirationTime + extendTimer) - end - end - end - local bar = Private.ExecEnv.BossMods.DBM:GetTimer(triggerText, triggerTextOperator, triggerSpellId, extendTimer, counter, triggerId, triggerDbmType) - if bar then - if extendTimer == 0 - or not (state and state.show) - or (state and state.show and state.expirationTime > (bar.expirationTime + extendTimer)) - then - return copyOrSchedule(bar, cloneId) - end - else - if state and state.show then - local bar_remainingTime = state.expirationTime - GetTime() + (state.extend or 0) - if state.extend == 0 or bar_remainingTime <= 0 then - state.show = false - state.changed = true - return true - end - end end end end - ]=] + 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"], - store = true, - type = "spell", - conditionType = "string", - noValidation = true, - showExactOption = false, - negativeIsEJ = true - }, - { - 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" - } + 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", }, - automaticrequired = true, - } - Private.category_event_prototype.addons["DBM Timer"] = L["DBM Timer"] -end + { + name = "spellId", + display = L["Spell Id"], + store = true, + type = "spell", + conditionType = "string", + noValidation = true, + showExactOption = false, + }, + { + 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, +} +Private.category_event_prototype.addons["DBM Timer"] = L["DBM Timer"] -- BigWigs Private.ExecEnv.BossMods.BigWigs = { @@ -1005,328 +996,329 @@ Private.ExecEnv.BossMods.BigWigs = { end } -if not WeakAuras.IsTWW() then - Private.event_prototypes["BigWigs Stage"] = { - type = "addons", - events = {}, - internal_events = { - "BigWigs_SetStage" - }, - name = L["BigWigs Stage"], - init = function(trigger) - Private.ExecEnv.BossMods.BigWigs:RegisterStage() - return "" - end, - args = { - { - name = "stage", - init = "Private.ExecEnv.BossMods.BigWigs:GetStage()", - display = L["Stage"], - type = "number", - conditionType = "number", - store = true, - } - }, - automaticrequired = true, - statesParameter = "one", - progressType = "none" - } - Private.category_event_prototype.addons["BigWigs Stage"] = L["BigWigs Stage"] +Private.event_prototypes["BigWigs Stage"] = { + type = "addons", + events = {}, + internal_events = { + "BigWigs_SetStage" + }, + name = L["BigWigs Stage"], + init = function(trigger) + Private.ExecEnv.BossMods.BigWigs:RegisterStage() + return "" + end, + args = { + { + name = "stage", + init = "Private.ExecEnv.BossMods.BigWigs:GetStage()", + display = L["Stage"], + type = "number", + conditionType = "number", + store = true, + } + }, + automaticrequired = true, + statesParameter = "one", + progressType = "none" +} +Private.category_event_prototype.addons["BigWigs Stage"] = L["BigWigs Stage"] - Private.event_prototypes["BigWigs Message"] = { - type = "addons", - events = {}, - internal_events = { - "BigWigs_Message" +Private.event_prototypes["BigWigs Message"] = { + type = "addons", + events = {}, + internal_events = { + "BigWigs_Message" + }, + name = L["BigWigs Message"], + init = function(trigger) + Private.ExecEnv.BossMods.BigWigs:RegisterMessage(); + 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 = L["BigWigs Message"], - init = function(trigger) - Private.ExecEnv.BossMods.BigWigs:RegisterMessage(); - 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["ID"], - desc = L["The 'ID' value can be found in the BigWigs options of a specific spell"], - type = "spell", - conditionType = "string", - noValidation = true, - showExactOption = false, - negativeIsEJ = true - }, - { - 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 ''" - }, + { + name = "spellId", + init = "arg", + display = L["ID"], + desc = L["The 'ID' value can be found in the BigWigs options of a specific spell"], + type = "spell", + conditionType = "string", + noValidation = true, + showExactOption = false, }, - timedrequired = true, - progressType = "timed" - } - Private.category_event_prototype.addons["BigWigs Message"] = L["BigWigs Message"] + { + 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, + progressType = "timed" +} +Private.category_event_prototype.addons["BigWigs Message"] = L["BigWigs Message"] - Private.event_prototypes["BigWigs Timer"] = { - type = "addons", - events = {}, - internal_events = { - "BigWigs_StartBar", "BigWigs_StopBar", "BigWigs_Timer_Update", "BigWigs_PauseBar", "BigWigs_ResumeBar" - }, - force_events = "BigWigs_Timer_Force", - name = L["BigWigs Timer"], - progressType = "timed", - triggerFunction = function(trigger) - Private.ExecEnv.BossMods.BigWigs:RegisterTimer() - 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, timerId) - local triggerSpellId = %q - local triggerText = %q - local triggerTextOperator = %q - local useClone = %s - local extendTimer = %s - local triggerUseRemaining = %s - local triggerRemaining = %s - local triggerCast = %s - local triggerIsCooldown = %s - local cloneId = useClone and timerId or "" - local state = states[cloneId] - local counter = counter +Private.event_prototypes["BigWigs Timer"] = { + type = "addons", + events = {}, + internal_events = { + "BigWigs_StartBar", "BigWigs_StopBar", "BigWigs_Timer_Update", "BigWigs_PauseBar", "BigWigs_ResumeBar" + }, + force_events = "BigWigs_Timer_Force", + name = L["BigWigs Timer"], + progressType = "timed", + triggerFunction = function(trigger) + Private.ExecEnv.BossMods.BigWigs:RegisterTimer() + 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, timerId) + local triggerSpellId = %q + local triggerText = %q + local triggerTextOperator = %q + local useClone = %s + local extendTimer = %s + local triggerUseRemaining = %s + local triggerRemaining = %s + local triggerCast = %s + local triggerIsCooldown = %s + local cloneId = useClone and timerId or "" + local state = states[cloneId] + local counter = counter - function copyOrSchedule(bar, cloneId) - local remainingTime - local changed - if bar.paused then - remainingTime = bar.remaining + extendTimer + function copyOrSchedule(bar, cloneId) + local remainingTime + local changed + if bar.paused then + remainingTime = bar.remaining + extendTimer + else + remainingTime = bar.expirationTime - GetTime() + extendTimer + end + if triggerUseRemaining then + if remainingTime > 0 and remainingTime %s triggerRemaining then + Private.ExecEnv.BossMods.BigWigs:CopyBarToState(bar, states, cloneId, extendTimer) + changed = true else - remainingTime = bar.expirationTime - GetTime() + extendTimer - end - if triggerUseRemaining then - if remainingTime > 0 and remainingTime %s triggerRemaining then - Private.ExecEnv.BossMods.BigWigs:CopyBarToState(bar, states, cloneId, extendTimer) + local state = states[cloneId] + if state and state.show then + state.show = false + state.changed = true changed = true - else - local state = states[cloneId] - if state and state.show then - state.show = false - state.changed = true - changed = true - end end - if not bar.paused then - if extendTimer > 0 then - bar.scheduledScanExpireAt = math.max(bar.scheduledScanExpireAt or 0, bar.expirationTime + extendTimer) - end - if remainingTime >= triggerRemaining then - Private.ExecEnv.BossMods.BigWigs:ScheduleCheck(bar.expirationTime - triggerRemaining + extendTimer) - end - end - else - if not bar.paused and extendTimer > 0 then + end + if not bar.paused then + if extendTimer > 0 then bar.scheduledScanExpireAt = math.max(bar.scheduledScanExpireAt or 0, bar.expirationTime + extendTimer) end - if remainingTime > 0 then - Private.ExecEnv.BossMods.BigWigs:CopyBarToState(bar, states, cloneId, extendTimer) - changed = true + if remainingTime >= triggerRemaining then + Private.ExecEnv.BossMods.BigWigs:ScheduleCheck(bar.expirationTime - triggerRemaining + extendTimer) + end + end + else + if not bar.paused and extendTimer > 0 then + bar.scheduledScanExpireAt = math.max(bar.scheduledScanExpireAt or 0, bar.expirationTime + extendTimer) + end + if remainingTime > 0 then + Private.ExecEnv.BossMods.BigWigs:CopyBarToState(bar, states, cloneId, extendTimer) + changed = true + end + end + return changed + end + + if useClone then + if event == "BigWigs_StartBar" + or event == "BigWigs_PauseBar" + or event == "BigWigs_ResumeBar" + then + if Private.ExecEnv.BossMods.BigWigs:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerCast, triggerIsCooldown) then + local bar = Private.ExecEnv.BossMods.BigWigs:GetTimerById(timerId) + if bar then + return copyOrSchedule(bar, cloneId) + end + end + elseif event == "BigWigs_StopBar" and state then + local bar_remainingTime = state.expirationTime - GetTime() + (state.extend or 0) + if state.extend == 0 or bar_remainingTime <= 0 then + state.show = false + state.changed = true + return true + end + elseif event == "BigWigs_Timer_Update" then + local changed + for timerId, bar in pairs(Private.ExecEnv.BossMods.BigWigs:GetAllTimers()) do + if Private.ExecEnv.BossMods.BigWigs:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerCast, triggerIsCooldown) then + changed = copyOrSchedule(bar, timerId) or changed + end + end + return changed + elseif event == "BigWigs_Timer_Force" then + local changed + for _, state in pairs(states) do + state.show = false + state.changed = true + changed = true + end + for timerId, bar in pairs(Private.ExecEnv.BossMods.BigWigs:GetAllTimers()) do + if Private.ExecEnv.BossMods.BigWigs:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerCast, triggerIsCooldown) then + changed = copyOrSchedule(bar, timerId) or changed end end return changed end - - if useClone then - if event == "BigWigs_StartBar" - or event == "BigWigs_PauseBar" - or event == "BigWigs_ResumeBar" - then + else + if event == "BigWigs_StartBar" then + if extendTimer ~= 0 then if Private.ExecEnv.BossMods.BigWigs:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerCast, triggerIsCooldown) then local bar = Private.ExecEnv.BossMods.BigWigs:GetTimerById(timerId) - if bar then - return copyOrSchedule(bar, cloneId) - end + Private.ExecEnv.BossMods.BigWigs:ScheduleCheck(bar.expirationTime + extendTimer) end - elseif event == "BigWigs_StopBar" and state then + end + end + local bar = Private.ExecEnv.BossMods.BigWigs:GetTimer(triggerText, triggerTextOperator, triggerSpellId, extendTimer, counter, triggerCast, triggerIsCooldown) + if bar then + if extendTimer == 0 + or not (state and state.show) + or (state and state.show and state.expirationTime > (bar.expirationTime + extendTimer)) + then + return copyOrSchedule(bar, cloneId) + end + else + if state and state.show then local bar_remainingTime = state.expirationTime - GetTime() + (state.extend or 0) if state.extend == 0 or bar_remainingTime <= 0 then state.show = false state.changed = true return true end - elseif event == "BigWigs_Timer_Update" then - local changed - for timerId, bar in pairs(Private.ExecEnv.BossMods.BigWigs:GetAllTimers()) do - if Private.ExecEnv.BossMods.BigWigs:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerCast, triggerIsCooldown) then - changed = copyOrSchedule(bar, timerId) or changed - end - end - return changed - elseif event == "BigWigs_Timer_Force" then - local changed - for _, state in pairs(states) do - state.show = false - state.changed = true - changed = true - end - for timerId, bar in pairs(Private.ExecEnv.BossMods.BigWigs:GetAllTimers()) do - if Private.ExecEnv.BossMods.BigWigs:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerCast, triggerIsCooldown) then - changed = copyOrSchedule(bar, timerId) or changed - end - end - return changed - end - else - if event == "BigWigs_StartBar" then - if extendTimer ~= 0 then - if Private.ExecEnv.BossMods.BigWigs:TimerMatches(timerId, triggerText, triggerTextOperator, triggerSpellId, counter, triggerCast, triggerIsCooldown) then - local bar = Private.ExecEnv.BossMods.BigWigs:GetTimerById(timerId) - Private.ExecEnv.BossMods.BigWigs:ScheduleCheck(bar.expirationTime + extendTimer) - end - end - end - local bar = Private.ExecEnv.BossMods.BigWigs:GetTimer(triggerText, triggerTextOperator, triggerSpellId, extendTimer, counter, triggerCast, triggerIsCooldown) - if bar then - if extendTimer == 0 - or not (state and state.show) - or (state and state.show and state.expirationTime > (bar.expirationTime + extendTimer)) - then - return copyOrSchedule(bar, cloneId) - end - else - if state and state.show then - local bar_remainingTime = state.expirationTime - GetTime() + (state.extend or 0) - if state.extend == 0 or bar_remainingTime <= 0 then - state.show = false - state.changed = true - return true - end - end end end 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_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["ID"], - desc = L["The 'ID' value can be found in the BigWigs options of a specific spell"], - type = "spell", - conditionType = "string", - noValidation = true, - showExactOption = false, - negativeIsEJ = true - }, - { - 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", - store = true, - conditionType = "string", - }, - { - name = "cast", - display = L["Cast Bar"], - desc = L["Filter messages with format "], - 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" - }, + 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_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["ID"], + desc = L["The 'ID' value can be found in the BigWigs options of a specific spell"], + type = "spell", + conditionType = "string", + noValidation = true, + showExactOption = false, }, - automaticrequired = true, - } - Private.category_event_prototype.addons["BigWigs Timer"] = L["BigWigs Timer"] -end + { + 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", + store = true, + conditionType = "string", + }, + { + name = "cast", + display = L["Cast Bar"], + desc = L["Filter messages with format "], + 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, +} +Private.category_event_prototype.addons["BigWigs Timer"] = L["BigWigs Timer"] -- Unified -if BigWigsLoader or not DBM then +if DBM then + Private.ExecEnv.BossMods.Generic = Private.ExecEnv.BossMods.DBM + Private.ExecEnv.BossMods.DBM.isGeneric = true + Private.ExecEnv.BossMods.DBM.isInstalled = true +end +--[[if BigWigsLoader or not DBM then Private.ExecEnv.BossMods.Generic = Private.ExecEnv.BossMods.BigWigs Private.ExecEnv.BossMods.BigWigs.isGeneric = true Private.ExecEnv.BossMods.BigWigs.isInstalled = BigWigsLoader ~= nil @@ -1334,7 +1326,7 @@ elseif DBM then Private.ExecEnv.BossMods.Generic = Private.ExecEnv.BossMods.DBM Private.ExecEnv.BossMods.DBM.isGeneric = true Private.ExecEnv.BossMods.DBM.isInstalled = true -end +end]] local ActiveBossModText if Private.ExecEnv.BossMods.BigWigs.isInstalled then @@ -1714,4 +1706,35 @@ Private.event_prototypes["Boss Mod Timer"] = { } Private.category_event_prototype.addons["Boss Mod Timer"] = L["Boss Mod Timer"] +-- Disable DBM for users with an outdated DBM version and always disable BigWigs triggers +-- Only disable DBM triggers if the DBM version is older than 2025-Feb-09 +-- References: +-- Commit: https://github.com/Zidras/DBM-Warmane/commit/5791dac460a07225c5d617d0252a88ce1e210618 +-- Download: https://github.com/Zidras/DBM-Warmane/archive/refs/heads/main.zip +if not (DBM and DBM.Revision >= 20250209000000) then + local dbm_trigger = { + "DBM Stage", + "DBM Announce", + "DBM Timer", + "Boss Mod Stage", + "Boss Mod Stage (Event)", + "Boss Mod Announce", + "Boss Mod Timer" + } + -- Remove all relevant DBM event prototypes + for _, event in ipairs(dbm_trigger) do + Private.event_prototype[event] = nil + end +end + +-- Always disable BigWigs triggers +local bigwigs_trigger = { + "BigWigs Stage", + "BigWigs Message", + "BigWigs Timer" +} + +for _, event in ipairs(bigwigs_trigger) do + Private.event_prototype[event] = nil +end