Hey guys, is it possible to check wether an event is already registered? If I register the same event multiple times, it seems not to be overwritten but registering multiple times which is very odd behavior.
function AuraMastery:RegisterForEvent(eventId, abilityId)
You are mistaken. Event handlers can only be registered once for the same eventNamespace/eventId pair. EVENT_MANAGER:RegisterForEvent returns true if it actually registered the function and false otherwise. In order to assign a different function you have to first call UnregisterForEvent for the same namespace and id, which will also return true in case it did unregister something.
The reason why you see your handler getting called more than once is that some abilities have more than one effect. I tried your code with Shadowy Disguise (id 62141) and it is called 2 times when it is cast and one more time when the invisibility runs out.