(refactor/BossMods) small refactor and code check

This commit is contained in:
NoM0Re
2025-10-09 21:05:18 +02:00
parent de1d05b2b2
commit ad6a8b3cab
+36 -31
View File
@@ -49,6 +49,10 @@ elseif (DBM and type(DBM.ReleaseRevision) == "number" and DBM.ReleaseRevision >=
dbmSupportStatus = dbmSupportStates.LEGACY dbmSupportStatus = dbmSupportStates.LEGACY
end end
local barOptions = DBM and type(DBM.ReleaseRevision) == "number" and (
DBM.ReleaseRevision >= 20220412000000 and DBT.Options or DBM.Bars.options
)
-- DBM -- DBM
Private.ExecEnv.BossMods.DBM = { Private.ExecEnv.BossMods.DBM = {
registeredEvents = {}, registeredEvents = {},
@@ -248,8 +252,6 @@ Private.ExecEnv.BossMods.DBM = {
r, g, b = r or 0, g or 0, b or 0 r, g, b = r or 0, g or 0, b or 0
else else
-- Compability code for DBM versions from around Aberrus -- Compability code for DBM versions from around Aberrus
-- Can be removed once we can assume newer versions
local barOptions = DBT.Options
if barOptions then if barOptions then
if dbmType == 1 then if dbmType == 1 then
r, g, b = barOptions.StartColorAR, barOptions.StartColorAG, barOptions.StartColorAB r, g, b = barOptions.StartColorAR, barOptions.StartColorAG, barOptions.StartColorAB
@@ -402,8 +404,6 @@ Private.ExecEnv.BossMods.DBM = {
self:RegisterCallback("DBM_TimerStart") self:RegisterCallback("DBM_TimerStart")
self:RegisterCallback("DBM_TimerStop") self:RegisterCallback("DBM_TimerStop")
self:RegisterCallback("DBM_TimerUpdate") self:RegisterCallback("DBM_TimerUpdate")
self:RegisterCallback("wipe")
self:RegisterCallback("kill")
end end
end, end,
@@ -413,8 +413,11 @@ Private.ExecEnv.BossMods.DBM = {
RegisterStage = function(self) RegisterStage = function(self)
self:RegisterCallback("DBM_SetStage") self:RegisterCallback("DBM_SetStage")
self:RegisterCallback("DBM_Pull") if dbmSupportStatus == dbmSupportStates.LATEST or
self:RegisterCallback("DBM_Kill") dbmSupportStatus == dbmSupportStates.COMPATIBLE then
self:RegisterCallback("DBM_Pull")
self:RegisterCallback("DBM_Kill")
end
end, end,
scheduled_scans = {}, scheduled_scans = {},
@@ -533,7 +536,7 @@ Private.event_prototypes["DBM Timer"] = {
type = "addons", type = "addons",
events = {}, events = {},
internal_events = { internal_events = {
"DBM_TimerStart", "DBM_TimerStop", "DBM_TimerUpdate", "DBM_TimerStopAll,", "DBM_TimerForce", "DBM_TimerStart", "DBM_TimerStop", "DBM_TimerUpdate", "DBM_TimerForce",
"DBM_TimerResume", "DBM_TimerPause", "DBM_TimerUpdateIcon" "DBM_TimerResume", "DBM_TimerPause", "DBM_TimerUpdateIcon"
}, },
force_events = "DBM_TimerForce", force_events = "DBM_TimerForce",
@@ -1820,7 +1823,6 @@ Private.event_prototypes["Boss Mod Timer"] = {
trigger.use_isBarEnabled == nil and "nil" or trigger.use_isBarEnabled and "true" or "false", trigger.use_isBarEnabled == nil and "nil" or trigger.use_isBarEnabled and "true" or "false",
trigger.remaining_operator or "<" trigger.remaining_operator or "<"
) )
end, end,
statesParameter = "full", statesParameter = "full",
args = { args = {
@@ -1889,6 +1891,7 @@ Private.event_prototypes["Boss Mod Timer"] = {
} }
Private.category_event_prototype.addons["Boss Mod Timer"] = L["Boss Mod Timer"] Private.category_event_prototype.addons["Boss Mod Timer"] = L["Boss Mod Timer"]
-- Deactivate DBM for users with outdated versions, and always disable BigWigs triggers. -- Deactivate DBM for users with outdated versions, and always disable BigWigs triggers.
-- DBM triggers are only disabled if the DBM version is older than 7.0.5+. -- DBM triggers are only disabled if the DBM version is older than 7.0.5+.
-- Supported DBM version is "DBM Warmane" with commits from 2025-Feb-09+ and from 2025-Mar-12+. -- Supported DBM version is "DBM Warmane" with commits from 2025-Feb-09+ and from 2025-Mar-12+.
@@ -1900,31 +1903,33 @@ Private.category_event_prototype.addons["Boss Mod Timer"] = L["Boss Mod Timer"]
-- Download: https://github.com/Zidras/DBM-Warmane/archive/refs/heads/main.zip -- Download: https://github.com/Zidras/DBM-Warmane/archive/refs/heads/main.zip
-- Disable DBM for users with an outdated DBM version -- Disable DBM for users with an outdated DBM version
if dbmSupportStatus == dbmSupportStates.UNSUPPORTED then do
local dbm_trigger = { if dbmSupportStatus == dbmSupportStates.UNSUPPORTED then
"DBM Stage", local dbm_trigger = {
"DBM Announce", "DBM Stage",
"DBM Timer", "DBM Announce",
"Boss Mod Stage", "DBM Timer",
"Boss Mod Stage (Event)", "Boss Mod Stage",
"Boss Mod Announce", "Boss Mod Stage (Event)",
"Boss Mod Timer" "Boss Mod Announce",
"Boss Mod Timer"
}
-- Remove all relevant DBM event prototypes
for _, event in ipairs(dbm_trigger) do
Private.event_prototypes[event] = nil
end
end
-- Always disable BigWigs triggers
local bigwigs_trigger = {
"BigWigs Stage",
"BigWigs Message",
"BigWigs Timer"
} }
-- Remove all relevant DBM event prototypes -- Remove all relevant BigWigs event prototypes
for _, event in ipairs(dbm_trigger) do for _, event in ipairs(bigwigs_trigger) do
Private.event_prototypes[event] = nil Private.event_prototypes[event] = nil
end end
end end
-- Always disable BigWigs triggers
local bigwigs_trigger = {
"BigWigs Stage",
"BigWigs Message",
"BigWigs Timer"
}
-- Remove all relevant BigWigs event prototypes
for _, event in ipairs(bigwigs_trigger) do
Private.event_prototypes[event] = nil
end