World of Warcraft Forever API · C_SwingTimer.md, for your AI
C_SwingTimer
2 functions, 2 events, 1 tables, as Blizzard documents them for Forever 1.60.1 (70959).
Making an addon with an AI? Tell it: Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it. It checks every call against this API before you try it in the game, then publishes it here. How it works.
Functions
C_SwingTimer.EnableRangeCheck
C_SwingTimer.EnableRangeCheck(swingType, enable)
Used in conjunction with PlayerSwingRangeUpdate to inform the UI when the current target goes in or out of auto attack range.
Arguments
swingType | PlayerSwingType | |
|---|---|---|
enable | bool | True if changes in range for the swing type should dispatch PlayerSwingRangeUpdate. False if the swing type no longer needs the event. |
C_SwingTimer.IsTargetWithinSwingRange
isInRange = C_SwingTimer.IsTargetWithinSwingRange(swingType)
Whether the current target is within range of the player's auto attack for the given swing type. Auto attacks only ever apply to the current target, so no other unit can be queried.
Arguments
swingType | PlayerSwingType |
|---|
Returns
isInRange | bool may be nil | Nil when no range check could be made, for example there is no target, the target cannot be attacked, or no weapon is equipped for the swing type. Nil must not be treated as out of range. |
|---|
Events
PLAYER_SWING
swingDuration | number | |
|---|---|---|
swingType | PlayerSwingType |
PLAYER_SWING_RANGE_UPDATE
Only signaled for swing types that have an active range check. See C_SwingTimer.EnableRangeCheck.
swingType | PlayerSwingType | |
|---|---|---|
isInRange | bool | Whether the current target is within auto attack range. Should not be used if the 'checksRange' parameter is false. |
checksRange | bool | Can be false if a range check was not made for any reason, for example there is not a current target. |
Tables
Enum.PlayerSwingType enumeration
MainHand | 0 |
|---|---|
OffHand | 1 |
Ranged | 2 |