@@ -40,8 +40,8 @@ class LMRTFYRequestor extends FormApplication {
40
40
41
41
async getData ( ) {
42
42
// Return data to the template
43
- const actors = game . actors . entities ;
44
- const users = game . users . entities ;
43
+ const actors = game . actors . entities || game . actors . contents ;
44
+ const users = game . users . entities || game . users . contents ;
45
45
// Note: Maybe these work better at a global level, but keeping things simple
46
46
const abilities = LMRTFY . abilities ;
47
47
const saves = LMRTFY . saves ;
@@ -117,7 +117,8 @@ class LMRTFYRequestor extends FormApplication {
117
117
const actorId = div . dataset . id ;
118
118
const actor = game . actors . get ( actorId ) ;
119
119
if ( ! actor ) return ;
120
- const user = userId === "character" ? game . users . entities . find ( u => u . character && u . character . _id === actor . _id ) : null ;
120
+ const gameUsers = game . users . entities || game . users . contents ;
121
+ const user = userId === "character" ? gameUsers . find ( u => u . character && u . character . _id === actor . _id ) : null ;
121
122
const tooltip = document . createElement ( "SPAN" ) ;
122
123
tooltip . classList . add ( "tooltip" ) ;
123
124
tooltip . textContent = `${ actor . name } ${ user ? ` (${ user . name } )` : '' } ` ;
@@ -128,21 +129,24 @@ class LMRTFYRequestor extends FormApplication {
128
129
_getUserActorIds ( userId ) {
129
130
let actors = [ ] ;
130
131
if ( userId === "character" ) {
131
- actors = game . users . entities . map ( u => u . character && u . character . id ) . filter ( a => a )
132
+ const gameUsers = game . users . entities || game . users . contents ;
133
+ actors = gameUsers . map ( u => u . character ?. id ) . filter ( a => a )
132
134
} else if ( userId === "tokens" ) {
133
135
actors = Array . from ( new Set ( canvas . tokens . placeables . map ( t => t . data . actorId ) ) ) . filter ( a => a ) ;
134
136
} else {
135
137
const user = game . users . get ( userId ) ;
136
- if ( user )
137
- actors = game . actors . entities . filter ( a => a . hasPerm ( user , "OWNER" ) ) . map ( a => a . id )
138
+ if ( user ) {
139
+ const gameActors = game . actors . contents || game . actors . entities ;
140
+ actors = gameActors . filter ( a => a . testUserPermission ( user , "OWNER" ) ) . map ( a => a . id )
141
+ }
138
142
}
139
143
return actors ;
140
144
}
145
+
141
146
_onUserChange ( ) {
142
147
const userId = this . element . find ( "select[name=user]" ) . val ( ) ;
143
148
const actors = this . _getUserActorIds ( userId )
144
149
this . element . find ( ".lmrtfy-actor" ) . hide ( ) . filter ( ( i , e ) => actors . includes ( e . dataset . id ) ) . show ( ) ;
145
-
146
150
}
147
151
148
152
diceLeftClick ( event ) {
0 commit comments