API UnitCastingInfo

Returns information on the spell currently cast by the specified unit. Returns nil if no spell is being cast.

name, nameSubtext, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible = UnitCastingInfo("unit")

Arguments

 * unit : String - The UnitId to query (e.g. "player", "party2", "pet", "target" etc.)

Returns

 * name : String - The name of the spell, or nil if no spell is being cast.
 * nameSubtext : String - The string describing additional properties of spell, used to contain rank, e.g. "Rank 1".
 * text : String - The name to be displayed.
 * texture : String - The texture path associated with the spell icon.
 * startTime : Number - Specifies when casting has begun, in milliseconds.
 * endTime : Number - Specifies when casting will end, in milliseconds.
 * isTradeSkill : Boolean - Specifies if the cast is a tradeskill
 * castID : Number - Counts the spellcast(s) since the game has loaded.(added either in or just before 3.2)
 * notInterruptible : Boolean - if true, indicates that this cast cannot be interrupted with abilites like Kick or Shield Bash. In default UI those spells have shield frame around their icons on enemy cast bars.

Example
local spell, _, _, _, _, endTime = UnitCastingInfo("player") if spell then local finish = endTime/1000 - GetTime ChatFrame1:AddMessage(spell .. ' will be finished casting in ' .. finish .. ' seconds.') end

Result

 * If you're currently casting Shadowbolt:

Shadowbolt will be finished casting in 1.234 seconds.

Details
For channeled spells, displayName is "Channeling". So far displayName is observed to be the same as name in any other contexts.

This function may not return anything when the target is channeling spell post it warm-up period, you should use UnitChannelInfo in that case. It takes the same arguments and returns the same values, but is specific to channeled spells.