I actually have a full implementation, but it involves hooking the spellcasting functions, as well as the targeting functions in order to glean the information necessary. Then it waits for the next SPELLCAST_STOP and attributes the "being cast" spell to that event. Send me an email at
[email protected] if you're interested.