Merge pull request 'Le GR a toujours le droit de voir les acteurs' (#601) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10

Reviewed-on: #601
This commit is contained in:
uberwald 2023-01-03 16:11:34 +01:00
commit a66fe122c4
4 changed files with 16 additions and 11 deletions

View File

@ -31,7 +31,7 @@ export class RdDBaseActorSheet extends ActorSheet {
Monnaie.validerMonnaies(this.actor.itemTypes['monnaie']);
this.actor.recompute();
const userRightLevel = this.actor.getUserLevel(game.user)
const userRightLevel = game.user.isGM ? CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER : this.actor.getUserLevel(game.user)
const options = duplicate(this.options);
mergeObject(options, {
isGM: game.user.isGM,

View File

@ -220,7 +220,7 @@ export class RdDBaseActor extends Actor {
/* -------------------------------------------- */
getQuantiteDisponible(item) {
return item?.getQuantite();
return item?.isService() ? undefined : item?.getQuantite();
}
/* -------------------------------------------- */
@ -310,6 +310,9 @@ export class RdDBaseActor extends Actor {
async decrementerQuantiteItem(item, quantite, options = { supprimerSiZero: true }) {
if (itemVendu.isService()) {
return;
}
let resteQuantite = (item.system.quantite ?? 1) - quantite;
if (resteQuantite <= 0) {
if (options.supprimerSiZero) {

View File

@ -22,7 +22,7 @@ export class RdDCommerce extends RdDBaseActor {
}
getQuantiteDisponible(item) {
return this.system.illimite ? undefined : item.getQuantite();
return this.system.illimite || item.isService() ? undefined : item.getQuantite();
}
verifierFortune(cout) {

View File

@ -223,15 +223,17 @@ export class RdDItem extends Item {
}
getQuantite() {
return Math.round(this.system.quantite ?? 0)
return this.isService() ? undefined : Math.round(this.system.quantite ?? 0)
}
getEncTotal() {
return this.getEnc() * this.getQuantite();
return (this.isService() ? 0 : this.getQuantite()) * this.getEnc();
}
getEnc() {
switch (this.type) {
case 'service':
return 0;
case 'herbe':
return this.getEncHerbe();
case 'gemme':
@ -250,7 +252,7 @@ export class RdDItem extends Item {
}
valeurTotale() {
return this.getQuantite() * this.valeur()
return (this.isService() ? 1 : this.getQuantite()) * this.valeur()
}
valeur() {