/** @module Multiplayer */ import type HTTPChannel from "../channel"; import Connection from "../connection"; interface GenericObject { [key: string]: unknown; } export default class Multiplayer { protected channel: HTTPChannel; /** * If not null, rooms will be created on the development server at the address defined by the server endpoint, instead of using the live multiplayer servers. */ developmentServer: string | null; constructor(channel: HTTPChannel); /** * Create a multiplayer room on the Player.IO infrastructure. * @param {string} roomId The id you wish to assign to your new room - You can use this to connect to the specific room later as long as it still exists. * @param {string} roomType The name of the room type you wish to run the room as. This value should match one of the [RoomType(...)] attributes of your uploaded code. A room type of 'bounce' is always available. * @param {number} visible Should the room be visible when listing rooms with GetRooms or not? * @param {object} roomData The data to initialize the room with, this can be read with ListRooms and changed from the serverside. */ createRoom(roomId: string, roomType: string, visible: boolean, roomData?: GenericObject): Promise; /** * Join a running multiplayer room. * @param {string} roomId The id of the room you wish to connect to. * @param {string} joinData Data to send to the room with additional information about the join. * @returns {Promise} */ joinRoom(roomId: string, joinData?: GenericObject): Promise; /** * Creates a multiplayer room (if it does not exist already) and joins it. * @param {string} roomId The id of the room you wish to create/join. * @param {string} roomType The name of the room type you wish to run the room as. This value should match one of the [RoomType(...)] attributes of your uploaded code. A room type of 'bounce' is always available. * @param {number} visible If the room doesn't exist: Should the room be visible when listing rooms with GetRooms upon creation? * @param {object} roomData If the room doesn't exist: The data to initialize the room with upon creation. * @param {object} joinData Data to send to the room with additional information about the join. * @returns {Promise} */ createJoinRoom(roomId: string, roomType: string, visible: boolean, roomData?: GenericObject, joinData?: GenericObject): Promise; /** * List the currently running multiplayer rooms. * @param {string} roomType The type of room you wish to list. * @param {object} searchCriteria Only rooms with the same values in their roomdata will be returned. * @param {number} resultLimit The maximum amount of rooms you want to receive. Use 0 for 'as many as possible'. * @param {number} resultOffset The offset into the list you wish to start listing at. * @returns {Promise} */ listRooms(roomType: string, searchCriteria: GenericObject | undefined, resultLimit?: number, resultOffset?: number): Promise; } /** * Information about a room returned from listRooms. */ export declare class RoomInfo { /** * The id of the room. */ id: string; /** * The type of the room (coresponding to the [RoomType(...)] attribute assignd to the room). */ roomType: string; /** * How many users are currently in the room */ onlineUsers: number; /** * lmao */ roomData: object; constructor(id: string, roomType: string, onlineUsers: number, roomData: object); } export {};