forked from public/foundryvtt-reve-de-dragon
Fix User ... lacks permission to update
Correction de l'erreur qui était affichée chez les joueurs lors de hooks utilisés pour effectuer des modifications sur des documents: - ChatMessage, ajout de flags pour l'heure - Item au sein d'un Actor pour mettre à jour certains éléments
This commit is contained in:
@ -32,10 +32,10 @@ export class RdDBaseActor extends Actor {
|
||||
}
|
||||
|
||||
static init() {
|
||||
Hooks.on("preUpdateItem", (item, change, options, id) => RdDBaseActor.getParentActor(item)?.onPreUpdateItem(item, change, options, id));
|
||||
Hooks.on("createItem", (item, options, id) => RdDBaseActor.getParentActor(item)?.onCreateItem(item, options, id));
|
||||
Hooks.on("deleteItem", (item, options, id) => RdDBaseActor.getParentActor(item)?.onDeleteItem(item, options, id));
|
||||
Hooks.on("updateActor", (actor, change, options, actorId) => actor.onUpdateActor(change, options, actorId));
|
||||
Hooks.on("preUpdateItem", (item, change, options, id) => Misc.documentIfResponsible(item.parent)?.onPreUpdateItem(item, change, options, id))
|
||||
Hooks.on("createItem", (item, options, id) => Misc.documentIfResponsible(item.parent)?.onCreateItem(item, options, id))
|
||||
Hooks.on("deleteItem", (item, options, id) => Misc.documentIfResponsible(item.parent)?.onDeleteItem(item, options, id))
|
||||
Hooks.on("updateActor", (actor, change, options, actorId) => Misc.documentIfResponsible(actor)?.onUpdateActor(change, options, actorId))
|
||||
}
|
||||
|
||||
static onSocketMessage(sockmsg) {
|
||||
@ -82,10 +82,6 @@ export class RdDBaseActor extends Actor {
|
||||
|
||||
static extractActorMin = (actor) => { return { id: actor?.id, type: actor?.type, name: actor?.name, img: actor?.img }; };
|
||||
|
||||
static getParentActor(document) {
|
||||
return document?.parent instanceof Actor ? document.parent : undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette methode surcharge Actor.create() pour ajouter si besoin des Items par défaut:
|
||||
* compétences et monnaies.
|
||||
@ -381,7 +377,7 @@ export class RdDBaseActor extends Actor {
|
||||
ChatUtility.removeChatMessageId(achat.chatMessageIdVente);
|
||||
}
|
||||
else if (achat.chatMessageIdVente) {
|
||||
await ChatVente.diminuerQuantite(achat.chatMessageIdVente, achat.choix.nombreLots)
|
||||
await ChatVente.diminuerQuantiteAchatVente(achat.chatMessageIdVente, achat.choix.nombreLots)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user