Skip to content

Commit

Permalink
Core/BossPrototype: Allow registering SPELL_DISPEL and `SPELL_INTER…
Browse files Browse the repository at this point in the history
…RUPT` with a spell ID
  • Loading branch information
funkydude committed Aug 7, 2024
1 parent 49ba81a commit caa2ffe
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Core/BossPrototype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,24 @@ do
end
end
end
elseif event == "SPELL_DISPEL" or event == "SPELL_INTERRUPT" then
for i = #enabledModules, 1, -1 do
local self = enabledModules[i]
local m = eventMap[self][event]
if m and (m[extraSpellId] or m["*"]) then
local func = m[extraSpellId] or m["*"]
-- DEVS! Please ask if you need args attached to the table that we've missed out!
args.sourceGUID, args.sourceName, args.sourceFlags, args.sourceRaidFlags = sourceGUID, sourceName, sourceFlags, sourceRaidFlags
args.destGUID, args.destName, args.destFlags, args.destRaidFlags = destGUID, destName, destFlags, destRaidFlags
args.spellId, args.spellName, args.spellSchool = spellId, spellName, spellSchool
args.time, args.extraSpellId, args.extraSpellName, args.amount = time, extraSpellId, amount, amount
if type(func) == "function" then
func(args)
else
self[func](self, args)
end
end
end
else
for i = #enabledModules, 1, -1 do
local self = enabledModules[i]
Expand Down
18 changes: 18 additions & 0 deletions Core/BossPrototype_Classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,24 @@ do
end
end
end
elseif event == "SPELL_DISPEL" or event == "SPELL_INTERRUPT" then
for i = #enabledModules, 1, -1 do
local self = enabledModules[i]
local m = eventMap[self][event]
if m and (m[extraSpellId] or m["*"]) then
local func = m[extraSpellId] or m["*"]
-- DEVS! Please ask if you need args attached to the table that we've missed out!
args.sourceGUID, args.sourceName, args.sourceFlags, args.sourceRaidFlags = sourceGUID, sourceName, sourceFlags, sourceRaidFlags
args.destGUID, args.destName, args.destFlags, args.destRaidFlags = destGUID, destName, destFlags, destRaidFlags
args.spellId, args.spellName, args.spellSchool = spellId, spellName, spellSchool
args.time, args.extraSpellId, args.extraSpellName, args.amount = time, extraSpellId, amount, amount
if type(func) == "function" then
func(args)
else
self[func](self, args)
end
end
end
else
for i = #enabledModules, 1, -1 do
local self = enabledModules[i]
Expand Down

0 comments on commit caa2ffe

Please sign in to comment.