From c5633a9fc54e79f2c6d77b1e7e22818058dac413 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 14 Jan 2025 21:42:02 +0100 Subject: [PATCH 01/16] Fix commande /tmra --- changelog.md | 6 ++++++ module/rdd-commands.js | 9 +++++---- module/tmr-rencontres.js | 4 ++-- module/tmr-utility.js | 10 +++++----- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/changelog.md b/changelog.md index 01b080d1..30ad6813 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,10 @@ # 12.0 +## 12.0.36 - La cartte d'Astrobazzarh +- Fix: la commande /tmra fonctionne correctement sans paramètres + +## 12.0.35 - La Solution d'Astrobazzarh +- Fix problème d'initialisation des feuilles d'items + ## 12.0.34 - la tête d'Astrobazzarh - support de liens "jets de dés" - on peut ajouter des liens "jet de dés" dans les journaux, descriptions, notes, maladresses, ... diff --git a/module/rdd-commands.js b/module/rdd-commands.js index aabd3dc0..8968afcb 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -361,13 +361,14 @@ export class RdDCommands { async getTMRAleatoire(msg, params) { if (params.length < 2) { let type = params[0] - const solvedTerrain = TMRUtility.findTMRLike(type)?.type - if (solvedTerrain){ - const tmr = await TMRUtility.getTMRAleatoire(type ? (it => it.type == solvedTerrain) : (it => true)) + const solvedTerrain = type ? TMRUtility.findTMRLike(type)?.type : undefined + const filter = solvedTerrain ? (it => it.type == solvedTerrain) : (it => true) + if (type == undefined || solvedTerrain != undefined) { + const tmr = await TMRUtility.getTMRAleatoire(filter) return RdDCommands._chatAnswer(msg, `Case aléatoire: ${tmr.coord} - ${tmr.label}`) } } - return false; + return false } async findTMR(msg, params) { diff --git a/module/tmr-rencontres.js b/module/tmr-rencontres.js index 61ad4ead..c7f9d820 100644 --- a/module/tmr-rencontres.js +++ b/module/tmr-rencontres.js @@ -26,7 +26,7 @@ export class TMRRencontres { * @param {*} forcedRoll */ async rollRencontre(terrain, forcedRoll) { - const tmrType = TMRUtility.findTMRLike(terrain)?.type + const tmrType = TMRUtility.findTMRLike(terrain, { inclusMauvaise: true })?.type if (tmrType == undefined) { return undefined; } @@ -38,7 +38,7 @@ export class TMRRencontres { const frequence = it => it.system.frequence[tmrType]; const row = await this.table.getRandom(frequence, filtreMauvaise, forcedRoll); if (row) { - await CompendiumTableHelpers.tableRowToChatMessage(row, 'Item', {showSource: false}); + await CompendiumTableHelpers.tableRowToChatMessage(row, 'Item', { showSource: false }); } return row?.document; diff --git a/module/tmr-utility.js b/module/tmr-utility.js index e8ae35e6..37fdc623 100644 --- a/module/tmr-utility.js +++ b/module/tmr-utility.js @@ -22,7 +22,7 @@ export const TMRType = { export const FLEUVE_COORD = 'Fleuve' const TMRMapping = { - Fleuve: { type: TMRType.fleuve.type, label: "Fleuve de l'Oubli" }, + Fleuve: { type: TMRType.fleuve.type, label: "Fleuve de l'Oubli", generique: 'fleuve' }, A1: { type: TMRType.cite.type, label: "Cité Vide" }, B1: { type: TMRType.plaines.type, label: "Plaines d’Assorh" }, C1: { type: TMRType.necropole.type, label: "Nécropole de Kroak" }, @@ -281,18 +281,18 @@ export class TMRUtility { return Grammar.articleDetermine(tmr.type) + ' ' + tmr.label; } - static findTMRLike(type, options = { inclusMauvaise: true }) { + static findTMRLike(type, options = { inclusMauvaise: false }) { const choix = [...Object.values(TMRType)] if (options.inclusMauvaise) { choix.push({ name: 'Mauvaise', type: 'mauvaise'}); } const selection = Misc.findAllLike(type, choix) if (selection.length == 0) { - ui.notifications.warn(`Un type de TMR doit être indiqué, '${type}' n'est pas trouvé dans ${choix}`); + ui.notifications.warn(`Un type de TMR doit être indiqué, '${type}' n'est pas trouvé dans ${choix.map(it => it.name).reduce(Misc.joining(', '))}`); return undefined } if (selection.length > 1) { - ui.notifications.warn(`Plusieurs types de TMR pourraient correspondre à '${type}': ${selection.map(it => it.name)}`); + ui.notifications.warn(`Plusieurs types de TMR pourraient correspondre à '${type}': ${selection.map(it => it.name).reduce(Misc.joining(', '))}`); return undefined; } return selection[0] @@ -357,7 +357,7 @@ export class TMRUtility { } static filterTMR(filter) { - return Object.values(TMRMapping).filter(filter); + return Object.values(TMRMapping).filter(it => !it.generique && filter(it)) } static getCasesType(type) { From 40a47ee8a2030913fcfec72f06f425d587b9ac4d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 14 Jan 2025 22:24:20 +0100 Subject: [PATCH 02/16] Ajout du symbole d20, pour les roll de formule --- module/apps/textroll/text-roll-formula.js | 2 +- styles/simple.css | 4 ++++ templates/apps/textroll/link-text-roll-formula.hbs | 4 ++-- templates/chat-compendium-table-roll.hbs | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/module/apps/textroll/text-roll-formula.js b/module/apps/textroll/text-roll-formula.js index 5b025024..9fe5897c 100644 --- a/module/apps/textroll/text-roll-formula.js +++ b/module/apps/textroll/text-roll-formula.js @@ -18,7 +18,7 @@ export class TextRollFormula { async onRollText(event, actor) { const node = TextRollManager.getNode(event) - const rollFormula = node.data('roll-formula') + const rollFormula = node.data('formula') if (rollFormula) { const roll = new Roll(rollFormula) await roll.evaluate() diff --git a/styles/simple.css b/styles/simple.css index 2457de0f..fa3020a9 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1050,6 +1050,10 @@ a.content-link { white-space: nowrap; word-break: break-all; } +a.roll-text i.fas{ + color: var(--color-text-dark-inactive); + margin-right: 0.25em; +} li label.compteur { diff --git a/templates/apps/textroll/link-text-roll-formula.hbs b/templates/apps/textroll/link-text-roll-formula.hbs index 35adcb41..e1118de8 100644 --- a/templates/apps/textroll/link-text-roll-formula.hbs +++ b/templates/apps/textroll/link-text-roll-formula.hbs @@ -1,8 +1,8 @@ -{{~param.formula~}} + data-formula="{{param.formula}}"> +{{param.formula}} {{~#if options.showlink}} {{/if~}} diff --git a/templates/chat-compendium-table-roll.hbs b/templates/chat-compendium-table-roll.hbs index 2f5a76c0..7c5457a1 100644 --- a/templates/chat-compendium-table-roll.hbs +++ b/templates/chat-compendium-table-roll.hbs @@ -10,7 +10,7 @@

{{linkCompendium document.pack document.id document.name}}

