Skip to content

Player

This type represents the player. It inherits all API functionality from Object, WorldObject, and Unit.

Members

The following are members of Player. All members are read-only. For example:

print("Last message: " .. some_bot.last_message)
Name Description Return Type Tested?
is_bot whether or not the player is a bot bool Yes
last_message the last whisper or party/raid message (only player messages) string Yes
class the player's class id- classes number No
inventory all the items in the player's backpack(s) array<Item> No
trinket_1 the player's first trinket Item Yes
trinket_2 the player's second trinket Item Yes
destination the player's destination (if given a chase command) Position No
has_reached_destination whether or not the player has reached its chase destination bool No
spec The player's deepest tree specialization- see specs number No
party the player's party number (i.e. the number in the raid panel) number No
movement_policy the player's [movement policy] (api/types/movement_policy.md) if any MovementPolicy No

Functions

The following are callable on a Player. Most of these functions perform an action. It is recommended to only choose one action to perform per tick. Responsible use is left to the developer. Example usage:

some_bot:whisper(wow.master, "I'm alive!")
Function Description Parameters Return Type Tested?
stand have the bot stand up none none No
sit have the bot sit down none none No
dance have the bot dance none none No
kneel have the bot kneel none none No
interrupt stop casting/channeling none none Yes
move move to a position - sets a move movement policy (x, y) or Unit none No
chase chase a unit- - sets a chase movement policy Unit target, number distance, number angle none No
follow follow a unit - sets a follow movement policy Unit target, number distance, number angle none Yes
teleport_to teleport to a unit Unit target none Yes
stop stops the player from moving none none No
reset_movement stops the player from moving and clears all movement tasks (i.e. follow, chase) none none No
add_item execute the additem command as the given bot (will not work in combat) string text bool success No
revive execute the revive chat command as the given bot (will not work in combat) none bool success No
whisper whisper a player Player target, string text none Yes
tell_party send a message to party chat string text none Yes
tell_raid send a message to raid chat string text none Yes
say send a message to local area string text none Yes
yell yell a message to local area string text none Yes
set_target set the bot's target Unit target none Yes
clear_target clear the bot's target none none Yes
clear_stealth clears stealth state none none Yes
face faces the given target or orientation Unit target or number orientation none Yes
has_power_to_cast checks to see if bot has enough power (mana, energy, etc.) to cast a given spell number spell_id bool Yes
can_cast returns of if the bot can cast a spell (checks cooldown, silenced, etc.) number spell_id bool Yes
get_cast_time Get the cast time of the provided spell id number spell_id number (ms) No
get_item_in_equip_slot gets the item in the passed equip_slot number slot Item (nullable) No
get_item locates the first item matching the name (case sensitive) or id in inventory string name or number Item (nullable) No
cast attempts to cast a spell on target or self- result is spell_result Unit target (optional), number spell_id number Yes
simple_cast same as cast, but only returns whether or not cast succeeded Unit target (optional), number spell_id bool Yes
force_cast same as cast, will interrupt current cast before casting Unit target (optional), number spell_id number Yes
simple_force_cast same as force cast, but only returns whether or not cast succeeded Unit target (optional), number spell_id bool Yes
in_same_party_as will return whether or not the player is in the same party as the given player Player target bool Yes
get_nearby_group_members get an array of all group members within given radius of world object (excludes original player) number radius array<Player> No
get_nearby_party_members get an array of all party members within given radius of world object (excludes original player) number radius array<Player> No
cancel_aura remove a beneficial aura from the player Aura aura or number spell_id none No