from retail

This commit is contained in:
NoM0Re
2025-01-16 21:11:14 +01:00
parent ba4039dae2
commit ec42e803b4
8 changed files with 186 additions and 141 deletions
+161 -91
View File
@@ -16,7 +16,6 @@ Private.ExecEnv.BossMods.DBM = {
CopyBarToState = function(self, bar, states, timerId, extendTimer)
extendTimer = extendTimer or 0
if extendTimer + bar.duration < 0 then return end
states[timerId] = states[timerId] or {}
local state = states[timerId]
state.show = true
@@ -127,10 +126,21 @@ Private.ExecEnv.BossMods.DBM = {
for timerId, bar in pairs(self.bars) do
if not bar.paused then
if bar.expirationTime < now then
self.bars[timerId] = nil
WeakAuras.ScanEvents("DBM_TimerStop", timerId)
if self.isGeneric then
WeakAuras.ScanEvents("BossMod_TimerStop", timerId)
if bar.scheduledScanExpireAt == nil or bar.scheduledScanExpireAt <= GetTime() then
self.bars[timerId] = nil
else
if self.nextExpire == nil then
self.nextExpire = bar.scheduledScanExpireAt
elseif bar.scheduledScanExpireAt < self.nextExpire then
self.nextExpire = bar.scheduledScanExpireAt
end
end
if not bar.expired then
bar.expired = true
WeakAuras.ScanEvents("DBM_TimerStop", timerId)
if self.isGeneric then
WeakAuras.ScanEvents("BossMod_TimerStop", timerId)
end
end
elseif self.nextExpire == nil then
self.nextExpire = bar.expirationTime
@@ -166,6 +176,7 @@ Private.ExecEnv.BossMods.DBM = {
bar.spellId = tostring(spellId)
bar.count = timerCount and tostring(timerCount) or "0"
bar.dbmType = dbmType
bar.expired = nil
local r, g, b = 0, 0, 0
if DBT.GetColorForType then
@@ -212,10 +223,16 @@ Private.ExecEnv.BossMods.DBM = {
end
elseif event == "DBM_TimerStop" then
local timerId = ...
self.bars[timerId] = nil
WeakAuras.ScanEvents("DBM_TimerStop", timerId)
if self.isGeneric then
WeakAuras.ScanEvents("BossMod_TimerStop", timerId)
local bar = self.bars[timerId]
if bar then
if bar.scheduledScanExpireAt == nil or bar.scheduledScanExpireAt <= GetTime() then
self.bars[timerId] = nil
end
bar.expired = true
WeakAuras.ScanEvents("DBM_TimerStop", timerId)
if self.isGeneric then
WeakAuras.ScanEvents("BossMod_TimerStop", timerId)
end
end
elseif event == "DBM_TimerPause" then
local timerId = ...
@@ -321,7 +338,7 @@ Private.ExecEnv.BossMods.DBM = {
ScheduleCheck = function(self, fireTime)
if not self.scheduled_scans[fireTime] then
self.scheduled_scans[fireTime] = timer:ScheduleTimerFixed(self.DoScan, fireTime - GetTime() + 0.1, self, fireTime)
self.scheduled_scans[fireTime] = timer:ScheduleTimerFixed(self.DoScan, fireTime - GetTime(), self, fireTime)
end
end
}
@@ -384,6 +401,7 @@ Private.event_prototypes["DBM Announce"] = {
type = "spell",
noValidation = true,
showExactOption = false,
negativeIsEJ = true
},
{
name = "message",
@@ -453,28 +471,43 @@ Private.event_prototypes["DBM Timer"] = {
local counter = counter
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
local remainingTime
if bar.paused then
remainingTime = bar.remaining + extendTimer
else
remainingTime = bar.expirationTime - GetTime() + extendTimer
end
if remainingTime %s triggerRemaining then
if remainingTime > 0 and remainingTime %s triggerRemaining then
Private.ExecEnv.BossMods.DBM:CopyBarToState(bar, states, cloneId, extendTimer)
changed = true
else
local state = states[cloneId]
if state and state.show then
state.show = false
state.changed = true
changed = true
end
end
if remainingTime >= triggerRemaining and not bar.paused then
Private.ExecEnv.BossMods.DBM:ScheduleCheck(bar.expirationTime - triggerRemaining + extendTimer)
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
Private.ExecEnv.BossMods.DBM:CopyBarToState(bar, states, cloneId, extendTimer)
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
@@ -485,13 +518,12 @@ Private.event_prototypes["DBM Timer"] = {
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
copyOrSchedule(bar, cloneId)
return true
return 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
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
@@ -500,13 +532,12 @@ Private.event_prototypes["DBM Timer"] = {
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
copyOrSchedule(bar, timerId)
changed = true
changed = copyOrSchedule(bar, timerId) or changed
else
local state = states[timerId]
if state then
local bar_remainingTime = GetTime() - state.expirationTime + (state.extend or 0)
if state.extend == 0 or bar_remainingTime > 0.2 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
@@ -524,8 +555,7 @@ Private.event_prototypes["DBM Timer"] = {
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
copyOrSchedule(bar, timerId)
changed = true
changed = copyOrSchedule(bar, timerId) or changed
end
end
return changed
@@ -545,13 +575,12 @@ Private.event_prototypes["DBM Timer"] = {
or not (state and state.show)
or (state and state.show and state.expirationTime > (bar.expirationTime + extendTimer))
then
copyOrSchedule(bar, cloneId)
return true
return 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
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
@@ -565,7 +594,7 @@ Private.event_prototypes["DBM Timer"] = {
return ret:format(
trigger.use_count and trigger.count or "",
trigger.use_id and trigger.id or "",
trigger.use_spellId and trigger.spellId 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",
@@ -591,6 +620,7 @@ Private.event_prototypes["DBM Timer"] = {
conditionType = "string",
noValidation = true,
showExactOption = false,
negativeIsEJ = true
},
{
name = "message",
@@ -644,7 +674,6 @@ Private.ExecEnv.BossMods.BigWigs = {
CopyBarToState = function(self, bar, states, timerId, extendTimer)
extendTimer = extendTimer or 0
if extendTimer + bar.duration < 0 then return end
states[timerId] = states[timerId] or {}
local state = states[timerId]
state.show = true
@@ -749,10 +778,21 @@ Private.ExecEnv.BossMods.BigWigs = {
for timerId, bar in pairs(self.bars) do
if not bar.paused then
if bar.expirationTime < now then
self.bars[timerId] = nil
WeakAuras.ScanEvents("BigWigs_StopBar", timerId)
if self.isGeneric then
WeakAuras.ScanEvents("BossMod_TimerStop", timerId)
if bar.scheduledScanExpireAt == nil or bar.scheduledScanExpireAt <= GetTime() then
self.bars[timerId] = nil
else
if self.nextExpire == nil then
self.nextExpire = bar.scheduledScanExpireAt
elseif bar.scheduledScanExpireAt < self.nextExpire then
self.nextExpire = bar.scheduledScanExpireAt
end
end
if not bar.expired then
bar.expired = true
WeakAuras.ScanEvents("BigWigs_StopBar", timerId)
if self.isGeneric then
WeakAuras.ScanEvents("BossMod_TimerStop", timerId)
end
end
elseif self.nextExpire == nil then
self.nextExpire = bar.expirationTime
@@ -789,6 +829,7 @@ Private.ExecEnv.BossMods.BigWigs = {
bar.expirationTime = expirationTime
bar.icon = icon
bar.isCooldown = isCD or false
bar.expired = nil
local BWColorModule = BigWigs:GetPlugin("Colors")
bar.bwBarColor = BWColorModule:GetColorTable("barColor", addon, spellId)
bar.bwTextColor = BWColorModule:GetColorTable("barText", addon, spellId)
@@ -810,8 +851,11 @@ Private.ExecEnv.BossMods.BigWigs = {
end
elseif event == "BigWigs_StopBar" then
local addon, text = ...
if self.bars[text] then
self.bars[text] = nil
local bar = self.bars[text]
if bar then
if bar.scheduledScanExpireAt == nil or bar.scheduledScanExpireAt <= GetTime() then
self.bars[text] = nil
end
WeakAuras.ScanEvents("BigWigs_StopBar", text)
if self.isGeneric then
WeakAuras.ScanEvents("BossMod_TimerStop", text)
@@ -934,7 +978,7 @@ Private.ExecEnv.BossMods.BigWigs = {
ScheduleCheck = function(self, fireTime)
if not self.scheduled_scans[fireTime] then
self.scheduled_scans[fireTime] = timer:ScheduleTimerFixed(self.DoScan, fireTime - GetTime() + 0.1, self, fireTime)
self.scheduled_scans[fireTime] = timer:ScheduleTimerFixed(self.DoScan, fireTime - GetTime(), self, fireTime)
end
end
}
@@ -994,6 +1038,7 @@ Private.event_prototypes["BigWigs Message"] = {
conditionType = "string",
noValidation = true,
showExactOption = false,
negativeIsEJ = true
},
{
name = "text",
@@ -1064,28 +1109,43 @@ Private.event_prototypes["BigWigs Timer"] = {
local counter = counter
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
local remainingTime
if bar.paused then
remainingTime = bar.remaining + extendTimer
else
remainingTime = bar.expirationTime - GetTime() + extendTimer
end
if remainingTime %s triggerRemaining then
if remainingTime > 0 and remainingTime %s triggerRemaining then
Private.ExecEnv.BossMods.BigWigs:CopyBarToState(bar, states, cloneId, extendTimer)
changed = true
else
local state = states[cloneId]
if state and state.show then
state.show = false
state.changed = true
changed = true
end
end
if remainingTime >= triggerRemaining and not bar.paused then
Private.ExecEnv.BossMods.BigWigs:ScheduleCheck(bar.expirationTime - triggerRemaining + extendTimer)
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
Private.ExecEnv.BossMods.BigWigs:CopyBarToState(bar, states, cloneId, extendTimer)
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
@@ -1096,13 +1156,12 @@ Private.event_prototypes["BigWigs Timer"] = {
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
copyOrSchedule(bar, cloneId)
return true
return 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
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
@@ -1111,8 +1170,7 @@ Private.event_prototypes["BigWigs Timer"] = {
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
copyOrSchedule(bar, timerId)
changed = true
changed = copyOrSchedule(bar, timerId) or changed
end
end
return changed
@@ -1125,8 +1183,7 @@ Private.event_prototypes["BigWigs Timer"] = {
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
copyOrSchedule(bar, timerId)
changed = true
changed = copyOrSchedule(bar, timerId) or changed
end
end
return changed
@@ -1146,13 +1203,12 @@ Private.event_prototypes["BigWigs Timer"] = {
or not (state and state.show)
or (state and state.show and state.expirationTime > (bar.expirationTime + extendTimer))
then
copyOrSchedule(bar, cloneId)
return true
return 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
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
@@ -1164,7 +1220,7 @@ Private.event_prototypes["BigWigs Timer"] = {
]=]
return ret:format(
trigger.use_count and trigger.count or "",
trigger.use_spellId and trigger.spellId 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",
@@ -1186,6 +1242,7 @@ Private.event_prototypes["BigWigs Timer"] = {
conditionType = "string",
noValidation = true,
showExactOption = false,
negativeIsEJ = true
},
{
name = "text",
@@ -1353,6 +1410,7 @@ Private.event_prototypes["Boss Mod Announce"] = {
conditionType = "string",
noValidation = true,
showExactOption = false,
negativeIsEJ = true
},
{
name = "message",
@@ -1429,28 +1487,43 @@ Private.event_prototypes["Boss Mod Timer"] = {
local counter = counter
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
local remainingTime
if bar.paused then
remainingTime = bar.remaining + extendTimer
else
remainingTime = bar.expirationTime - GetTime() + extendTimer
end
if remainingTime %s triggerRemaining then
if remainingTime > 0 and remainingTime %s triggerRemaining then
Private.ExecEnv.BossMods.Generic:CopyBarToState(bar, states, cloneId, extendTimer)
changed = true
else
local state = states[cloneId]
if state and state.show then
state.show = false
state.changed = true
changed = true
end
end
if remainingTime >= triggerRemaining and not bar.paused then
Private.ExecEnv.BossMods.Generic:ScheduleCheck(bar.expirationTime - triggerRemaining + extendTimer)
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.Generic:ScheduleCheck(bar.expirationTime - triggerRemaining + extendTimer)
end
end
else
Private.ExecEnv.BossMods.Generic:CopyBarToState(bar, states, cloneId, extendTimer)
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.Generic:CopyBarToState(bar, states, cloneId, extendTimer)
changed = true
end
end
return changed
end
if useClone then
@@ -1461,13 +1534,12 @@ Private.event_prototypes["Boss Mod Timer"] = {
if Private.ExecEnv.BossMods.Generic:TimerMatchesGeneric(timerId, triggerText, triggerTextOperator, triggerSpellId, counter) then
local bar = Private.ExecEnv.BossMods.Generic:GetTimerById(timerId)
if bar then
copyOrSchedule(bar, cloneId)
return true
return copyOrSchedule(bar, cloneId)
end
end
elseif event == "BossMod_TimerStop" and state then
local bar_remainingTime = GetTime() - state.expirationTime + (state.extend or 0)
if state.extend == 0 or bar_remainingTime > 0.2 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
@@ -1476,13 +1548,12 @@ Private.event_prototypes["Boss Mod Timer"] = {
local changed
for timerId, bar in pairs(Private.ExecEnv.BossMods.Generic:GetAllTimers()) do
if Private.ExecEnv.BossMods.Generic:TimerMatchesGeneric(timerId, triggerText, triggerTextOperator, triggerSpellId, counter) then
copyOrSchedule(bar, timerId)
changed = true
changed = copyOrSchedule(bar, timerId) or changed
else
local state = states[timerId]
if state then
local bar_remainingTime = GetTime() - state.expirationTime + (state.extend or 0)
if state.extend == 0 or bar_remainingTime > 0.2 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
@@ -1500,8 +1571,7 @@ Private.event_prototypes["Boss Mod Timer"] = {
end
for timerId, bar in pairs(Private.ExecEnv.BossMods.Generic:GetAllTimers()) do
if Private.ExecEnv.BossMods.Generic:TimerMatchesGeneric(timerId, triggerText, triggerTextOperator, triggerSpellId, counter) then
copyOrSchedule(bar, timerId)
changed = true
changed = copyOrSchedule(bar, timerId) or changed
end
end
return changed
@@ -1521,13 +1591,12 @@ Private.event_prototypes["Boss Mod Timer"] = {
or not (state and state.show)
or (state and state.show and state.expirationTime > (bar.expirationTime + extendTimer))
then
copyOrSchedule(bar, cloneId)
return true
return 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
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
@@ -1540,7 +1609,7 @@ Private.event_prototypes["Boss Mod Timer"] = {
return ret:format(
trigger.use_count and trigger.count or "",
trigger.use_spellId and trigger.spellId 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",
@@ -1560,6 +1629,7 @@ Private.event_prototypes["Boss Mod Timer"] = {
conditionType = "string",
noValidation = true,
showExactOption = false,
negativeIsEJ = true
},
{
name = "message",