Skip to content

Commit 16fdc91

Browse files
authored
Merge pull request #59 from Roll20/feature/BEACON-25
BEACON-25
2 parents 63a0ebc + 2bfcc50 commit 16fdc91

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

content/docs/components/dispatch.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,26 @@ dispatch.setComputed({
132132
```
133133
`getComputed` and `setComputed` are both nearly identical in how they are called, taking a character id and a property with the name of the computed property you wish to get or set, and an array of string args. Both methods return a promise that resolves with the computed value.
134134

135+
## getAvailableCharacters
136+
```typescript
137+
dispatch.getAvailableCharacters(): Promise<{
138+
[id: string]: {
139+
id: string;
140+
name: string;
141+
avatar: string;
142+
permissions: "view"|"edit";
143+
characterType: string;
144+
description: string;
145+
customMeta1: string;
146+
customMeta2: string;
147+
customMeta3: string;
148+
statusmarkers: string;
149+
tags: string;
150+
}
151+
}>
152+
```
153+
`getAvailableCharacters` returns a list of all characters available to the current player. It returns the characters' metadata, as well as the player's permission level (`view` or `edit`).
154+
135155
## compendiumRequest
136156
```javascript
137157
dispatch.compendiumRequest({

content/docs/components/handlers.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ onInit(event: {
5151
settings: { // Campaign and character specific settings
5252
colorTheme: string, // 'dark' or 'light'
5353
language: string, // two-letter language code, i.e. 'en'
54-
gm: boolean, // whether or not the current player has gm permissions
55-
owned: boolean, // whether or not the current player controls the primary character
56-
settingsSheet: boolean, // whether or not this sheet is the settings sheet
57-
headless: boolean, // whether or not it should be displayed, set by the host
54+
gm: boolean, // Whether the current player has gm permissions
55+
owned: boolean, // Whether the current player controls the primary character
56+
playerSubscription: 'free'|'plus'|'pro', // The player's subscription level
57+
campaignSubscription?: 'free'|'plus'|'pro', // The campaign's subscription level
58+
settingsSheet: boolean, // Whether this sheet is the settings sheet
59+
headless: boolean, // Whether it should be displayed, set by the host
5860
sandbox: boolean,
5961
campaignId: number, // The id of the current campaign
6062
environment: string, // VTT, CHARACTERS, DISCORD
@@ -69,6 +71,27 @@ onInit(event: {
6971
},
7072
}, dispatch: Dispatch): void;
7173
```
74+
The `Character` data is returned in the following format:
75+
76+
```typescript
77+
type Character {
78+
id: string // The character's unique ID
79+
name: string // The character's name
80+
characterType?: string // The character type metadata, i.e. PC, NPC, Vehicle, etc.
81+
description?: string // The character desciprtion metadata
82+
customMeta1?: string // Custom metadata fields
83+
customMeta2?: string
84+
customMeta3?: string
85+
attributes: Object // The character's attributes
86+
customAttributes?: CustomAttributes // Custom attributes created by the user
87+
abilities?: Abilities // The character's abilities (macros)
88+
playerMacros?: PlayerMacros // Custom macros created by the user
89+
bio?: string | null // The character's biography metadata
90+
gmNotes?: string | null // The character's GM Notes metadata (only present if the player is GM)
91+
token: Token // The character's default token
92+
avatar: string // The url for the character's avatar
93+
}
94+
```
7295

7396
{{< callout context="note" >}}
7497
This function may be called multiple times during development in the sheet sandbox as part of hot reloads.

0 commit comments

Comments
 (0)