Skip to content

Commit

Permalink
Core: mod sync bugfixes
Browse files Browse the repository at this point in the history
- Fixed a bug where combat rules were applied globally to syncs, causing many trash mods, and boss RP syncs to never actually sync in the first place, defeating entire purpose in many cases of why syncs were coded. This should fix MANY RP timers. One concern here is that it might also cause mods that aren't correctly checking IsInCombat in their OnSync handlers to start showing stuff out of combat, which has to be fixed on a per mod level.
- Fixed a bug where player syncs were given no restriction on whether or not they should be trusted. There is a reason minSyncRevision exists and an out of date players DBM shouldn't be allowed to ignore that. This code originally existed so a player in a solo raid wouldn't have broken comms entirely, but that's now handled correctly in the sendSync function which automatically passes player comms to sync handler without check if there is no one else in group with them, so all the hacky exclusion checks in ReceiveSync are no longer needed.

This change makes this commit not needed anymore: 22ab121
Topic was also discussed in more detail on my retail PR.
  • Loading branch information
Zidras committed Dec 27, 2023
1 parent e2e6507 commit b7853a3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions DBM-Core/DBM-Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ local function currentFullDate()
end

DBM = {
Revision = parseCurseDate("20231227194407"),
Revision = parseCurseDate("20231227223523"),
DisplayVersion = "10.1.10 alpha", -- the string that is shown as version
ReleaseRevision = releaseDate(2023, 12, 26) -- the date of the latest stable version that is available, optionally pass hours, minutes, and seconds for multiple releases in one day
}
Expand Down Expand Up @@ -4817,7 +4817,6 @@ do
local modId = mod.id
mod.inCombat = true
encounterInProgress = true
mod.blockSyncs = nil
mod.combatInfo.pull = GetTime() - (delay or 0)
bossuIdFound = event == "IEEU"
if (self.Options.AlwaysShowHealthFrame or mod.Options.HealthFrame) and mod.Options.Enabled then
Expand Down Expand Up @@ -5104,7 +5103,6 @@ do
end
mod.inCombat = false
encounterInProgress = false
mod.blockSyncs = true
if mod.combatInfo.killMobs then
for i, _ in pairs(mod.combatInfo.killMobs) do
mod.combatInfo.killMobs[i] = true
Expand Down Expand Up @@ -11434,7 +11432,7 @@ function bossModPrototype:SendSync(event, ...)
--Mod syncs are more strict and enforce latency threshold always.
--Do not put latency check in main sendSync local function (line 313) though as we still want to get version information, etc from these users.
if not private.modSyncSpam[spamId] or (time - private.modSyncSpam[spamId]) > 8 then
self:ReceiveSync(event, nil, self.revision or 0, tostringall(...)) -- keep sender as nil, for (self.blockSyncs and sender) check
self:ReceiveSync(event, playerName, self.revision or 0, tostringall(...))
sendSync("DBMv4-Mod", str)
end
end
Expand All @@ -11453,7 +11451,7 @@ end
function bossModPrototype:ReceiveSync(event, sender, revision, ...)
local spamId = self.id .. event .. strjoin("\t", ...)
local time = GetTime()
if (not private.modSyncSpam[spamId] or (time - private.modSyncSpam[spamId]) > self.SyncThreshold) and self.OnSync and (not (self.blockSyncs and sender)) and (not sender or (not self.minSyncRevision or revision >= self.minSyncRevision)) then
if (not private.modSyncSpam[spamId] or (time - private.modSyncSpam[spamId]) > self.SyncThreshold) and self.OnSync and (not self.minSyncRevision or revision >= self.minSyncRevision) then
private.modSyncSpam[spamId] = time
-- we have to use the sender as last argument for compatibility reasons (stupid old API...)
-- avoid table allocations for frequently used number of arguments
Expand Down

0 comments on commit b7853a3

Please sign in to comment.