import type { Subscription } from "rxjs"; import type { HasPlayerMovedEventCallback } from "../Events/HasPlayerMovedEvent"; import { IframeApiContribution } from "./IframeApiContribution"; import { WorkadventureProximityMeetingCommands } from "./Player/ProximityMeeting"; export declare const setPlayerName: (name: string) => void; export declare const setPlayerLanguage: (language: string | undefined) => void; export declare const setTags: (_tags: string[]) => void; export declare const setUserRoomToken: (token: string | undefined) => void; export declare const setPlayerId: (_id: number | undefined) => void; export declare const setUuid: (_uuid: string | undefined) => void; export declare const setIsLogged: (_isLogged: boolean | undefined) => void; export declare class WorkadventurePlayerCommands extends IframeApiContribution { readonly state: import("./playerState").WorkadventurePlayerStateCommands & import("./PublicPlayerState").PublicPlayerState & import("./PrivatePlayerState").PrivatePlayerState; private _proximityMeeting; callbacks: { type: "hasPlayerMoved"; callback: (event: { x: number; y: number; direction: "left" | "right" | "up" | "down"; moving: boolean; oldX?: number | undefined; oldY?: number | undefined; }) => void; }[]; /** * Get the player name. * Important: You need to wait for the end of the initialization before accessing. * {@link https://docs.workadventu.re/map-building/api-player.md#get-the-player-name | Website documentation} * * @returns {string} Player name */ get name(): string; /** * Get the player UUID. * Important: You need to wait for the end of the initialization before accessing. * {@link https://docs.workadventu.re/map-building/api-player.md#get-the-player-uuid | Website documentation} * @deprecated Use WA.player.uuid instead * * @returns {string|undefined} Player UUID */ get id(): string | undefined; /** * Get the player id. * Important: You need to wait for the end of the initialization before accessing. * {@link https://docs.workadventu.re/map-building/api-player.md#get-the-player-id | Website documentation} * * @returns {number} Player id */ get playerId(): number; /** * Get the player UUID. * Important: You need to wait for the end of the initialization before accessing. * {@link https://docs.workadventu.re/map-building/api-player.md#get-the-player-uuid | Website documentation} * * @returns {string|undefined} Player UUID */ get uuid(): string | undefined; /** * Get the player language. * Important: You need to wait for the end of the initialization before accessing. * {@link https://docs.workadventu.re/map-building/api-player.md#get-the-player-language | Website documentation} * * @returns {string} Player language */ get language(): string; /** * Get the player tags. * Important: You need to wait for the end of the initialization before accessing. * {@link https://docs.workadventu.re/map-building/api-player.md#get-the-tags-of-the-player | Website documentation} * * @returns {string[]} Player tags */ get tags(): string[]; /** * Get the player position. * Important: You need to wait for the end of the initialization before accessing. * {@link https://docs.workadventu.re/map-building/api-player.md#get-the-position-of-the-player | Website documentation} * * @returns {Position} Player position */ getPosition(): Promise; /** * Listens to the movement of the current user and calls the callback. * Sends an event when the user stops moving, changes direction and every 200ms when moving in the same direction. * {@link https://docs.workadventu.re/map-building/api-player.md#listen-to-player-movement | Website documentation} * * @param {HasPlayerMovedEventCallback} callback Function that will be called when the current player is moving. It contains the event * @return {Subscription} Subscription to the stream. Use ".unsubscribe()" to stop listening. */ onPlayerMove(callback: HasPlayerMovedEventCallback): Subscription; /** * Player will try to find the shortest path to the destination point and proceed to move there. * {@link https://docs.workadventu.re/map-building/api-player.md#move-player-to-position | Website documentation} * * @param {number} x Horizontal position * @param {number} y Vertical position * @param {number} speed Speed * @returns {Promise<{ x: number, y: number, cancelled: boolean }>} Promise to give an object with the position and if the move has been cancelled or not */ moveTo(x: number, y: number, speed?: number): Promise<{ x: number; y: number; cancelled: boolean; }>; teleport(x: number, y: number): Promise; /** * This token can be used by third party services to authenticate a player and prove that the player is in a given room. * The token is generated by the administration panel linked to WorkAdventure. * The token is a string and is depending on your implementation of the administration panel. * In WorkAdventure SAAS version, the token is a JWT token that contains information such as the player's room ID and its associated membership ID. * * If you are using the self-hosted version of WorkAdventure and you developed your own administration panel, the token can be anything. * By default, self-hosted versions of WorkAdventure don't come with an administration panel, so the token string will be empty. * {@link https://docs.workadventu.re/map-building/api-player.md#get-the-user-room-token-of-the-player | Website documentation} * * @returns {string|undefined} User room token */ get userRoomToken(): string | undefined; /** * Display a thin line around your player's name (the "outline"). * {@link https://docs.workadventu.re/map-building/api-player.md#set-the-outline-color-of-the-player | Website documentation} * * @param {number} red * @param {number} green * @param {number} blue * @returns {Promise} Promise to wait to known when the outiline has been displayed */ setOutlineColor(red: number, green: number, blue: number): Promise; /** * Remove the thin line around your player's name (the "outline"). * {@link https://docs.workadventu.re/map-building/api-player.md#set-the-outline-color-of-the-player | Website documentation} * * @returns {Promise} Promise to await to known when the outline has been removed */ removeOutlineColor(): Promise; get proximityMeeting(): WorkadventureProximityMeetingCommands; /** * Get a value to provide connected status for the current player. * Important: You need to wait for the end of the initialization before accessing. * {@link https://docs.workadventu.re/map-building/api-player.md#get-the-tags-of-the-player | Website documentation} * * @returns {boolean} Player tags */ get isLogged(): boolean; /** * Get a base64 string of the Woka image of the current player. * The Woka is in "still" position facing south. * @returns {Promise} * {@link https://docs.workadventu.re/map-building/api-player.md#get-the-woka-of-the-player | Website documentation} * * @returns {Promise} Current player woka in base64 */ getWokaPicture(): Promise; /** * Set the availability status of the current player. * * Supported statuses: * - "ONLINE": Clear any custom status (default state) * - "BUSY": Indicate the player is busy * - "DO_NOT_DISTURB": Indicate the player does not want to be disturbed * - "BACK_IN_A_MOMENT": Indicate the player is temporarily away * * {@link https://docs.workadventu.re/map-building/api-player.md#set-the-status-of-the-player | Website documentation} * * @param {string} status The status to set. Allowed values: "ONLINE", "BUSY", "DO_NOT_DISTURB", "BACK_IN_A_MOMENT" * @returns {void} */ setStatus(status: "ONLINE" | "BUSY" | "DO_NOT_DISTURB" | "BACK_IN_A_MOMENT"): void; } export type Position = { x: number; y: number; }; declare const _default: WorkadventurePlayerCommands; export default _default;