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.
ReadonlyaudioThe singleton Audio Helper.
ReadonlycanvasThe singleton game Canvas.
The collection of Cards documents which exists in the World.
ReadonlyclipboardThe singleton Clipboard Helper.
ReadonlycollectionsA mapping of WorldCollection instances, one per primary Document type.
The collection of Combat documents which exists in the World.
ReadonlycompendiumThe singleton compendium art manager.
The UUID redirects tree.
ReadonlydataThe object of world data passed from the server.
Whether the Game is running in debug mode
ReadonlydocumentThe singleton DocumentIndex instance.
The collection of Folder documents which exists in the World.
ReadonlygamepadThe singleton Gamepad Manager.
Readonlyi18nLocalization support.
ReadonlyissuesThe singleton ClientIssues manager.
The collection of Item documents which exists in the World.
The collection of JournalEntry documents which exists in the World.
ReadonlykeybindingsClient keybindings which are used to configure application behavior
ReadonlykeyboardThe 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.
ReadonlymouseThe singleton Mouse Manager.
ReadonlynueThe singleton New User Experience manager.
ReadonlypacksA 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
ReadonlyreleaseThe Release data for this version of Foundry
The collection of Scene documents which exists in the World.
ReadonlysessionThe client session id which is currently active.
ReadonlysettingsClient settings which are used to configure application behavior.
ReadonlysocketA 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.
ReadonlytimeA singleton GameTime instance which manages the progression of time within the game world.
ReadonlytooltipThe singleton TooltipManager.
ReadonlytoursThe singleton Tours collection.
ReadonlyuserThe id of the active World user, if any.
The collection of User documents which exists in the World.
ReadonlyvideoThe singleton Video Helper.
ReadonlyviewThe named view which is currently active.
ReadonlyworkersA 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
InternalInitialize 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
Optionaloptions: { broadcast?: boolean; userId?: string } = {}Additional options which modify the pause operation
Optionalbroadcast?: booleanBroadcast the pause state change to other connected clients? Broadcasting to other clients can only be done by a GM user.
OptionaluserId?: stringThe ID of the user who triggered the pause operation. This is populated automatically by the game server.
The new paused state
Protected_onProtectedOn left mouse clicks, check if the element is contained in a valid hyperlink and open it in a new tab.
StaticconnectEstablish 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
StaticcreateFetch 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
StaticgetRetrieve the cookies which are attached to the client session
The session cookies
StaticgetRequest World data from server and return it
The active socket connection
The view for which data is being requested
StaticgetGet 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.