Originally Posted by myrroddin
ResCastFinished and ResCastCancelled could follow suit above, replacing targetUnit, targetGUID with casterUnit, casterGUID. The API can give us targets. ResPending is the only one that needs the extra return (targetUnit, targetGUID, expiry_time).
|
Actually, ResCastFinished and ResCastCancelled need both the caster and the target, since the data returned by the API is updated before callbacks are fired. If you call UnitIsCastingRes on the caster in response to either of those callbacks, you will get nil, because the caster is no longer casting a res. Likewise, if you call UnitHasIncomingRes after those callbacks, if the caster whose cast finished or was cancelled was the only one casting a res on that unit, you will get nil, because the unit no longer has an incoming res.
ResPending actually doesn't need the expiry time, since you can get that from UnitHasIncomingRes, but after typing the previous paragraph, I realized I'll need to keep both caster and target in at least ResCastFinished and ResCastCancelled, since there's no other way to get that info, so I might as well just keep all of the current callback args (though the order will change as detailed in a previous post) to keep them consistent. Also, all of the info currently passed is always on hand when the callbacks are fired, so there isn't any extra work involved, whereas spellID or isFirst are not always on hand, and would require extra work in some cases.