View Single Post
10/07/20, 09:23 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,993
You need to register 2 events with the appropriate filters then and in your callback functions handle both cases.
e.g. do some pre-checks in your event callback function and then call the same "further stuff" function from it.

Code:
event_combat_event, filter source == player, callback = callback1
event_combat_event, filter target == player, callback = callback2

function callbackEventCombat(caseType, a, b, c, ...)
 if caseType == 1 then
 elseif caseType == 2 then
 end
end

function callback1(a, b, c, source, target, ...)
 if target ~= "player" then return end
 callbackEventCombat(1, a, b, c, source, target, ...)
end

function callback2(a, b, c, source, target, ...)
 if source~= "player" then return end
 callbackEventCombat(2, a, b, c, source, target, ...)
end
Something like that perhaps.
  Reply With Quote