Constructor
new User(data, options)
- Source:
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object | The source data for the User entity, usually retrieved from the database. Properties
|
|||||||||||||||||||||||||||
options |
Object | Initialization options which modify the construction of a User entity. See the Entity class for more detail. |
Members
(static) config
- Source:
active :boolean
- Source:
Track whether the user is currently active in the game
Type:
- boolean
avatar :string
- Source:
Return the User avatar icon or the controlled actor's image
Type:
- string
character :Actor
- Source:
Return the Actor instance of the user's impersonated character (or undefined)
Type:
isGM
- Source:
A flag for whether the current User has Assistant GameMaster or full GameMaster role
isSelf
- Source:
A flag for whether this User is the connected client
isTrusted
- Source:
A flag for whether the current User is a Trusted Player
permissions :Object
- Source:
A convenience shortcut for the permissions object of the current User
Type:
- Object
targets :Set.<Token>
- Source:
Track references to the current set of Tokens which are targeted by the User
Type:
- Set.<Token>
viewedScene :string|null
- Source:
Track the ID of the Scene that is currently being viewed by the User
Type:
- string | null
Methods
_onCreate()
- Source:
(async) assignHotbarMacro(macro, slot, fromSlotopt) → {Promise.<User>}
- Source:
Assign a Macro to a numbered hotbar slot between 1 and 50
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
macro |
Macro | null | The Macro entity to assign |
|
slot |
number | The integer Hotbar slot to fill |
|
fromSlot |
number |
<optional> |
An optional origin slot from which the Macro is being shifted |
Returns:
A Promise which resolves once the User update is complete
- Type
- Promise.<User>
broadcastActivity(activityData)
- Source:
Submit User activity data to the server for broadcast to other players. This type of data is transient, persisting only for the duration of the session and not saved to any database.
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
activityData |
Object | An object of User activity data to submit to the server for broadcast. Properties
|
can(permission) → {boolean}
- Source:
Test whether the User is able to perform a certain permission action. Game Master users are always allowed to perform every action, regardless of permissions.
Parameters:
Name | Type | Description |
---|---|---|
permission |
string | The action to test |
Returns:
Does the user have the ability to perform this action?
- Type
- boolean
getHotbarMacros(page) → {Array.<Object>}
- Source:
Get an Array of Macro Entities on this User's Hotbar by page
Parameters:
Name | Type | Default | Description |
---|---|---|---|
page |
number |
1
|
The hotbar page number |
Returns:
- Type
- Array.<Object>
hasPermission(permission) → {boolean}
- Source:
Test whether the User has a specific permission entitled .This differs from user#can because it does not always return true for Game Master users and should be used in cases where a permission could be withheld even from a GM player (for example cursor display, or A/V audio).
Parameters:
Name | Type | Description |
---|---|---|
permission |
string | The action to test |
Returns:
Does the user have explicit permission to perform this action?
- Type
- boolean
hasRole(role) → {boolean}
- Source:
Test whether the User has at least the permission level of a certain role
Parameters:
Name | Type | Description |
---|---|---|
role |
string | number | The role name from USER_ROLES to test |
Returns:
Does the user have at least this role level?
- Type
- boolean
isRole(role) → {boolean}
- Source:
Test whether the User has exactly the permission level of a certain role
Parameters:
Name | Type | Description |
---|---|---|
role |
string | number | The role name from USER_ROLES to test |
Returns:
Does the user have exactly this role level?
- Type
- boolean
setPermission(permission, allowed)
- Source:
Sets a user's permission Modifies the user permissions to grant or restrict access to a feature.
Parameters:
Name | Type | Description |
---|---|---|
permission |
string | The permission name from USER_PERMISSIONS |
allowed |
boolean | Whether to allow or restrict the permission |