Fix achat par un joueur

This commit is contained in:
Vincent Vandemeulebrouck 2021-05-27 01:47:34 +02:00
parent 6a85073dbb
commit d874720973

View File

@ -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;