forked from public/foundryvtt-reve-de-dragon
Fix jets encaissements faits par le défenseur
=> Les dés sont ceux du défenseur => Le message d'encaissement est visible par le joueur
This commit is contained in:
@ -62,26 +62,23 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
static remoteActorCall(data) {
|
||||
if (Misc.isUniqueConnectedGM()) {
|
||||
static remoteActorCall(data, canExecuteLocally = () => Misc.isUniqueConnectedGM()) {
|
||||
if (canExecuteLocally()) {
|
||||
RdDActor.onRemoteActorCall(data);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
game.socket.emit("system.foundryvtt-reve-de-dragon", { msg: "msg_remote_actor_call", data: data });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static onRemoteActorCall(data) {
|
||||
if (Misc.isUniqueConnectedGM()) { // 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);
|
||||
}
|
||||
else {
|
||||
const args = data.args;
|
||||
console.info(`RdDActor.onRemoteActorCall: pour l'Actor ${data.actorId}, appel de RdDActor.${data.method}(`, ...args, ')');
|
||||
actor[data.method](...args);
|
||||
}
|
||||
const actor = game.actors.get(data?.actorId);
|
||||
if (Misc.isOwnerPlayerOrUniqueConnectedGM(actor)) { // Seul le joueur choisi effectue l'appel: le joueur courant si propriétaire de l'actor, ou le MJ sinon
|
||||
const args = data.args;
|
||||
console.info(`RdDActor.onRemoteActorCall: pour l'Actor ${data.actorId}, appel de RdDActor.${data.method}(`, ...args, ')');
|
||||
actor[data.method](...args);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3668,7 +3665,10 @@ export class RdDActor extends Actor {
|
||||
return;
|
||||
}
|
||||
if (fromActorId && !game.user.isGM) {
|
||||
RdDActor.remoteActorCall({ userId: Misc.connectedGMOrUser(), actorId: this.id, method: 'ajouterDeniers', args: [gain, fromActorId] });
|
||||
RdDActor.remoteActorCall({
|
||||
userId: Misc.connectedGMOrUser(),
|
||||
actorId: this.id,
|
||||
method: 'ajouterDeniers', args: [gain, fromActorId] });
|
||||
}
|
||||
else {
|
||||
const fromActor = game.actors.get(fromActorId)
|
||||
@ -3700,7 +3700,11 @@ export class RdDActor extends Actor {
|
||||
return;
|
||||
}
|
||||
if (!Misc.isUniqueConnectedGM()) {
|
||||
RdDActor.remoteActorCall({ actorId: achat.vendeurId ?? achat.acheteurId, method: 'achatVente', args: [achat] });
|
||||
RdDActor.remoteActorCall({
|
||||
actorId: achat.vendeurId ?? achat.acheteurId,
|
||||
method: 'achatVente',
|
||||
args: [achat] },
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user