Version 12.0.23 - La bibliothèque d'Astrobazzarh #723

Merged
uberwald merged 14 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2024-11-27 10:12:27 +01:00
Showing only changes of commit 864194e3b4 - Show all commits

View File

@ -189,13 +189,7 @@ export class Misc {
* and there is no connected GM
*/
static documentIfResponsible(document) {
if (foundry.utils.isNewerVersion(game.release.version, '12.0')) {
if (game.users.activeGM || (Misc.connectedGMs().length == 0 && Misc.isOwnerPlayer(document)))
{
return document
}
}
else if (Misc.isFirstConnectedGM() || (Misc.connectedGMs().length == 0 && Misc.isOwnerPlayer(document))) {
if (Misc.isFirstConnectedGM() || (Misc.connectedGMs().length == 0 && Misc.isFirstOwnerPlayer(document))) {
return document
}
return undefined
@ -205,8 +199,15 @@ export class Misc {
return document.testUserPermission && document.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)
}
static isFirstOwnerPlayer(document) {
if (!document.testUserPermission){
return false
}
return game.users.filter(u => document.testUserPermission(u, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)) == game.user
}
static isOwnerPlayerOrUniqueConnectedGM(actor) {
return Misc.isOwnerPlayer(actor) ?? Misc.isFirstConnectedGM();
return Misc.isFirstOwnerPlayer(actor) ?? Misc.isFirstConnectedGM();
}
/**