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 @@