From d4ddc4e940281df65ab15a93f01551ae419c7e23 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 3 Jan 2023 00:31:32 +0100 Subject: [PATCH] Services pour Commerces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les services sont modifiés pour correspondre aux nouveaux commerces --- lang/fr.json | 2 +- module/actor/base-actor-sheet.js | 28 ++-- module/actor/base-actor.js | 30 ++-- module/actor/commerce-sheet.js | 5 + module/actor/commerce.js | 2 +- module/item-service-sheet.js | 65 --------- module/item-service.js | 138 +----------------- module/item.js | 22 +-- template.json | 8 +- templates/actor/commerce-inventaire-item.html | 16 +- templates/item-service-sheet.html | 74 ++-------- 11 files changed, 77 insertions(+), 313 deletions(-) diff --git a/lang/fr.json b/lang/fr.json index 8fa8f3fd..f857f204 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -28,7 +28,7 @@ "TypeArmure": "Armure", "TypeConteneur": "Conteneur", "TypeNourritureboisson": "Nourriture & boisson", - "TypeService": "Services/Boutique", + "TypeService": "Service", "TypeChant": "Chant", "TypeDanse": "Danse", "TypeMusique": "Musique", diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index 328e2b72..6cfc9e7e 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -77,7 +77,6 @@ export class RdDBaseActorSheet extends ActorSheet { /* -------------------------------------------- */ filterItemsPerTypeForSheet(formData, itemTypes) { - formData.services = Misc.arrayOrEmpty(itemTypes['service']); formData.recettescuisine = Misc.arrayOrEmpty(itemTypes['recettecuisine']); formData.recettesAlchimiques = Misc.arrayOrEmpty(itemTypes['recettealchimique']); formData.maladies = Misc.arrayOrEmpty(itemTypes['maladie']); @@ -103,9 +102,8 @@ export class RdDBaseActorSheet extends ActorSheet { formData.oeuvres = Misc.arrayOrEmpty(itemTypes['oeuvre']); formData.jeux = Misc.arrayOrEmpty(itemTypes['jeu']); - + formData.services = Misc.arrayOrEmpty(itemTypes['service']); formData.conteneurs = Misc.arrayOrEmpty(itemTypes['conteneur']); - formData.materiel = Misc.arrayOrEmpty(itemTypes['objet']); formData.armes = Misc.arrayOrEmpty(itemTypes['arme']); formData.armures = Misc.arrayOrEmpty(itemTypes['armure']); @@ -117,22 +115,12 @@ export class RdDBaseActorSheet extends ActorSheet { formData.herbes = Misc.arrayOrEmpty(itemTypes['herbe']); formData.nourritureboissons = Misc.arrayOrEmpty(itemTypes['nourritureboisson']); formData.gemmes = Misc.arrayOrEmpty(itemTypes['gemme']); - formData.monnaie = Misc.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere()); - formData.objets = formData.conteneurs - .concat(formData.materiel) - .concat(formData.armes) - .concat(formData.armures) - .concat(formData.munitions) - .concat(formData.livres) - .concat(formData.potions) - .concat(formData.ingredients) - .concat(formData.herbes) - .concat(formData.faunes) - .concat(formData.monnaie) - .concat(formData.nourritureboissons) - .concat(formData.gemmes); + formData.objets = RdDItem.getItemTypesInventaire('all') + .map(t => Misc.arrayOrEmpty(itemTypes[t])) + .reduce((a, b) => a.concat(b), []) + .sort(Misc.ascending(it => it.name)); } /* -------------------------------------------- */ /** @override */ @@ -205,7 +193,7 @@ export class RdDBaseActorSheet extends ActorSheet { /* -------------------------------------------- */ async selectObjetTypeToCreate() { - let typeObjets = RdDItem.getItemTypesInventaire(); + let typeObjets = this.getTypesInventaire().sort(Misc.ascending(type => Misc.typeName('Item', type))); let content = `Selectionnez le type d'équipement - {{#if @root.options.isOwner}} - - {{/if}} + {{#unless (or (eq item.type 'service') (and (eq item.type 'conteneur') (not vide)))}} + {{#if @root.options.isOwner}} + + {{/if}} + + {{#if @root.options.isOwner}} + + {{/if}} {{/unless}} {{/unless}} diff --git a/templates/item-service-sheet.html b/templates/item-service-sheet.html index 8e8f0ee0..bcb7de4f 100644 --- a/templates/item-service-sheet.html +++ b/templates/item-service-sheet.html @@ -2,69 +2,23 @@ {{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
-
- {{editor description target="system.description" button=true owner=owner editable=(or isGM isOwner) engine="prosemirror"}} -
- - Quantité en vente illimitée + Jet de moral en situation heureuse +
-
-
    -
  • - - {{#unless system.illimite}} - - {{/unless}} - -
    - {{#unless disabled}} - - - - {{/unless}} -
    -
  • - {{#each system.items as |item key|}} -
  • - - {{#unless @root.system.illimite}} - - {{#unless @root.disabled}} - - {{/unless}} - - {{#unless @root.disabled}} - - {{/unless}} - - {{/unless}} - - - -
    - - {{#unless @root.disabled}} - - - {{/unless}} -
    -
  • - {{/each}} -
+ +
+ +
- {{#if isGM}} -
-
- -
- {{editor descriptionmj target="system.descriptionmj" button=true owner=owner editable=true engine="prosemirror"}} -
+ +
+ +
- {{/if}} + + {{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}