From d874720973d8045893c056eaa3621e77ba833f2d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 27 May 2021 01:47:34 +0200 Subject: [PATCH] Fix achat par un joueur --- module/actor.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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;