{{#if document.system.formule}}
- [[/r {{document.system.formule}}]] + @roll[{{document.system.formule}}]
{{/if}} {{#if document.system.description}} From a8dc07b4db8ca0c1fafd46e5710202c09f635735 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 15 Jan 2025 01:48:20 +0100 Subject: [PATCH 03/16] Enchanter des Potions --- module/actor.js | 33 ++-- module/item-sheet.js | 17 +- module/item.js | 32 +--- module/item/potion.js | 150 ++++++++++++++++++ module/item/potion/dialog-enchanter.js | 46 ++++++ module/item/sheet-potion.js | 57 +++++++ module/rdd-herbes.js | 73 --------- module/rdd-main.js | 15 +- module/rdd-utility.js | 5 +- module/time/rdd-timestamp.js | 6 + template.json | 2 + templates/item-ombre-sheet.html | 1 - .../arme-sheet.hbs} | 0 .../armure-sheet.hbs} | 0 .../blessure-sheet.hbs} | 0 .../casetmr-sheet.hbs} | 0 .../chant-sheet.hbs} | 0 .../competence-sheet.hbs} | 0 .../competencecreature-sheet.hbs} | 0 .../conteneur-sheet.hbs} | 0 .../danse-sheet.hbs} | 0 .../empoignade-sheet.hbs} | 0 .../extraitpoetique-sheet.hbs} | 0 .../faune-sheet.hbs} | 0 .../gemme-sheet.hbs} | 0 .../herbe-sheet.hbs} | 0 .../ingredient-sheet.hbs} | 0 .../{item-sheet.html => item/item-sheet.hbs} | 0 .../jeu-sheet.hbs} | 0 .../livre-sheet.hbs} | 0 .../maladie-sheet.hbs} | 0 .../meditation-sheet.hbs} | 0 .../monnaie-sheet.hbs} | 0 .../munition-sheet.hbs} | 0 .../musique-sheet.hbs} | 0 .../nombreastral-sheet.hbs} | 0 .../nourritureboisson-sheet.hbs} | 0 .../objet-sheet.hbs} | 0 .../oeuvre-sheet.hbs} | 0 templates/item/ombre-sheet.hbs | 1 + .../plante-sheet.hbs} | 0 .../poison-sheet.hbs} | 0 .../possession-sheet.hbs} | 0 .../potion-enum-categorie.hbs} | 10 +- .../potion-sheet.hbs} | 81 +++++----- templates/item/potion/dialog-enchanter.hbs | 22 +++ .../queue-sheet.hbs} | 0 .../race-sheet.hbs} | 0 .../recettealchimique-sheet.hbs} | 0 .../recettecuisine-sheet.hbs} | 0 .../rencontre-sheet.hbs} | 0 .../service-sheet.hbs} | 0 .../signedraconique-sheet.hbs} | 0 .../sort-sheet.hbs} | 0 .../sortreserve-sheet.hbs} | 0 .../souffle-sheet.hbs} | 0 .../tache-sheet.hbs} | 0 .../tarot-sheet.hbs} | 0 .../tete-sheet.hbs} | 0 59 files changed, 363 insertions(+), 188 deletions(-) create mode 100644 module/item/potion.js create mode 100644 module/item/potion/dialog-enchanter.js create mode 100644 module/item/sheet-potion.js delete mode 100644 module/rdd-herbes.js delete mode 100644 templates/item-ombre-sheet.html rename templates/{item-arme-sheet.html => item/arme-sheet.hbs} (100%) rename templates/{item-armure-sheet.html => item/armure-sheet.hbs} (100%) rename templates/{item-blessure-sheet.html => item/blessure-sheet.hbs} (100%) rename templates/{item-casetmr-sheet.html => item/casetmr-sheet.hbs} (100%) rename templates/{item-chant-sheet.html => item/chant-sheet.hbs} (100%) rename templates/{item-competence-sheet.html => item/competence-sheet.hbs} (100%) rename templates/{item-competencecreature-sheet.html => item/competencecreature-sheet.hbs} (100%) rename templates/{item-conteneur-sheet.html => item/conteneur-sheet.hbs} (100%) rename templates/{item-danse-sheet.html => item/danse-sheet.hbs} (100%) rename templates/{item-empoignade-sheet.html => item/empoignade-sheet.hbs} (100%) rename templates/{item-extraitpoetique-sheet.html => item/extraitpoetique-sheet.hbs} (100%) rename templates/{item-faune-sheet.html => item/faune-sheet.hbs} (100%) rename templates/{item-gemme-sheet.html => item/gemme-sheet.hbs} (100%) rename templates/{item-herbe-sheet.html => item/herbe-sheet.hbs} (100%) rename templates/{item-ingredient-sheet.html => item/ingredient-sheet.hbs} (100%) rename templates/{item-sheet.html => item/item-sheet.hbs} (100%) rename templates/{item-jeu-sheet.html => item/jeu-sheet.hbs} (100%) rename templates/{item-livre-sheet.html => item/livre-sheet.hbs} (100%) rename templates/{item-maladie-sheet.html => item/maladie-sheet.hbs} (100%) rename templates/{item-meditation-sheet.html => item/meditation-sheet.hbs} (100%) rename templates/{item-monnaie-sheet.html => item/monnaie-sheet.hbs} (100%) rename templates/{item-munition-sheet.html => item/munition-sheet.hbs} (100%) rename templates/{item-musique-sheet.html => item/musique-sheet.hbs} (100%) rename templates/{item-nombreastral-sheet.html => item/nombreastral-sheet.hbs} (100%) rename templates/{item-nourritureboisson-sheet.html => item/nourritureboisson-sheet.hbs} (100%) rename templates/{item-objet-sheet.html => item/objet-sheet.hbs} (100%) rename templates/{item-oeuvre-sheet.html => item/oeuvre-sheet.hbs} (100%) create mode 100644 templates/item/ombre-sheet.hbs rename templates/{item-plante-sheet.html => item/plante-sheet.hbs} (100%) rename templates/{item-poison-sheet.html => item/poison-sheet.hbs} (100%) rename templates/{item-possession-sheet.html => item/possession-sheet.hbs} (100%) rename templates/{enum-categorie-potion.html => item/potion-enum-categorie.hbs} (95%) rename templates/{item-potion-sheet.html => item/potion-sheet.hbs} (55%) create mode 100644 templates/item/potion/dialog-enchanter.hbs rename templates/{item-queue-sheet.html => item/queue-sheet.hbs} (100%) rename templates/{item-race-sheet.html => item/race-sheet.hbs} (100%) rename templates/{item-recettealchimique-sheet.html => item/recettealchimique-sheet.hbs} (100%) rename templates/{item-recettecuisine-sheet.html => item/recettecuisine-sheet.hbs} (100%) rename templates/{item-rencontre-sheet.html => item/rencontre-sheet.hbs} (100%) rename templates/{item-service-sheet.html => item/service-sheet.hbs} (100%) rename templates/{item-signedraconique-sheet.html => item/signedraconique-sheet.hbs} (100%) rename templates/{item-sort-sheet.html => item/sort-sheet.hbs} (100%) rename templates/{item-sortreserve-sheet.html => item/sortreserve-sheet.hbs} (100%) rename templates/{item-souffle-sheet.html => item/souffle-sheet.hbs} (100%) rename templates/{item-tache-sheet.html => item/tache-sheet.hbs} (100%) rename templates/{item-tarot-sheet.html => item/tarot-sheet.hbs} (100%) rename templates/{item-tete-sheet.html => item/tete-sheet.hbs} (100%) diff --git a/module/actor.js b/module/actor.js index f107bc3e..87e30b53 100644 --- a/module/actor.js +++ b/module/actor.js @@ -167,28 +167,23 @@ export class RdDActor extends RdDBaseActorSang { /* -------------------------------------------- */ async $perteRevePotionsEnchantees() { - let potions = this.itemTypes[ITEM_TYPES.potion] - .filter(it => Grammar.includesLowerCaseNoAccent(it.system.categorie, 'enchanté') && !it.system.prpermanent) - - const potionUpdates = await Promise.all(potions.map(async it => { - const nouveauReve = Math.max(it.system.pr - 1, 0) + const potionUpdates = this.itemTypes[ITEM_TYPES.potion].map( + it.perteRevePotion()) + .filter(it => it != undefined) + if (potionUpdates.length > 0) { + console.log('perte rêve de potions', potionUpdates) + const messageUpdates = await Promise.all(potionUpdates.map(async p => await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, { + pr: foundry.utils.getProperty(p, 'system.pr'), + alias: this.getAlias(), + potionName: p.name, + potionImg: p.img + }))) ChatMessage.create({ whisper: ChatUtility.getOwners(this), - content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, { - pr: nouveauReve, - alias: this.getAlias(), - potionName: it.name, - potionImg: it.img - }) + content: messageUpdates.reduce(Misc.joining('
')) }) - return { - _id: it._id, - 'system.pr': nouveauReve, - 'system.quantite': nouveauReve > 0 ? it.system.quantite : 0 - } - })) - - await this.updateEmbeddedDocuments('Item', potionUpdates); + await this.updateEmbeddedDocuments('Item', potionUpdates); + } } /** -------------------------------------------- diff --git a/module/item-sheet.js b/module/item-sheet.js index 5e965140..ea7cf51c 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -1,7 +1,6 @@ import { RdDItemSort } from "./item-sort.js"; import { RdDUtility } from "./rdd-utility.js"; import { RdDItemCompetence } from "./item-competence.js"; -import { RdDHerbes } from "./rdd-herbes.js"; import { RdDGemme } from "./rdd-gemme.js"; import { HtmlUtility } from "./html-utility.js"; import { ReglesOptionnelles } from "./settings/regles-optionnelles.js"; @@ -26,8 +25,8 @@ export class RdDItemSheet extends ItemSheet { static defaultTemplate(type) { return type ? - `systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html` : - "systems/foundryvtt-reve-de-dragon/templates/item-sheet.html"; + `systems/foundryvtt-reve-de-dragon/templates/item/${type}-sheet.hbs` : + "systems/foundryvtt-reve-de-dragon/templates/item/item-sheet.hbs"; } static register(sheetClass) { @@ -136,9 +135,7 @@ export class RdDItemSheet extends ItemSheet { formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList(); RdDGemme.calculDataDerivees(this.item) } - if (this.item.type == ITEM_TYPES.potion) { - RdDHerbes.calculFormData(formData, this.item) - } + if (this.item.type == ITEM_TYPES.herbe) { if (formData.options.isOwned && ['Soin', 'Repos'].includes(formData.system.categorie)) { formData.isIngredientPotionBase = true; @@ -193,14 +190,6 @@ export class RdDItemSheet extends ItemSheet { this.supprimerBonusCase(event.currentTarget.attributes['data-deleteCoord'].value) }) - this.html.find('.date-enchantement').change((event) => { - const jour = Number(this.html.find('input.date-enchantement[name="enchantement.jour"]').val()); - const mois = RdDTimestamp.definition(this.html.find('select.date-enchantement[name="enchantement.mois"]').val()); - const indexDate = game.system.rdd.calendrier.getIndexFromDate(jour, mois.heure); - this.item.update({ 'system.prdate': indexDate }); - console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`) - }); - this.html.find('.creer-tache-livre').click((event) => this._getEventActor(event).creerTacheDepuisLivre(this.item)); this.html.find('.consommer-potion').click((event) => this._getEventActor(event).consommerPotion(this.item, this.getActionRenderItem())); this.html.find('.creer-potion-base').click((event) => this._getEventActor(event).actionHerbe(this.item)); diff --git a/module/item.js b/module/item.js index 74ac8bef..40ecfcac 100644 --- a/module/item.js +++ b/module/item.js @@ -1,7 +1,6 @@ import { DialogItemVente } from "./achat-vente/dialog-item-vente.js"; import { Grammar } from "./grammar.js"; import { Misc } from "./misc.js"; -import { RdDHerbes } from "./rdd-herbes.js"; import { RdDTimestamp } from "./time/rdd-timestamp.js"; import { RdDUtility } from "./rdd-utility.js"; import { SystemCompendiums } from "./settings/system-compendiums.js"; @@ -356,13 +355,6 @@ export class RdDItem extends Item { getUtilisation() { switch (this.type) { - case ITEM_TYPES.potion: - switch (this.system.categorie) { - case 'Alchimie': case 'AlchimieEnchante': case 'AlchimieAutre': return 'alchimie' - case 'Cuisine': return 'cuisine' - case 'Remede': case 'Repos': case 'ReposEnchante': case 'Soin': case 'SoinEnchante': return 'soins' - } - return ''; case ITEM_TYPES.nourritureboisson: return 'cuisine'; case ITEM_TYPES.herbe: case ITEM_TYPES.faune: case ITEM_TYPES.ingredient: case ITEM_TYPES.plante: switch (this.system.categorie) { @@ -478,25 +470,11 @@ export class RdDItem extends Item { super.prepareDerivedData(); if (this.isInventaire()) { this.system.encTotal = this.getEncTotal(); - if (this.isPotion()) { - this.prepareDataPotion() - } this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false }); } this.equipable = this.isEquipable(); } - prepareDataPotion() { - const categorie = Grammar.toLowerCaseNoAccent(this.system.categorie); - this.system.magique = categorie.includes('enchante'); - if (this.system.magique) { - if (categorie.includes('soin') || categorie.includes('repos')) { - // TODO: utiliser calculPointsRepos / calculPointsGuerison - this.system.puissance = RdDHerbes.calculPuissancePotion(this); - } - } - } - getActionPrincipale(options = { warnIfNot: true }) { switch (this.type) { case ITEM_TYPES.conteneur: return 'Ouvrir'; @@ -514,7 +492,7 @@ export class RdDItem extends Item { case ITEM_TYPES.queue: case ITEM_TYPES.ombre: return this.system.refoulement > 0 ? 'Refouler' : undefined; } } - return undefined; + return undefined } /* -------------------------------------------- */ @@ -805,14 +783,6 @@ export class RdDItem extends Item { ] } /* -------------------------------------------- */ - _potionChatData() { - return [ - `Rareté: ${this.system.rarete}`, - `Catégorie: ${this.system.categorie}`, - ...this._inventaireTemplateChatData() - ] - } - /* -------------------------------------------- */ _queueChatData() { function label(categorie) { switch (categorie) { diff --git a/module/item/potion.js b/module/item/potion.js new file mode 100644 index 00000000..5110c151 --- /dev/null +++ b/module/item/potion.js @@ -0,0 +1,150 @@ +import { Grammar } from "../grammar.js"; +import { RdDItem } from "../item.js"; +import { SystemCompendiums } from "../settings/system-compendiums.js"; +import { RdDTimestamp } from "../time/rdd-timestamp.js"; +import { DialogEnchanter } from "./potion/dialog-enchanter.js"; + +const POTION_MAGIQUE = ['AlchimieEnchante', 'ReposEnchante', 'SoinEnchante', 'AutreEnchante'] +const POTION_ENCHANTABLE = ['Alchimie', 'Repos', 'Soin', 'Autre'] + .concat(POTION_MAGIQUE) + +const MAP_CATEGORIE_ENCHANTEMENT = [ + { basique: 'Alchimie', enchante: 'AlchimieEnchante' }, + { basique: 'Repos', enchante: 'ReposEnchante' }, + { basique: 'Soin', enchante: 'SoinEnchante' }, + { basique: 'Autre', enchante: 'AutreEnchante' }] + +export class RdDItemPotion extends RdDItem { + + static async herbesSoins() { + return await RdDItemPotion.$listHerbes(it => Grammar.equalsInsensitive(it.system.categorie, 'Soin') && it.system.niveau > 0) + } + static async herbesRepos() { + return await RdDItemPotion.$listHerbes(it => Grammar.equalsInsensitive(it.system.categorie, 'Repos') && it.system.niveau > 0) + } + + static async $listHerbes(filter) { + const herbes = await SystemCompendiums.getWorldOrCompendiumItems('herbe', 'faune-flore-mineraux'); + return herbes.filter(filter) + } + + static get defaultIcon() { + return "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp" + } + + prepareDerivedData() { + super.prepareDerivedData() + this.system.puissance = this.system.magique ? this.calculPuissance() : 0 + } + + isPotion() { return true } + isEnchantable() { return POTION_ENCHANTABLE.includes(this.system.categorie) } + isMagique() { return POTION_MAGIQUE.includes(this.system.categorie) } + + getActions(options = { warnIfNot: true }) { + const actionConsommer = this.prepareAction('Consommer', options.warnIfNot); + if (this.isEnchantable()) { + return [ + actionConsommer, + this.prepareAction('Enchanter', options.warnIfNot) + ] + } + return [ + actionConsommer + ] + } + + + getUtilisation() { + switch (this.system.categorie) { + case 'Alchimie': case 'AlchimieEnchante': + case 'AlchimieAutre': + return 'alchimie' + case 'Cuisine': return 'cuisine' + case 'Remede': case 'Repos': case 'ReposEnchante': case 'Soin': case 'SoinEnchante': + return 'soins' + } + return '' + } + + _potionChatData() { + return [ + `Rareté: ${this.system.rarete}`, + `Catégorie: ${this.system.categorie}`, + ...this._inventaireTemplateChatData() + ] + } + + async enchanterPotion() { + const actor = this.parent; + if (actor && (!actor.isPersonnage() || !actor.isHautRevant())) { + ui.notifications.info('Seul un haut rêvant peut enchanter une potion') + return + } + const dailog = await DialogEnchanter.create(this, actor, (updates) => this.$onEnchanterPotion(updates)); + dailog.render(true) + } + + perteRevePotion() { + if (this.system.magique && !this.system.prpermanent && this.system.pr > 0) { + const nouveauReve = Math.max(this.system.pr - 1, 0) + return { + _id: it._id, + name: this.name, + img: this.img, + 'system.pr': nouveauReve, + 'system.quantite': nouveauReve > 0 ? it.system.quantite : 0, + 'system.magique': nouveauReve > 0 + } + } + return undefined + } + + async $onEnchanterPotion(enchanter) { + if (enchanter.nouveaupr == 0) { + await this.update({ + 'system.pr': 0, + 'system.purifie': false, + 'system.magique': false, + 'system.categorie': this.categorieEnchantement().basique, + 'system.prpermanent': false, + 'system.prdate': 0, + 'system.quantite': this.parent ? 0 : this.system.quantite + }) + } + else { + const updates = { + 'system.pr': enchanter.nouveaupr, + 'system.purifie': enchanter.purifier, + 'system.magique': true, + 'system.categorie': this.categorieEnchantement().enchante, + 'system.prpermanent': enchanter.prpermanent, + 'system.prdate': RdDItemPotion.dateEnchantement() + } + this.update(updates) + } + } + + calculPuissance() { return this.system.herbebonus * this.system.pr } + + categorieEnchantement() { + const categorie = this.system.categorie + const categorieEnchantement = MAP_CATEGORIE_ENCHANTEMENT.find(it => [it.basique, it.enchante].includes(categorie)) + return categorieEnchantement ?? { basique: categorie, enchante: categorie } + } + + static dateEnchantement() { + return game.system.rdd.calendrier.getTimestamp().debutJournee() + } + + static buildHerbesList(listeHerbes, max) { + let list = {} + for (let herbe of listeHerbes) { + let brins = max - herbe.system.niveau; + list[herbe.name] = `${herbe.name} (Bonus: ${herbe.system.niveau}, Brins: ${brins})`; + } + list['Autre'] = 'Autre (Bonus: variable, Brins: variable)' + return list; + } + +} \ No newline at end of file diff --git a/module/item/potion/dialog-enchanter.js b/module/item/potion/dialog-enchanter.js new file mode 100644 index 00000000..248f9485 --- /dev/null +++ b/module/item/potion/dialog-enchanter.js @@ -0,0 +1,46 @@ + +export class DialogEnchanter extends Dialog { + + static async create(item, actor, callback) { + const enchanter = { + actor: actor, + item: item, + nouveaupr: item.system.pr, + prpermanent: item.system.prpermanent, + purifier: false + } + const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/item/potion/dialog-enchanter.hbs`, enchanter) + return new DialogEnchanter(enchanter, html, callback) + } + + constructor(enchanter, html, callback) { + let options = { classes: ["dialog-enchanter"], width: 400, height: 'fit-content', 'z-index': 99999 } + let conf = { + title: "Enchanter une potion", + content: html, + default: "enchanter", + buttons: { + "enchanter": { label: "Enchanter", callback: it => this.onEnchanter() } + } + }; + super(conf, options) + + this.callback = callback + this.enchanter = enchanter + } + + activateListeners(html) { + super.activateListeners(html) + this.html = html + this.html.find("input.nouveaupr").change(event => this.enchanter.nouveaupr = Number(event.currentTarget.value)) + this.html.find("input.purifier").change(event => this.enchanter.purifier = event.currentTarget.checked) + this.html.find("input.prpermanent").change(event => this.enchanter.prpermanent = event.currentTarget.checked) + } + + + async onEnchanter() { + await this.html.find(".nouveaupr").change() + this.callback(this.enchanter); + } + +} \ No newline at end of file diff --git a/module/item/sheet-potion.js b/module/item/sheet-potion.js new file mode 100644 index 00000000..ff29ebb9 --- /dev/null +++ b/module/item/sheet-potion.js @@ -0,0 +1,57 @@ +import { ITEM_TYPES } from "../item.js"; +import { RdDTimestamp } from "../time/rdd-timestamp.js"; +import { RdDItemPotion } from "./potion.js"; +import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js"; + + +export class RdDPotionItemSheet extends RdDItemInventaireSheet { + + static get ITEM_TYPE() { return ITEM_TYPES.potion }; + + static $calculBonusHerbe(formData, herbesList, max) { + if (Number(formData.system.herbebrins)) { + let herbe = herbesList.find(h => h.name.toLowerCase() == formData.system.herbe.toLowerCase()); + if (herbe) { + const brinsRequis = max - herbe.system.niveau; + const brinsManquants = Math.max(brinsRequis - formData.system.herbebrins, 0); + formData.system.herbebonus = Math.max(herbe.system.niveau - brinsManquants, 0); + } + } + } + get potion(){ return this.item } + + async getData() { + const formData = await super.getData() + formData.enchantable = this.potion.isEnchantable() + const enchantement = this.potion.categorieEnchantement() + formData.isSoins = enchantement.basique == 'Soin' + formData.isRepos = enchantement.basique == 'Repos' + if (formData.isSoins) { + const herbesSoins = await RdDItemPotion.herbesSoins() + RdDPotionItemSheet.$calculBonusHerbe(formData, herbesSoins, 12); + formData.herbesSoins = RdDItemPotion.buildHerbesList(herbesSoins, 12) + } + if (formData.isRepos) { + const herbesRepos = await RdDItemPotion.herbesRepos() + RdDPotionItemSheet.$calculBonusHerbe(formData, herbesRepos, 7); + formData.herbesRepos = RdDItemPotion.buildHerbesList(herbesRepos, 7) + } + formData.dateActuelle = game.system.rdd.calendrier.dateCourante() + formData.enchantement = RdDTimestamp.splitIndexDate(this.potion.system.prdate) + return formData + } + + activateListeners(html) { + super.activateListeners(html); + this.html.find('.enchanter-potion').click((event) => this.potion.enchanterPotion()) + + this.html.find('.date-enchantement').change((event) => { + const jour = Number(this.html.find('input.date-enchantement[name="enchantement.jour"]').val()) + const mois = RdDTimestamp.definition(this.html.find('select.date-enchantement[name="enchantement.mois"]').val()) + const indexDate = game.system.rdd.calendrier.getIndexFromDate(jour, mois.heure) + this.potion.update({ 'system.prdate': indexDate }) + console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`) + }); + + } +} diff --git a/module/rdd-herbes.js b/module/rdd-herbes.js deleted file mode 100644 index 2a94b5ff..00000000 --- a/module/rdd-herbes.js +++ /dev/null @@ -1,73 +0,0 @@ -import { Grammar } from "./grammar.js"; -import { SystemCompendiums } from "./settings/system-compendiums.js"; -import { RdDTimestamp } from "./time/rdd-timestamp.js"; - -/* -------------------------------------------- */ -export class RdDHerbes extends Item { - - /* -------------------------------------------- */ - static async onReady() { - this.herbesSoins = await RdDHerbes.listCategorieHerbes('Soin'); - this.herbesRepos = await RdDHerbes.listCategorieHerbes('Repos'); - } - - static async listCategorieHerbes(categorie) { - const herbes = await SystemCompendiums.getWorldOrCompendiumItems('herbe', 'faune-flore-mineraux'); - return herbes.filter(it => Grammar.equalsInsensitive(it.system.categorie, categorie)); - } - - /* -------------------------------------------- */ - static buildHerbesList(listeHerbes, max) { - let list = {} - for (let herbe of listeHerbes) { - let brins = max - herbe.system.niveau; - list[herbe.name] = `${herbe.name} (Bonus: ${herbe.system.niveau}, Brins: ${brins})`; - } - list['Autre'] = 'Autre (Bonus: variable, Brins: variable)' - return list; - } - - /* -------------------------------------------- */ - static calculFormData(formData, item) { - formData.isSoins = item.system.categorie.includes('Soin'); - formData.isRepos = item.system.categorie.includes('Repos'); - if (formData.isSoins) { - RdDHerbes.calculBonusHerbe(formData, this.herbesSoins, 12); - } - if (formData.isRepos) { - RdDHerbes.calculBonusHerbe(formData, this.herbesRepos, 7); - } - formData.herbesSoins = RdDHerbes.buildHerbesList(this.herbesSoins, 12); - formData.herbesRepos = RdDHerbes.buildHerbesList(this.herbesRepos, 7); - formData.dateActuelle = game.system.rdd.calendrier.dateCourante(); - formData.enchantement = RdDTimestamp.splitIndexDate(item.system.prdate); - } - - /* -------------------------------------------- */ - static calculPuissancePotion(potion) { - return potion.system.herbebonus * potion.system.pr; - } - - /* -------------------------------------------- */ - static calculPointsRepos(potion) { - return potion.system.herbebonus * potion.system.pr; - } - - /* -------------------------------------------- */ - static calculPointsGuerison(potion) { - return potion.system.herbebonus * potion.system.pr; - } - - /* -------------------------------------------- */ - static calculBonusHerbe(formData, herbesList, max) { - if (Number(formData.system.herbebrins)) { - let herbe = herbesList.find(item => item.name.toLowerCase() == formData.system.herbe.toLowerCase()); - if (herbe) { - const brinsRequis = max - herbe.system.niveau; - const brinsManquants = Math.max(brinsRequis - formData.system.herbebrins, 0); - formData.system.herbebonus = Math.max(herbe.system.niveau - brinsManquants, 0); - } - } - } - -} \ No newline at end of file diff --git a/module/rdd-main.js b/module/rdd-main.js index 2096ca9f..907781c1 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -18,7 +18,6 @@ import { RdDCompendiumOrganiser } from "./rdd-compendium-organiser.js" import { ReglesOptionnelles } from "./settings/regles-optionnelles.js" import { RdDHotbar } from "./rdd-hotbar-drop.js" import { EffetsDraconiques } from "./tmr/effets-draconiques.js" -import { RdDHerbes } from "./rdd-herbes.js" import { RdDDice } from "./rdd-dice.js" import { RdDPossession } from "./rdd-possession.js" import { Misc } from "./misc.js" @@ -76,7 +75,8 @@ import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire. import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-encart-sheet.js" import { RdDStatBlockParser } from "./apps/rdd-import-stats.js" import { RdDJournalSheet } from "./journal/journal-sheet.js" -import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js" +import { RdDPotionItemSheet } from "./item/sheet-potion.js" +import { RdDItemPotion } from "./item/potion.js" /** * RdD system @@ -105,6 +105,7 @@ export class SystemReveDeDragon { poison: RdDItemPoison, queue: RdDItemQueue, tete: RdDItemTete, + potion: RdDItemPotion, race: RdDItemRace, rencontre: RdDRencontre, service: RdDItemService, @@ -195,6 +196,7 @@ export class SystemReveDeDragon { RdDItemSheet.register(RdDHerbeItemSheet) RdDItemSheet.register(RdDFauneItemSheet) RdDItemSheet.register(RdDPlanteItemSheet) + RdDItemSheet.register(RdDPotionItemSheet) RdDItemSheet.register(RdDIngredientItemSheet) RdDItemSheet.register(RdDServiceItemSheet) RdDItemSheet.register(RdDBlessureItemSheet) @@ -202,9 +204,10 @@ export class SystemReveDeDragon { Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, { types: [ - "objet", "arme", "armure", "livre", "potion", "munition", + "objet", "arme", "armure", "livre", "munition", "monnaie", "nourritureboisson", "gemme", - ], makeDefault: true + ], + makeDefault: true }) Items.registerSheet(SYSTEM_RDD, RdDItemSheet, { types: [ @@ -214,7 +217,8 @@ export class SystemReveDeDragon { "queue", "ombre", "souffle", "tete", "casetmr", "sort", "sortreserve", "nombreastral", "tache", "maladie", "poison", "possession", "tarot", "extraitpoetique", "empoignade" - ], makeDefault: true + ], + makeDefault: true }) // préparation des différents modules @@ -316,7 +320,6 @@ export class SystemReveDeDragon { } StatusEffects.onReady() - RdDHerbes.onReady() RdDDice.onReady() RdDStatBlockParser.parseStatBlock() diff --git a/module/rdd-utility.js b/module/rdd-utility.js index e592dcc2..b4da7b51 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -180,8 +180,9 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html', 'systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html', 'systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.html', - 'systems/foundryvtt-reve-de-dragon/templates/item-queue-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/header-item.html', + + 'systems/foundryvtt-reve-de-dragon/templates/item/queue-sheet.hbs', // partial enums 'systems/foundryvtt-reve-de-dragon/templates/enum-aspect-tarot.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-base-competence.html', @@ -189,7 +190,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/enum-categories.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-ingredient.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-parade.html', - 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-potion.html', + 'systems/foundryvtt-reve-de-dragon/templates/item/potion-enum-categorie.hbs', 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-queue.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-vehicule.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-competence.html', diff --git a/module/time/rdd-timestamp.js b/module/time/rdd-timestamp.js index b1cb827b..6e010cff 100644 --- a/module/time/rdd-timestamp.js +++ b/module/time/rdd-timestamp.js @@ -334,6 +334,12 @@ export class RdDTimestamp { return this.nouvelleHeure().addHeures((12 + heure - this.heure) % 12); } + debutJournee() { + return RdDTimestamp.timestamp(this.timestamp.annee, + this.timestamp.mois, + this.timestamp.jour) + } + async appliquerDuree(duree, actor) { const formule = FORMULES_DUREE.find(it => it.code == duree) ?? FORMULES_DUREE.find(it => it.code == ""); return await formule.calcul(this, actor); diff --git a/template.json b/template.json index f1835b56..fec10313 100644 --- a/template.json +++ b/template.json @@ -802,7 +802,9 @@ "herbebrins": 0, "herbebonus": 0, "reposalchimique": false, + "magique": false, "pr": 0, + "purifie": false, "prpermanent": false, "prdate": 0 }, diff --git a/templates/item-ombre-sheet.html b/templates/item-ombre-sheet.html deleted file mode 100644 index 51f6c0d3..00000000 --- a/templates/item-ombre-sheet.html +++ /dev/null @@ -1 +0,0 @@ -{{>"systems/foundryvtt-reve-de-dragon/templates/item-queue-sheet.html"}} diff --git a/templates/item-arme-sheet.html b/templates/item/arme-sheet.hbs similarity index 100% rename from templates/item-arme-sheet.html rename to templates/item/arme-sheet.hbs diff --git a/templates/item-armure-sheet.html b/templates/item/armure-sheet.hbs similarity index 100% rename from templates/item-armure-sheet.html rename to templates/item/armure-sheet.hbs diff --git a/templates/item-blessure-sheet.html b/templates/item/blessure-sheet.hbs similarity index 100% rename from templates/item-blessure-sheet.html rename to templates/item/blessure-sheet.hbs diff --git a/templates/item-casetmr-sheet.html b/templates/item/casetmr-sheet.hbs similarity index 100% rename from templates/item-casetmr-sheet.html rename to templates/item/casetmr-sheet.hbs diff --git a/templates/item-chant-sheet.html b/templates/item/chant-sheet.hbs similarity index 100% rename from templates/item-chant-sheet.html rename to templates/item/chant-sheet.hbs diff --git a/templates/item-competence-sheet.html b/templates/item/competence-sheet.hbs similarity index 100% rename from templates/item-competence-sheet.html rename to templates/item/competence-sheet.hbs diff --git a/templates/item-competencecreature-sheet.html b/templates/item/competencecreature-sheet.hbs similarity index 100% rename from templates/item-competencecreature-sheet.html rename to templates/item/competencecreature-sheet.hbs diff --git a/templates/item-conteneur-sheet.html b/templates/item/conteneur-sheet.hbs similarity index 100% rename from templates/item-conteneur-sheet.html rename to templates/item/conteneur-sheet.hbs diff --git a/templates/item-danse-sheet.html b/templates/item/danse-sheet.hbs similarity index 100% rename from templates/item-danse-sheet.html rename to templates/item/danse-sheet.hbs diff --git a/templates/item-empoignade-sheet.html b/templates/item/empoignade-sheet.hbs similarity index 100% rename from templates/item-empoignade-sheet.html rename to templates/item/empoignade-sheet.hbs diff --git a/templates/item-extraitpoetique-sheet.html b/templates/item/extraitpoetique-sheet.hbs similarity index 100% rename from templates/item-extraitpoetique-sheet.html rename to templates/item/extraitpoetique-sheet.hbs diff --git a/templates/item-faune-sheet.html b/templates/item/faune-sheet.hbs similarity index 100% rename from templates/item-faune-sheet.html rename to templates/item/faune-sheet.hbs diff --git a/templates/item-gemme-sheet.html b/templates/item/gemme-sheet.hbs similarity index 100% rename from templates/item-gemme-sheet.html rename to templates/item/gemme-sheet.hbs diff --git a/templates/item-herbe-sheet.html b/templates/item/herbe-sheet.hbs similarity index 100% rename from templates/item-herbe-sheet.html rename to templates/item/herbe-sheet.hbs diff --git a/templates/item-ingredient-sheet.html b/templates/item/ingredient-sheet.hbs similarity index 100% rename from templates/item-ingredient-sheet.html rename to templates/item/ingredient-sheet.hbs diff --git a/templates/item-sheet.html b/templates/item/item-sheet.hbs similarity index 100% rename from templates/item-sheet.html rename to templates/item/item-sheet.hbs diff --git a/templates/item-jeu-sheet.html b/templates/item/jeu-sheet.hbs similarity index 100% rename from templates/item-jeu-sheet.html rename to templates/item/jeu-sheet.hbs diff --git a/templates/item-livre-sheet.html b/templates/item/livre-sheet.hbs similarity index 100% rename from templates/item-livre-sheet.html rename to templates/item/livre-sheet.hbs diff --git a/templates/item-maladie-sheet.html b/templates/item/maladie-sheet.hbs similarity index 100% rename from templates/item-maladie-sheet.html rename to templates/item/maladie-sheet.hbs diff --git a/templates/item-meditation-sheet.html b/templates/item/meditation-sheet.hbs similarity index 100% rename from templates/item-meditation-sheet.html rename to templates/item/meditation-sheet.hbs diff --git a/templates/item-monnaie-sheet.html b/templates/item/monnaie-sheet.hbs similarity index 100% rename from templates/item-monnaie-sheet.html rename to templates/item/monnaie-sheet.hbs diff --git a/templates/item-munition-sheet.html b/templates/item/munition-sheet.hbs similarity index 100% rename from templates/item-munition-sheet.html rename to templates/item/munition-sheet.hbs diff --git a/templates/item-musique-sheet.html b/templates/item/musique-sheet.hbs similarity index 100% rename from templates/item-musique-sheet.html rename to templates/item/musique-sheet.hbs diff --git a/templates/item-nombreastral-sheet.html b/templates/item/nombreastral-sheet.hbs similarity index 100% rename from templates/item-nombreastral-sheet.html rename to templates/item/nombreastral-sheet.hbs diff --git a/templates/item-nourritureboisson-sheet.html b/templates/item/nourritureboisson-sheet.hbs similarity index 100% rename from templates/item-nourritureboisson-sheet.html rename to templates/item/nourritureboisson-sheet.hbs diff --git a/templates/item-objet-sheet.html b/templates/item/objet-sheet.hbs similarity index 100% rename from templates/item-objet-sheet.html rename to templates/item/objet-sheet.hbs diff --git a/templates/item-oeuvre-sheet.html b/templates/item/oeuvre-sheet.hbs similarity index 100% rename from templates/item-oeuvre-sheet.html rename to templates/item/oeuvre-sheet.hbs diff --git a/templates/item/ombre-sheet.hbs b/templates/item/ombre-sheet.hbs new file mode 100644 index 00000000..eba4bac7 --- /dev/null +++ b/templates/item/ombre-sheet.hbs @@ -0,0 +1 @@ +{{>"systems/foundryvtt-reve-de-dragon/templates/item/queue-sheet.hbs"}} diff --git a/templates/item-plante-sheet.html b/templates/item/plante-sheet.hbs similarity index 100% rename from templates/item-plante-sheet.html rename to templates/item/plante-sheet.hbs diff --git a/templates/item-poison-sheet.html b/templates/item/poison-sheet.hbs similarity index 100% rename from templates/item-poison-sheet.html rename to templates/item/poison-sheet.hbs diff --git a/templates/item-possession-sheet.html b/templates/item/possession-sheet.hbs similarity index 100% rename from templates/item-possession-sheet.html rename to templates/item/possession-sheet.hbs diff --git a/templates/enum-categorie-potion.html b/templates/item/potion-enum-categorie.hbs similarity index 95% rename from templates/enum-categorie-potion.html rename to templates/item/potion-enum-categorie.hbs index cf7325ef..a96437d0 100644 --- a/templates/enum-categorie-potion.html +++ b/templates/item/potion-enum-categorie.hbs @@ -1,12 +1,14 @@ - - + - - +{{#if enchantable}} + + + +{{/if}} diff --git a/templates/item-potion-sheet.html b/templates/item/potion-sheet.hbs similarity index 55% rename from templates/item-potion-sheet.html rename to templates/item/potion-sheet.hbs index 9ff3814d..ede90bbf 100644 --- a/templates/item-potion-sheet.html +++ b/templates/item/potion-sheet.hbs @@ -3,11 +3,14 @@

- {{#if options.isOwned}} - - {{/if}} + + {{#if options.isOwned}} + Consommer + {{/if}} + {{#if enchantable}} + Enchanter + {{/if}} +
@@ -30,7 +33,7 @@ @@ -61,39 +64,41 @@ {{/if}} {{/if}} - {{#if system.magique}} -
- - -
- {{#if isSoins}} -
- - -
+ {{#if enchantable}} + {{#if system.magique}} +
+ + +
+ {{#if isSoins}} +
+ + +
+ {{/if}} + {{#if isRepos}} +
+ + +
+ {{/if}} +
+ + +
+
+ +
+
+ + +
+ {{/if}} {{/if}} - {{#if isRepos}} -
- - -
- {{/if}} -
- - -
-
- -
-
- - -
- {{/if}} {{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item/potion/dialog-enchanter.hbs b/templates/item/potion/dialog-enchanter.hbs new file mode 100644 index 00000000..68e43052 --- /dev/null +++ b/templates/item/potion/dialog-enchanter.hbs @@ -0,0 +1,22 @@ +
+ +
+

Enchanter {{item.name}}

+
+ + +
+ {{!--
+ + + +
--}} +
+ + + +
+
+
+ diff --git a/templates/item-queue-sheet.html b/templates/item/queue-sheet.hbs similarity index 100% rename from templates/item-queue-sheet.html rename to templates/item/queue-sheet.hbs diff --git a/templates/item-race-sheet.html b/templates/item/race-sheet.hbs similarity index 100% rename from templates/item-race-sheet.html rename to templates/item/race-sheet.hbs diff --git a/templates/item-recettealchimique-sheet.html b/templates/item/recettealchimique-sheet.hbs similarity index 100% rename from templates/item-recettealchimique-sheet.html rename to templates/item/recettealchimique-sheet.hbs diff --git a/templates/item-recettecuisine-sheet.html b/templates/item/recettecuisine-sheet.hbs similarity index 100% rename from templates/item-recettecuisine-sheet.html rename to templates/item/recettecuisine-sheet.hbs diff --git a/templates/item-rencontre-sheet.html b/templates/item/rencontre-sheet.hbs similarity index 100% rename from templates/item-rencontre-sheet.html rename to templates/item/rencontre-sheet.hbs diff --git a/templates/item-service-sheet.html b/templates/item/service-sheet.hbs similarity index 100% rename from templates/item-service-sheet.html rename to templates/item/service-sheet.hbs diff --git a/templates/item-signedraconique-sheet.html b/templates/item/signedraconique-sheet.hbs similarity index 100% rename from templates/item-signedraconique-sheet.html rename to templates/item/signedraconique-sheet.hbs diff --git a/templates/item-sort-sheet.html b/templates/item/sort-sheet.hbs similarity index 100% rename from templates/item-sort-sheet.html rename to templates/item/sort-sheet.hbs diff --git a/templates/item-sortreserve-sheet.html b/templates/item/sortreserve-sheet.hbs similarity index 100% rename from templates/item-sortreserve-sheet.html rename to templates/item/sortreserve-sheet.hbs diff --git a/templates/item-souffle-sheet.html b/templates/item/souffle-sheet.hbs similarity index 100% rename from templates/item-souffle-sheet.html rename to templates/item/souffle-sheet.hbs diff --git a/templates/item-tache-sheet.html b/templates/item/tache-sheet.hbs similarity index 100% rename from templates/item-tache-sheet.html rename to templates/item/tache-sheet.hbs diff --git a/templates/item-tarot-sheet.html b/templates/item/tarot-sheet.hbs similarity index 100% rename from templates/item-tarot-sheet.html rename to templates/item/tarot-sheet.hbs diff --git a/templates/item-tete-sheet.html b/templates/item/tete-sheet.hbs similarity index 100% rename from templates/item-tete-sheet.html rename to templates/item/tete-sheet.hbs From d922e4fdd5447abe23af7f67b0ba3cc895a0eadd Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 15 Jan 2025 16:16:59 +0100 Subject: [PATCH 04/16] Move type constants Prevent problems of circular dependencies when sepating actions from items & sheets --- module/actor-sheet.js | 3 +- module/actor.js | 2 +- module/actor/base-actor-reve-sheet.js | 2 +- module/actor/base-actor-reve.js | 2 +- module/actor/base-actor-sang.js | 2 +- module/actor/base-actor-sheet.js | 3 +- module/actor/base-actor.js | 2 +- module/actor/creature.js | 2 +- module/actor/entite.js | 2 +- .../export-scriptarium/export-scriptarium.js | 2 +- module/actor/export-scriptarium/mapping.js | 2 +- module/apps/rdd-import-stats.js | 2 +- module/apps/rdd-text-roll-editor.js | 2 +- module/apps/textroll/text-roll-alchimie.js | 2 +- module/constants.js | 57 ++++++++++++++++++- module/item-arme.js | 2 +- module/item-competencecreature.js | 2 +- module/item-sheet.js | 3 +- module/item-sort.js | 2 +- module/item.js | 56 +----------------- module/item/armure.js | 3 +- module/item/race.js | 3 +- module/item/sheet-conteneur.js | 2 +- module/item/sheet-potion.js | 2 +- module/item/tete.js | 3 +- module/migrations.js | 3 +- module/rdd-empoignade.js | 3 +- module/rdd-hotbar-drop.js | 2 +- module/rdd-possession.js | 2 +- module/rdd-roll.js | 2 +- module/rdd-tmr-dialog.js | 2 +- module/tmr/draconique.js | 2 +- module/tmr/effets-draconiques.js | 2 +- module/tmr/urgence-draconique.js | 2 +- module/voyage/dialog-fatigue-voyage.js | 2 +- 35 files changed, 97 insertions(+), 90 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 2c0b26ff..10273649 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -12,7 +12,8 @@ import { RdDSheetUtility } from "./rdd-sheet-utility.js"; import { STATUSES } from "./settings/status-effects.js"; import { MAINS_DIRECTRICES } from "./actor.js"; import { RdDBaseActorReveSheet } from "./actor/base-actor-reve-sheet.js"; -import { ITEM_TYPES, RdDItem } from "./item.js"; +import { ITEM_TYPES } from "./constants.js"; +import { RdDItem } from "./item.js"; import { RdDItemBlessure } from "./item/blessure.js"; import { RdDEmpoignade } from "./rdd-empoignade.js"; import { RdDBaseActorSangSheet } from "./actor/base-actor-sang-sheet.js"; diff --git a/module/actor.js b/module/actor.js index 87e30b53..c9bc7fae 100644 --- a/module/actor.js +++ b/module/actor.js @@ -32,7 +32,7 @@ import { RdDItemBlessure } from "./item/blessure.js"; import { AppAstrologie } from "./sommeil/app-astrologie.js"; import { RdDEmpoignade } from "./rdd-empoignade.js"; import { ExperienceLog, XP_TOPIC } from "./actor/experience-log.js"; -import { ITEM_TYPES } from "./item.js"; +import { ITEM_TYPES } from "./constants.js"; import { RdDBaseActorSang } from "./actor/base-actor-sang.js"; import { RdDCoeur } from "./coeur/rdd-coeur.js"; import { DialogChoixXpCarac } from "./dialog-choix-xp-carac.js"; diff --git a/module/actor/base-actor-reve-sheet.js b/module/actor/base-actor-reve-sheet.js index a7753af0..a21a28fa 100644 --- a/module/actor/base-actor-reve-sheet.js +++ b/module/actor/base-actor-reve-sheet.js @@ -1,6 +1,6 @@ import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js"; import { Grammar } from "../grammar.js"; -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; import { RdDSheetUtility } from "../rdd-sheet-utility.js"; import { RdDBaseActorSheet } from "./base-actor-sheet.js"; diff --git a/module/actor/base-actor-reve.js b/module/actor/base-actor-reve.js index b920cf8a..268109bc 100644 --- a/module/actor/base-actor-reve.js +++ b/module/actor/base-actor-reve.js @@ -7,7 +7,7 @@ import { RdDRoll } from "../rdd-roll.js"; import { RdDUtility } from "../rdd-utility.js"; import { ReglesOptionnelles } from "../settings/regles-optionnelles.js"; import { RdDBaseActor } from "./base-actor.js"; -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; import { RdDItemCompetence } from "../item-competence.js"; import { RdDItemCompetenceCreature } from "../item-competencecreature.js"; import { RdDItemArme } from "../item-arme.js"; diff --git a/module/actor/base-actor-sang.js b/module/actor/base-actor-sang.js index c7392486..5fe7895d 100644 --- a/module/actor/base-actor-sang.js +++ b/module/actor/base-actor-sang.js @@ -1,7 +1,7 @@ import { RdDUtility } from "../rdd-utility.js"; import { ReglesOptionnelles } from "../settings/regles-optionnelles.js"; import { STATUSES } from "../settings/status-effects.js"; -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; import { RdDBaseActorReve } from "./base-actor-reve.js"; import { RdDDice } from "../rdd-dice.js"; import { RdDItemBlessure } from "../item/blessure.js"; diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index 00429a92..a5edbd09 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -3,7 +3,8 @@ import { Misc } from "../misc.js"; import { DialogSplitItem } from "../dialog-split-item.js"; import { RdDSheetUtility } from "../rdd-sheet-utility.js"; import { Monnaie } from "../item-monnaie.js"; -import { RdDItem, ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; +import { RdDItem } from "../item.js"; import { RdDItemCompetenceCreature } from "../item-competencecreature.js"; import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js"; diff --git a/module/actor/base-actor.js b/module/actor/base-actor.js index a4962cfa..4d23aa22 100644 --- a/module/actor/base-actor.js +++ b/module/actor/base-actor.js @@ -3,7 +3,7 @@ import { ChatUtility } from "../chat-utility.js"; import { SYSTEM_SOCKET_ID } from "../constants.js"; import { Grammar } from "../grammar.js"; import { Monnaie } from "../item-monnaie.js"; -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; import { Misc } from "../misc.js"; import { RdDAudio } from "../rdd-audio.js"; import { RdDConfirm } from "../rdd-confirm.js"; diff --git a/module/actor/creature.js b/module/actor/creature.js index 8f65041f..6724f38b 100644 --- a/module/actor/creature.js +++ b/module/actor/creature.js @@ -1,5 +1,5 @@ import { Grammar } from "../grammar.js"; -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; import { LIST_CARAC_AUTRES } from "../rdd-carac.js"; import { RdDBaseActorSang } from "./base-actor-sang.js"; diff --git a/module/actor/entite.js b/module/actor/entite.js index eea0b9cb..eeacd5e4 100644 --- a/module/actor/entite.js +++ b/module/actor/entite.js @@ -1,5 +1,5 @@ import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js"; -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; import { Misc } from "../misc.js"; import { RdDCarac } from "../rdd-carac.js"; import { RdDEncaisser } from "../rdd-roll-encaisser.js"; diff --git a/module/actor/export-scriptarium/export-scriptarium.js b/module/actor/export-scriptarium/export-scriptarium.js index aea110e7..0c66df17 100644 --- a/module/actor/export-scriptarium/export-scriptarium.js +++ b/module/actor/export-scriptarium/export-scriptarium.js @@ -1,4 +1,4 @@ -import { ACTOR_TYPES } from "../../item.js" +import { ACTOR_TYPES } from "../../constants.js" import { Misc } from "../../misc.js" import { EXPORT_CSV_SCRIPTARIUM, OptionsAvancees } from "../../settings/options-avancees.js" import { Mapping } from "./mapping.js" diff --git a/module/actor/export-scriptarium/mapping.js b/module/actor/export-scriptarium/mapping.js index 34b59453..0d79ebf1 100644 --- a/module/actor/export-scriptarium/mapping.js +++ b/module/actor/export-scriptarium/mapping.js @@ -2,7 +2,7 @@ import { Grammar } from "../../grammar.js" import { RdDItemArme } from "../../item-arme.js" import { RdDItemCompetence } from "../../item-competence.js" import { RdDItemSort } from "../../item-sort.js" -import { ITEM_TYPES } from "../../item.js" +import { ITEM_TYPES } from "../../constants.js" import { Misc } from "../../misc.js" import { RdDTimestamp } from "../../time/rdd-timestamp.js" import { RdDBonus } from "../../rdd-bonus.js" diff --git a/module/apps/rdd-import-stats.js b/module/apps/rdd-import-stats.js index d07cdc39..851911c8 100644 --- a/module/apps/rdd-import-stats.js +++ b/module/apps/rdd-import-stats.js @@ -6,7 +6,7 @@ import { Grammar } from "../grammar.js"; import { Misc } from "../misc.js"; import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js"; import { RdDItemTete } from "../item/tete.js"; -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; const WHITESPACES = "\\s+" const NUMERIC = "[\\+\\-]?\\d+" diff --git a/module/apps/rdd-text-roll-editor.js b/module/apps/rdd-text-roll-editor.js index 33463eca..10583f7e 100644 --- a/module/apps/rdd-text-roll-editor.js +++ b/module/apps/rdd-text-roll-editor.js @@ -1,6 +1,6 @@ import "./xregexp-all.js"; import { SystemCompendiums } from "../settings/system-compendiums.js"; -import { ACTOR_TYPES } from "../item.js"; +import { ACTOR_TYPES } from "../constants.js"; import { TextRollAlchimie } from "./textroll/text-roll-alchimie.js"; import { TextRollCaracCompetence } from "./textroll/text-roll-carac-competence.js"; import { TextRollFormula } from "./textroll/text-roll-formula.js"; diff --git a/module/apps/textroll/text-roll-alchimie.js b/module/apps/textroll/text-roll-alchimie.js index 2e6ff20f..6733754d 100644 --- a/module/apps/textroll/text-roll-alchimie.js +++ b/module/apps/textroll/text-roll-alchimie.js @@ -1,5 +1,5 @@ import "../xregexp-all.js"; -import { ACTOR_TYPES, ITEM_TYPES } from "../../item.js"; +import { ACTOR_TYPES, ITEM_TYPES } from "../../constants.js"; import { RdDCarac } from "../../rdd-carac.js"; import { RdDUtility } from "../../rdd-utility.js"; import { RdDAlchimie } from "../../rdd-alchimie.js"; diff --git a/module/constants.js b/module/constants.js index 58088ed8..bd69b80d 100644 --- a/module/constants.js +++ b/module/constants.js @@ -50,4 +50,59 @@ export const RDD_CONFIG = { {value: "Rare", label: "Rare"}, {value: "Rarissime", label: "Rarissime"} ] -} \ No newline at end of file +} + +export const ACTOR_TYPES = { + personnage: 'personnage', + creature: 'creature', + entite: 'entite', + commerce: 'commerce', + vehicule: 'vehicule' +} + +export const ITEM_TYPES = { + competence: 'competence', + competencecreature: 'competencecreature', + empoignade: 'empoignade', + possession: 'possession', + blessure: 'blessure', + maladie: 'maladie', + poison: 'poison', + arme: 'arme', + armure: 'armure', + conteneur: 'conteneur', + objet: 'objet', + monnaie: 'monnaie', + gemme: 'gemme', + munition: 'munition', + nourritureboisson: 'nourritureboisson', + herbe: 'herbe', + plante: 'plante', + ingredient: 'ingredient', + faune: 'faune', + livre: 'livre', + potion: 'potion', + service: 'service', + musique: 'musique', + danse: 'danse', + chant: 'chant', + jeu: 'jeu', + race: 'race', + recettecuisine: 'recettecuisine', + oeuvre: 'oeuvre', + recettealchimique: 'recettealchimique', + tache: 'tache', + sort: 'sort', + sortreserve: 'sortreserve', + rencontre: 'rencontre', + queue: 'queue', + ombre: 'ombre', + souffle: 'souffle', + tete: 'tete', + casetmr: 'casetmr', + meditation: 'meditation', + signedraconique: 'signedraconique', + tarot: 'tarot', + nombreastral: 'nombreastral', + extraitpoetique: 'extraitpoetique', +} diff --git a/module/item-arme.js b/module/item-arme.js index c7343564..8207ada4 100644 --- a/module/item-arme.js +++ b/module/item-arme.js @@ -1,6 +1,6 @@ import { Grammar } from "./grammar.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js" -import { ITEM_TYPES } from "./item.js"; +import { ITEM_TYPES } from "./constants.js"; import { BASE_CORPS_A_CORPS } from "./item/base-items.js"; import { RdDCombatManager } from "./rdd-combat.js"; diff --git a/module/item-competencecreature.js b/module/item-competencecreature.js index 8648d8bd..d0a19f25 100644 --- a/module/item-competencecreature.js +++ b/module/item-competencecreature.js @@ -1,5 +1,5 @@ -import { ITEM_TYPES } from "./item.js"; +import { ITEM_TYPES } from "./constants.js"; import { RdDCombatManager } from "./rdd-combat.js"; export const CATEGORIES_COMPETENCES_CREATURES = { diff --git a/module/item-sheet.js b/module/item-sheet.js index ea7cf51c..386d7b34 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -1,3 +1,4 @@ +import { ACTOR_TYPES, ITEM_TYPES } from "./constants.js"; import { RdDItemSort } from "./item-sort.js"; import { RdDUtility } from "./rdd-utility.js"; import { RdDItemCompetence } from "./item-competence.js"; @@ -10,7 +11,7 @@ import { SystemCompendiums } from "./settings/system-compendiums.js"; import { Misc } from "./misc.js"; import { RdDTimestamp } from "./time/rdd-timestamp.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; -import { ACTOR_TYPES, ITEM_TYPES, RdDItem } from "./item.js"; +import { RdDItem } from "./item.js"; import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js"; import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js"; diff --git a/module/item-sort.js b/module/item-sort.js index fd7be217..e619583f 100644 --- a/module/item-sort.js +++ b/module/item-sort.js @@ -1,6 +1,6 @@ import { Grammar } from "./grammar.js"; import { RdDItemCompetence } from "./item-competence.js"; -import { ITEM_TYPES } from "./item.js"; +import { ITEM_TYPES } from "./constants.js"; import { Misc } from "./misc.js"; import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js"; diff --git a/module/item.js b/module/item.js index 40ecfcac..f94cff23 100644 --- a/module/item.js +++ b/module/item.js @@ -1,3 +1,4 @@ +import { ACTOR_TYPES, ITEM_TYPES } from "./constants.js"; import { DialogItemVente } from "./achat-vente/dialog-item-vente.js"; import { Grammar } from "./grammar.js"; import { Misc } from "./misc.js"; @@ -9,61 +10,6 @@ import { CATEGORIES_COMPETENCES } from "./item-competence.js"; import { CATEGORIES_COMPETENCES_CREATURES } from "./item-competencecreature.js"; import { BASE_CORPS_A_CORPS, BASE_ESQUIVE } from "./item/base-items.js"; -export const ACTOR_TYPES = { - personnage: 'personnage', - creature: 'creature', - entite: 'entite', - commerce: 'commerce', - vehicule: 'vehicule' -} - -export const ITEM_TYPES = { - competence: 'competence', - competencecreature: 'competencecreature', - empoignade: 'empoignade', - possession: 'possession', - blessure: 'blessure', - maladie: 'maladie', - poison: 'poison', - arme: 'arme', - armure: 'armure', - conteneur: 'conteneur', - objet: 'objet', - monnaie: 'monnaie', - gemme: 'gemme', - munition: 'munition', - nourritureboisson: 'nourritureboisson', - herbe: 'herbe', - plante: 'plante', - ingredient: 'ingredient', - faune: 'faune', - livre: 'livre', - potion: 'potion', - service: 'service', - musique: 'musique', - danse: 'danse', - chant: 'chant', - jeu: 'jeu', - race: 'race', - recettecuisine: 'recettecuisine', - oeuvre: 'oeuvre', - recettealchimique: 'recettealchimique', - tache: 'tache', - sort: 'sort', - sortreserve: 'sortreserve', - rencontre: 'rencontre', - queue: 'queue', - ombre: 'ombre', - souffle: 'souffle', - tete: 'tete', - casetmr: 'casetmr', - meditation: 'meditation', - signedraconique: 'signedraconique', - tarot: 'tarot', - nombreastral: 'nombreastral', - extraitpoetique: 'extraitpoetique', -} - const typesInventaireMateriel = [ ITEM_TYPES.arme, ITEM_TYPES.armure, diff --git a/module/item/armure.js b/module/item/armure.js index fdb89583..14096a8b 100644 --- a/module/item/armure.js +++ b/module/item/armure.js @@ -1,4 +1,5 @@ -import { ITEM_TYPES, RdDItem } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; +import { RdDItem } from "../item.js"; import { Misc } from "../misc.js"; import { ReglesOptionnelles } from "../settings/regles-optionnelles.js"; diff --git a/module/item/race.js b/module/item/race.js index 49216f3a..e1685185 100644 --- a/module/item/race.js +++ b/module/item/race.js @@ -1,4 +1,5 @@ -import { ITEM_TYPES, RdDItem } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; +import { RdDItem } from "../item.js"; import { Misc } from "../misc.js"; import { LIST_CARAC_PERSONNAGE, RdDCarac } from "../rdd-carac.js"; diff --git a/module/item/sheet-conteneur.js b/module/item/sheet-conteneur.js index 78114833..effa355c 100644 --- a/module/item/sheet-conteneur.js +++ b/module/item/sheet-conteneur.js @@ -1,5 +1,5 @@ import { RdDBaseActorSheet } from "../actor/base-actor-sheet.js"; -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; import { RdDSheetUtility } from "../rdd-sheet-utility.js"; import { RdDUtility } from "../rdd-utility.js"; import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js"; diff --git a/module/item/sheet-potion.js b/module/item/sheet-potion.js index ff29ebb9..c37a846f 100644 --- a/module/item/sheet-potion.js +++ b/module/item/sheet-potion.js @@ -1,4 +1,4 @@ -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; import { RdDTimestamp } from "../time/rdd-timestamp.js"; import { RdDItemPotion } from "./potion.js"; import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js"; diff --git a/module/item/tete.js b/module/item/tete.js index f16598cb..9649ad9c 100644 --- a/module/item/tete.js +++ b/module/item/tete.js @@ -1,5 +1,6 @@ +import { ITEM_TYPES } from "../constants.js"; +import { RdDItem } from "../item.js"; import { Grammar } from "../grammar.js" -import { ITEM_TYPES, RdDItem } from "../item.js" import { SystemCompendiums } from "../settings/system-compendiums.js" const DON_HAUT_REVE = "Don de Haut-Rêve" diff --git a/module/migrations.js b/module/migrations.js index 148ee4c9..612210b9 100644 --- a/module/migrations.js +++ b/module/migrations.js @@ -2,7 +2,8 @@ import { RdDBaseActor } from "./actor/base-actor.js"; import { LOG_HEAD, SYSTEM_RDD } from "./constants.js"; import { Grammar } from "./grammar.js"; import { Monnaie } from "./item-monnaie.js"; -import { RdDItem, ITEM_TYPES, ACTOR_TYPES } from "./item.js"; +import { ITEM_TYPES, ACTOR_TYPES } from "./constants.js"; +import { RdDItem } from "./item.js"; import { RdDTimestamp } from "./time/rdd-timestamp.js"; import { RdDRaretes } from "./item/raretes.js"; import { VOIES_DRACONIC } from "./item-sort.js"; diff --git a/module/rdd-empoignade.js b/module/rdd-empoignade.js index 50307a4e..51a155e9 100644 --- a/module/rdd-empoignade.js +++ b/module/rdd-empoignade.js @@ -4,8 +4,7 @@ import { RdDRoll } from "./rdd-roll.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { ChatUtility } from "./chat-utility.js"; import { STATUSES } from "./settings/status-effects.js"; -import { ReglesOptionnelles } from "./settings/regles-optionnelles.js"; -import { ITEM_TYPES } from "./item.js"; +import { ITEM_TYPES } from "./constants.js"; /* -------------------------------------------- */ diff --git a/module/rdd-hotbar-drop.js b/module/rdd-hotbar-drop.js index 76610d53..ad80a03d 100644 --- a/module/rdd-hotbar-drop.js +++ b/module/rdd-hotbar-drop.js @@ -1,6 +1,6 @@ import { RdDItemArme } from "./item-arme.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; -import { ITEM_TYPES } from "./item.js"; +import { ITEM_TYPES } from "./constants.js"; export class RdDHotbar { diff --git a/module/rdd-possession.js b/module/rdd-possession.js index 57c3a142..cdcb5864 100644 --- a/module/rdd-possession.js +++ b/module/rdd-possession.js @@ -3,7 +3,7 @@ import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDRoll } from "./rdd-roll.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { Targets } from "./targets.js"; -import { ITEM_TYPES } from "./item.js"; +import { ITEM_TYPES } from "./constants.js"; /* -------------------------------------------- */ /* On part du principe qu'une entité démarre tjs diff --git a/module/rdd-roll.js b/module/rdd-roll.js index c6d2f029..99b270da 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -8,7 +8,7 @@ import { RdDCarac } from "./rdd-carac.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { ReglesOptionnelles } from "./settings/regles-optionnelles.js"; import { Grammar } from "./grammar.js"; -import { ACTOR_TYPES } from "./item.js"; +import { ACTOR_TYPES } from "./constants.js"; /** * Extend the base Dialog entity to select roll parameters diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 5bfc1cea..a805954f 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -16,7 +16,7 @@ import { RdDDice } from "./rdd-dice.js"; import { STATUSES } from "./settings/status-effects.js"; import { RdDRencontre } from "./item/rencontre.js"; import { RdDTimestamp } from "./time/rdd-timestamp.js"; -import { ITEM_TYPES } from "./item.js"; +import { ITEM_TYPES } from "./constants.js"; import { Misc } from "./misc.js"; const TMR_DISPLAY_SIZE = { diff --git a/module/tmr/draconique.js b/module/tmr/draconique.js index fb12145e..74db8bb7 100644 --- a/module/tmr/draconique.js +++ b/module/tmr/draconique.js @@ -1,4 +1,4 @@ -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; import { TMRUtility } from "../tmr-utility.js"; import { PixiTMR } from "./pixi-tmr.js"; diff --git a/module/tmr/effets-draconiques.js b/module/tmr/effets-draconiques.js index c60c50c8..9e283d19 100644 --- a/module/tmr/effets-draconiques.js +++ b/module/tmr/effets-draconiques.js @@ -18,7 +18,7 @@ import { Periple } from "./periple.js"; import { UrgenceDraconique } from "./urgence-draconique.js"; import { Grammar } from "../grammar.js"; import { AugmentationSeuil } from "./augmentation-seuil.js"; -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; export class EffetsDraconiques { static carteTmr = new CarteTmr(); diff --git a/module/tmr/urgence-draconique.js b/module/tmr/urgence-draconique.js index 8ecbe572..ba17dcef 100644 --- a/module/tmr/urgence-draconique.js +++ b/module/tmr/urgence-draconique.js @@ -5,7 +5,7 @@ import { RdDRollTables } from "../rdd-rolltables.js"; import { TMRUtility } from "../tmr-utility.js"; import { tmrTokenZIndex } from "../tmr-constants.js"; import { Draconique } from "./draconique.js"; -import { ITEM_TYPES } from "../item.js"; +import { ITEM_TYPES } from "../constants.js"; import { TMRAnimations } from "./animation.js"; export class UrgenceDraconique extends Draconique { diff --git a/module/voyage/dialog-fatigue-voyage.js b/module/voyage/dialog-fatigue-voyage.js index e4caa365..a0e08bb6 100644 --- a/module/voyage/dialog-fatigue-voyage.js +++ b/module/voyage/dialog-fatigue-voyage.js @@ -1,4 +1,4 @@ -import { ITEM_TYPES } from "../item.js" +import { ITEM_TYPES } from "../constants.js" import { RdDItemCompetence } from "../item-competence.js" import { ChatUtility } from "../chat-utility.js" import { Misc } from "../misc.js" From 442ffe9b3a4de5f4e1f480c2810363b6b931cd2e Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 17 Jan 2025 03:14:03 +0100 Subject: [PATCH 05/16] Ajout de jets aux descriptions --- .../animaux/creature_Brolute_rieuse_twCuK1GjVBTUFGXF.yml | 2 +- packs_src/animaux/creature_Cheval_76I21ASdWYBqsg8I.yml | 2 +- .../ingredient_Boralm_kbWKsR0HovidPw6d.yml | 2 +- .../ingredient_Candique_FjfZ789LlkzUUSMU.yml | 2 +- .../ingredient_Chramaelium_NNTl6CAdRZcylrU1.yml | 2 +- .../ingredient_Nartha_SiFtJoydPawJaMKA.yml | 2 +- .../ingredient_Obbadion_f4TPpX03pJuyBkuX.yml | 2 +- .../ingredient_Obyssum_gris_m9ONkzH9KwLk3P3i.yml | 2 +- .../ingredient_Obyssum_vert_HTtgzxpvUvMHilqx.yml | 2 +- .../ombre_Coup_de_barre_PMz7SaB6sRxhwrWw.yml | 2 +- ...asser_3d6_oeufs_en_les_jetant___terre_OjG8XRbeYtq2jcgB.yml | 2 +- .../queues-de-dragon/queue_Coup_de_barre_Qgj5eSMpQ0IDHwZX.yml | 2 +- ..._Garder_sur_soi_3d6_kilos_de_cailloux_F8G3rdU1nfJzYwYR.yml | 2 +- .../recettealchimique_Bitume_de_Camphre_RXQcnXK88LjMICB5.yml | 2 +- .../tables_D_sirs_lancinants_sVWhyr4wPnieuPP8.yml | 2 +- .../tables-diverses/tables_Id_es_fixes_nbH4v630P7ARaAHk.yml | 2 +- .../tables_Table_sp_ciale_de_rencontres_66ye0OOxBO9LEjdd.yml | 4 ++-- 17 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packs_src/animaux/creature_Brolute_rieuse_twCuK1GjVBTUFGXF.yml b/packs_src/animaux/creature_Brolute_rieuse_twCuK1GjVBTUFGXF.yml index 745590ff..4b7be87f 100644 --- a/packs_src/animaux/creature_Brolute_rieuse_twCuK1GjVBTUFGXF.yml +++ b/packs_src/animaux/creature_Brolute_rieuse_twCuK1GjVBTUFGXF.yml @@ -300,7 +300,7 @@ system: déchirure. Celle-là se contente de chercher à fuir en cas d’agression, ou attaque toutes griffes dehors si elle se sent acculée. Pour la distinguer (visuellement) de la rieuse, - réussir VUE/Zoologie à -5. Les caractéristiques de + réussir @roll[VUE/Zoologie/-5]. Les caractéristiques de combat indiquées ne s’appliquent qu’à la pointue.

race: '' diff --git a/packs_src/animaux/creature_Cheval_76I21ASdWYBqsg8I.yml b/packs_src/animaux/creature_Cheval_76I21ASdWYBqsg8I.yml index 092c2d7c..dec5b756 100644 --- a/packs_src/animaux/creature_Cheval_76I21ASdWYBqsg8I.yml +++ b/packs_src/animaux/creature_Cheval_76I21ASdWYBqsg8I.yml @@ -215,7 +215,7 @@ system: souffrir ses premiers malus à la course et au saut. La vitesse indiquée correspond à une allure plutôt lente. Contrairement aux autres animaux pour qui la vitesse de base est fixe, le - gardien des rêves peut rajouter jusqu’à 3d6 points + gardien des rêves peut rajouter jusqu’à @roll[3d6] points à la vitesse de course de chaque individu. Cette nouvelle vitesse de course est rajoutée une fois pour toutes, mais peut être modulée par un jet de course sur la table de Course animale.

diff --git a/packs_src/faune-flore-mineraux/ingredient_Boralm_kbWKsR0HovidPw6d.yml b/packs_src/faune-flore-mineraux/ingredient_Boralm_kbWKsR0HovidPw6d.yml index a47408c2..9e8130e8 100644 --- a/packs_src/faune-flore-mineraux/ingredient_Boralm_kbWKsR0HovidPw6d.yml +++ b/packs_src/faune-flore-mineraux/ingredient_Boralm_kbWKsR0HovidPw6d.yml @@ -5,7 +5,7 @@ effects: [] system: description: |-

Poudre brune apparaissant sur les parois des grottes.

-

VUE/Alchimie à -1.

+

@roll[VUE/Alchimie/-1].

descriptionmj: '' encombrement: 0.001 quantite: 1 diff --git a/packs_src/faune-flore-mineraux/ingredient_Candique_FjfZ789LlkzUUSMU.yml b/packs_src/faune-flore-mineraux/ingredient_Candique_FjfZ789LlkzUUSMU.yml index 254a5ab4..a066aee9 100644 --- a/packs_src/faune-flore-mineraux/ingredient_Candique_FjfZ789LlkzUUSMU.yml +++ b/packs_src/faune-flore-mineraux/ingredient_Candique_FjfZ789LlkzUUSMU.yml @@ -7,7 +7,7 @@ system:

Poudre blanche apparaissant sous l’écorce de nombreux arbres,

-

VUE/Alchimie à 0.

+

@roll[VUE/Alchimie/0].

descriptionmj: '' encombrement: 0.001 quantite: 1 diff --git a/packs_src/faune-flore-mineraux/ingredient_Chramaelium_NNTl6CAdRZcylrU1.yml b/packs_src/faune-flore-mineraux/ingredient_Chramaelium_NNTl6CAdRZcylrU1.yml index 0dd8fb20..3e508244 100644 --- a/packs_src/faune-flore-mineraux/ingredient_Chramaelium_NNTl6CAdRZcylrU1.yml +++ b/packs_src/faune-flore-mineraux/ingredient_Chramaelium_NNTl6CAdRZcylrU1.yml @@ -7,7 +7,7 @@ system:

Poudre rouge obtenue par disruption alchimique de la chramaele, minerai ayant l’apparence de la glaise.

-

VUE/Alchimie à -4

+

@roll[VUE/Alchimie/-4]

descriptionmj: '' encombrement: 0.001 quantite: 1 diff --git a/packs_src/faune-flore-mineraux/ingredient_Nartha_SiFtJoydPawJaMKA.yml b/packs_src/faune-flore-mineraux/ingredient_Nartha_SiFtJoydPawJaMKA.yml index 5cf550fb..b8c77741 100644 --- a/packs_src/faune-flore-mineraux/ingredient_Nartha_SiFtJoydPawJaMKA.yml +++ b/packs_src/faune-flore-mineraux/ingredient_Nartha_SiFtJoydPawJaMKA.yml @@ -7,7 +7,7 @@ system:

Poudre noire obtenue par disruption alchimique du minerai appelé narthalide, sorte de marne.

-

VUE/Alchimie à -3

+

@roll[VUE/Alchimie/-3]

descriptionmj: '' encombrement: 0.001 quantite: 1 diff --git a/packs_src/faune-flore-mineraux/ingredient_Obbadion_f4TPpX03pJuyBkuX.yml b/packs_src/faune-flore-mineraux/ingredient_Obbadion_f4TPpX03pJuyBkuX.yml index aa79c313..36d58fc5 100644 --- a/packs_src/faune-flore-mineraux/ingredient_Obbadion_f4TPpX03pJuyBkuX.yml +++ b/packs_src/faune-flore-mineraux/ingredient_Obbadion_f4TPpX03pJuyBkuX.yml @@ -7,7 +7,7 @@ system:

Poudre bleuâtre obtenue par disruption alchimique du minerai appelé obbadine,  sorte de tourbe.

-

VUE/Alchimie à -2

+

@roll[VUE/Alchimie/-2]

descriptionmj: '' encombrement: 0.001 quantite: 1 diff --git a/packs_src/faune-flore-mineraux/ingredient_Obyssum_gris_m9ONkzH9KwLk3P3i.yml b/packs_src/faune-flore-mineraux/ingredient_Obyssum_gris_m9ONkzH9KwLk3P3i.yml index 26a10a38..b7f369fe 100644 --- a/packs_src/faune-flore-mineraux/ingredient_Obyssum_gris_m9ONkzH9KwLk3P3i.yml +++ b/packs_src/faune-flore-mineraux/ingredient_Obyssum_gris_m9ONkzH9KwLk3P3i.yml @@ -7,7 +7,7 @@ system:

Plus rare que le vert, poudre grisâtre apparaissant le long de certaines lianes des marais.

-

VUE/Alchimie à -4

+

@roll[VUE/Alchimie/-4]

descriptionmj: '' encombrement: 0.001 quantite: 1 diff --git a/packs_src/faune-flore-mineraux/ingredient_Obyssum_vert_HTtgzxpvUvMHilqx.yml b/packs_src/faune-flore-mineraux/ingredient_Obyssum_vert_HTtgzxpvUvMHilqx.yml index d2c6944c..2a9219a4 100644 --- a/packs_src/faune-flore-mineraux/ingredient_Obyssum_vert_HTtgzxpvUvMHilqx.yml +++ b/packs_src/faune-flore-mineraux/ingredient_Obyssum_vert_HTtgzxpvUvMHilqx.yml @@ -5,7 +5,7 @@ effects: [] system: description: |-

Poudre verdâtre apparaissant sur les tiges de certains roseaux.

-

VUE/Alchimie à -2

+

@roll[VUE/Alchimie/-2]

descriptionmj: '' encombrement: 0.001 quantite: 1 diff --git a/packs_src/ombres-de-thanatos/ombre_Coup_de_barre_PMz7SaB6sRxhwrWw.yml b/packs_src/ombres-de-thanatos/ombre_Coup_de_barre_PMz7SaB6sRxhwrWw.yml index d9ee9912..6e90ada8 100644 --- a/packs_src/ombres-de-thanatos/ombre_Coup_de_barre_PMz7SaB6sRxhwrWw.yml +++ b/packs_src/ombres-de-thanatos/ombre_Coup_de_barre_PMz7SaB6sRxhwrWw.yml @@ -4,7 +4,7 @@ type: ombre img: systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp effects: [] system: - description:

Prise immédiate de 3d6 points de fatigue.

+ description:

Prise immédiate de @roll[3d6] points de fatigue.

descriptionmj: '' temporel: debut: diff --git a/packs_src/queues-de-dragon/queue_Casser_3d6_oeufs_en_les_jetant___terre_OjG8XRbeYtq2jcgB.yml b/packs_src/queues-de-dragon/queue_Casser_3d6_oeufs_en_les_jetant___terre_OjG8XRbeYtq2jcgB.yml index 2b6678a5..ce377cc1 100644 --- a/packs_src/queues-de-dragon/queue_Casser_3d6_oeufs_en_les_jetant___terre_OjG8XRbeYtq2jcgB.yml +++ b/packs_src/queues-de-dragon/queue_Casser_3d6_oeufs_en_les_jetant___terre_OjG8XRbeYtq2jcgB.yml @@ -1,5 +1,5 @@ _id: OjG8XRbeYtq2jcgB -name: Casser 3d6 oeufs en les jetant à terre +name: Casser @roll[3d6] oeufs en les jetant à terre type: queue img: systems/foundryvtt-reve-de-dragon/icons/queues/desir_lancinant.webp effects: [] diff --git a/packs_src/queues-de-dragon/queue_Coup_de_barre_Qgj5eSMpQ0IDHwZX.yml b/packs_src/queues-de-dragon/queue_Coup_de_barre_Qgj5eSMpQ0IDHwZX.yml index 173193f8..d6b0f31c 100644 --- a/packs_src/queues-de-dragon/queue_Coup_de_barre_Qgj5eSMpQ0IDHwZX.yml +++ b/packs_src/queues-de-dragon/queue_Coup_de_barre_Qgj5eSMpQ0IDHwZX.yml @@ -4,7 +4,7 @@ type: queue img: systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp effects: [] system: - description:

Prise immédiate de 3d6 points de fatigue.

+ description:

Prise immédiate de @roll[3d6] points de fatigue.

descriptionmj: '' temporel: debut: diff --git a/packs_src/queues-de-dragon/queue_Garder_sur_soi_3d6_kilos_de_cailloux_F8G3rdU1nfJzYwYR.yml b/packs_src/queues-de-dragon/queue_Garder_sur_soi_3d6_kilos_de_cailloux_F8G3rdU1nfJzYwYR.yml index da79c531..403b211d 100644 --- a/packs_src/queues-de-dragon/queue_Garder_sur_soi_3d6_kilos_de_cailloux_F8G3rdU1nfJzYwYR.yml +++ b/packs_src/queues-de-dragon/queue_Garder_sur_soi_3d6_kilos_de_cailloux_F8G3rdU1nfJzYwYR.yml @@ -1,5 +1,5 @@ _id: F8G3rdU1nfJzYwYR -name: Garder sur soi 3d6 kilos de cailloux +name: Garder sur soi @roll[3d6] kilos de cailloux type: queue img: systems/foundryvtt-reve-de-dragon/icons/queues/idee_fixe.webp effects: [] diff --git a/packs_src/recettes-alchimiques/recettealchimique_Bitume_de_Camphre_RXQcnXK88LjMICB5.yml b/packs_src/recettes-alchimiques/recettealchimique_Bitume_de_Camphre_RXQcnXK88LjMICB5.yml index b3733112..4d3999d0 100644 --- a/packs_src/recettes-alchimiques/recettealchimique_Bitume_de_Camphre_RXQcnXK88LjMICB5.yml +++ b/packs_src/recettes-alchimiques/recettealchimique_Bitume_de_Camphre_RXQcnXK88LjMICB5.yml @@ -9,7 +9,7 @@ system:

L’huile de pierre (pétrole brut) se trouve naturellement à la surface de certains marais.

-

VUE/Alchimie à zéro pour l’identifier.

+

@roll[VUE/Alchimie/0] pour l’identifier.

 

diff --git a/packs_src/tables-diverses/tables_D_sirs_lancinants_sVWhyr4wPnieuPP8.yml b/packs_src/tables-diverses/tables_D_sirs_lancinants_sVWhyr4wPnieuPP8.yml index 5d1f1af0..5e2b46bc 100644 --- a/packs_src/tables-diverses/tables_D_sirs_lancinants_sVWhyr4wPnieuPP8.yml +++ b/packs_src/tables-diverses/tables_D_sirs_lancinants_sVWhyr4wPnieuPP8.yml @@ -252,7 +252,7 @@ results: - _id: 5AHjNXDrQL5TqLjv flags: {} type: pack - text: 'Désir lancinant : Casser 3d6 oeufs en les jetant à terre' + text: 'Désir lancinant : Casser @roll[3d6] oeufs en les jetant à terre' img: systems/foundryvtt-reve-de-dragon/icons/queues/desir_lancinant.webp weight: 1 range: diff --git a/packs_src/tables-diverses/tables_Id_es_fixes_nbH4v630P7ARaAHk.yml b/packs_src/tables-diverses/tables_Id_es_fixes_nbH4v630P7ARaAHk.yml index 4ff01473..34806c39 100644 --- a/packs_src/tables-diverses/tables_Id_es_fixes_nbH4v630P7ARaAHk.yml +++ b/packs_src/tables-diverses/tables_Id_es_fixes_nbH4v630P7ARaAHk.yml @@ -64,7 +64,7 @@ results: - _id: P0eaJjtQQfpNIL9I flags: {} type: pack - text: 'Idée fixe : Garder sur soi 3d6 kilos de cailloux' + text: 'Idée fixe : Garder sur soi @roll[3d6] kilos de cailloux' img: systems/foundryvtt-reve-de-dragon/icons/queues/idee_fixe.webp weight: 1 range: diff --git a/packs_src/tables-diverses/tables_Table_sp_ciale_de_rencontres_66ye0OOxBO9LEjdd.yml b/packs_src/tables-diverses/tables_Table_sp_ciale_de_rencontres_66ye0OOxBO9LEjdd.yml index 06cbd2df..d608e7bf 100644 --- a/packs_src/tables-diverses/tables_Table_sp_ciale_de_rencontres_66ye0OOxBO9LEjdd.yml +++ b/packs_src/tables-diverses/tables_Table_sp_ciale_de_rencontres_66ye0OOxBO9LEjdd.yml @@ -37,7 +37,7 @@ results: - _id: wpUaRAW4HVRM8eOs flags: {} type: text - text: Reflet d’ancien rêve 2d6+4. + text: Reflet d’ancien rêve @roll[2d6+4]. img: systems/foundryvtt-reve-de-dragon/icons/heures/hd06.webp weight: 1 range: @@ -53,7 +53,7 @@ results: - _id: tPwuPqShKzWo5jkG flags: {} type: text - text: Tourbillon blanc 2d6+4. + text: Tourbillon blanc @roll[2d6+4]. img: systems/foundryvtt-reve-de-dragon/icons/heures/hd06.webp weight: 1 range: From ac29e1410e277e4df204165f4a22357d9a1ce6d5 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 17 Jan 2025 03:14:48 +0100 Subject: [PATCH 06/16] Correction de remedes enchantables Les remedes ne sont pas enchantable, changement en Alchimie --- ...ce_Liste_d__quipement_1Nng9d8r6lrPHCaJ.yml | 28 +++++++++---------- ...ion_Elixir_des_gnomes_JXMef7FXVOG1XYWO.yml | 2 +- ...n_Huile_de_S_likanthe_LkE8EjPfao9m6Rn7.yml | 2 +- .../potion_Lait_de_lune_A3jx5dPkk5IeXSXn.yml | 2 +- ...ion_Liqueur_de_Bagdol_PrnJrG50u1UPdlJN.yml | 2 +- .../potion_Mirobolant_keLCmhsbxHK39UIy.yml | 2 +- ...n_Teinture_d_Erozonne_bA0JDA7awoWhu0vO.yml | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packs_src/archetypes/commerce_Liste_d__quipement_1Nng9d8r6lrPHCaJ.yml b/packs_src/archetypes/commerce_Liste_d__quipement_1Nng9d8r6lrPHCaJ.yml index 9e91208b..3e0932a2 100644 --- a/packs_src/archetypes/commerce_Liste_d__quipement_1Nng9d8r6lrPHCaJ.yml +++ b/packs_src/archetypes/commerce_Liste_d__quipement_1Nng9d8r6lrPHCaJ.yml @@ -3897,7 +3897,7 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 @@ -5349,7 +5349,7 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 @@ -5605,7 +5605,7 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 @@ -5765,7 +5765,7 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 @@ -6437,7 +6437,7 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 @@ -7610,7 +7610,7 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 @@ -8010,7 +8010,7 @@ items: poussant dans les lieux frais et humides : marais ombragés, certaines forêts, et parfois vallées de montagne. Un peu moins rare est la fausse endebrume, qui lui ressemble physiquement, mais - n'a aucune vertu.
VUE/Botanique à -1 pour savoir + n'a aucune vertu.
@roll[VUE/Botanique/-1] pour savoir à quelle espèce on a affaire (jet obligatoire à chaque cueillette).

@@ -8782,7 +8782,7 @@ items: system: description: |-

Poudre brune apparaissant sur les parois des grottes.

-

VUE/Alchimie à -1.

+

@roll[VUE/Alchimie/-1].

descriptionmj: '' encombrement: 0.001 quantite: 1 @@ -8818,7 +8818,7 @@ items:

Poudre blanche apparaissant sous l’écorce de nombreux arbres,

-

VUE/Alchimie à 0.

+

@roll[VUE/Alchimie/0].

descriptionmj: '' encombrement: 0.001 quantite: 1 @@ -8854,7 +8854,7 @@ items:

Poudre rouge obtenue par disruption alchimique de la chramaele, minerai ayant l’apparence de la glaise.

-

VUE/Alchimie à -4

+

@roll[VUE/Alchimie/-4]

descriptionmj: '' encombrement: 0.001 quantite: 1 @@ -8899,7 +8899,7 @@ items:

Poudre noire obtenue par disruption alchimique du minerai appelé narthalide, sorte de marne.

-

VUE/Alchimie à -3

+

@roll[VUE/Alchimie/-3]

descriptionmj: '' encombrement: 0.001 quantite: 1 @@ -8941,7 +8941,7 @@ items:

Poudre bleuâtre obtenue par disruption alchimique du minerai appelé obbadine,  sorte de tourbe.

-

VUE/Alchimie à -2

+

@roll[VUE/Alchimie/-2]

descriptionmj: '' encombrement: 0.001 quantite: 1 @@ -8983,7 +8983,7 @@ items:

Plus rare que le vert, poudre grisâtre apparaissant le long de certaines lianes des marais.

-

VUE/Alchimie à -4

+

@roll[VUE/Alchimie/-4]

descriptionmj: '' encombrement: 0.001 quantite: 1 @@ -9019,7 +9019,7 @@ items:

Poudre verdâtre apparaissant sur les tiges de certains roseaux.

-

VUE/Alchimie à -2

+

@roll[VUE/Alchimie/-2]

descriptionmj: '' encombrement: 0.001 quantite: 1 diff --git a/packs_src/equipement/potion_Elixir_des_gnomes_JXMef7FXVOG1XYWO.yml b/packs_src/equipement/potion_Elixir_des_gnomes_JXMef7FXVOG1XYWO.yml index 9e54b3ef..163bd09f 100644 --- a/packs_src/equipement/potion_Elixir_des_gnomes_JXMef7FXVOG1XYWO.yml +++ b/packs_src/equipement/potion_Elixir_des_gnomes_JXMef7FXVOG1XYWO.yml @@ -30,7 +30,7 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Huile_de_S_likanthe_LkE8EjPfao9m6Rn7.yml b/packs_src/equipement/potion_Huile_de_S_likanthe_LkE8EjPfao9m6Rn7.yml index 51bd9957..86834b00 100644 --- a/packs_src/equipement/potion_Huile_de_S_likanthe_LkE8EjPfao9m6Rn7.yml +++ b/packs_src/equipement/potion_Huile_de_S_likanthe_LkE8EjPfao9m6Rn7.yml @@ -30,7 +30,7 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Lait_de_lune_A3jx5dPkk5IeXSXn.yml b/packs_src/equipement/potion_Lait_de_lune_A3jx5dPkk5IeXSXn.yml index e759f785..ad79816a 100644 --- a/packs_src/equipement/potion_Lait_de_lune_A3jx5dPkk5IeXSXn.yml +++ b/packs_src/equipement/potion_Lait_de_lune_A3jx5dPkk5IeXSXn.yml @@ -30,7 +30,7 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Liqueur_de_Bagdol_PrnJrG50u1UPdlJN.yml b/packs_src/equipement/potion_Liqueur_de_Bagdol_PrnJrG50u1UPdlJN.yml index 8ba5279c..2b8c8a83 100644 --- a/packs_src/equipement/potion_Liqueur_de_Bagdol_PrnJrG50u1UPdlJN.yml +++ b/packs_src/equipement/potion_Liqueur_de_Bagdol_PrnJrG50u1UPdlJN.yml @@ -28,7 +28,7 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Mirobolant_keLCmhsbxHK39UIy.yml b/packs_src/equipement/potion_Mirobolant_keLCmhsbxHK39UIy.yml index 128ad052..6f164f04 100644 --- a/packs_src/equipement/potion_Mirobolant_keLCmhsbxHK39UIy.yml +++ b/packs_src/equipement/potion_Mirobolant_keLCmhsbxHK39UIy.yml @@ -30,7 +30,7 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Teinture_d_Erozonne_bA0JDA7awoWhu0vO.yml b/packs_src/equipement/potion_Teinture_d_Erozonne_bA0JDA7awoWhu0vO.yml index 368eccd6..baea12de 100644 --- a/packs_src/equipement/potion_Teinture_d_Erozonne_bA0JDA7awoWhu0vO.yml +++ b/packs_src/equipement/potion_Teinture_d_Erozonne_bA0JDA7awoWhu0vO.yml @@ -30,7 +30,7 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Remede + categorie: Alchimie herbe: '' herbebrins: 0 herbebonus: 0 From 14391daa0be7d264bd2f21d5d33e7bff7104d600 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 17 Jan 2025 01:08:27 +0100 Subject: [PATCH 07/16] Simplification monnaies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note: bug étrange causé par la 12.0.34, mais le code était bon --- module/actor/base-actor-sheet.js | 3 ++- module/item-monnaie.js | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index a5edbd09..0106ff96 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -27,7 +27,7 @@ export class RdDBaseActorSheet extends ActorSheet { /* -------------------------------------------- */ async getData() { - Monnaie.validerMonnaies(this.actor.itemTypes['monnaie']); + Monnaie.validerMonnaies(this.actor) this.actor.computeEtatGeneral(); let formData = { @@ -55,6 +55,7 @@ export class RdDBaseActorSheet extends ActorSheet { formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs); formData.competences.filter(it => it.type == ITEM_TYPES.competencecreature) .forEach(it => it.isdommages = RdDItemCompetenceCreature.isDommages(it)) + return formData; } diff --git a/module/item-monnaie.js b/module/item-monnaie.js index 366983ca..4d324444 100644 --- a/module/item-monnaie.js +++ b/module/item-monnaie.js @@ -1,5 +1,5 @@ import { Misc } from "./misc.js"; -import { LOG_HEAD } from "./constants.js"; +import { ITEM_TYPES, LOG_HEAD } from "./constants.js"; const MONNAIE_ETAIN = { name: "Denier (étain)", type: 'monnaie', @@ -70,18 +70,17 @@ export class Monnaie { } static getFortune(monnaies) { - return (monnaies??[]) + return (monnaies ?? []) .map(m => Number(m.system.cout) * Number(m.system.quantite)) .reduce(Misc.sum(), 0); } static async optimiserFortune(actor, fortune) { + Monnaie.validerMonnaies(actor) let resteEnDeniers = Math.round(fortune * 100); - let monnaies = actor.itemTypes['monnaie']; - let updates = []; - Monnaie.validerMonnaies(monnaies, actor); + const updates = [] - let parValeur = Misc.classifyFirst(monnaies, it => VALEUR_DENIERS(it.system.cout)); + const parValeur = Misc.classifyFirst(actor.itemTypes[ITEM_TYPES.monnaie], it => VALEUR_DENIERS(it.system.cout)); for (let valeurDeniers of [1000, 100, 10, 1]) { const itemPiece = parValeur[valeurDeniers]; if (itemPiece) { @@ -102,8 +101,11 @@ export class Monnaie { } } - static validerMonnaies(monnaies, actor = undefined) { - monnaies.filter(it => VALEUR_DENIERS(it.system.cout) == 0) + static validerMonnaies(actor) { + if (!actor) { + return + } + actor.itemTypes[ITEM_TYPES.monnaie]?.filter(it => VALEUR_DENIERS(it.system.cout) == 0) .map(it => `La monnaie ${it.name} de l'acteur ${actor?.name ?? 'sélectionné'} a une valeur de 0!`) .forEach(message => { ui.notifications.warn(message); From 8ebd6ec77164ae1096735d834f98c97a63423dfc Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 15 Jan 2025 21:52:38 +0100 Subject: [PATCH 08/16] Normalisation des listes d'items Utiliser le type d'Item + 's' --- module/actor.js | 4 +- module/actor/base-actor-sheet.js | 47 +++---------------- module/rdd-tmr-dialog.js | 9 ++-- module/rdd-utility.js | 12 ++--- templates/actor-sheet.html | 2 +- templates/actor/alchimie.html | 4 +- ...item.html => commerce-inventaire-item.hbs} | 0 templates/actor/haut-revant.hbs | 2 +- .../{hr-casestmr.html => hr-casetmrs.hbs} | 4 +- templates/actor/hr-signes-draconiques.html | 4 +- templates/actor/hr-sorts-reserve.html | 4 +- ...ventaire-item.html => inventaire-item.hbs} | 5 +- templates/actor/{jeux.html => jeus.hbs} | 4 +- templates/actor/oeuvres.html | 2 +- 14 files changed, 34 insertions(+), 69 deletions(-) rename templates/actor/{commerce-inventaire-item.html => commerce-inventaire-item.hbs} (100%) rename templates/actor/{hr-casestmr.html => hr-casetmrs.hbs} (90%) rename templates/actor/{inventaire-item.html => inventaire-item.hbs} (92%) rename templates/actor/{jeux.html => jeus.hbs} (90%) diff --git a/module/actor.js b/module/actor.js index c9bc7fae..369bc762 100644 --- a/module/actor.js +++ b/module/actor.js @@ -240,7 +240,7 @@ export class RdDActor extends RdDBaseActorSang { } async _recuperationSante(message) { - const maladiesPoisons = this.getMaladiePoisons(); + const maladiesPoisons = this.getMaladiesPoisons(); const isMaladeEmpoisonne = maladiesPoisons.length > 0; this._messageRecuperationMaladiePoisons(maladiesPoisons, message); @@ -248,7 +248,7 @@ export class RdDActor extends RdDBaseActorSang { await this._recupererVie(message, isMaladeEmpoisonne); } - getMaladiePoisons() { + getMaladiesPoisons() { return this.items.filter(item => item.type == 'maladie' || (item.type == 'poison' && item.system.active)); } diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index 0106ff96..89f2fa1f 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -81,48 +81,13 @@ export class RdDBaseActorSheet extends ActorSheet { /* -------------------------------------------- */ static filterItemsPerTypeForSheet(formData, itemTypes) { - formData.blessures = Misc.arrayOrEmpty(itemTypes['blessure']); - formData.recettescuisine = Misc.arrayOrEmpty(itemTypes['recettecuisine']); - formData.recettesAlchimiques = Misc.arrayOrEmpty(itemTypes['recettealchimique']); - formData.maladies = Misc.arrayOrEmpty(itemTypes['maladie']); - formData.poisons = Misc.arrayOrEmpty(itemTypes['poison']); - formData.possessions = Misc.arrayOrEmpty(itemTypes['possession']); - formData.maladiesPoisons = formData.maladies.concat(formData.poisons); - formData.competences = (itemTypes['competence'] ?? []).concat(itemTypes['competencecreature'] ?? []); - formData.sortsReserve = Misc.arrayOrEmpty(itemTypes['sortreserve']); + Object.values(ITEM_TYPES).forEach(t => { + formData[t + 's'] = Misc.arrayOrEmpty(itemTypes[t]) + }) - formData.sorts = Misc.arrayOrEmpty(itemTypes['sort']); - formData.rencontres = Misc.arrayOrEmpty(itemTypes['rencontre']); - formData.casestmr = Misc.arrayOrEmpty(itemTypes['casetmr']); - formData.signesdraconiques = Misc.arrayOrEmpty(itemTypes['signedraconique']); - formData.queues = Misc.arrayOrEmpty(itemTypes['queue']); - formData.souffles = Misc.arrayOrEmpty(itemTypes['souffle']); - formData.ombres = Misc.arrayOrEmpty(itemTypes['ombre']); - formData.tetes = Misc.arrayOrEmpty(itemTypes['tete']); - formData.taches = Misc.arrayOrEmpty(itemTypes['tache']); - formData.meditations = Misc.arrayOrEmpty(itemTypes['meditation']); - formData.chants = Misc.arrayOrEmpty(itemTypes['chant']); - formData.danses = Misc.arrayOrEmpty(itemTypes['danse']); - formData.musiques = Misc.arrayOrEmpty(itemTypes['musique']); - 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']); - formData.munitions = Misc.arrayOrEmpty(itemTypes['munition']); - formData.livres = Misc.arrayOrEmpty(itemTypes['livre']); - formData.potions = Misc.arrayOrEmpty(itemTypes['potion']); - formData.plantes = Misc.arrayOrEmpty(itemTypes['plante']); - formData.ingredients = Misc.arrayOrEmpty(itemTypes['ingredient']); - formData.faunes = Misc.arrayOrEmpty(itemTypes['faune']); - formData.herbes = Misc.arrayOrEmpty(itemTypes['herbe']); - formData.nourritureboissons = Misc.arrayOrEmpty(itemTypes['nourritureboisson']); - formData.gemmes = Misc.arrayOrEmpty(itemTypes['gemme']); - formData.monnaies = Misc.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere()); - formData.objets = Misc.arrayOrEmpty(itemTypes['objet']) + formData.maladiesPoisons = formData.maladies.concat(formData.poisons) + formData.competences = formData.competences.concat(formData.competencecreatures) + formData.monnaies = formData.monnaies.sort(Monnaie.triValeurEntiere()) formData.inventaires = RdDItem.getItemTypesInventaire('all') .map(t => Misc.arrayOrEmpty(itemTypes[t])) diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index a805954f..e738c971 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -212,7 +212,7 @@ export class RdDTMRDialog extends Dialog { } getSortsReserve(coord) { - return this.actor.itemTypes[ITEM_TYPES.sortreserve].filter(// Reserve sur une case fleuve ou normale + return this.sortsReserve.filter(// Reserve sur une case fleuve ou normale TMRUtility.getTMR(coord).type == 'fleuve' ? it => TMRUtility.getTMR(it.system.coord).type == 'fleuve' : it => it.system.coord == coord @@ -271,8 +271,7 @@ export class RdDTMRDialog extends Dialog { } _getTokensSortsReserve() { - const sortsReserve = this.actor.itemTypes[ITEM_TYPES.sortreserve]; - return Misc.concat(sortsReserve.map(sortReserve => + return Misc.concat(this.sortsReserve.map(sortReserve => EffetsDraconiques.sortReserve.tokens(this.pixiTMR, sortReserve, () => sortReserve.system.coord))) } @@ -908,8 +907,8 @@ export class RdDTMRDialog extends Dialog { /* -------------------------------------------- */ lancerSortEnReserve(coord, sortId) { - let sorts = this.getSortsReserve(coord); - let sort = sorts.find(it => it.id == sortId); + const sort = this.getSortsReserve(coord) + .find(it => it.id == sortId); if (sort) { this.processSortReserve(sort); } else { diff --git a/module/rdd-utility.js b/module/rdd-utility.js index b4da7b51..4504ebfe 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -145,7 +145,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/jeux.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/jeus.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html', @@ -160,17 +160,17 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts-reserve.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-meditations.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-casestmr.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-casetmrs.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/xp-journal.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.hbs', "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.html", 'systems/foundryvtt-reve-de-dragon/templates/actor/liens-animaux.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/liens-suivants.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/liens-vehicules.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.hbs', //Items 'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete-script.hbs', 'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete.hbs', @@ -436,8 +436,8 @@ export class RdDUtility { }; if (!optionsArbre.templateItem) { optionsArbre.templateItem = item.parent?.type == 'commerce' - ? "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.html" - : "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.html"; + ? "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.hbs" + : "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.hbs"; } item.niveau = optionsArbre.profondeur; } diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index fdc3c8c0..d6f4d61b 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -122,7 +122,7 @@ {{> "systems/foundryvtt-reve-de-dragon/templates/actor/taches.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.html"}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/jeux.html"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/jeus.hbs"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html"}} {{/if}} diff --git a/templates/actor/alchimie.html b/templates/actor/alchimie.html index f10c0da8..2b0f5826 100644 --- a/templates/actor/alchimie.html +++ b/templates/actor/alchimie.html @@ -1,7 +1,7 @@ -{{#if recettesAlchimiques.length}} +{{#if recettealchimiques.length}}

Recettes Alchimiques

    - {{#each (trier recettesAlchimiques) as |recette id|}} + {{#each (trier recettealchimiques) as |recette id|}}
  • {{recette.name}}
    diff --git a/templates/actor/commerce-inventaire-item.html b/templates/actor/commerce-inventaire-item.hbs similarity index 100% rename from templates/actor/commerce-inventaire-item.html rename to templates/actor/commerce-inventaire-item.hbs diff --git a/templates/actor/haut-revant.hbs b/templates/actor/haut-revant.hbs index 74d59386..0932a2f3 100644 --- a/templates/actor/haut-revant.hbs +++ b/templates/actor/haut-revant.hbs @@ -33,4 +33,4 @@ {{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts-reserve.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-meditations.html"}} -{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-casestmr.html"}} +{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-casetmrs.hbs"}} diff --git a/templates/actor/hr-casestmr.html b/templates/actor/hr-casetmrs.hbs similarity index 90% rename from templates/actor/hr-casestmr.html rename to templates/actor/hr-casetmrs.hbs index 81d60f10..9a292f1d 100644 --- a/templates/actor/hr-casestmr.html +++ b/templates/actor/hr-casetmrs.hbs @@ -1,7 +1,7 @@ -{{#if casestmr.length}} +{{#if casetmrs.length}}

    Effets sur les cases des TMR

      - {{#each casestmr as |casetmr key|}} + {{#each casetmrs as |casetmr key|}}
    • {{casetmr.name}} diff --git a/templates/actor/hr-signes-draconiques.html b/templates/actor/hr-signes-draconiques.html index 15e6d12f..16afeb28 100644 --- a/templates/actor/hr-signes-draconiques.html +++ b/templates/actor/hr-signes-draconiques.html @@ -1,7 +1,7 @@ -{{#if (and options.isGM signesdraconiques.length)}} +{{#if (and options.isGM signedraconiques.length)}}

      Signes draconiques

        - {{#each signesdraconiques as |signe key|}} + {{#each signedraconiques as |signe key|}}
      • {{signe.name}} diff --git a/templates/actor/hr-sorts-reserve.html b/templates/actor/hr-sorts-reserve.html index ed9bd240..1e338dea 100644 --- a/templates/actor/hr-sorts-reserve.html +++ b/templates/actor/hr-sorts-reserve.html @@ -1,10 +1,10 @@ -{{#if sortsReserve.length}} +{{#if sortreserves.length}}

        Sorts en Réserve{{#if options.isGM}} {{/if}}

          - {{#each (trier sortsReserve) as |sort key|}} + {{#each (trier sortreserves) as |sort key|}}
        • diff --git a/templates/actor/inventaire-item.html b/templates/actor/inventaire-item.hbs similarity index 92% rename from templates/actor/inventaire-item.html rename to templates/actor/inventaire-item.hbs index 5dd8887e..f604d783 100644 --- a/templates/actor/inventaire-item.html +++ b/templates/actor/inventaire-item.hbs @@ -30,7 +30,8 @@ {{/if}} {{numberFormat item.system.encTotal decimals=2}} - + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=item options=options}} + {{!-- {{#if options.isOwner}} {{#unless item.estContenu}} {{#if item.equipable}} @@ -50,7 +51,7 @@ {{item.system.actionPrincipale}} {{/if}} {{/if}} - + --}}
        • {{/if}} {{/unless}} diff --git a/templates/actor/jeux.html b/templates/actor/jeus.hbs similarity index 90% rename from templates/actor/jeux.html rename to templates/actor/jeus.hbs index 69425dd0..2d790788 100644 --- a/templates/actor/jeux.html +++ b/templates/actor/jeus.hbs @@ -1,7 +1,7 @@ -{{#if jeux.length}} +{{#if jeus.length}}

          Jeux :

            - {{#each jeux as |jeu id|}} + {{#each jeus as |jeu id|}}
          • {{jeu.name}} (base {{jeu.system.base}})
            diff --git a/templates/actor/oeuvres.html b/templates/actor/oeuvres.html index e244b7e3..e413334f 100644 --- a/templates/actor/oeuvres.html +++ b/templates/actor/oeuvres.html @@ -12,7 +12,7 @@ {{#each (trier oeuvres) as |oeuvre id|}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=oeuvre typeOeuvre=oeuvre.system.competence classOeuvre="oeuvre-label"}} {{/each}} - {{#each (trier recettescuisine) as |recette id|}} + {{#each (trier recettecuisines) as |recette id|}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=recette typeOeuvre="Recette de cuisine" classOeuvre="recettecuisine-label"}} {{/each}}
          From 4281f76dfb1bb33d51d2e33b22403f6f35a49831 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 15 Jan 2025 19:12:39 +0100 Subject: [PATCH 09/16] Simplification des actionPrincipales MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Préparation pour supporter une liste d'actions sur les items --- module/actor.js | 159 ++++++++++++++++++------------------ module/item-sheet.js | 34 +++++--- module/rdd-sheet-utility.js | 9 +- 3 files changed, 113 insertions(+), 89 deletions(-) diff --git a/module/actor.js b/module/actor.js index 369bc762..faa060a5 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1200,22 +1200,27 @@ export class RdDActor extends RdDBaseActorSang { async actionPrincipale(item, onActionItem = async () => { }) { let result = await super.actionPrincipale(item, onActionItem) - if (result) { return result } - - result = await this.actionNourritureboisson(item, onActionItem) - if (result) { return result } - - switch (item.type) { - case ITEM_TYPES.potion: return await this.consommerPotion(item, onActionItem); - case ITEM_TYPES.livre: return await this.actionLire(item); - case ITEM_TYPES.conteneur: return await item.sheet.render(true); - case ITEM_TYPES.herbe: return await this.actionHerbe(item, onActionItem); - case ITEM_TYPES.queue: case ITEM_TYPES.ombre: return await this.actionRefoulement(item); + if (!result){ + result = await this.actionNourritureboisson(item) } - return undefined + if (!result){ + result = await this.itemActionPrincipale(item) + } + await onActionItem() + return result } - async actionNourritureboisson(item, onActionItem) { + async itemActionPrincipale(item) { + switch (item.type) { + case ITEM_TYPES.potion: return await this.consommerPotion(item); + case ITEM_TYPES.livre: return await this.actionLire(item); + case ITEM_TYPES.conteneur: return await item.sheet.render(true); + case ITEM_TYPES.herbe: return await this.actionHerbe(item); + case ITEM_TYPES.queue: case ITEM_TYPES.ombre: return await this.actionRefoulement(item); + } + } + + async actionNourritureboisson(item) { switch (item.getUtilisationCuisine()) { case 'brut': { const utilisation = new Dialog({ @@ -1223,19 +1228,19 @@ export class RdDActor extends RdDBaseActorSang { content: `Que faire de votre ${item.name}`, buttons: { 'cuisiner': { icon: '', label: 'Cuisiner', callback: async () => await this.preparerNourriture(item) }, - 'manger': { icon: '', label: 'Manger cru', callback: async () => await this.mangerNourriture(item, onActionItem) } + 'manger': { icon: '', label: 'Manger cru', callback: async () => await this.mangerNourriture(item) } } }); return utilisation.render(true); } case 'pret': - return await this.mangerNourriture(item, onActionItem); + return await this.mangerNourriture(item); } return undefined; } - async mangerNourriture(item, onActionItem) { - return (await DialogConsommer.create(this, item, onActionItem)).render(true); + async mangerNourriture(item) { + return (await DialogConsommer.create(this, item)).render(true); } async actionLire(item) { @@ -2829,6 +2834,59 @@ export class RdDActor extends RdDBaseActorSang { return guerisonData; } + + /* -------------------------------------------- */ + async fabriquerPotion(herbeData) { + let newPotion = { + name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion', + img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp", + system: { + quantite: 1, cout: 0, encombrement: 0.1, + categorie: herbeData.system.categorie, + herbe: herbeData.name, + rarete: herbeData.system.rarete, + herbebrins: herbeData.nbBrins, + herbebonus: herbeData.herbebonus, + description: "" + } + } + await this.createEmbeddedDocuments('Item', [newPotion]); + + let newQuantite = herbeData.system.quantite - herbeData.nbBrins; + let messageData = { + alias: this.getAlias(), + nbBrinsReste: newQuantite, + potion: newPotion, + herbe: herbeData + } + this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins); + + ChatMessage.create({ + whisper: ChatUtility.getOwners(this), + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, messageData) + }); + } + + /* -------------------------------------------- */ + async diminuerQuantiteObjet(id, nb, options = { supprimerSiZero: false }) { + const item = this.getItem(id); + if (item) { + await item.diminuerQuantite(nb, options); + } + } + + /* -------------------------------------------- */ + async consommerPotion(potion) { + if (potion.system.categorie.includes('Soin')) { + await this.consommerPotionSoin(potion); + } else if (potion.system.categorie.includes('Repos')) { + await this.consommerPotionRepos(potion); + } else { + await this.consommerPotionGenerique(potion); + } + await this.diminuerQuantiteObjet(potion.id, 1, { supprimerSiZero: potion.supprimer }); + } + /* -------------------------------------------- */ async consommerPotionSoin(potionData) { potionData.alias = this.name; @@ -2890,77 +2948,22 @@ export class RdDActor extends RdDBaseActorSang { } /* -------------------------------------------- */ - async fabriquerPotion(herbeData) { - let newPotion = { - name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion', - img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp", - system: { - quantite: 1, cout: 0, encombrement: 0.1, - categorie: herbeData.system.categorie, - herbe: herbeData.name, - rarete: herbeData.system.rarete, - herbebrins: herbeData.nbBrins, - herbebonus: herbeData.herbebonus, - description: "" - } - } - await this.createEmbeddedDocuments('Item', [newPotion], { renderSheet: true }); + async consommerPotionGenerique(potion) { + potion.alias = this.name; - let newQuantite = herbeData.system.quantite - herbeData.nbBrins; - let messageData = { - alias: this.getAlias(), - nbBrinsReste: newQuantite, - potion: newPotion, - herbe: herbeData - } - this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins); - - ChatMessage.create({ - whisper: ChatUtility.getOwners(this), - content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, messageData) - }); - } - - /* -------------------------------------------- */ - async diminuerQuantiteObjet(id, nb, options = { supprimerSiZero: false }) { - const item = this.getItem(id); - if (item) { - await item.diminuerQuantite(nb, options); - } - } - - /* -------------------------------------------- */ - async consommerPotionGenerique(potionData) { - potionData.alias = this.name; - - if (potionData.system.magique) { + if (potion.system.magique) { // Gestion de la résistance: - potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8); - if (potionData.rolled.isEchec) { + potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8); + if (potion.rolled.isEchec) { await this.reveActuelIncDec(-1); } } ChatMessage.create({ whisper: ChatUtility.getOwners(this), - content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.html`, potionData) + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.html`, potion) }); } - /* -------------------------------------------- */ - async consommerPotion(potion, onActionItem = async () => { }) { - const potionData = potion - - if (potionData.system.categorie.includes('Soin')) { - this.consommerPotionSoin(potionData); - } else if (potionData.system.categorie.includes('Repos')) { - this.consommerPotionRepos(potionData); - } else { - this.consommerPotionGenerique(potionData); - } - await this.diminuerQuantiteObjet(potion.id, 1, { supprimerSiZero: potionData.supprimer }); - await onActionItem() - } - /* -------------------------------------------- */ async onUpdateActor(update, options, actorId) { const updatedEndurance = update?.system?.sante?.endurance diff --git a/module/item-sheet.js b/module/item-sheet.js index 386d7b34..e88af8f0 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -192,7 +192,6 @@ export class RdDItemSheet extends ItemSheet { }) this.html.find('.creer-tache-livre').click((event) => this._getEventActor(event).creerTacheDepuisLivre(this.item)); - this.html.find('.consommer-potion').click((event) => this._getEventActor(event).consommerPotion(this.item, this.getActionRenderItem())); this.html.find('.creer-potion-base').click((event) => this._getEventActor(event).actionHerbe(this.item)); this.html.find('input[name="system.cacher_points_de_tache"]').change(async event => await this.item.update({ 'system.cacher_points_de_tache': event.currentTarget.checked })); @@ -200,12 +199,13 @@ export class RdDItemSheet extends ItemSheet { this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event)) if (this.actor) { - this.html.find('.item-split').click(async event => RdDSheetUtility.splitItem(RdDSheetUtility.getItem(event, this.actor), this.actor, this.getActionRenderItem())); + this.html.find('.consommer-potion').click(event => this.itemActionConsommer(event)) + this.html.find('.item-action').click(event => this.itemAction(event)) + this.html.find('.item-split').click( event => this.itemActionSplit(event)) this.html.find('.item-edit').click(async event => RdDSheetUtility.getItem(event, this.actor)?.sheet.render(true)); this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, RdDSheetUtility.getItem(event, this.actor))); this.html.find('.item-vendre').click(async event => RdDSheetUtility.getItem(event, this.actor)?.proposerVente()); this.html.find('.item-montrer').click(async event => RdDSheetUtility.getItem(event, this.actor)?.postItemToChat()); - this.html.find('.item-action').click(async event => RdDSheetUtility.getItem(event, this.actor)?.actionPrincipale(this.actor, this.getActionRenderItem())); this.html.find('.item-quantite-plus').click(async event => { await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), 1) @@ -223,13 +223,27 @@ export class RdDItemSheet extends ItemSheet { RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.fin', updateItemTimestamp); } - getActionRenderItem() { - return async () => { - let item = this.item; - while (item) { - await item.sheet?.render() - item = this.actor.getContenant(item) - } + async itemActionConsommer(event) { + const item = RdDSheetUtility.getItem(event, this.actor) + if (item) { + await actor.consommerPotion(item) + await RdDSheetUtility.renderItemBranch(this.actor, item) + } + } + + async itemActionSplit(event) { + const item = RdDSheetUtility.getItem(event, this.actor) + if (item) { + await RdDSheetUtility.splitItem(item, this.actor) + await RdDSheetUtility.renderItemBranch(this.actor, item) + } + } + + async itemAction(event) { + const item = RdDSheetUtility.getItem(event, this.actor); + if (item) { + await item.actionPrincipale(this.actor) + await RdDSheetUtility.renderItemBranch(this.actor, item) } } diff --git a/module/rdd-sheet-utility.js b/module/rdd-sheet-utility.js index ee8a21da..8dbbf217 100644 --- a/module/rdd-sheet-utility.js +++ b/module/rdd-sheet-utility.js @@ -70,7 +70,7 @@ export class RdDSheetUtility { await RdDSheetUtility._onSplitItem(item, split, actor); onSplit(); }); - dialog.render(true); + dialog.render(true) } static async _onSplitItem(item, split, actor) { @@ -82,4 +82,11 @@ export class RdDSheetUtility { await actor.createEmbeddedDocuments('Item', [splitItem]) } } + + static async renderItemBranch(actor, item) { + while (item) { + await item.sheet?.render() + item = actor.getContenant(item) + } + } } \ No newline at end of file From 425c6af6725c3ef321099f50cbae59755d06d87d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 15 Jan 2025 22:26:18 +0100 Subject: [PATCH 10/16] Correction ouverture feuille de conteneur --- module/actor/base-actor-sheet.js | 25 ++++++------------- module/item.js | 2 +- module/item/sheet-conteneur.js | 5 ++-- module/rdd-utility.js | 41 +++++++++++++++++++++++++------- 4 files changed, 44 insertions(+), 29 deletions(-) diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index 89f2fa1f..6e99e08c 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -43,7 +43,7 @@ export class RdDBaseActorSheet extends ActorSheet { effects: this.actor.effects } - RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes); + RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes); formData.calc = { fortune: Monnaie.toSolsDeniers(this.actor.getFortune()), prixTotalEquipement: this.actor.computePrixTotalEquipement(), @@ -79,22 +79,6 @@ export class RdDBaseActorSheet extends ActorSheet { } } - /* -------------------------------------------- */ - static filterItemsPerTypeForSheet(formData, itemTypes) { - Object.values(ITEM_TYPES).forEach(t => { - formData[t + 's'] = Misc.arrayOrEmpty(itemTypes[t]) - }) - - formData.maladiesPoisons = formData.maladies.concat(formData.poisons) - formData.competences = formData.competences.concat(formData.competencecreatures) - formData.monnaies = formData.monnaies.sort(Monnaie.triValeurEntiere()) - - formData.inventaires = RdDItem.getItemTypesInventaire('all') - .map(t => Misc.arrayOrEmpty(itemTypes[t])) - .reduce((a, b) => a.concat(b), []) - .sort(Misc.ascending(it => it.name)); - } - /* -------------------------------------------- */ /** @override */ activateListeners(html) { super.activateListeners(html); @@ -105,7 +89,7 @@ export class RdDBaseActorSheet extends ActorSheet { this.render(true); }); this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat()); - this.html.find('.item-edit').click(async event => this.getItem(event)?.sheet.render(true)) + this.html.find('.item-edit').click(async event => this.itemActionEdit(event)) this.html.find('.item-montrer').click(async event => this.getItem(event)?.postItemToChat()); this.html.find('.recherche') @@ -147,6 +131,11 @@ export class RdDBaseActorSheet extends ActorSheet { }); } + itemActionEdit(event) { + const item = this.getItem(event); + return item?.sheet.render(true); + } + _rechercherKeyup(event) { const currentTarget = event.currentTarget; const nouvelleRecherche = this._optionRecherche(currentTarget); diff --git a/module/item.js b/module/item.js index f94cff23..6b545694 100644 --- a/module/item.js +++ b/module/item.js @@ -1,4 +1,4 @@ -import { ACTOR_TYPES, ITEM_TYPES } from "./constants.js"; +import { ITEM_TYPES } from "./constants.js"; import { DialogItemVente } from "./achat-vente/dialog-item-vente.js"; import { Grammar } from "./grammar.js"; import { Misc } from "./misc.js"; diff --git a/module/item/sheet-conteneur.js b/module/item/sheet-conteneur.js index effa355c..46966473 100644 --- a/module/item/sheet-conteneur.js +++ b/module/item/sheet-conteneur.js @@ -29,9 +29,10 @@ export class RdDConteneurItemSheet extends RdDItemInventaireSheet { /* -------------------------------------------- */ prepareConteneurData(formData) { - RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes); + RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes); this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires); - formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems; + const subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems; + formData.subItems = subItems } async _onDragStart(event) { diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 4504ebfe..c7aeeb6d 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -19,10 +19,11 @@ import { RdDEmpoignade } from "./rdd-empoignade.js"; import { ExperienceLog } from "./actor/experience-log.js"; import { RdDCoeur } from "./coeur/rdd-coeur.js"; import { APP_ASTROLOGIE_REFRESH } from "./sommeil/app-astrologie.js"; -import { RDD_CONFIG } from "./constants.js"; +import { ITEM_TYPES, RDD_CONFIG } from "./constants.js"; import { RdDBaseActor } from "./actor/base-actor.js"; import { RdDCarac } from "./rdd-carac.js"; import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js"; +import { Monnaie } from "./item-monnaie.js"; /* -------------------------------------------- */ // This table starts at 0 -> niveau -10 @@ -264,7 +265,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html' ]; - + // foundry et options Handlebars.registerHelper('RDD_CONFIG', path => RDD_CONFIG[path]) Handlebars.registerHelper('linkCompendium', (pack, id, name) => RdDUtility.linkCompendium(pack, id, name)); @@ -279,7 +280,7 @@ export class RdDUtility { const html = options.fn(this); return html.replace(rgx, "$& selected"); }) - + // logic Handlebars.registerHelper('either', (a, b) => a ?? b); // string manipulation @@ -295,9 +296,9 @@ export class RdDUtility { // math Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1))); - Handlebars.registerHelper('repeat', function(n, block) { + Handlebars.registerHelper('repeat', function (n, block) { let accum = ''; - for(let i = 0; i < n; ++i){ + for (let i = 0; i < n; ++i) { accum += block.fn(i) } return accum @@ -465,13 +466,37 @@ export class RdDUtility { return ligneObjet; } + static filterItemsPerTypeForSheet(formData, itemTypes) { + Object.values(ITEM_TYPES).forEach(t => { + formData[t + 's'] = Misc.arrayOrEmpty(itemTypes[t]) + }) + + formData.maladiesPoisons = formData.maladies.concat(formData.poisons) + formData.competences = formData.competences.concat(formData.competencecreatures) + formData.monnaies = formData.monnaies.sort(Monnaie.triValeurEntiere()) + + formData.inventaires = RdDUtility.prepareInventaire(itemTypes) + } + static buildInventaireConteneur(actorId, itemId, options) { const actor = game.actors.get(actorId) const item = actor?.items.get(itemId) - if (item) { - return RdDUtility.buildContenuConteneur(item, options, { ouvert: true, profondeur: 1 }); + if (item?.type == ITEM_TYPES.conteneur) { + const formData = {} + RdDUtility.filterItemsPerTypeForSheet(formData, actor.itemTypes); + RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires); + item.subItems = formData.conteneurs.find(it => it._id == itemId)?.subItems; + + return RdDUtility.buildContenuConteneur(item, options, { ouvert: true, profondeur: 1 }) } - return ''; + return '' + } + + static prepareInventaire(itemTypes) { + return RdDItem.getItemTypesInventaire('all') + .map(t => Misc.arrayOrEmpty(itemTypes[t])) + .reduce((a, b) => a.concat(b), []) + .sort(Misc.ascending(it => it.name)) } /* -------------------------------------------- */ From 48acdaaca6073c86f68d2f6a818978883f3b6b41 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 18 Jan 2025 22:50:21 +0100 Subject: [PATCH 11/16] Fix bouton tchat jet encaissement --- module/rdd-combat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index dc4a6035..f0301131 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -542,7 +542,7 @@ export class RdDCombat { case '.particuliere-attaque': return await this.choixParticuliere(attackerRoll, event.currentTarget.attributes['data-mode'].value); case '.parer-button': return this.parade(attackerRoll, armeParadeId); case '.esquiver-button': return this.esquive(attackerRoll, compId, competence); - case '0encaisser-button': return this.encaisser(attackerRoll, defenderRoll); + case '.encaisser-button': return this.encaisser(attackerRoll, defenderRoll); case '.echec-total-attaque': return this._onEchecTotal(attackerRoll); case '.appel-chance-attaque': return this.attacker.rollAppelChance( From ce7f5381cae2ab011072ff244bc20853f2360c41 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 18 Jan 2025 22:54:10 +0100 Subject: [PATCH 12/16] Fix update endurance/vie MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dans certains cas, les valeurs de vie/endurance n'étaient pas mises à jour --- module/actor.js | 25 ++++++------ module/item/armure.js | 12 +++--- module/item/blessure.js | 55 ++++++++++++++------------- templates/actor/header-compteurs.html | 32 +++++++++------- 4 files changed, 65 insertions(+), 59 deletions(-) diff --git a/module/actor.js b/module/actor.js index faa060a5..a21e2410 100644 --- a/module/actor.js +++ b/module/actor.js @@ -408,19 +408,18 @@ export class RdDActor extends RdDBaseActorSang { /* -------------------------------------------- */ async remiseANeuf() { - ChatMessage.create({ - whisper: ChatUtility.getOwners(this), - content: 'Remise à neuf de ' + this.name - }); - await this.supprimerBlessures(it => true); - await this.removeEffects(e => e.id != STATUSES.StatusDemiReve); - const updates = { + await this.update({ 'system.sante.endurance.value': this.system.sante.endurance.max, 'system.sante.vie.value': this.system.sante.vie.max, 'system.sante.fatigue.value': 0, 'system.compteurs.ethylisme': { value: 1, nb_doses: 0, jet_moral: false } - }; - await this.update(updates); + }) + await this.removeEffects(e => e.id != STATUSES.StatusDemiReve); + await this.supprimerBlessures(it => true); + await ChatMessage.create({ + whisper: ChatUtility.getOwners(this), + content: 'Remise à neuf de ' + this.name + }); } /* -------------------------------------------- */ @@ -524,7 +523,7 @@ export class RdDActor extends RdDBaseActorSang { jet_moral: false, value: value } - }); + }) } /* -------------------------------------------- */ @@ -1891,8 +1890,8 @@ export class RdDActor extends RdDBaseActorSang { } rollData.tache.system.tentatives = rollData.tache.system.nb_jet_succes + rollData.tache.system.nb_jet_echec; - this.updateEmbeddedDocuments('Item', [rollData.tache]); - this.santeIncDec("fatigue", rollData.tache.system.fatigue); + await this.updateEmbeddedDocuments('Item', [rollData.tache]); + await this.santeIncDec("fatigue", rollData.tache.system.fatigue); await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-tache.html'); if (options?.onRollAutomate) { @@ -2590,7 +2589,7 @@ export class RdDActor extends RdDBaseActorSang { for (const armure of armures) { protection += await RdDDice.rollTotal(armure.system.protection.toString()); if (dmg > 0 && attackerRoll.dmg.encaisserSpecial != "noarmure") { - armure.deteriorerArmure(dmg); + await armure.deteriorerArmure(dmg) dmg = 0; } } diff --git a/module/item/armure.js b/module/item/armure.js index 14096a8b..03f011ec 100644 --- a/module/item/armure.js +++ b/module/item/armure.js @@ -11,7 +11,7 @@ export class RdDItemArmure extends RdDItem { return "systems/foundryvtt-reve-de-dragon/icons/armes_armures/armure_plaques.webp"; } - deteriorerArmure(dmg) { + async deteriorerArmure(dmg) { if (!ReglesOptionnelles.isUsing('deteriorationArmure') || this.system.protection == '0') { return; } @@ -23,12 +23,10 @@ export class RdDItemArmure extends RdDItem { protection = this.calculProtectionDeterioree(); ChatMessage.create({ content: `Votre armure ${this.name} s'est détériorée, elle protège maintenant de ${protection}` }); } - this.update({ - system: { - deterioration: deterioration, - protection: protection - } - }); + await this.update({ + 'system.deterioration': deterioration, + 'system.protection': protection + }) } calculProtectionDeterioree() { diff --git a/module/item/blessure.js b/module/item/blessure.js index d58eb4f0..d028a745 100644 --- a/module/item/blessure.js +++ b/module/item/blessure.js @@ -30,7 +30,7 @@ export class RdDItemBlessure extends RdDItem { prepareDerivedData() { super.prepareDerivedData(); - this.system.label = this.getLabelGravite() + this.system.label = RdDItemBlessure.getLabelGravite(this.system.gravite) } static prepareTacheSoin(gravite) { @@ -43,29 +43,32 @@ export class RdDItemBlessure extends RdDItem { } static async applyFullBlessure(actor, gravite) { - const definition = RdDItemBlessure.getDefinition(gravite) - - let lostEndurance = 0 - let lostVie = 0 - if (definition.endurance) { - lostEndurance = new Roll(definition.endurance) - await lostEndurance.roll(); - actor.santeIncDec("endurance", -Number(lostEndurance.total)); - } + const definition = foundry.utils.duplicate(RdDItemBlessure.getDefinition(gravite)) + if (definition.vie) { - lostVie = definition.vie - actor.santeIncDec("vie", definition.vie) + await actor.santeIncDec("vie", definition.vie) + } + const lostEndurance = await RdDItemBlessure.rollLostEndurance(definition.endurance) + if (lostEndurance) { + await actor.santeIncDec("endurance", -Number(lostEndurance)); } - await this.createBlessure(actor, gravite) ChatMessage.create({ - content: `Blessure ${definition.label} appliquée à ${actor.name}`+ - `
          Perte d'endurance : ${lostEndurance}`+ - `
          Perte de Vie : ${lostVie}`, + //TODO: hbs + content: `Blessure ${definition.label} appliquée à ${actor.name}
          Perte d'endurance : ${lostEndurance} (${definition.endurance})
          Perte de Vie : ${definition.vie}`, whisper: ChatUtility.getOwners(actor) }); + actor.sheet?.render() + } + static async rollLostEndurance(formula) { + if (formula) { + const roll = new Roll(formula) + await roll.evaluate() + return roll.total + } + return 0 } static async createBlessure(actor, gravite, localisation = '', attackerToken) { @@ -125,10 +128,10 @@ export class RdDItemBlessure extends RdDItem { } if (this.system.gravite > 0) { const update = { system: { premierssoins: { bonus: 0 }, soinscomplets: { bonus: 0 } } } - const gravite = this.system.gravite; - const graviteMoindre = gravite - 2; + const gravite = this.system.gravite + const graviteMoindre = gravite - 2 const moindres = blessures.filter(it => it.system.gravite == graviteMoindre, 'blessures').length - const label = this.getLabelGravite(); + const label = RdDItemBlessure.getLabelGravite(this.system.gravite) let rolled = await actor.jetRecuperationConstitution(this.system.soinscomplets.bonus, message); @@ -158,7 +161,7 @@ export class RdDItemBlessure extends RdDItem { } peutRetrograder(graviteMoindre, moindres) { - return moindres < RdDItemBlessure.getDefinition(graviteMoindre).max + return moindres < RdDItemBlessure.maxBlessures(graviteMoindre) } async calculerFinPeriodeTemporel(debut) { @@ -182,16 +185,16 @@ export class RdDItemBlessure extends RdDItem { return `systems/foundryvtt-reve-de-dragon/icons/sante/${soins ? 'blessure-soins' : img}.webp` } - getLabelGravite() { - return RdDItemBlessure.getDefinition(this.system.gravite).label + static getLabelGravite(gravite) { + return definitionsBlessures.find(it => it.gravite >= gravite).label } static getDefinition(gravite) { - return definitionsBlessures.sort(Misc.ascending(it => it.gravite)) - .find(it => it.gravite >= gravite); + return definitionsBlessures.find(it => it.gravite >= gravite) } + static maxBlessures(gravite) { - return RdDItemBlessure.getDefinition(gravite).max + return definitionsBlessures.find(it => it.gravite >= gravite).max } isContusion() { @@ -216,7 +219,7 @@ export class RdDItemBlessure extends RdDItem { `Heure et Date: ${new RdDTimestamp(this.system.temporel.debut).formatDateHeure()}`, RdDItem.propertyIfDefined('Blessé', this.parent?.name, this.parent), `Localisation: ${this.system.localisation}`, - `Gravité: ${RdDItemBlessure.getDefinition(this.system.gravite).label}`, + `Gravité: ${this.system.label}`, `Difficulté des soins: ${this.system.difficulte}`, (this.system.soinscomplets.done ? `Bonus soins complets: ${this.system.soinscomplets.bonus}` : diff --git a/templates/actor/header-compteurs.html b/templates/actor/header-compteurs.html index 89904278..8d86aa34 100644 --- a/templates/actor/header-compteurs.html +++ b/templates/actor/header-compteurs.html @@ -1,41 +1,47 @@
          • -
          • -
          • -
          • -
          From 9fc21e6d97de61c33a316ada09f617e0e70ec12d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 15 Jan 2025 19:13:32 +0100 Subject: [PATCH 13/16] Gestion des actions sur les items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - dans la liste d'équipement, liste d'actions fournie par code - support d'actions multiples - listener générique Utilisation du mécanisme pour tous les items, standardisation de l'apparence des boutons d'items --- module/actor-sheet.js | 22 +-- module/actor.js | 182 +++++++----------- module/actor/base-actor-sheet.js | 36 ++-- module/actor/base-actor.js | 9 +- module/actor/commerce-sheet.js | 1 + module/item-sheet.js | 25 ++- module/item.js | 122 ++++++------ module/item/item-actions.js | 154 +++++++++++++++ module/item/potion.js | 22 ++- module/item/sheet-potion.js | 3 +- module/rdd-empoignade.js | 1 - module/rdd-possession.js | 2 +- module/rdd-roll.js | 6 +- module/rdd-tmr-dialog.js | 2 +- module/rdd-utility.js | 54 +++--- module/time/rdd-timestamp.js | 4 +- styles/simple.css | 64 +++--- templates/actor-creature-sheet.html | 4 +- templates/actor-entite-sheet.html | 4 +- templates/actor-sheet.html | 14 +- templates/actor-vehicule-sheet.html | 2 +- templates/actor/alchimie.hbs | 11 ++ templates/actor/alchimie.html | 15 -- templates/actor/armures.hbs | 2 +- templates/actor/blessure.hbs | 7 +- .../actor/{chirurgie.html => chirurgie.hbs} | 9 +- templates/actor/combat.html | 40 ++-- templates/actor/commerce-actor-sheet.html | 37 +--- templates/actor/commerce-inventaire-item.hbs | 18 +- ...nventaire.html => commerce-inventaire.hbs} | 0 .../{comp-creature.html => comp-creature.hbs} | 9 +- ...mp-possession.html => comp-possession.hbs} | 7 +- templates/actor/competence-categorie.html | 8 +- .../actor/{competence.html => competence.hbs} | 9 +- .../{dragon-queue.html => dragon-queue.hbs} | 8 +- templates/actor/dragon-queues.html | 4 +- ...agon-souffles.html => dragon-souffles.hbs} | 5 +- .../{dragon-tetes.html => dragon-tetes.hbs} | 5 +- templates/actor/haut-revant.hbs | 12 +- templates/actor/hr-casetmrs.hbs | 6 +- ...hr-meditations.html => hr-meditations.hbs} | 7 +- .../{hr-rencontres.html => hr-rencontres.hbs} | 4 +- ...oniques.html => hr-signes-draconiques.hbs} | 4 +- ...orts-reserve.html => hr-sorts-reserve.hbs} | 9 +- .../actor/{hr-sorts.html => hr-sorts.hbs} | 11 +- templates/actor/inventaire-item.hbs | 21 -- ...re-monnaie.html => inventaire-monnaie.hbs} | 9 +- templates/actor/item-action-controls.hbs | 16 ++ templates/actor/jeus.hbs | 9 +- templates/actor/liens-suivants.hbs | 6 +- ...dies-poisons.html => maladies-poisons.hbs} | 19 +- templates/actor/non-haut-revant.hbs | 10 +- templates/actor/oeuvre.hbs | 9 + templates/actor/oeuvre.html | 14 -- templates/actor/{oeuvres.html => oeuvres.hbs} | 10 +- templates/actor/possessions.hbs | 19 ++ templates/actor/possessions.html | 24 --- templates/actor/resonances.hbs | 2 + templates/actor/{taches.html => taches.hbs} | 9 +- templates/item/potion-sheet.hbs | 4 +- 60 files changed, 560 insertions(+), 601 deletions(-) create mode 100644 module/item/item-actions.js create mode 100644 templates/actor/alchimie.hbs delete mode 100644 templates/actor/alchimie.html rename templates/actor/{chirurgie.html => chirurgie.hbs} (71%) rename templates/actor/{commerce-inventaire.html => commerce-inventaire.hbs} (100%) rename templates/actor/{comp-creature.html => comp-creature.hbs} (81%) rename templates/actor/{comp-possession.html => comp-possession.hbs} (57%) rename templates/actor/{competence.html => competence.hbs} (85%) rename templates/actor/{dragon-queue.html => dragon-queue.hbs} (61%) rename templates/actor/{dragon-souffles.html => dragon-souffles.hbs} (62%) rename templates/actor/{dragon-tetes.html => dragon-tetes.hbs} (62%) rename templates/actor/{hr-meditations.html => hr-meditations.hbs} (61%) rename templates/actor/{hr-rencontres.html => hr-rencontres.hbs} (84%) rename templates/actor/{hr-signes-draconiques.html => hr-signes-draconiques.hbs} (79%) rename templates/actor/{hr-sorts-reserve.html => hr-sorts-reserve.hbs} (69%) rename templates/actor/{hr-sorts.html => hr-sorts.hbs} (67%) rename templates/actor/{inventaire-monnaie.html => inventaire-monnaie.hbs} (79%) create mode 100644 templates/actor/item-action-controls.hbs rename templates/actor/{maladies-poisons.html => maladies-poisons.hbs} (50%) create mode 100644 templates/actor/oeuvre.hbs delete mode 100644 templates/actor/oeuvre.html rename templates/actor/{oeuvres.html => oeuvres.hbs} (61%) create mode 100644 templates/actor/possessions.hbs delete mode 100644 templates/actor/possessions.html rename templates/actor/{taches.html => taches.hbs} (60%) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 10273649..dfc00f87 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -185,22 +185,19 @@ export class RdDActorSheet extends RdDBaseActorSangSheet { await blessure?.setSoinsBlessure({ soinscomplets: { bonus: Number(event.currentTarget.value) } }) }); - // Equip Inventory Item - this.html.find('.item-equip').click(async event => this.actor.equiperObjet(RdDSheetUtility.getItemId(event))) this.html.find('.roll-chance-actuelle').click(async event => this.actor.rollCarac('chance-actuelle')) - this.html.find('.button-appel-chance').click(async event => this.actor.rollAppelChance()) this.html.find('[name="jet-astrologie"]').click(async event => this.actor.astrologieNombresAstraux()) - this.html.find('.tache-label a').click(async event => this.actor.rollTache(RdDSheetUtility.getItemId(event))) + this.html.find('.action-tache').click(async event => this.actor.rollTache(RdDSheetUtility.getItemId(event))) this.html.find('.meditation-label a').click(async event => this.actor.rollMeditation(RdDSheetUtility.getItemId(event))) - this.html.find('.chant-label a').click(async event => this.actor.rollChant(RdDSheetUtility.getItemId(event))) - this.html.find('.danse-label a').click(async event => this.actor.rollDanse(RdDSheetUtility.getItemId(event))) - this.html.find('.musique-label a').click(async event => this.actor.rollMusique(RdDSheetUtility.getItemId(event))) - this.html.find('.oeuvre-label a').click(async event => this.actor.rollOeuvre(RdDSheetUtility.getItemId(event))) - this.html.find('.jeu-label a').click(async event => this.actor.rollJeu(RdDSheetUtility.getItemId(event))) - this.html.find('.recettecuisine-label a').click(async event => this.actor.rollRecetteCuisine(RdDSheetUtility.getItemId(event))) + this.html.find('.action-chant').click(async event => this.actor.rollChant(RdDSheetUtility.getItemId(event))) + this.html.find('.action-danse').click(async event => this.actor.rollDanse(RdDSheetUtility.getItemId(event))) + this.html.find('.action-musique').click(async event => this.actor.rollMusique(RdDSheetUtility.getItemId(event))) + this.html.find('.action-oeuvre').click(async event => this.actor.rollOeuvre(RdDSheetUtility.getItemId(event))) + this.html.find('.action-jeu').click(async event => this.actor.rollJeu(RdDSheetUtility.getItemId(event))) + this.html.find('.action-recettecuisine').click(async event => this.actor.rollRecetteCuisine(RdDSheetUtility.getItemId(event))) this.html.find('.description-aleatoire').click(async event => new AppPersonnageAleatoire(this.actor).render(true)) if (game.user.isGM) { @@ -218,13 +215,12 @@ export class RdDActorSheet extends RdDBaseActorSangSheet { // Boutons spéciaux MJs this.html.find('.forcer-tmr-aleatoire').click(async event => this.actor.reinsertionAleatoire("Action MJ")) this.html.find('.don-de-haut-reve').click(async event => this.actor.addDonDeHautReve()) - this.html.find('.sortreserve-add').click(async event => this.actor.addSortReserve(RdDSheetUtility.getItemId(event))) this.html.find('.afficher-tmr').click(async event => this.actor.changeTMRVisible()) } // Points de reve actuel this.html.find('.roll-reve-actuel').click(async event => this.actor.rollCarac('reve-actuel', {resistance:true})) - this.html.find('.empoignade-label a').click(async event => RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor))) + this.html.find('.action-empoignade').click(async event => RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor))) this.html.find('.roll-arme').click(async event => this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event)), 'competence')) @@ -328,7 +324,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet { /* -------------------------------------------- */ async selectTypeOeuvreToCreate() { let types = RdDItem.getTypesOeuvres(); - let content = `Selectionnez le type d'oeuvre`; for (let typeName of types) { content += `` } diff --git a/module/actor.js b/module/actor.js index a21e2410..ffa65fbc 100644 --- a/module/actor.js +++ b/module/actor.js @@ -167,8 +167,7 @@ export class RdDActor extends RdDBaseActorSang { /* -------------------------------------------- */ async $perteRevePotionsEnchantees() { - const potionUpdates = this.itemTypes[ITEM_TYPES.potion].map( - it.perteRevePotion()) + const potionUpdates = this.itemTypes[ITEM_TYPES.potion].map(it => it.perteRevePotion()) .filter(it => it != undefined) if (potionUpdates.length > 0) { console.log('perte rêve de potions', potionUpdates) @@ -987,13 +986,10 @@ export class RdDActor extends RdDBaseActorSang { } } - async addSortReserve(itemId) { - if (itemId) { - const item = this.items.get(itemId) - if (item.type == ITEM_TYPES.sort && !item.system.isrituel) { - this.$createSortReserve(item) - return - } + async addSortReserve(item) { + if (item?.type == ITEM_TYPES.sort && !item.system.isrituel) { + this.$createSortReserve(item) + return } const selectSortReserve = { title: "Créer un sort en réserve", @@ -1197,49 +1193,8 @@ export class RdDActor extends RdDBaseActorSang { new RdDRollDialogEthylisme(html, rollData, this, r => this.saouler(r.forceAlcool)).render(true); } - async actionPrincipale(item, onActionItem = async () => { }) { - let result = await super.actionPrincipale(item, onActionItem) - if (!result){ - result = await this.actionNourritureboisson(item) - } - if (!result){ - result = await this.itemActionPrincipale(item) - } - await onActionItem() - return result - } - - async itemActionPrincipale(item) { - switch (item.type) { - case ITEM_TYPES.potion: return await this.consommerPotion(item); - case ITEM_TYPES.livre: return await this.actionLire(item); - case ITEM_TYPES.conteneur: return await item.sheet.render(true); - case ITEM_TYPES.herbe: return await this.actionHerbe(item); - case ITEM_TYPES.queue: case ITEM_TYPES.ombre: return await this.actionRefoulement(item); - } - } - - async actionNourritureboisson(item) { - switch (item.getUtilisationCuisine()) { - case 'brut': { - const utilisation = new Dialog({ - title: "Nourriture brute", - content: `Que faire de votre ${item.name}`, - buttons: { - 'cuisiner': { icon: '', label: 'Cuisiner', callback: async () => await this.preparerNourriture(item) }, - 'manger': { icon: '', label: 'Manger cru', callback: async () => await this.mangerNourriture(item) } - } - }); - return utilisation.render(true); - } - case 'pret': - return await this.mangerNourriture(item); - } - return undefined; - } - - async mangerNourriture(item) { - return (await DialogConsommer.create(this, item)).render(true); + async mangerNourriture(item, onActionItem) { + return (await DialogConsommer.create(this, item, onActionItem)).render(true); } async actionLire(item) { @@ -2569,8 +2524,7 @@ export class RdDActor extends RdDBaseActorSang { } /* -------------------------------------------- */ - async equiperObjet(itemID) { - let item = this.getEmbeddedDocument('Item', itemID); + async equiperObjet(item) { if (item?.isEquipable()) { const isEquipe = !item.system.equipe; await item.update({ "system.equipe": isEquipe }); @@ -2833,59 +2787,6 @@ export class RdDActor extends RdDBaseActorSang { return guerisonData; } - - /* -------------------------------------------- */ - async fabriquerPotion(herbeData) { - let newPotion = { - name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion', - img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp", - system: { - quantite: 1, cout: 0, encombrement: 0.1, - categorie: herbeData.system.categorie, - herbe: herbeData.name, - rarete: herbeData.system.rarete, - herbebrins: herbeData.nbBrins, - herbebonus: herbeData.herbebonus, - description: "" - } - } - await this.createEmbeddedDocuments('Item', [newPotion]); - - let newQuantite = herbeData.system.quantite - herbeData.nbBrins; - let messageData = { - alias: this.getAlias(), - nbBrinsReste: newQuantite, - potion: newPotion, - herbe: herbeData - } - this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins); - - ChatMessage.create({ - whisper: ChatUtility.getOwners(this), - content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, messageData) - }); - } - - /* -------------------------------------------- */ - async diminuerQuantiteObjet(id, nb, options = { supprimerSiZero: false }) { - const item = this.getItem(id); - if (item) { - await item.diminuerQuantite(nb, options); - } - } - - /* -------------------------------------------- */ - async consommerPotion(potion) { - if (potion.system.categorie.includes('Soin')) { - await this.consommerPotionSoin(potion); - } else if (potion.system.categorie.includes('Repos')) { - await this.consommerPotionRepos(potion); - } else { - await this.consommerPotionGenerique(potion); - } - await this.diminuerQuantiteObjet(potion.id, 1, { supprimerSiZero: potion.supprimer }); - } - /* -------------------------------------------- */ async consommerPotionSoin(potionData) { potionData.alias = this.name; @@ -2947,22 +2848,77 @@ export class RdDActor extends RdDBaseActorSang { } /* -------------------------------------------- */ - async consommerPotionGenerique(potion) { - potion.alias = this.name; + async fabriquerPotion(herbeData) { + let newPotion = { + name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion', + img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp", + system: { + quantite: 1, cout: 0, encombrement: 0.1, + categorie: herbeData.system.categorie, + herbe: herbeData.name, + rarete: herbeData.system.rarete, + herbebrins: herbeData.nbBrins, + herbebonus: herbeData.herbebonus, + description: "" + } + } + await this.createEmbeddedDocuments('Item', [newPotion], { renderSheet: true }); - if (potion.system.magique) { + let newQuantite = herbeData.system.quantite - herbeData.nbBrins; + let messageData = { + alias: this.getAlias(), + nbBrinsReste: newQuantite, + potion: newPotion, + herbe: herbeData + } + this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins); + + ChatMessage.create({ + whisper: ChatUtility.getOwners(this), + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, messageData) + }); + } + + /* -------------------------------------------- */ + async diminuerQuantiteObjet(id, nb, options = { supprimerSiZero: false }) { + const item = this.getItem(id); + if (item) { + await item.diminuerQuantite(nb, options); + } + } + + /* -------------------------------------------- */ + async consommerPotionGenerique(potionData) { + potionData.alias = this.name; + + if (potionData.system.magique) { // Gestion de la résistance: - potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8); - if (potion.rolled.isEchec) { + potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8); + if (potionData.rolled.isEchec) { await this.reveActuelIncDec(-1); } } ChatMessage.create({ whisper: ChatUtility.getOwners(this), - content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.html`, potion) + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.html`, potionData) }); } + /* -------------------------------------------- */ + async consommerPotion(potion, onActionItem = async () => { }) { + const potionData = potion + + if (potionData.system.categorie.includes('Soin')) { + this.consommerPotionSoin(potionData); + } else if (potionData.system.categorie.includes('Repos')) { + this.consommerPotionRepos(potionData); + } else { + this.consommerPotionGenerique(potionData); + } + await this.diminuerQuantiteObjet(potion.id, 1, { supprimerSiZero: potionData.supprimer }); + await onActionItem() + } + /* -------------------------------------------- */ async onUpdateActor(update, options, actorId) { const updatedEndurance = update?.system?.sante?.endurance diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index 6e99e08c..b7a2be14 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -7,6 +7,7 @@ import { ITEM_TYPES } from "../constants.js"; import { RdDItem } from "../item.js"; import { RdDItemCompetenceCreature } from "../item-competencecreature.js"; import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js"; +import { ItemAction } from "../item/item-actions.js"; /* -------------------------------------------- */ /** @@ -84,39 +85,32 @@ export class RdDBaseActorSheet extends ActorSheet { super.activateListeners(html); this.html = html; - this.html.find('.conteneur-name a').click(async event => { - RdDUtility.toggleAfficheContenu(this.getItemId(event)); - this.render(true); - }); - this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat()); + this.html.find('.actionItem').click(event => ItemAction.onActionItem(event, this.actor, this.options)) this.html.find('.item-edit').click(async event => this.itemActionEdit(event)) - this.html.find('.item-montrer').click(async event => this.getItem(event)?.postItemToChat()); + this.html.find('.conteneur-name a').click(async event => { + RdDUtility.toggleAfficheContenu(this.getItemId(event)) + this.render(true) + }) + + this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat()); this.html.find('.recherche') .each((index, field) => { this._rechercheSelectArea(field); }) .keyup(async event => this._rechercherKeyup(event)) - .change(async event => this._rechercherKeyup(event)); - this.html.find('.recherche').prop("disabled", false); + .change(async event => this._rechercherKeyup(event)) + + this.html.find('.recherche').prop("disabled", false) // Everything below here is only needed if the sheet is editable if (!this.options.editable) return; - this.html.find('.item-action').click(async event => { - const item = RdDSheetUtility.getItem(event, this.actor); - item?.actionPrincipale(this.actor, async () => this.render()) - }); - - - this.html.find('.item-split').click(async event => { - const item = this.getItem(event); - RdDSheetUtility.splitItem(item, this.actor); - }); + this.html.find('.item-equip-armure').click(async event => this.actor.equiperObjet(this.getItem(event))) + this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this.getItem(event), this.actor)); + this.html.find('.item-split').click(async event => RdDSheetUtility.splitItem(this.getItem(event), this.actor)) this.html.find('.item-quantite-plus').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), 1)); this.html.find('.item-quantite-moins').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), -1)); - this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, this.getItem(event))); - this.html.find('.item-vendre').click(async event => this.vendre(this.getItem(event))); this.html.find('.creer-un-objet').click(async event => { this.selectObjetTypeToCreate(); @@ -202,7 +196,7 @@ export class RdDBaseActorSheet extends ActorSheet { /* -------------------------------------------- */ async selectObjetTypeToCreate() { let types = this.getTypesInventaire().sort(Misc.ascending(type => Misc.typeName('Item', type))); - let content = `Selectionnez le type d'équipement`; for (let typeName of types) { content += `` } diff --git a/module/actor/base-actor.js b/module/actor/base-actor.js index 4d23aa22..2cdd2834 100644 --- a/module/actor/base-actor.js +++ b/module/actor/base-actor.js @@ -737,25 +737,20 @@ export class RdDBaseActor extends Actor { actionImpossible(action) { ui.notifications.info(`${this.getAlias()} ne peut pas faire cette action: ${action}`) - } async jetEthylisme() { this.actionImpossible("jet d'éthylisme") } async rollAppelChance() { this.actionImpossible("appel à la chance") } async jetDeMoral() { this.actionImpossible("jet de moral") } - async actionPrincipale(item, onActionItem = async () => { }) { - switch (item.type) { - case ITEM_TYPES.conteneur: return await item.sheet.render(true); - } - return undefined - } async resetItemUse() { } async incDecItemUse(itemId, inc = 1) { } getItemUse(itemId) { return 0; } + async finDeRound(options = { terminer: false }) { } isActorCombat() { return false } getCaracInit(competence) { return 0 } + listActionsCombat() { return [] } listActionsPossessions() { return this.itemTypes[ITEM_TYPES.possession] diff --git a/module/actor/commerce-sheet.js b/module/actor/commerce-sheet.js index 7a305195..ca617fec 100644 --- a/module/actor/commerce-sheet.js +++ b/module/actor/commerce-sheet.js @@ -45,6 +45,7 @@ export class RdDCommerceSheet extends RdDBaseActorSheet { super.activateListeners(html); this.html.find('a.item-acheter').click(async event => await this.vente(this.getItem(event))); + this.html.find('.service-acheter').click(async event => await this.vente(this.getItem(event))); if (!this.options.editable) return; diff --git a/module/item-sheet.js b/module/item-sheet.js index e88af8f0..4cfb3985 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -14,6 +14,7 @@ import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { RdDItem } from "./item.js"; import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js"; import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js"; +import { ItemAction } from "./item/item-actions.js"; /** * Extend the basic ItemSheet for RdD specific items @@ -199,13 +200,14 @@ export class RdDItemSheet extends ItemSheet { this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event)) if (this.actor) { - this.html.find('.consommer-potion').click(event => this.itemActionConsommer(event)) - this.html.find('.item-action').click(event => this.itemAction(event)) + // TODO + this.html.find('.actionItem').click(event => ItemAction.onActionItem(event, this.actor, this.options)) + + this.html.find('.item-potion-consommer').click(event => this.itemActionConsommer(event)) + this.html.find('.item-split').click( event => this.itemActionSplit(event)) this.html.find('.item-edit').click(async event => RdDSheetUtility.getItem(event, this.actor)?.sheet.render(true)); - this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, RdDSheetUtility.getItem(event, this.actor))); - this.html.find('.item-vendre').click(async event => RdDSheetUtility.getItem(event, this.actor)?.proposerVente()); - this.html.find('.item-montrer').click(async event => RdDSheetUtility.getItem(event, this.actor)?.postItemToChat()); + this.html.find('.item-delete').click(async event => this.itemActionDelete(event)); this.html.find('.item-quantite-plus').click(async event => { await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), 1) @@ -223,6 +225,11 @@ export class RdDItemSheet extends ItemSheet { RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.fin', updateItemTimestamp); } + itemActionDelete(event) { + const item = RdDSheetUtility.getItem(event, this.actor) + return RdDUtility.confirmActorItemDelete(item, this.actor) + } + async itemActionConsommer(event) { const item = RdDSheetUtility.getItem(event, this.actor) if (item) { @@ -239,14 +246,6 @@ export class RdDItemSheet extends ItemSheet { } } - async itemAction(event) { - const item = RdDSheetUtility.getItem(event, this.actor); - if (item) { - await item.actionPrincipale(this.actor) - await RdDSheetUtility.renderItemBranch(this.actor, item) - } - } - _getEventActor(event) { let actorId = event.currentTarget.attributes['data-actor-id'].value; let actor = game.actors.get(actorId); diff --git a/module/item.js b/module/item.js index 6b545694..c51fffe8 100644 --- a/module/item.js +++ b/module/item.js @@ -9,6 +9,7 @@ import { RdDRaretes } from "./item/raretes.js"; import { CATEGORIES_COMPETENCES } from "./item-competence.js"; import { CATEGORIES_COMPETENCES_CREATURES } from "./item-competencecreature.js"; import { BASE_CORPS_A_CORPS, BASE_ESQUIVE } from "./item/base-items.js"; +import { ITEM_ACTIONS, DEFAULT_ACTIONS, COMMON_ACTIONS } from "./item/item-actions.js"; const typesInventaireMateriel = [ ITEM_TYPES.arme, @@ -45,41 +46,41 @@ densité 3.5 (~2.3 à 4, parfois plus) -- https://www.juwelo.fr/guide-des-pierre */ export const defaultItemImg = { - competence: "systems/foundryvtt-reve-de-dragon/icons/competence_defaut.webp", - competencecreature: "systems/foundryvtt-reve-de-dragon/icons/competence_defaut.webp", arme: "systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_gnome.webp", armure: "systems/foundryvtt-reve-de-dragon/icons/armes_armures/armure_plaques.webp", - conteneur: "systems/foundryvtt-reve-de-dragon/icons/objets/sac_a_dos.webp", - sort: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp", - herbe: "systems/foundryvtt-reve-de-dragon/icons/botanique/Endorlotte.webp", - faune: "systems/foundryvtt-reve-de-dragon/icons/faune/rongeur.webp", - ingredient: "systems/foundryvtt-reve-de-dragon/icons/objets/sable_poudre.webp", - livre: "systems/foundryvtt-reve-de-dragon/icons/objets/livre.webp", - potion: "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp", - rencontre: "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp", - queue: "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp", - ombre: "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp", - souffle: "systems/foundryvtt-reve-de-dragon/icons/souffle_dragon.webp", - tete: "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp", - meditation: "systems/foundryvtt-reve-de-dragon/icons/meditations_ecrits/meditation_alchimie.webp", - recettealchimique: "systems/foundryvtt-reve-de-dragon/icons/competence_alchimie.webp", chant: "systems/foundryvtt-reve-de-dragon/icons/arts/chant_0.webp", + competence: "systems/foundryvtt-reve-de-dragon/icons/competence_defaut.webp", + competencecreature: "systems/foundryvtt-reve-de-dragon/icons/competence_defaut.webp", + conteneur: "systems/foundryvtt-reve-de-dragon/icons/objets/sac_a_dos.webp", danse: "systems/foundryvtt-reve-de-dragon/icons/arts/danse_0.webp", + empoignade: "systems/foundryvtt-reve-de-dragon/icons/empoignade.webp", + extraitpoetique: "systems/foundryvtt-reve-de-dragon/icons/competence_ecriture.webp", + faune: "systems/foundryvtt-reve-de-dragon/icons/faune/rongeur.webp", + gemme: "systems/foundryvtt-reve-de-dragon/icons/gemmes/almaze.webp", + herbe: "systems/foundryvtt-reve-de-dragon/icons/botanique/Endorlotte.webp", + ingredient: "systems/foundryvtt-reve-de-dragon/icons/objets/sable_poudre.webp", jeu: "systems/foundryvtt-reve-de-dragon/icons/arts/jeux_petasse.webp", - recettecuisine: "systems/foundryvtt-reve-de-dragon/icons/arts/recette_cuisine_1.webp", - musique: "systems/foundryvtt-reve-de-dragon/icons/arts/chant_0.webp", + livre: "systems/foundryvtt-reve-de-dragon/icons/objets/livre.webp", maladie: "systems/foundryvtt-reve-de-dragon/icons/maladies_venins/maladie.webp", - poison: "systems/foundryvtt-reve-de-dragon/icons/maladies_venins/venin.webp", - oeuvre: "systems/foundryvtt-reve-de-dragon/icons/competence_comedie.webp", + meditation: "systems/foundryvtt-reve-de-dragon/icons/meditations_ecrits/meditation_alchimie.webp", + musique: "systems/foundryvtt-reve-de-dragon/icons/arts/chant_0.webp", nourritureboisson: "systems/foundryvtt-reve-de-dragon/icons/objets/provision_crue.webp", + oeuvre: "systems/foundryvtt-reve-de-dragon/icons/competence_comedie.webp", + ombre: "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp", + poison: "systems/foundryvtt-reve-de-dragon/icons/maladies_venins/venin.webp", + possession: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp", + potion: "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp", + queue: "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp", + recettealchimique: "systems/foundryvtt-reve-de-dragon/icons/competence_alchimie.webp", + recettecuisine: "systems/foundryvtt-reve-de-dragon/icons/arts/recette_cuisine_1.webp", + rencontre: "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp", service: "systems/foundryvtt-reve-de-dragon/icons/services/lit.webp", signedraconique: "systems/foundryvtt-reve-de-dragon/icons/tmr/signe_draconique.webp", - gemme: "systems/foundryvtt-reve-de-dragon/icons/gemmes/almaze.webp", - possession: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp", + sort: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp", sortreserve: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp", - extraitpoetique: "systems/foundryvtt-reve-de-dragon/icons/competence_ecriture.webp", + souffle: "systems/foundryvtt-reve-de-dragon/icons/souffle_dragon.webp", tarot: "systems/foundryvtt-reve-de-dragon/icons/tarots/dos-tarot.webp", - empoignade: "systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp" + tete: "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp", } /* -------------------------------------------- */ @@ -409,54 +410,51 @@ export class RdDItem extends Item { // appliquer le pourcentage return this.parent.calculerPrix(this); } - return this.system.cout; + return this.system.cout } prepareDerivedData() { super.prepareDerivedData(); if (this.isInventaire()) { - this.system.encTotal = this.getEncTotal(); - this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false }); + this.system.encTotal = this.getEncTotal() } - this.equipable = this.isEquipable(); + this.equipable = this.isEquipable() } - getActionPrincipale(options = { warnIfNot: true }) { + itemActions() { + return COMMON_ACTIONS.concat(this.itemSpecificActions()).concat(DEFAULT_ACTIONS) + } + + itemSpecificActions() { + const actions = ITEM_ACTIONS[this.type] ?? [] + // const actorTypes = actions.actorTypes ?? [ACTOR_TYPES.personnage] + // if (!actorTypes.includes(this.actor?.type)) { + // return [] + // } + return actions + } + + isActionAllowed(code) { switch (this.type) { - case ITEM_TYPES.conteneur: return 'Ouvrir'; - } - if (this.actor?.isPersonnage()) { - const warn = options.warnIfNot; - if (this.getUtilisationCuisine() == 'brut') { - return 'Cuisiner'; - } - switch (this.type) { - case ITEM_TYPES.nourritureboisson: return this._actionOrWarnQuantiteZero(this.system.boisson ? 'Boire' : 'Manger', warn); - case ITEM_TYPES.potion: return this._actionOrWarnQuantiteZero('Consommer', warn); - case ITEM_TYPES.livre: return this._actionOrWarnQuantiteZero('Lire', warn); - case ITEM_TYPES.herbe: return this.isHerbeAPotion() ? this._actionOrWarnQuantiteZero('Décoction', warn) : undefined; - case ITEM_TYPES.queue: case ITEM_TYPES.ombre: return this.system.refoulement > 0 ? 'Refouler' : undefined; - } - } - return undefined - } - - /* -------------------------------------------- */ - async actionPrincipale(actor, onActionItem = async () => { }) { - if (!this.getActionPrincipale()) { return } - await actor?.actionPrincipale(this, onActionItem); - } - - _actionOrWarnQuantiteZero(actionName, warn) { - if ((this.system.quantite ?? 0) <= 0) { - if (warn) { - ui.notifications.warn(`Vous n'avez plus de ${this.name}.`); - } - return undefined; - } - else { - return actionName; + case ITEM_TYPES.possession: + case ITEM_TYPES.empoignade: + case ITEM_TYPES.rencontre: + case ITEM_TYPES.signedraconique: + switch (code) { + case 'item-edit': + case 'item-delete': + return game.user.isGM + } + case ITEM_TYPES.maladie: + case ITEM_TYPES.poison: + return game.user.isGM + case ITEM_TYPES.casetmr: + switch (code) { + case 'item-delete': + return game.user.isGM + } } + return true } async diminuerQuantite(nombre, options = { diminuerQuantite: true, supprimerSiZero: false }) { diff --git a/module/item/item-actions.js b/module/item/item-actions.js new file mode 100644 index 00000000..74e17268 --- /dev/null +++ b/module/item/item-actions.js @@ -0,0 +1,154 @@ +import { Misc } from "../misc.js" +import { RdDSheetUtility } from "../rdd-sheet-utility.js" +import { RdDUtility } from "../rdd-utility.js" + + + +/** + * TODO: + * options.editable ? + * + */ +const _SPACEHOLDER = { placeholder: true } + +const _VENDRE = { + code: 'item-vendre', label: 'Vendre ou donner', icon: it => 'fa-solid fa-comments-dollar', + filter: it => Misc.toInt(it.system.quantite) > 0, + optionsFilter: options => options.editable, + action: (item, actor) => item.proposerVente() +} +const _ACHAT_SERVICE = { + code: 'item-service-acheter', label: 'Acheter', icon: it => 'fa-regular fa-coins', + //filter: it => Misc.toInt(it.system.quantite) > 0, + //optionsFilter: options => options.editable, + //action: (item, actor) => item.proposerVente() +} +const _MONTRER = { + code: 'item-montrer', label: 'Montrer', icon: it => 'fa-solid fa-comment', + action: (item, actor) => item.postItemToChat() +} +const _EDIT = { + code: 'item-edit', label: 'Editer', icon: it => 'fa-solid fa-edit', + action: (item, actor) => item.sheet.render(true) +} +const _DELETE = { + code: 'item-delete', label: 'Supprimer', icon: it => 'fa-solid fa-trash', + optionsFilter: options => options.editable && options.isOwner, + action: (item, actor) => RdDUtility.confirmActorItemDelete(item, actor) +} +const _EQUIPER = { + code: 'item-equip', label: 'Equiper', icon: it => it.system.equipe ? 'fa-solid fa-hand-rock' : 'fa-regular fa-hand-paper', + filter: it => !it.estContenu && it.isEquipable(), + action: (item, actor) => actor.equiperObjet(item) +} + +const _CUISINER = { + code: 'item-cuisiner', label: 'Cuisiner', icon: it => 'fa-solid fa-utensils', + filter: it => it.getUtilisation() == 'cuisine' && it.system.sust > 0, + optionsFilter: options => options.editable, + action: (item, actor) => actor.preparerNourriture(item) +} +const _MANGER_CRU = { + code: 'item-manger-cru', label: 'Manger cru', icon: it => 'fa-solid fa-drumstick-bite', + filter: it => it.getUtilisation() == 'cuisine' && it.system.sust > 0, + optionsFilter: options => options.editable, + action: (item, actor) => actor.mangerNourriture(item) +} +const _MANGER = { + code: 'item-manger', label: 'Manger', icon: it => 'fa-solid fa-utensils', + filter: it => !(it.system.boisson), + optionsFilter: options => options.editable, + action: (item, actor) => actor.mangerNourriture(item) +} +const _BOIRE = { + code: 'item-boire', label: 'Boire', icon: it => 'fa-solid fa-glass-water', + filter: it => it.system.boisson, + optionsFilter: options => options.editable, + action: (item, actor) => actor.mangerNourriture(item) +} +const _DECOCTION = { + code: 'item-decoction', label: 'Décoction', icon: it => 'fa-solid fa-flask-vial', + optionsFilter: options => options.editable, + action: (item, actor) => actor.actionHerbe(item) +} +const _OUVRIR = { + code: 'item-edit', label: 'Ouvrir', icon: it => 'fa-solid fa-eye', + action: (item, actor) => item.sheet.render(true) +} + +const _LIRE = { + code: 'item-lire', label: 'Lire', icon: it => 'fa-solid fa-book-open', + optionsFilter: options => options.editable, + action: (item, actor) => actor.actionLire(item) +} + +const _REFOULER = { + code: 'item-refouler', label: 'Refouler', icon: it => 'fa-solid fa-burst', + filter: it => it.system.refoulement > 0, + optionsFilter: options => options.editable, + action: (item, actor) => actor.actionRefoulement(item) +} + +const _CONSOMMER_POTION = { + code: 'item-potion-consommer', label: 'Consommer', icon: it => 'fa-solid fa-vial', + optionsFilter: options => options.editable, + action: (item, actor) => actor.consommerPotion(item) +} + +const _ENCHANTER = { + code: 'item-enchanter', label: 'Enchanter', icon: it => 'fa-solid fa-sparkles', + filter: it => it.isEnchantable(), + optionsFilter: options => options.editable, + action: (item, actor) => item.enchanterPotion() +} + +const _SORT_RESERVE = { + code: 'item-sortreserve-add', label: 'Ajouter en réserve', icon: it => 'fa-solid fa-sparkles', + filter: it => game.user.isGM && !it.system.isrituel, + action: (item, actor) => actor.addSortReserve(item) +} + +export const COMMON_ACTIONS = [_EQUIPER] +export const DEFAULT_ACTIONS = [_SPACEHOLDER, _VENDRE, _MONTRER, _EDIT, _DELETE] + +export const ITEM_ACTIONS = { + faune: [_CUISINER, _MANGER_CRU], + ingredient: [_CUISINER, _MANGER_CRU], + conteneur: [_OUVRIR], + herbe: [_DECOCTION, _CUISINER, _MANGER_CRU], + livre: [_LIRE], + nourritureboisson: [_MANGER, _BOIRE], + ombre: [_REFOULER], + plante: [_CUISINER, _MANGER_CRU], + potion: [_CONSOMMER_POTION, _ENCHANTER], + queue: [_REFOULER], + sort: [_SORT_RESERVE], + service: [_ACHAT_SERVICE] +} + + +export class ItemAction { + + static applies(action, item, options) { + return action + && item.isActionAllowed(action.code) + && (!action.filter || action.filter(item)) + && (!action.optionsFilter || action.optionsFilter(options)) + } + + static icon(action, item) { + if (action && action.icon) { + return action.icon(item) + } + return undefined + } + + static onActionItem(event, actor, options) { + const item = RdDSheetUtility.getItem(event, actor) + const code = $(event.currentTarget).data('code') + const action = item.itemActions().find(it => it.code == code) + if (action && (!action.optionsFilter || action.optionsFilter(options))) { + action.action(item, actor) + } + } +} diff --git a/module/item/potion.js b/module/item/potion.js index 5110c151..f0af84d4 100644 --- a/module/item/potion.js +++ b/module/item/potion.js @@ -1,7 +1,8 @@ +import { ITEM_TYPES } from "../constants.js"; import { Grammar } from "../grammar.js"; import { RdDItem } from "../item.js"; import { SystemCompendiums } from "../settings/system-compendiums.js"; -import { RdDTimestamp } from "../time/rdd-timestamp.js"; +import { ITEM_ACTIONS } from "./item-actions.js"; import { DialogEnchanter } from "./potion/dialog-enchanter.js"; const POTION_MAGIQUE = ['AlchimieEnchante', 'ReposEnchante', 'SoinEnchante', 'AutreEnchante'] @@ -41,6 +42,10 @@ export class RdDItemPotion extends RdDItem { isEnchantable() { return POTION_ENCHANTABLE.includes(this.system.categorie) } isMagique() { return POTION_MAGIQUE.includes(this.system.categorie) } + itemSpecificActions() { + return ITEM_ACTIONS[ITEM_TYPES.potion] + } + getActions(options = { warnIfNot: true }) { const actionConsommer = this.prepareAction('Consommer', options.warnIfNot); if (this.isEnchantable()) { @@ -53,8 +58,7 @@ export class RdDItemPotion extends RdDItem { actionConsommer ] } - - + // TDOD: purifier? getUtilisation() { switch (this.system.categorie) { case 'Alchimie': case 'AlchimieEnchante': @@ -89,11 +93,11 @@ export class RdDItemPotion extends RdDItem { if (this.system.magique && !this.system.prpermanent && this.system.pr > 0) { const nouveauReve = Math.max(this.system.pr - 1, 0) return { - _id: it._id, + _id: this.id, name: this.name, img: this.img, 'system.pr': nouveauReve, - 'system.quantite': nouveauReve > 0 ? it.system.quantite : 0, + 'system.quantite': nouveauReve > 0 ? this.system.quantite : 0, 'system.magique': nouveauReve > 0 } } @@ -113,16 +117,16 @@ export class RdDItemPotion extends RdDItem { }) } else { - const updates = { + await this.update({ 'system.pr': enchanter.nouveaupr, 'system.purifie': enchanter.purifier, 'system.magique': true, 'system.categorie': this.categorieEnchantement().enchante, 'system.prpermanent': enchanter.prpermanent, 'system.prdate': RdDItemPotion.dateEnchantement() - } - this.update(updates) + }) } + this.sheet?.render(true) } calculPuissance() { return this.system.herbebonus * this.system.pr } @@ -134,7 +138,7 @@ export class RdDItemPotion extends RdDItem { } static dateEnchantement() { - return game.system.rdd.calendrier.getTimestamp().debutJournee() + return game.system.rdd.calendrier.getTimestamp().debutJournee().indexDate } static buildHerbesList(listeHerbes, max) { diff --git a/module/item/sheet-potion.js b/module/item/sheet-potion.js index c37a846f..d556c36e 100644 --- a/module/item/sheet-potion.js +++ b/module/item/sheet-potion.js @@ -43,7 +43,8 @@ export class RdDPotionItemSheet extends RdDItemInventaireSheet { activateListeners(html) { super.activateListeners(html); - this.html.find('.enchanter-potion').click((event) => this.potion.enchanterPotion()) + + this.html.find('.item-enchanter').click((event) => this.potion.enchanterPotion()) this.html.find('.date-enchantement').change((event) => { const jour = Number(this.html.find('input.date-enchantement[name="enchantement.jour"]').val()) diff --git a/module/rdd-empoignade.js b/module/rdd-empoignade.js index 51a155e9..cd49d881 100644 --- a/module/rdd-empoignade.js +++ b/module/rdd-empoignade.js @@ -428,7 +428,6 @@ export class RdDEmpoignade { return await Item.create({ name: "Empoignade en cours de " + attacker.name + ' sur ' + defender.name, type: 'empoignade', - img: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp", system: { description: "", empoignadeid: foundry.utils.randomID(16), compteempoigne: 0, empoigneurid: attacker.id, empoigneid: defender.id, ptsemp: 0, empoigneurname: attacker.name, empoignename: defender.name } }, { diff --git a/module/rdd-possession.js b/module/rdd-possession.js index cdcb5864..483a9603 100644 --- a/module/rdd-possession.js +++ b/module/rdd-possession.js @@ -174,7 +174,7 @@ export class RdDPossession { await RdDResolutionTable.displayRollData(rollData, rollData.attacker, 'chat-resultat-possession.html') if (rollData.possession.isPosseder || rollData.possession.isConjurer) { // conjuration - victime.deleteEmbeddedDocuments("Item", [rollData.possession._id]) + await victime.deleteEmbeddedDocuments("Item", [rollData.possession._id]) } } diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 99b270da..6c88cd8e 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -137,7 +137,11 @@ export class RdDRoll extends Dialog { this.rollData.selectedCarac = this.rollData.carac[this.actor.mapCarac(this.rollData.competence.system.defaut_carac)] } if (this.rollData.selectedCarac) { - this.html.find("[name='carac']").val(RdDCarac.caracDetails(this.rollData.selectedCarac.label).code) + this.html.find("[name='carac']").val( + this.actor?.type == ACTOR_TYPES.personnage + ? RdDCarac.caracDetails(this.rollData.selectedCarac.label).code + : this.rollData.selectedCarac.label + ) } if (this.rollData.selectedSort) { this.setSelectedSort(this.rollData.selectedSort); diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index e738c971..221fc278 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -241,7 +241,7 @@ export class RdDTMRDialog extends Dialog { this._getTokensRencontres().forEach(t => this._trackToken(t)) this._getTokensSortsReserve().forEach(t => this._trackToken(t)) } - + /* -------------------------------------------- */ updateTokens() { this._removeTokens(t => true); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index c7aeeb6d..8c22cb41 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -24,6 +24,7 @@ import { RdDBaseActor } from "./actor/base-actor.js"; import { RdDCarac } from "./rdd-carac.js"; import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js"; import { Monnaie } from "./item-monnaie.js"; +import { ItemAction } from "./item/item-actions.js"; /* -------------------------------------------- */ // This table starts at 0 -> niveau -10 @@ -116,6 +117,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html', // sous-parties de feuilles de personnages + 'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/header-buttons.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/header-etat.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs.html', @@ -130,47 +132,46 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-derivee.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-creature.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-entitee.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/comp-possession.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/comp-possession.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-total.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/competence.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/competence.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/xp-competences.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/combat.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs', - 'systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/possessions.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/resonances.hbs', - 'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/taches.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/jeus.hbs', - 'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-souffles.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-tetes.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-signes-draconiques.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-rencontres.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts-reserve.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-meditations.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-souffles.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-tetes.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-signes-draconiques.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-rencontres.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts-reserve.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-meditations.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-casetmrs.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/xp-journal.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.hbs', - "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.html", + "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.hbs", 'systems/foundryvtt-reve-de-dragon/templates/actor/liens-animaux.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/liens-suivants.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/liens-vehicules.hbs', - 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.hbs', //Items 'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete-script.hbs', @@ -336,6 +337,8 @@ export class RdDUtility { Handlebars.registerHelper('isFieldInventaireModifiable', (type, field) => RdDItem.isFieldInventaireModifiable(type, field)); // Items Handlebars.registerHelper('rarete-getChamp', (rarete, field) => RdDRaretes.getChamp(rarete, field)); + Handlebars.registerHelper('item-action-applies', (action, item, options) => ItemAction.applies(action, item, options)) + Handlebars.registerHelper('item-action-icon', (action, item) => ItemAction.icon(action, item)) // TMRs Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord)); @@ -469,6 +472,7 @@ export class RdDUtility { static filterItemsPerTypeForSheet(formData, itemTypes) { Object.values(ITEM_TYPES).forEach(t => { formData[t + 's'] = Misc.arrayOrEmpty(itemTypes[t]) + itemTypes[t].forEach(item => item.actions = item.itemActions()) }) formData.maladiesPoisons = formData.maladies.concat(formData.poisons) @@ -898,7 +902,7 @@ export class RdDUtility { } /* -------------------------------------------- */ - static async confirmActorItemDelete(sheet, item, htmlToDelete) { + static async confirmActorItemDelete(item, actor) { const itemId = item.id; const confirmationSuppression = { settingConfirmer: "confirmation-supprimer-" + item.getItemGroup(), @@ -907,8 +911,7 @@ export class RdDUtility { buttonLabel: "Supprimer", onAction: () => { console.log('Delete : ', itemId); - sheet.actor.deleteEmbeddedDocuments('Item', [itemId], { renderSheet: false }); - RdDUtility.slideOnDelete(sheet, htmlToDelete); + actor.deleteEmbeddedDocuments('Item', [itemId], { renderSheet: false }); } }; if (item.isConteneurNonVide()) { @@ -921,8 +924,7 @@ export class RdDUtility { label: "Supprimer conteneur et contenu", callback: () => { console.log("Delete : ", itemId); - sheet.actor.deleteAllConteneur(itemId, { renderSheet: false }); - RdDUtility.slideOnDelete(sheet, htmlToDelete); + actor.deleteAllConteneur(itemId, { renderSheet: false }); } } }); diff --git a/module/time/rdd-timestamp.js b/module/time/rdd-timestamp.js index 6e010cff..bdf4107a 100644 --- a/module/time/rdd-timestamp.js +++ b/module/time/rdd-timestamp.js @@ -335,9 +335,7 @@ export class RdDTimestamp { } debutJournee() { - return RdDTimestamp.timestamp(this.timestamp.annee, - this.timestamp.mois, - this.timestamp.jour) + return RdDTimestamp.timestamp(this.annee, this.mois, this.jour) } async appliquerDuree(duree, actor) { diff --git a/styles/simple.css b/styles/simple.css index fa3020a9..38d4d89d 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -67,7 +67,8 @@ /* =================== 3. some constants ============ */ --color-controls:rgba(0, 0, 0, 0.9); - --color-controls-hover:rgba(255, 255, 128, 0.7); + --color-controls-light:hsla(0, 0%, 20%, 0.8); + --color-controls-hover:hsla(60, 100%, 75%, 0.7); --color-control-border-hover:rgba(255, 128, 0, 0.8); --color-gold: rgba(191, 149, 63, 0.8); --gradient-gold: linear-gradient(30deg, rgba(191, 149, 63, 0.3), rgba(252, 246, 186, 0.3), rgba(179, 135, 40, 0.3), rgba(251, 245, 183, 0.3), rgba(170, 119, 28, 0.3)); @@ -391,9 +392,7 @@ table {border: 1px solid #7a7971;} grid-template-columns: repeat(12, minmax(0, 1fr)); } -.flex-group-center, -.flex-group-left, -.flex-group-right { +.flex-group-center { -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; @@ -405,8 +404,11 @@ table {border: 1px solid #7a7971;} } .flex-group-left { + -webkit-box-align: start; -webkit-box-pack: start; + -ms-flex-align: start; -ms-flex-pack: start; + align-items: start; justify-content: flex-start; text-align: left; } @@ -417,8 +419,11 @@ table {border: 1px solid #7a7971;} } .flex-group-right { + -webkit-box-align: end; -webkit-box-pack: end; + -ms-flex-align: end; -ms-flex-pack: end; + align-items: end; justify-content: flex-end; text-align: right; } @@ -440,9 +445,9 @@ table {border: 1px solid #7a7971;} } .flex-shrink { flex: 'flex-shrink' ; - flex-shrink: 2; + flex-shrink: 0; } -:is(.flex-grow, .flex-grow-3) { +.flex-grow, .flex-grow-3 { flex-grow: 3; } .flex-grow-2 { @@ -493,12 +498,13 @@ span.equipement-detail-buttons { justify-content: center; text-align: center; } +.item-actions-controls, .equipement-actions { margin: 0; flex-grow: 2; - align-items: center; - justify-content: center; - text-align: left; + align-items: end; + justify-content: flex-end; + text-align: right; } .blessure-control { @@ -813,16 +819,21 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) { margin: 0; } -.competence-list .item-controls { +.competence-list .item-controls, +.competence-list .item-actions-controls { display: contents !important; } +.competence-list .item-actions-controls.hidden-controls, .competence-list .item-controls.hidden-controls { display: none !important; } + +.item-actions-controls a.actionItem i:is(.fas, .fa, .fa-solid, .fa-regular), .item-controls i:is(.fas, .fa, .fa-solid, .fa-regular) { font-size: 0.8em; - color: var(--color-controls); + color: var(--color-controls-light); } +.item-actions-controls a.actionItem i:is(.fas, .fa, .fa-solid, .fa-regular):hover, .item-controls i:is(.fas, .far, .fa-solid, .fa-regular):hover { opacity: 0.6; } @@ -1088,25 +1099,29 @@ li label.compteur { padding: 0.25rem; } -.window-app.sheet .window-content .carac-value, .window-app.sheet .window-content .competence-xp { +.window-app.sheet .window-content .carac-value, +.window-app.sheet .window-content .competence-xp { flex-grow: 0; margin: 0.05rem; flex-basis: 2rem; text-align: center; } -.window-app.sheet .window-content .carac-value, .window-app.sheet .window-content .competence-value { +.window-app.sheet .window-content .carac-value, +.window-app.sheet .window-content .competence-value { flex-grow: 0; margin: 0.05rem; flex-basis: 2rem; text-align: center; } -.window-app.sheet .window-content .carac-value, .window-app.sheet .window-content .competence-archetype { +.window-app.sheet .window-content .carac-value, +.window-app.sheet .window-content .competence-archetype { flex-grow: 0; margin: 0.05rem; flex-basis: 2rem; text-align: center; } -.window-app.sheet .window-content .carac-value, .window-app.sheet .window-content .competence-xp-sort { +.window-app.sheet .window-content .carac-value, +.window-app.sheet .window-content .competence-xp-sort { flex-grow: 0; margin: 0.05rem; flex-basis: 2rem; @@ -1196,6 +1211,9 @@ ul.chat-list li:nth-child(odd) { .item-controls i.fas.allouer-stress.level-up { color: var(--color-gold); } +.item-action-controls i.fa-solid.allouer-stress.level-up { + color: var(--color-gold); +} .blessures-list ul { display: flex; } @@ -1312,21 +1330,11 @@ div.competence-column div.categorie-competence{ font-weight: bold; flex-grow: 0; } -.arme-label, -.generic-label, -.competence-label, .astrologie-label, -.tache-label, +.generic-label, .subacteur-label, -.chant-label, -.musique-label, -.oeuvre-label, -.chant-label, -.danse-label, -.recette-label, -.jeu-label, -.recettecuisine-label, -.description-label { +.list-item-label, +.list-title-label { flex-grow: 2; } .attribut-value, diff --git a/templates/actor-creature-sheet.html b/templates/actor-creature-sheet.html index 5ac324ed..83d39de4 100644 --- a/templates/actor-creature-sheet.html +++ b/templates/actor-creature-sheet.html @@ -53,7 +53,7 @@
    - {{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.html"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.hbs"}}
    @@ -62,7 +62,7 @@ {{!-- Equipment Tab --}}
    - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.html"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.hbs"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire.html"}}
    diff --git a/templates/actor-entite-sheet.html b/templates/actor-entite-sheet.html index 89de5e74..68ea2b48 100644 --- a/templates/actor-entite-sheet.html +++ b/templates/actor-entite-sheet.html @@ -40,8 +40,8 @@
    - {{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.html"}} - {{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-possession.html"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.hbs"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-possession.hbs"}}
    {{>"systems/foundryvtt-reve-de-dragon/templates/actor/resonances.hbs"}} diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index d6f4d61b..ee639d95 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -111,19 +111,19 @@
    {{> "systems/foundryvtt-reve-de-dragon/templates/actor/combat.html"}}
    {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html"}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html"}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.hbs"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/possessions.hbs"}}
    {{/if}} {{#if options.isObserver}}{{!-- Connaissances Tab --}}
    {{> "systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html"}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/taches.html"}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html"}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.html"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/taches.hbs"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.hbs"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.hbs"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/jeus.hbs"}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.hbs"}}
    {{/if}} {{#if options.isObserver}}{{!-- hautreve Tab --}} @@ -143,7 +143,7 @@ {{!-- Equipment Tab --}}
    - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.html"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.hbs"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/liens-animaux.hbs"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/liens-vehicules.hbs"}} diff --git a/templates/actor-vehicule-sheet.html b/templates/actor-vehicule-sheet.html index 709ce3ae..8c8b4a2f 100644 --- a/templates/actor-vehicule-sheet.html +++ b/templates/actor-vehicule-sheet.html @@ -91,7 +91,7 @@ {{!-- Equipment Tab --}}
    - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.html"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.hbs"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire.html"}}
    diff --git a/templates/actor/alchimie.hbs b/templates/actor/alchimie.hbs new file mode 100644 index 00000000..e15f58f3 --- /dev/null +++ b/templates/actor/alchimie.hbs @@ -0,0 +1,11 @@ +{{#if recettealchimiques.length}} +

    Recettes Alchimiques

    +
      + {{#each (trier recettealchimiques) as |recette id|}} +
    • + {{recette.name}} + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=recette options=@root.options}} +
    • + {{/each}} +
    +{{/if}} \ No newline at end of file diff --git a/templates/actor/alchimie.html b/templates/actor/alchimie.html deleted file mode 100644 index 2b0f5826..00000000 --- a/templates/actor/alchimie.html +++ /dev/null @@ -1,15 +0,0 @@ -{{#if recettealchimiques.length}} -

    Recettes Alchimiques

    -
      - {{#each (trier recettealchimiques) as |recette id|}} -
    • {{recette.name}} -
      - - -   - -
      -
    • - {{/each}} -
    -{{/if}} \ No newline at end of file diff --git a/templates/actor/armures.hbs b/templates/actor/armures.hbs index 78edda87..cab6b93a 100644 --- a/templates/actor/armures.hbs +++ b/templates/actor/armures.hbs @@ -3,7 +3,7 @@
  • - {{#if armure.system.equipe}}{{else}}{{/if}} + {{#if armure.system.equipe}}{{else}}{{/if}} {{armure.name}} {{#if armure.system.malus}} ({{armure.system.malus}}) diff --git a/templates/actor/blessure.hbs b/templates/actor/blessure.hbs index ef6ec483..095258d2 100644 --- a/templates/actor/blessure.hbs +++ b/templates/actor/blessure.hbs @@ -33,10 +33,5 @@ {{#if system.origine}}Par {{system.origine}}{{/if}} {{#if system.localisation}}{{system.localisation}}{{/if}} - - - -   - - + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=this options=@root.options}}
  • diff --git a/templates/actor/chirurgie.html b/templates/actor/chirurgie.hbs similarity index 71% rename from templates/actor/chirurgie.html rename to templates/actor/chirurgie.hbs index 4c9aba22..80efe8cf 100644 --- a/templates/actor/chirurgie.html +++ b/templates/actor/chirurgie.hbs @@ -10,14 +10,9 @@
  • - {{tache.name}} + {{tache.name}} ({{tache.system.points_de_tache_courant}}/{{tache.system.points_de_tache}}) -
    - - -   - -
    + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=tache options=@root.options}}
  • {{/if}} {{/each}} diff --git a/templates/actor/combat.html b/templates/actor/combat.html index 8179a27b..a7765cbd 100644 --- a/templates/actor/combat.html +++ b/templates/actor/combat.html @@ -1,10 +1,10 @@
    • - Armes et Défenses - Niveau - +dom - - Initiative + Armes et Défenses + Niveau + +dom + + Initiative
    • {{#each combat as |arme key|}}
    • - + {{#if arme.img}} @@ -31,7 +31,7 @@ {{#each esquives as |esq key|}}
    • - + {{esq.name}} @@ -47,26 +47,20 @@ \ No newline at end of file diff --git a/templates/actor/commerce-actor-sheet.html b/templates/actor/commerce-actor-sheet.html index dd89938b..e212dd93 100644 --- a/templates/actor/commerce-actor-sheet.html +++ b/templates/actor/commerce-actor-sheet.html @@ -39,46 +39,13 @@ {{editor description target="system.description" button=true owner=options.isOwner editable=options.isOwner engine="prosemirror"}}
      - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire.html"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire.hbs"}} {{#unless system.illimite}} {{#if @root.options.isObserver}}
      - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.html"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.hbs"}} {{/if}} {{/unless}} - {{!-- -
      -
      -
        -
      • - - - - - -
      • - {{#each (trier system.services) as |service key|}} -
      • - - - - -
        - - {{#unless @root.disabled}} - - - {{/unless}} -
        -
      • - {{/each}} -
      -
      - --}}
      {{> "systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.html"}}
      diff --git a/templates/actor/commerce-inventaire-item.hbs b/templates/actor/commerce-inventaire-item.hbs index b6548b1c..7cf0f09d 100644 --- a/templates/actor/commerce-inventaire-item.hbs +++ b/templates/actor/commerce-inventaire-item.hbs @@ -39,23 +39,7 @@ {{/if}} /> {{/unless}} - - {{#if options.isOwner}} - - {{#unless (and (eq item.type 'conteneur') (not vide))}} - - {{#if (or item.parent.system.illimite (ne item.system.quantite 0))}} - - {{/if}} - {{/unless}} - {{/if}} - {{#unless (and (eq item.type 'conteneur') (not vide))}} - {{#if (or item.parent.system.illimite (gt item.system.quantite 0))}} - - {{/if}} - - {{/unless}} - + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=item options=@root.options}}
    • {{/if}} {{/unless}} \ No newline at end of file diff --git a/templates/actor/commerce-inventaire.html b/templates/actor/commerce-inventaire.hbs similarity index 100% rename from templates/actor/commerce-inventaire.html rename to templates/actor/commerce-inventaire.hbs diff --git a/templates/actor/comp-creature.html b/templates/actor/comp-creature.hbs similarity index 81% rename from templates/actor/comp-creature.html rename to templates/actor/comp-creature.hbs index c22297f8..2baf2420 100644 --- a/templates/actor/comp-creature.html +++ b/templates/actor/comp-creature.hbs @@ -4,7 +4,7 @@
        {{#each (trier competences) as |comp key|}}
      • - + {{comp.name}} @@ -23,12 +23,7 @@ {{#unless @root.options.vueDetaillee}}disabled{{/unless}} {{else}}disabled{{/if}} /> - {{#if @root.options.vueDetaillee}} -
        - - -
        - {{/if}} + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=comp options=@root.options}}
      • {{/each}}
      diff --git a/templates/actor/comp-possession.html b/templates/actor/comp-possession.hbs similarity index 57% rename from templates/actor/comp-possession.html rename to templates/actor/comp-possession.hbs index c82d584a..8d726d77 100644 --- a/templates/actor/comp-possession.html +++ b/templates/actor/comp-possession.hbs @@ -4,11 +4,8 @@ {{#each possessions as |possession key|}}
    • - {{possession.name}} -
      - - -
      + {{possession.name}} + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=possession options=@root.options}}
    • {{/each}} diff --git a/templates/actor/competence-categorie.html b/templates/actor/competence-categorie.html index 8c1e8122..626731b7 100644 --- a/templates/actor/competence-categorie.html +++ b/templates/actor/competence-categorie.html @@ -14,17 +14,17 @@ sort {{/if}}
      - + Arch. - + {{#if @root.options.isGM}} - + {{/if}}
      {{/if}} {{#each competences as |comp key|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence.html" comp}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence.hbs" comp}} {{/each}}
    diff --git a/templates/actor/competence.html b/templates/actor/competence.hbs similarity index 85% rename from templates/actor/competence.html rename to templates/actor/competence.hbs index fb1624de..1f82426b 100644 --- a/templates/actor/competence.html +++ b/templates/actor/competence.hbs @@ -1,7 +1,7 @@ {{#unless system.isHidden}}
  • - + {{name}} @@ -46,13 +46,8 @@ - - {{#if @root.options.isGM}} - - {{/if}} -   - + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=this options=@root.options}} {{/if}}
  • {{/unless}} \ No newline at end of file diff --git a/templates/actor/dragon-queue.html b/templates/actor/dragon-queue.hbs similarity index 61% rename from templates/actor/dragon-queue.html rename to templates/actor/dragon-queue.hbs index 5e2664a9..0d6212e5 100644 --- a/templates/actor/dragon-queue.html +++ b/templates/actor/dragon-queue.hbs @@ -7,11 +7,5 @@ {{/if}} {{queue.name}} -
    - - - {{#if queue.system.refoulement}} - Refouler - {{/if}} -
    + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=queue options=@root.options}} diff --git a/templates/actor/dragon-queues.html b/templates/actor/dragon-queues.html index c04ef0ff..e2b565b4 100644 --- a/templates/actor/dragon-queues.html +++ b/templates/actor/dragon-queues.html @@ -6,10 +6,10 @@
      {{#each queues as |queue key|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.html" queue=queue key=key}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.hbs" queue=queue key=key}} {{/each}} {{#each ombres as |ombre key|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.html" queue=ombre key=key}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.hbs" queue=ombre key=key}} {{/each}}
    {{/if}} diff --git a/templates/actor/dragon-souffles.html b/templates/actor/dragon-souffles.hbs similarity index 62% rename from templates/actor/dragon-souffles.html rename to templates/actor/dragon-souffles.hbs index c5839a73..165589b5 100644 --- a/templates/actor/dragon-souffles.html +++ b/templates/actor/dragon-souffles.hbs @@ -5,10 +5,7 @@
  • {{souffle.name}} -
    - - -
    + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=souffle options=@root.options}}
  • {{/each}}
diff --git a/templates/actor/dragon-tetes.html b/templates/actor/dragon-tetes.hbs similarity index 62% rename from templates/actor/dragon-tetes.html rename to templates/actor/dragon-tetes.hbs index f05c8f10..672ab156 100644 --- a/templates/actor/dragon-tetes.html +++ b/templates/actor/dragon-tetes.hbs @@ -5,10 +5,7 @@
  • {{tete.name}} -
    - - -
    + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=tete options=@root.options}}
  • {{/each}} diff --git a/templates/actor/haut-revant.hbs b/templates/actor/haut-revant.hbs index 0932a2f3..340ed9c4 100644 --- a/templates/actor/haut-revant.hbs +++ b/templates/actor/haut-revant.hbs @@ -10,7 +10,7 @@ {{/if}}
  • - Demi rêve : + Demi rêve : {{#if options.isGM}} {{caseTmr-label system.reve.tmrpos.coord}} @@ -28,9 +28,9 @@
  • {{> "systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.hbs"}}
    -{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-signes-draconiques.html"}} -{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-rencontres.html"}} -{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts.html"}} -{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts-reserve.html"}} -{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-meditations.html"}} +{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-signes-draconiques.hbs"}} +{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-rencontres.hbs"}} +{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts.hbs"}} +{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts-reserve.hbs"}} +{{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-meditations.hbs"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/hr-casetmrs.hbs"}} diff --git a/templates/actor/hr-casetmrs.hbs b/templates/actor/hr-casetmrs.hbs index 9a292f1d..8d558ebf 100644 --- a/templates/actor/hr-casetmrs.hbs +++ b/templates/actor/hr-casetmrs.hbs @@ -6,11 +6,7 @@ {{casetmr.name}} {{casetmr.system.coord}} - {{caseTmr-label casetmr.system.coord}} -
    - -   - -
    + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=casetmr options=@root.options}} {{/each}} diff --git a/templates/actor/hr-meditations.html b/templates/actor/hr-meditations.hbs similarity index 61% rename from templates/actor/hr-meditations.html rename to templates/actor/hr-meditations.hbs index af9dc52e..dae569de 100644 --- a/templates/actor/hr-meditations.html +++ b/templates/actor/hr-meditations.hbs @@ -5,12 +5,7 @@
  • {{meditation.name}} - {{meditation.system.competence}} -
    - - -   - -
    + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=meditation options=@root.options}}
  • {{/each}} diff --git a/templates/actor/hr-rencontres.html b/templates/actor/hr-rencontres.hbs similarity index 84% rename from templates/actor/hr-rencontres.html rename to templates/actor/hr-rencontres.hbs index d049c815..fc649a33 100644 --- a/templates/actor/hr-rencontres.html +++ b/templates/actor/hr-rencontres.hbs @@ -10,9 +10,7 @@ {{#if rencontre.system.date}} {{upperFirst rencontre.system.heure}}, le {{rencontre.system.date}} {{/if}} -
    - -
    + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=rencontre options=@root.options}} {{/each}} diff --git a/templates/actor/hr-signes-draconiques.html b/templates/actor/hr-signes-draconiques.hbs similarity index 79% rename from templates/actor/hr-signes-draconiques.html rename to templates/actor/hr-signes-draconiques.hbs index 16afeb28..1a190bd6 100644 --- a/templates/actor/hr-signes-draconiques.html +++ b/templates/actor/hr-signes-draconiques.hbs @@ -6,9 +6,7 @@ {{signe.name}} {{signe.system.difficulte}} -
    - -
    + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=signe options=@root.options}} {{/each}} diff --git a/templates/actor/hr-sorts-reserve.html b/templates/actor/hr-sorts-reserve.hbs similarity index 69% rename from templates/actor/hr-sorts-reserve.html rename to templates/actor/hr-sorts-reserve.hbs index 1e338dea..b048be51 100644 --- a/templates/actor/hr-sorts-reserve.html +++ b/templates/actor/hr-sorts-reserve.hbs @@ -1,8 +1,5 @@ {{#if sortreserves.length}} -

    Sorts en Réserve{{#if options.isGM}} - -{{/if}} -

    +

    Sorts en Réserve

    diff --git a/templates/actor/hr-sorts.html b/templates/actor/hr-sorts.hbs similarity index 67% rename from templates/actor/hr-sorts.html rename to templates/actor/hr-sorts.hbs index 0f9d1c72..edde88da 100644 --- a/templates/actor/hr-sorts.html +++ b/templates/actor/hr-sorts.hbs @@ -15,16 +15,7 @@ {{#if sort.system.caseTMRspeciale}}{{sort.system.caseTMRspeciale}}{{else}}{{upperFirst sort.system.caseTMR}}{{/if}}
    R{{itemSort-spaceIfText sort.system.difficulte}} r{{itemSort-spaceIfText sort.system.ptreve}} -
    - - - - {{#if (and @root.options.isGM (not sort.system.isrituel))}} - - - - {{/if}} -
    + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=sort options=@root.options}} {{/each}} diff --git a/templates/actor/inventaire-item.hbs b/templates/actor/inventaire-item.hbs index f604d783..26137e2d 100644 --- a/templates/actor/inventaire-item.hbs +++ b/templates/actor/inventaire-item.hbs @@ -31,27 +31,6 @@ {{numberFormat item.system.encTotal decimals=2}} {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=item options=options}} - {{!-- - {{#if options.isOwner}} - {{#unless item.estContenu}} - {{#if item.equipable}} - {{#if item.system.equipe}}{{else}}{{/if}} - {{/if}} - {{/unless}} - - -   - {{#if (ne item.system.quantite 0)}} - - {{/if}} - {{/if}} - - {{#if options.isOwner}} - {{#if item.system.actionPrincipale}} - {{item.system.actionPrincipale}} - {{/if}} - {{/if}} - --}} {{/if}} {{/unless}} diff --git a/templates/actor/inventaire-monnaie.html b/templates/actor/inventaire-monnaie.hbs similarity index 79% rename from templates/actor/inventaire-monnaie.html rename to templates/actor/inventaire-monnaie.hbs index 6553cbb2..6421a15d 100644 --- a/templates/actor/inventaire-monnaie.html +++ b/templates/actor/inventaire-monnaie.hbs @@ -21,12 +21,9 @@ {{/if}} - - {{#if @root.options.isOwner}} - - - {{/if}} - + {{#if @root.options.isOwner}} + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=signe options=@root.options}} + {{/if}} {{/each}} diff --git a/templates/actor/item-action-controls.hbs b/templates/actor/item-action-controls.hbs new file mode 100644 index 00000000..5027b35c --- /dev/null +++ b/templates/actor/item-action-controls.hbs @@ -0,0 +1,16 @@ + + {{#each item.actions as |action|}} + {{#if action.placeholder}} +   + {{/if}} + {{#if (item-action-applies action ../item ../options)}} + + {{#if (item-action-icon action ../item)}} + + {{else}} + {{action.label}} + {{/if}} + + {{/if}} + {{/each}} + diff --git a/templates/actor/jeus.hbs b/templates/actor/jeus.hbs index 2d790788..0baff5bd 100644 --- a/templates/actor/jeus.hbs +++ b/templates/actor/jeus.hbs @@ -3,13 +3,8 @@ diff --git a/templates/actor/liens-suivants.hbs b/templates/actor/liens-suivants.hbs index 919f702b..04ec2d58 100644 --- a/templates/actor/liens-suivants.hbs +++ b/templates/actor/liens-suivants.hbs @@ -3,20 +3,20 @@ {{#each subacteurs.suivants as |suivant id|}}
  • - + {{suivant.name}} {{#if suivant.ephemere}} {{else}} - + {{>'systems/foundryvtt-reve-de-dragon/templates/coeur/afficher-coeur.hbs' numero=1 courant=suivant.coeur prochain=suivant.prochainCoeur}} {{>'systems/foundryvtt-reve-de-dragon/templates/coeur/afficher-coeur.hbs' numero=2 courant=suivant.coeur prochain=suivant.prochainCoeur}} {{>'systems/foundryvtt-reve-de-dragon/templates/coeur/afficher-coeur.hbs' numero=3 courant=suivant.coeur prochain=suivant.prochainCoeur}} {{>'systems/foundryvtt-reve-de-dragon/templates/coeur/afficher-coeur.hbs' numero=4 courant=suivant.coeur prochain=suivant.prochainCoeur}} - + {{#if (gte suivant.coeur 1)}} Tendre moment {{/if}} diff --git a/templates/actor/maladies-poisons.html b/templates/actor/maladies-poisons.hbs similarity index 50% rename from templates/actor/maladies-poisons.html rename to templates/actor/maladies-poisons.hbs index a97fa240..6177c5e2 100644 --- a/templates/actor/maladies-poisons.html +++ b/templates/actor/maladies-poisons.hbs @@ -2,32 +2,29 @@

    Maladies & Poisons:

    • - Nom - Type - Remèdes - Edition + Nom + Type + Remèdes + Edition
    • {{#each maladiesPoisons as |maladie key|}}
    • - + {{#if (or @root.options.isGM maladie.system.identifie)}} {{maladie.name}} {{else}} Inconnue {{/if}} - {{maladie.type}} - + {{maladie.type}} + {{#if (or @root.options.isGM maladie.system.remedesconnus)}} {{maladie.system.remedes}} {{else}} Remèdes Inconnus {{/if}} -
      - - -
      + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=maladie options=@root.options}}
    • {{/each}}
    diff --git a/templates/actor/non-haut-revant.hbs b/templates/actor/non-haut-revant.hbs index c91ed10b..ae1f9c54 100644 --- a/templates/actor/non-haut-revant.hbs +++ b/templates/actor/non-haut-revant.hbs @@ -8,7 +8,7 @@ pour rendre le personnage Haut-Rêvant.

    {{/if}}
  • - Seuil de Rêve : + Seuil de Rêve : {{#if options.isGM}} @@ -18,7 +18,7 @@
  • - Refoulement : + Refoulement : {{#if options.isGM}} @@ -29,7 +29,7 @@
  • {{#if system.reve.reve.thanatosused}}
  • - La prochaine queue est une Ombre + La prochaine queue est une Ombre @@ -37,5 +37,5 @@ {{/if}}
    {{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html"}} -{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-souffles.html"}} -{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-tetes.html"}} +{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-souffles.hbs"}} +{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-tetes.hbs"}} diff --git a/templates/actor/oeuvre.hbs b/templates/actor/oeuvre.hbs new file mode 100644 index 00000000..daac7f6f --- /dev/null +++ b/templates/actor/oeuvre.hbs @@ -0,0 +1,9 @@ +
  • + + {{upperFirst typeOeuvre}} + + {{oeuvre.name}} (niveau {{oeuvre.system.niveau}}) + + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=oeuvre options=@root.options}} +
  • + diff --git a/templates/actor/oeuvre.html b/templates/actor/oeuvre.html deleted file mode 100644 index 606bfe64..00000000 --- a/templates/actor/oeuvre.html +++ /dev/null @@ -1,14 +0,0 @@ -
  • - - {{upperFirst typeOeuvre}} - - {{oeuvre.name}} (niveau {{oeuvre.system.niveau}}) - -
    - - -   - -
    -
  • - diff --git a/templates/actor/oeuvres.html b/templates/actor/oeuvres.hbs similarity index 61% rename from templates/actor/oeuvres.html rename to templates/actor/oeuvres.hbs index e413334f..50cffcd1 100644 --- a/templates/actor/oeuvres.html +++ b/templates/actor/oeuvres.hbs @@ -1,18 +1,18 @@

    Oeuvres diverses

    Créer une oeuvre
      {{#each (trier chants) as |chant id|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=chant typeOeuvre="Chant" classOeuvre="chant-label"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.hbs" oeuvre=chant typeOeuvre="Chant" classOeuvre="action-chant list-item-label"}} {{/each}} {{#each (trier musiques) as |musique id|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=musique typeOeuvre="Musique" classOeuvre="musique-label"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.hbs" oeuvre=musique typeOeuvre="Musique" classOeuvre="action-musique list-item-label"}} {{/each}} {{#each (trier danses) as |danse id|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=danse typeOeuvre="Danse" classOeuvre="danse-label"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.hbs" oeuvre=danse typeOeuvre="Danse" classOeuvre="action-danse list-item-label"}} {{/each}} {{#each (trier oeuvres) as |oeuvre id|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=oeuvre typeOeuvre=oeuvre.system.competence classOeuvre="oeuvre-label"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.hbs" oeuvre=oeuvre typeOeuvre=oeuvre.system.competence classOeuvre="action-oeuvre list-item-label"}} {{/each}} {{#each (trier recettecuisines) as |recette id|}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=recette typeOeuvre="Recette de cuisine" classOeuvre="recettecuisine-label"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.hbs" oeuvre=recette typeOeuvre="Recette de cuisine" classOeuvre="action-recettecuisine list-item-label"}} {{/each}}
    diff --git a/templates/actor/possessions.hbs b/templates/actor/possessions.hbs new file mode 100644 index 00000000..2d9ce67c --- /dev/null +++ b/templates/actor/possessions.hbs @@ -0,0 +1,19 @@ +{{#if possessions.length}} +{{!-- Possession --}} +

    Possession:

    +
      +
    • + Nom + Type +
    • + {{#each possessions as |possession key|}} +
    • + + {{possession.name}} (Conjurer) + + {{possession.system.type}} + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=possession options=@root.options}} +
    • + {{/each}} +
    +{{/if}} diff --git a/templates/actor/possessions.html b/templates/actor/possessions.html deleted file mode 100644 index 31ab3da6..00000000 --- a/templates/actor/possessions.html +++ /dev/null @@ -1,24 +0,0 @@ -{{#if possessions.length}} -{{!-- Possession --}} -

    Possession:

    -
      -
    • - Nom - Type -
    • - {{#each possessions as |possession key|}} -
    • - - {{possession.name}} (Conjurer) - - {{possession.system.type}} -
      - - -   - -
      -
    • - {{/each}} -
    -{{/if}} diff --git a/templates/actor/resonances.hbs b/templates/actor/resonances.hbs index a0dbdea6..1e1eb1fe 100644 --- a/templates/actor/resonances.hbs +++ b/templates/actor/resonances.hbs @@ -6,6 +6,8 @@
  • {{actor.name}} + + {{!-- {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=oeuvre options=@root.options}} --}}
    diff --git a/templates/actor/taches.html b/templates/actor/taches.hbs similarity index 60% rename from templates/actor/taches.html rename to templates/actor/taches.hbs index 7a8d54cb..cb88bc04 100644 --- a/templates/actor/taches.html +++ b/templates/actor/taches.hbs @@ -4,16 +4,11 @@ {{#unless (eq tache.system.competence 'Chirurgie')}}
  • - {{tache.name}} + {{tache.name}} ({{tache.system.points_de_tache_courant}}{{#if (or @root.options.isGM (not tache.system.cacher_points_de_tache)) }}/{{tache.system.points_de_tache}}{{/if}}) -
    - - -   - -
    + {{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=tache options=@root.options}}
  • {{/unless}} {{/each}} diff --git a/templates/item/potion-sheet.hbs b/templates/item/potion-sheet.hbs index ede90bbf..fe6429b0 100644 --- a/templates/item/potion-sheet.hbs +++ b/templates/item/potion-sheet.hbs @@ -5,10 +5,10 @@

    {{#if options.isOwned}} - Consommer + Consommer {{/if}} {{#if enchantable}} - Enchanter + Enchanter {{/if}} From 800b4a2f324fa8d80ba4584563aba24d33bd87d4 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 19 Jan 2025 00:49:58 +0100 Subject: [PATCH 14/16] Remove unused import --- module/rdd-rolltables.js | 1 - 1 file changed, 1 deletion(-) diff --git a/module/rdd-rolltables.js b/module/rdd-rolltables.js index d24d474b..8ad7ed36 100644 --- a/module/rdd-rolltables.js +++ b/module/rdd-rolltables.js @@ -1,4 +1,3 @@ -import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js"; import { CompendiumTable, CompendiumTableHelpers, SystemCompendiums } from "./settings/system-compendiums.js"; export class RdDRollTables { From 9d66a479c422d1ff26adb3928c28b0e699db0289 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 19 Jan 2025 01:17:38 +0100 Subject: [PATCH 15/16] Heures des Queues lors de la nuit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit L'heure des queues ajoutées à fin chateau dormant sont maintenant décalées d'une minute dans le passé pour s'appliquer correctement 12 heures draconiques à partir de vaisseau (et non pas --- module/item/blessure.js | 2 +- module/item/maladie.js | 2 +- module/item/ombre.js | 9 +++------ module/item/poison.js | 2 +- module/item/queue.js | 5 +++-- module/item/rencontre.js | 2 +- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/module/item/blessure.js b/module/item/blessure.js index d028a745..74365fb0 100644 --- a/module/item/blessure.js +++ b/module/item/blessure.js @@ -165,7 +165,7 @@ export class RdDItemBlessure extends RdDItem { } async calculerFinPeriodeTemporel(debut) { - return await debut.nouveauJour().addJours(this.system.gravite); + return debut.nouveauJour().addJours(this.system.gravite); } async onFinPeriode(oldTimestamp, newTimestamp) { diff --git a/module/item/maladie.js b/module/item/maladie.js index bdf85e04..40c85c42 100644 --- a/module/item/maladie.js +++ b/module/item/maladie.js @@ -10,7 +10,7 @@ export class RdDItemMaladie extends RdDItem { } async calculerFinPeriodeTemporel(debut) { - return await debut.addPeriode(this.system.periode.nombre, this.system.periode.unite); + return debut.addPeriode(this.system.periode.nombre, this.system.periode.unite); } async onFinPeriode(oldTimestamp, newTimestamp) { diff --git a/module/item/ombre.js b/module/item/ombre.js index b543901a..baa5b040 100644 --- a/module/item/ombre.js +++ b/module/item/ombre.js @@ -1,11 +1,8 @@ -import { RdDItem } from "../item.js"; +import { RdDItemQueue } from "./queue.js"; + +export class RdDItemOmbre extends RdDItemQueue { -export class RdDItemOmbre extends RdDItem { static get defaultIcon() { return "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp"; } - - async calculerFinPeriodeTemporel(debut) { - return await debut.appliquerDuree(this.system.duree, this.parent); - } } diff --git a/module/item/poison.js b/module/item/poison.js index 75d7bf83..41515119 100644 --- a/module/item/poison.js +++ b/module/item/poison.js @@ -8,7 +8,7 @@ export class RdDItemPoison extends RdDItem { } async calculerFinPeriodeTemporel(debut) { - return await debut.addPeriode(this.system.periode.nombre, this.system.periode.unite) ; + return debut.addPeriode(this.system.periode.nombre, this.system.periode.unite) ; } async onFinPeriode(oldTimestamp, newTimestamp) { diff --git a/module/item/queue.js b/module/item/queue.js index c21d1dbd..7b117828 100644 --- a/module/item/queue.js +++ b/module/item/queue.js @@ -6,8 +6,9 @@ export class RdDItemQueue extends RdDItem { return "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp"; } - async calculerFinPeriodeTemporel(debut) { + async calculerFinPeriodeTemporel(timestamp) { + // décaller le début pour calcul correct si la queue dure 12h + const debut = timestamp.addMinutes(timestamp.indexMinute == 0 ? -1 : 0); return await debut.appliquerDuree(this.system.duree, this.parent); } - } \ No newline at end of file diff --git a/module/item/rencontre.js b/module/item/rencontre.js index 0ef89063..ecc3e27b 100644 --- a/module/item/rencontre.js +++ b/module/item/rencontre.js @@ -74,7 +74,7 @@ export class RdDRencontre extends RdDItem { } async calculerFinPeriodeTemporel(debut) { - return await debut.nouvelleHeure().addHeures(12); + return debut.nouvelleHeure().addHeures(12); } } From 7d135a214ff1dc0b97510625bfda2b37863861af Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 19 Jan 2025 00:50:24 +0100 Subject: [PATCH 16/16] Version 12.0.36 --- changelog.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 30ad6813..3ba0e277 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,17 @@ # 12.0 -## 12.0.36 - La cartte d'Astrobazzarh -- Fix: la commande /tmra fonctionne correctement sans paramètres +## 12.0.36 - L'alchimie d'Astrobazzarh +- Nouveautés + - ajout d'un bouton pour enchanter les potions + - standardisation des boutons d'actions sur les items + - utilisations d'icones pour les actions de l'inventaire +- Corrections: + - la commande /tmra sans paramètres fonctionne + - les jets d'encaissement depuis le tchat fonctionnent + - affichage de la vie/endurance en cas de blessures et remise à neuf + - les queues durant 12 heures ajoutées début Vaisseau ne durent plus 24 heures +- Compendiums + - Corrections des remedes enchantables + - Corrections de descriptions pour proposer les jet de dés ## 12.0.35 - La Solution d'Astrobazzarh - Fix problème d'initialisation des feuilles d'items