diff --git a/module/actor.js b/module/actor.js index be01a33a..0defc7d9 100644 --- a/module/actor.js +++ b/module/actor.js @@ -56,13 +56,17 @@ export class RdDActor extends Actor { } } - static remoteActorCall(options) { - options.userId = options.userId ?? Misc.connectedGMOrUser(); - game.socket.emit("system.foundryvtt-reve-de-dragon", { msg: "msg_remote_actor_call", data: options }); + static remoteActorCall(data) { + if (Misc.isElectedUser()){ + RdDActor.onRemoteActorCall(data); + } + else{ + game.socket.emit("system.foundryvtt-reve-de-dragon", { msg: "msg_remote_actor_call", data: data }); + } } static onRemoteActorCall(data) { - if (game.user.id == data.userId) { // Seul le joueur choisi effectue l'appel + if (Misc.isElectedUser()) { // Seul le joueur choisi effectue l'appel const actor = game.actors.get(data?.actorId); if (!actor) { console.info("RdDActor.onRemoteActorCall: Pas d'Actor disponible ", data); @@ -3425,8 +3429,7 @@ export class RdDActor extends Actor { } if (!Misc.isElectedUser()) { RdDActor.remoteActorCall({ - userId: Misc.connectedGMOrUser(), - actorId: this.vendeur?.id ?? this.acheteur?.id, + actorId: vendeurId ?? acheteurId, method: 'achatVente', args: [vendeurId, acheteurId, venteData, chatMessageIdVente] }); return;