Initialize a singleton Game instance for a specific view using socket data retrieved from the server.
The named view which is active for this game instance.
An object of all the World data vended by the server when the client first connects
The ID of the currently active client session retrieved from the browser cookie
The open web-socket which should be used to transact game-state data
The collection of Actor documents which exists in the World.
Readonly
audioThe singleton Audio Helper.
Readonly
canvasThe singleton game Canvas.
The collection of Cards documents which exists in the World.
Readonly
clipboardThe singleton Clipboard Helper.
Readonly
collectionsA mapping of WorldCollection instances, one per primary Document type.
The collection of Combat documents which exists in the World.
Readonly
compendiumThe singleton compendium art manager.
The UUID redirects tree.
Readonly
dataThe object of world data passed from the server.
Whether the Game is running in debug mode
Readonly
documentThe singleton DocumentIndex instance.
The collection of Folder documents which exists in the World.
Readonly
gamepadThe singleton Gamepad Manager.
Readonly
i18nLocalization support.
Readonly
issuesThe singleton ClientIssues manager.
The collection of Item documents which exists in the World.
The collection of JournalEntry documents which exists in the World.
Readonly
keybindingsClient keybindings which are used to configure application behavior
Readonly
keyboardThe singleton Keyboard Manager.
A flag for whether texture assets for the game canvas are currently loading
The collection of Macro documents which exists in the World.
The collection of ChatMessage documents which exists in the World.
A Map of active Modules which are currently eligible to be enabled in this World. The subset of Modules which are designated as active are currently enabled.
Readonly
mouseThe singleton Mouse Manager.
Readonly
nueThe singleton New User Experience manager.
Readonly
packsA mapping of CompendiumCollection instances, one per Compendium pack.
The user role permissions setting.
The collection of Playlist documents which exists in the World.
A flag for whether the Game has successfully reached the hookEvents.ready hook
Readonly
releaseThe Release data for this version of Foundry
The collection of Scene documents which exists in the World.
Readonly
sessionThe client session id which is currently active.
Readonly
settingsClient settings which are used to configure application behavior.
Readonly
socketA reference to the open Socket.io connection.
The System which is used to power this game World.
The collection of RollTable documents which exists in the World.
Readonly
timeA singleton GameTime instance which manages the progression of time within the game world.
Readonly
tooltipThe singleton TooltipManager.
Readonly
toursThe singleton Tours collection.
Readonly
userThe id of the active World user, if any.
The collection of User documents which exists in the World.
Readonly
videoThe singleton Video Helper.
Readonly
viewThe named view which is currently active.
Readonly
workersA singleton web Worker manager.
The game World which is currently active.
A convenient reference to the currently active canvas tool
A shortcut to compendiumConfiguration data settings
A registry of document types supported by the active world.
Is the current session user authenticated as an application administrator?
A registry of document sub-types and their respective template.json defaults.
A state variable which tracks whether the game session is currently paused
Returns the current version of the Release, usable for comparisons using isNewerVersion
Internal
Initialize elements required for the current view
Activate Event Listeners which apply to every Game View
Activate Socket event listeners which are used to transact game state data with the server
Configure custom cursors.
Return the named scopes which can exist for packages. Scopes are returned in the prioritization order that their content is loaded.
An array of string package scopes
Initialize the Game for the current window location, triggering the hookEvents.init event.
Initialize the game Canvas
Initialize configuration state.
Initialize game state data by creating WorldCollection instances for every primary Document type
Initialize Gamepad controls
Initialize Keyboard controls
Initialize Mouse controls
Initialize the Compendium packs which are present within this Game Create a Collection which maps each Compendium pack using its collection ID.
Initialize the WebRTC implementation
Initialize collection trees.
Initialize core UI elements
Log out of the game session by returning to the Join screen
Register core game settings
Fully set up the game state, initializing Documents, UI applications, and the Canvas. Triggers the hookEvents.setup and hookEvents.ready events.
Configure package data that is currently enabled for this world
Game data provided by the server socket
Shut down the currently active Game. Requires GameMaster user permission.
Open Character sheet for current token or controlled actor
The toggled Actor sheet, or null if the User has no assigned character
Toggle the pause state of the game, triggering the hookEvents.pauseGame hook when the paused state changes.
The desired pause state; true for paused, false for un-paused
Optional
options: { broadcast?: boolean; userId?: string } = {}Additional options which modify the pause operation
Optional
broadcast?: booleanBroadcast the pause state change to other connected clients? Broadcasting to other clients can only be done by a GM user.
Optional
userId?: stringThe ID of the user who triggered the pause operation. This is populated automatically by the game server.
The new paused state
Protected
_onProtected
On left mouse clicks, check if the element is contained in a valid hyperlink and open it in a new tab.
Static
connectEstablish a live connection to the game server through the socket.io URL
The client session ID with which to establish the connection
A promise which resolves to the connected socket, if successful
Static
createFetch World data and return a Game instance
The named view being created
The current sessionId of the connecting client
A Promise which resolves to the created Game instance
Static
getRetrieve the cookies which are attached to the client session
The session cookies
Static
getRequest World data from server and return it
The active socket connection
The view for which data is being requested
Static
getGet the current World status upon initial connection.
The active client socket connection
The core Game instance which encapsulates the data, settings, and states relevant for managing the game experience. The singleton instance of the Game class is available as the global variable game.