Skip to content

Commit

Permalink
Core: Fix filtering UNIT_* events by unitId (#200)
Browse files Browse the repository at this point in the history
Fixes event filters such as "UNIT_HEALTH boss1" which were not working as expected
  • Loading branch information
oomshroom authored Jun 23, 2024
1 parent bece7cb commit 49cc770
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 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("2024025190711"),
Revision = parseCurseDate("20240623223141"),
DisplayVersion = "10.1.12 alpha", -- the string that is shown as version
ReleaseRevision = releaseDate(2024, 02, 21) -- 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 @@ -797,15 +797,17 @@ do
local zones = v.zones
local handler = v[event]
local modEvents = v.registeredUnitEvents
if isUnitEvent --[[and v.id == DBM.currentModId]] then -- Me and Kader initially coded a current mod check to save some CPU but noticed it would not work with RegisterEvents (to be listened out of modCombat) since currentModId is being set on StartCombat
--if isUnitEvent --[[and v.id == DBM.currentModId]] then -- Me and Kader initially coded a current mod check to save some CPU but noticed it would not work with RegisterEvents (to be listened out of modCombat) since currentModId is being set on StartCombat
-- Workaround for retail-like mod:RegisterEvents("UNIT_SPELLCAST_START boss1"). Check if we have valid units registered and filter out everything else.
-- v is mod here... so we check registered mods for registered events with registered uIds (v.registeredUnitEvents[event]).
-- then we check if we have our unit (args) in the table ... self.registeredUnitEvents[event] = args which is defined below
if modEvents and modEvents[event] and not checkEntry(modEvents[event], ...) then return end
end
--if modEvents and modEvents[event] and not checkEntry(modEvents[event], ...) then return end
--end

if handler and (not zones or zones[LastInstanceMapID] or zones[LastInstanceZoneName]) and not (not v.isTrashModBossFightAllowed and v.isTrashMod and #inCombat > 0) then
handler(v, ...)
if not (isUnitEvent and modEvents and modEvents[event] and not checkEntry(modEvents[event], ...)) then
if handler and (not zones or zones[LastInstanceMapID] or zones[LastInstanceZoneName]) and not (not v.isTrashModBossFightAllowed and v.isTrashMod and #inCombat > 0) then
handler(v, ...)
end
end
end
end
Expand Down

0 comments on commit 49cc770

Please sign in to comment.