Originally Posted by sirinsidiator
You can also just call AddFilterForEvent multiple times for the same event and it will also work.
|
That's what I tried, but only the last added result would work, don't know what I did wrong then if it should work.
Edit: If anyone ever finds this with the same question, then here's my current solution to multiple results with multiple handlers:
Lua Code:
local filters = {
[self.onCombatEventDmg] = {
ACTION_RESULT_DAMAGE,
ACTION_RESULT_DOT_TICK,
ACTION_RESULT_BLOCKED_DAMAGE,
ACTION_RESULT_DAMAGE_SHIELDED
},
[self.onCombatEventDmgCrit] = {
ACTION_RESULT_CRITICAL_DAMAGE,
ACTION_RESULT_DOT_TICK_CRITICAL
},
[self.onCombatEventHeal] = {
ACTION_RESULT_HOT_TICK,
ACTION_RESULT_HEAL
},
[self.onCombatEventHealCrit] = {
ACTION_RESULT_CRITICAL_HEAL,
ACTION_RESULT_HOT_TICK_CRITICAL
}
}
local nsInc = 1
for k,v in pairs(filters) do
for i=1, #v do
EVENT_MANAGER:RegisterForEvent(self.name..nsInc, EVENT_COMBAT_EVENT, k)
EVENT_MANAGER:AddFilterForEvent(self.name..nsInc, EVENT_COMBAT_EVENT, REGISTER_FILTER_COMBAT_RESULT , v[i], REGISTER_FILTER_IS_ERROR, false)
nsInc = nsInc+1
end
end
I could reduce the need for IFs in LUA to checking whether I need to create arrays or not, which should be a major improvement I guess.