yolkbot
    Preparing search index...

    Class FFAGame

    An FFA game

    Hierarchy

    Index

    Accessors

    • get me(): Player

      Automatically pulls the current Player that represents the bot. Returns something with (mostly) incorrect properties (aside from id and team) if the player hasn't initialized yet. You can use BaseGameMode.isReady to check if the player is ready or not.

      Returns Player

    Constructors

    • Creates a base gamemode.

      Parameters

      • bot: Bot

        The bot

      • socket: Socket

        The game's socket

      • map: Map

        The game's basic map information

      • mapIdx: number

        The map index

      • myId: number

        The ID of the player

      • myTeam: number

        The ID of the team the player is on

      • inputData: RawFindGameResponse

        The input game data (region, code, subdomain, etc)

      • isGameOwner: boolean

        Whether the bot is the game owner or not

      • isPrivate: boolean

        Whether the game is private or not

      • OptionalrawMap: MapJSON

        The raw map data, if the LOAD_MAP Intents is enabled and the map data was successfully loaded

      Returns FFAGame

    Methods

    • Checks whether the bot can see a specific player. Requires the PATHFINDING Intents to be enabled, otherwise it will throw an error. Basic and not super accurate, but it should work for most cases.

      Parameters

      • target: Player

        The player to check line of sight to

      Returns boolean

      Whether the bot can see the target player or not

    • Cleans up a game after the bot leaves

      Returns void

    • Gets the best target for the bot to attack based on distance and if they're in the line of sight (among other factors)

      Returns Player | null

      The best target for the bot to attack, or null if there are no valid targets

    • Checks whether bot.me is ready to use

      Returns boolean

    • Leaves a game

      Parameters

      • code: number = CloseCode.mainMenu

      Returns void

    • Processes an incoming packet from the server

      Parameters

      • bytes: Uint8Array<ArrayBuffer>

        The raw packet bytes in a Uint8Array

      Returns void

    • Manually updates the game state; only necessary if the MANUAL_UPDATE Intents is enabled. If you don't have that intent enabled, please don't call this.

      Returns void

    Properties

    bot: Bot

    The bot attached to the game

    code: string = ''

    The game code

    collectibles: Record<CollectType, Collectible[]> = ...

    The collectibles spawned in on the map

    isGameOwner: boolean = false

    Whether the bot is the game owner

    isNoob: boolean = false

    Whether the game is a "noob" game

    isPrivate: boolean = false

    Whether the game is private

    map: GameMap

    The game's map information; raw exists if the LOAD_MAP Intents is used

    mode: FFA = ...

    The game mode (FFA)

    options: GameOptions = ...

    The game's options in that lil old panel

    pathing?: {
        activeNode: MapNode | null;
        activeNodeIdx: number;
        activePath: MapNode[] | null;
        astar: AStar;
        nodeList: NodeList;
    }

    The pathfinding information, if the PATHFINDING Intents is enabled

    ping: number = 0

    The bot's ingame ping, if the PING Intents is enabled

    players: (Player | undefined)[] = []

    All of the players in the game

    region: string = ''

    The game region

    socket: Socket

    The websocket instance associated with the game

    state: {
        buffer: {
            controlKeys?: number;
            pitch?: number;
            shotsFired?: number;
            yaw?: number;
        }[];
        chatLines: number;
        controlKeys: number;
        dx: number;
        dy: number;
        dz: number;
        onGround: number;
        pitch: number;
        reloading: boolean;
        serverStateIdx: number;
        shotsFired: number;
        stateIdx: number;
        swappingGun: boolean;
        usingMelee: boolean;
        yaw: number;
    } = ...

    Advanced data about the game state

    subdomain: string = ''

    The game's cluster subdomain