Class PlayerBot [-] [+]
Represents Playerbots/RNDBots for servers running mod-playerbots
Syntax: Playerbot.MethodName(...)
Methods
| BotCanCastSpell |
Check whether the bot can cast a given spell on an optional target. |
| BotCastSpell |
Command the bot to cast a spell on a target. |
| BotHasAura |
Check whether the bot has an aura. |
| BotRemoveAura |
Remove an aura by name from the bot. |
| BotSay |
Make the bot say text in say-range chat. |
| BotSayToGuild |
Make the bot speak in guild chat. |
| BotSayToParty |
Make the bot speak in party chat. |
| BotSayToRaid |
Make the bot speak in raid chat. |
| BotTellError |
Send an error message to the bot's master (used by AI to report errors). |
| BotTellMaster |
Send a message to the bot's master (private / tell). |
| BotWhisper |
Make the bot whisper text to a specific player name. |
| BotYell |
Make the bot yell text in yell-range chat. |
| ChangeBotStrategy |
Toggle a named strategy for the specified bot state. |
| CreateBotAccount |
Creates a new game account. Uses the core AccountMgr to register a username/password pair in the login database. |
| CreateBotPlayer |
Creates a new bot character in the database and returns its GUID (low part). The character is created via the standard Player::Create() and saved via SaveToDB(). After creation, use [LoginBotByGuid] to log the character into the world. |
| CreateBotSession |
Creates a bot [WorldSession] without a network socket (isBot=true). The session is added to the world session manager but no character is logged in yet. Use [LoginBotByGuid] to log in a character on this session. |
| DeleteBotAccount |
Deletes an account and all its characters. |
| DoBotAction |
Execute a specific action on a bot. |
| FindBotConsumable |
Find a consumable item in the bot's inventory by itemId. |
| FindBotPlayer |
Finds a logged-in player (including bots) by GUID. Returns the Player object if found and in world, nil otherwise. |
| FindNewMaster |
Find a candidate new master for a bot. |
| GetAccountCharCount |
Returns the number of characters on an account. |
| GetAccountIdByUsername |
Returns the account ID for a given username. |
| GetBotInventoryItemCount |
Return how many copies of an item the bot has in its inventory. |
| GetBotMaster |
Returns the current master (owner/controller) of a bot. |
| GetBotSessionCount |
Returns the total number of active world sessions (both real players and bots). |
| GetBotState |
Return the bot's current AI state. |
| GetBotStrategies |
Return the active strategies for a bot state as a Lua array of strings. |
| GetCharAccountIdByGuid |
Returns the account ID that owns a character, looked up by GUID. |
| GetCharGuidByName |
Returns the GUID (low part) of a character by name. Looks up the character cache, not the database directly. |
| GetCharNameByGuid |
Returns the character name for a given GUID. |
| GetGroupLeader |
Return the group leader for the bot, or its master when no group leader is available. |
| GetNearGroupMemberCount |
Return the number of nearby group members within the given distance. |
| GetPlayerbotsCount |
Return the total number of playerbots managed for the provided |
| GetPlayerbotsCountByClass |
Return the number of playerbots of a specific class for the provided |
| HasActivePlayerMaster |
Return true if the bot currently has a connected real player as its master. |
| HasBotItemInInventory |
Check whether the bot has at least one copy of an item in its inventory. |
| HasBotStrategy |
Check whether a named strategy is active for the specified bot state. |
| HasRealPlayerMaster |
Return true if the bot has a real player as its master. |
| IsAltbot |
Return true if the bot is considered an Altbot rather than a random bot. |
| IsRealPlayer |
Return true if this Player is treated as a real player by mod-playerbots. |
| LeaveOrDisbandBotGroup |
Make the bot leave its current group, or disband it if appropriate. |
| LinkAccount |
Trigger account-linking for a master via PlayerbotMgr. |
| ListBotsByMaster |
Return a formatted list of bots belonging to |
| LoginBotByGuid |
Logs in an existing character as a bot (ASYNCHRONOUS). Creates a WorldSession with isBot=true and loads the character from the database via DelayQueryHolder. The bot will appear in the world after a few server ticks. |
| LogoutBotByGuid |
Logs out a bot by its GUID. Calls WorldSession::LogoutPlayer and destroys the bot session. Only works on bot sessions (IsBot=true). Will not log out real players. |
| SendBotCommand |
Send a remote command to a bot and return the response string. |
| UnlinkAccount |
Trigger unlinking an account from the master via PlayerbotMgr. No value is returned to Lua. |
| ViewLinkedAccounts |
Trigger viewing linked accounts for the master via PlayerbotMgr.
The manager will send the result to the |