WoW:API UnitCastingInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(added castID and interrupt to the returns list)
m (Move page script moved page API UnitCastingInfo to API UnitCastingInfo without leaving a redirect)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
__NOWYSIWYG__{{wowapi}}__NOTOC__




Line 12: Line 12:


=== Returns ===
=== Returns ===
:;spell : String - The name of the spell, or nil if no spell is being cast.
:;spell: String - The name of the spell, or nil if no spell is being cast.
:;rank : String - The string describing the rank of the spell, e.g. "Rank 1".
:;rank: String - The string describing the rank of the spell, e.g. "Rank 1".
:;displayName : String - The name to be displayed.
:;displayName: String - The name to be displayed.
:;icon : String - The texture path associated with the spell.
:;icon: String - The texture path associated with the spell.
:;startTime : Number - Specifies when casting has begun, in milliseconds.
:;startTime: Number - Specifies when casting has begun, in milliseconds.
:;endTime : Number - Specifies when casting will end, in milliseconds.
:;endTime: Number - Specifies when casting will end, in milliseconds.
:;isTradeSkill : Boolean - Specifies if the cast is a tradeskill
:;isTradeSkill: Boolean - Specifies if the cast is a tradeskill
:;castID : Number - (added either in or just before 3.2 - not sure what it does)
:;castID: Number - Counts the spellcast(s) since the game has loaded.(added either in or just before 3.2)
:;interrupt : ? (added in 3.2... believe it's boolean for isInterruptable, but not sure)
:;interrupt: (added in 3.2) Boolean - Returns true if the unit's current cast can not be interrupted by abilities such as Counterspell or Kick. Otherwise, returns false if the cast is interruptible or nil if the unit is not casting. If tested on a Paladin with Divine Shield active, interrupt returns true while the Paladin is casting. Without Divine Shield active, interrupt would return false.)


== Example ==
== Example ==
Line 44: Line 44:
As of May 10, 2008, this does not return anything while casting Hellfire, Drain Life, or Rain of Fire with my warlock.  The correct API for channeled spells is [[API UnitChannelInfo|UnitChannelInfo]].  It takes the same arguments and returns the same values, but is specific to channeled spells.
As of May 10, 2008, this does not return anything while casting Hellfire, Drain Life, or Rain of Fire with my warlock.  The correct API for channeled spells is [[API UnitChannelInfo|UnitChannelInfo]].  It takes the same arguments and returns the same values, but is specific to channeled spells.


New in Patch 3.2 (August 2009), returns 'interrupt' as well. Believe this is a boolean value for whether it is interruptable or not, but needs confirmation.
New in Patch 3.2 (August 2009), returns 'interrupt' as well. Believe this is a boolean value for whether it is interruptable or not, but needs confirmation. Confirmed and updated.


Also, the [http://forums.worldofwarcraft.com/thread.html?topicId=18031134556&sid=1&pageNo=1 official WoW 3.2 patch changes page] lists the returns as:
Also, the [http://forums.worldofwarcraft.com/thread.html?topicId=18031134556&sid=1&pageNo=1 official WoW 3.2 patch changes page] lists the returns as:

Latest revision as of 04:47, 15 August 2023

WoW API < UnitCastingInfo


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

spell, rank, displayName, icon, startTime, endTime, isTradeSkill, castID, interrupt = UnitCastingInfo("unit")


Parameters[edit]

Arguments[edit]

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

Returns[edit]

spell
String - The name of the spell, or nil if no spell is being cast.
rank
String - The string describing the rank of the spell, e.g. "Rank 1".
displayName
String - The name to be displayed.
icon
String - The texture path associated with the spell.
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)
interrupt
(added in 3.2) Boolean - Returns true if the unit's current cast can not be interrupted by abilities such as Counterspell or Kick. Otherwise, returns false if the cast is interruptible or nil if the unit is not casting. If tested on a Paladin with Divine Shield active, interrupt returns true while the Paladin is casting. Without Divine Shield active, interrupt would return false.)

Example[edit]

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[edit]

If you're currently casting Shadowbolt:
Shadowbolt will be finished casting in 1.234 seconds.


Details[edit]

For channeled spells, displayName is "Channeling".

Not sure if displayName ever differs from spell in any other contexts.

As of May 10, 2008, this does not return anything while casting Hellfire, Drain Life, or Rain of Fire with my warlock. The correct API for channeled spells is UnitChannelInfo. It takes the same arguments and returns the same values, but is specific to channeled spells.

New in Patch 3.2 (August 2009), returns 'interrupt' as well. Believe this is a boolean value for whether it is interruptable or not, but needs confirmation. Confirmed and updated.

Also, the official WoW 3.2 patch changes page lists the returns as:

name, nameSubtext, text, texture, startTime, endTime, isTradeSkill, castID, interrupt 

Didn't see 'castID' in there before, so added it to the returns list above. Assume it's a number, but this and the return type of interrupt need to be confirmed