diff --git a/changelog.md b/changelog.md index 3ba0e277..14472e4e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,10 @@ # 12.0 +## 12.0.37 - Les enchantements d'Astrobazzarh +- les potions ont un état, seules les potions liquides sont enchantables +- les lancements de sorts du jour sont conservés jusqu'à chateau dormant +- lorsqu'un joueur souhaite enchanter une potion, les sorts d'enchantements/purification/permanence doivent avoir été lancés auparavant +- on peut enchanter des gemmes exactement comme des potions + ## 12.0.36 - L'alchimie d'Astrobazzarh - Nouveautés - ajout d'un bouton pour enchanter les potions diff --git a/module/actor-sheet.js b/module/actor-sheet.js index dfc00f87..447188b5 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -19,7 +19,6 @@ import { RdDEmpoignade } from "./rdd-empoignade.js"; import { RdDBaseActorSangSheet } from "./actor/base-actor-sang-sheet.js"; import { RdDCoeur } from "./coeur/rdd-coeur.js"; import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js"; -import { RdDItemRace } from "./item/race.js"; import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js"; /* -------------------------------------------- */ diff --git a/module/actor.js b/module/actor.js index ffa65fbc..c8dd832c 100644 --- a/module/actor.js +++ b/module/actor.js @@ -166,22 +166,29 @@ export class RdDActor extends RdDBaseActorSang { } /* -------------------------------------------- */ - async $perteRevePotionsEnchantees() { - const potionUpdates = this.itemTypes[ITEM_TYPES.potion].map(it => it.perteRevePotion()) + async $perteReveEnchantementsChateauDormants() { + const toUpdate = this.items.filter(it => [ITEM_TYPES.potion, ITEM_TYPES.gemme].includes(it.type)) + .map(it => it.perteReveChateauDormant()) .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 - }))) + + if (toUpdate.length > 0) { + console.log('perte de rêve des enchantements', toUpdate) + const messageUpdates = await Promise.all( + toUpdate.map(async it => await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-pertereve-enchantement-chateaudormant.hbs`, it))) ChatMessage.create({ whisper: ChatUtility.getOwners(this), content: messageUpdates.reduce(Misc.joining('
')) }) - await this.updateEmbeddedDocuments('Item', potionUpdates); + await this.updateEmbeddedDocuments('Item', toUpdate.map(it => it.update)); + } + } + + async $suppressionLancementsSort() { + const updates = this.itemTypes[ITEM_TYPES.sort] + .filter(it => it.system.lancements.length > 0) + .map(it => { return { _id: it.id, 'system.lancements': [] } }) + if (updates.length > 0) { + await this.updateEmbeddedDocuments('Item', updates) } } @@ -277,13 +284,14 @@ export class RdDActor extends RdDBaseActorSang { }; await this._recuperationSante(message) - await this._recupereMoralChateauDormant(message); - await this._recupereChance(); - await this.transformerStress(); - await this.retourSeuilDeReve(message); - await this.setBonusPotionSoin(0); - await this.retourSust(message); - await this.$perteRevePotionsEnchantees(); + await this._recupereMoralChateauDormant(message) + await this._recupereChance() + await this.transformerStress() + await this.retourSeuilDeReve(message) + await this.setBonusPotionSoin(0) + await this.retourSust(message) + await this.$perteReveEnchantementsChateauDormants() + await this.$suppressionLancementsSort() await RdDCoeur.applyCoeurChateauDormant(this, message) if (message.content != "") { message.content = `A la fin Chateau Dormant, ${message.content}
Un nouveau jour se lève`; @@ -1204,9 +1212,9 @@ export class RdDActor extends RdDBaseActorSang { } } - async actionHerbe(item, onActionItem = async () => { }) { + async fabriquerDecoctionHerbe(item) { if (item.isHerbeAPotion()) { - return DialogFabriquerPotion.create(this, item, onActionItem); + return DialogFabriquerPotion.create(this, item); } return; } @@ -1726,6 +1734,17 @@ export class RdDActor extends RdDBaseActorSang { if (rollData.isSortReserve) { await this.sortMisEnReserve(selectedSort, rollData.competence, rollData.tmr.coord, Number(selectedSort.system.ptreve_reel)); } + else { + console.log('lancement de sort', rollData.selectedSort) + const precedents = rollData.selectedSort.system.lancements ?? [] + const lancements = [...precedents, { + timestamp: game.system.rdd.calendrier.getTimestamp(), + reve: rollData.selectedSort.system.ptreve_reel + }] + await this.updateEmbeddedDocuments('Item', + [{ _id: rollData.selectedSort._id, 'system.lancements': lancements }] + ) + } } else { rollData.depenseReve = 0; @@ -2849,12 +2868,13 @@ export class RdDActor extends RdDBaseActorSang { /* -------------------------------------------- */ async fabriquerPotion(herbeData) { - let newPotion = { + const 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, + etat: 'Liquide', herbe: herbeData.name, rarete: herbeData.system.rarete, herbebrins: herbeData.nbBrins, @@ -2862,29 +2882,23 @@ export class RdDActor extends RdDBaseActorSang { description: "" } } - await this.createEmbeddedDocuments('Item', [newPotion], { renderSheet: true }); - - let newQuantite = herbeData.system.quantite - herbeData.nbBrins; - let messageData = { - alias: this.getAlias(), - nbBrinsReste: newQuantite, - potion: newPotion, - herbe: herbeData - } - this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins); + await this.createEmbeddedDocuments('Item', [newPotion]) + await 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) - }); + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, { + alias: this.getAlias(), + nbBrinsReste: herbeData.system.quantite - herbeData.nbBrins, + potion: newPotion, + herbe: herbeData + }) + }) } /* -------------------------------------------- */ async diminuerQuantiteObjet(id, nb, options = { supprimerSiZero: false }) { - const item = this.getItem(id); - if (item) { - await item.diminuerQuantite(nb, options); - } + await this.getItem(id)?.diminuerQuantite(nb, options); } /* -------------------------------------------- */ diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index b7a2be14..309e538f 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -108,7 +108,6 @@ export class RdDBaseActorSheet extends ActorSheet { 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)); diff --git a/module/dialog-fabriquer-potion.js b/module/dialog-fabriquer-potion.js index a3e2b5d7..43b39fac 100644 --- a/module/dialog-fabriquer-potion.js +++ b/module/dialog-fabriquer-potion.js @@ -1,88 +1,79 @@ -import { Grammar } from "./grammar.js"; import { Misc } from "./misc.js"; import { RdDUtility } from "./rdd-utility.js"; export class DialogFabriquerPotion extends Dialog { /* -------------------------------------------- */ - static async create(actor, item, onActionItem) { - const min = DialogFabriquerPotion.nombreBrinsMinimum(item); - if (item.system.quantite < min) { - ui.notifications.warn(`Vous avez ${item.system.quantite} brins de ${item.name}, il en faut au moins ${min} pour faire une potion!`); - return; + static async create(actor, item) { + const brinsMinimum = DialogFabriquerPotion.nombreBrinsMinimum(item) + if (item.system.quantite < brinsMinimum) { + ui.notifications.warn(`Vous avez ${item.system.quantite} brins de ${item.name}, il en faut au moins ${brinsMinimum} pour faire une potion!`) + return } - let potionData = DialogFabriquerPotion.prepareData(actor, item); + const potionData = DialogFabriquerPotion.prepareData(item, brinsMinimum) + const options = { classes: ["dialogfabriquerpotion"], width: 600, height: 160, 'z-index': 99999 } + const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-fabriquer-potion-base.html', potionData) - const html = await renderTemplate( 'systems/foundryvtt-reve-de-dragon/templates/dialog-fabriquer-potion-base.html', potionData); - - let options = { classes: ["dialogfabriquerpotion"], width: 600, height: 160, 'z-index': 99999 }; - new DialogFabriquerPotion(actor, potionData, onActionItem, html, options).render(true); + new DialogFabriquerPotion(actor, potionData, html, options).render(true) } /* -------------------------------------------- */ - static prepareData(actor, item) { - let potionData = foundry.utils.duplicate(item) - potionData.nbBrinsSelect = RdDUtility.buildListOptions( - DialogFabriquerPotion.nombreBrinsMinimum(item), - DialogFabriquerPotion.nombreBrinsOptimal(item)); - potionData.nbBrins = Math.min(potionData.system.quantite, DialogFabriquerPotion.nombreBrinsOptimal(potionData)); - potionData.herbebonus = item.system.niveau; - potionData.buttonName = "Fabriquer"; - return potionData; + static prepareData(item, brinsMinimum) { + const brinsOptimal = DialogFabriquerPotion.nombreBrinsOptimal(item) + return foundry.utils.mergeObject(foundry.utils.duplicate(item), { + nbBrinsSelect: RdDUtility.buildListOptions(brinsMinimum, brinsOptimal), + nbBrins: Math.min(item.system.quantite, brinsOptimal), + herbebonus: item.system.niveau + }) } /* -------------------------------------------- */ - constructor(actor, potionData, onActionItem, html, options) { + constructor(actor, potionData, html, options) { const conf = { title: `Fabriquer une potion de ${potionData.system.categorie}`, content: html, default: 'fabriquer', buttons: { - 'fabriquer': { - label: potionData.buttonName, callback: it => this.onFabriquer() - } + 'fabriquer': { label: "Fabriquer", callback: it => this.onFabriquer() } } - }; + } + super(conf, options) - super(conf, options); - - this.actor = actor; - this.potionData = potionData; - this.onActionItem = onActionItem; + this.actor = actor + this.potionData = potionData } /* -------------------------------------------- */ activateListeners(html) { - super.activateListeners(html); - this.html = html; + super.activateListeners(html) + this.html = html this.html.find("[name='nbBrins']").change(event => { - this.potionData.nbBrins = Misc.toInt(event.currentTarget.value); - const brinsManquants = Math.max(0, DialogFabriquerPotion.nombreBrinsOptimal(this.potionData) - this.potionData.nbBrins); + this.potionData.nbBrins = Misc.toInt(event.currentTarget.value) + const brinsManquants = Math.max(0, DialogFabriquerPotion.nombreBrinsOptimal(this.potionData) - this.potionData.nbBrins) this.potionData.herbebonus = Math.max(0, this.potionData.system.niveau - brinsManquants) - }); + }) } /* -------------------------------------------- */ async onFabriquer() { - await this.html.find("[name='nbBrins']").change(); - await this.actor.fabriquerPotion(this.potionData); - this.close(); - await this.onActionItem() + await this.html.find("[name='nbBrins']").change() + await this.actor.fabriquerPotion(this.potionData) + this.close() } static nombreBrinsMinimum(herbeData) { switch (herbeData.system.categorie ?? '') { - case "Soin": return 1 + Math.max(0, 12 - 2 * herbeData.system.niveau); - case "Repos": return 1 + Math.max(0, 7 - 2 * herbeData.system.niveau); + case "Soin": return 1 + Math.max(0, 12 - 2 * herbeData.system.niveau) + case "Repos": return 1 + Math.max(0, 7 - 2 * herbeData.system.niveau) } - return 1; + return 1 } static nombreBrinsOptimal(herbeData) { switch (herbeData.system.categorie ?? '') { - case "Soin": return 12 - herbeData.system.niveau; - case "Repos": return 7 - herbeData.system.niveau; + case "Soin": return 12 - herbeData.system.niveau + case "Repos": return 7 - herbeData.system.niveau } - return 1; + return 1 } } \ No newline at end of file diff --git a/module/enchantement/dialog-enchanter.js b/module/enchantement/dialog-enchanter.js new file mode 100644 index 00000000..ffa82f56 --- /dev/null +++ b/module/enchantement/dialog-enchanter.js @@ -0,0 +1,177 @@ +import { ITEM_TYPES } from "../constants.js" +import { RdDItemSort } from "../item-sort.js" +import { Misc } from "../misc.js" + +export const ACTION_ITEM_ENCHANTER = { + code: 'item-enchanter', label: 'Enchanter', icon: it => 'fa-solid fa-sparkles', + filter: it => game.user.isGM || DialogEnchanter.isEnchantable(it), + optionsFilter: options => options.editable, + action: (item, actor) => DialogEnchanter.enchanter(item) +} + +export class DialogEnchanter extends Dialog { + + static isEnchantable(item) { + if (!item.isEnchantementPossible) { + return false + } + if (game.user.isGM) { + return true + } + if (item.system.prpermanent) { + return false + } + if (!item.parent?.isHautRevant()) { + return false + } + return RdDItemSort.lancements(RdDItemSort.findEnchantement(item.parent)) > 0 + || RdDItemSort.lancements(RdDItemSort.findPurification(item.parent)) > 0 + || RdDItemSort.lancements(RdDItemSort.findPermanence(item.parent)) > 0 + } + + static dateEnchantement() { + return game.system.rdd.calendrier.getTimestamp().debutJournee().indexDate + } + + static async enchanter(item) { + const actor = item.parent + const sorts = { + enchantement: RdDItemSort.findEnchantement(actor), + purification: RdDItemSort.findPurification(actor), + permanence: RdDItemSort.findPermanence(actor) + } + const nouveauxpr = (sorts.enchantement?.system.lancements ?? []).map(it => it.reve) + const purification = (sorts.purification?.system.lancements ?? []).find(it => true) + const permanence = (sorts.permanence?.system.lancements ?? []).find(it => true) + + const enchanter = { + type: item.type == ITEM_TYPES.potion ? 'potion' : Misc.typeName('Item', item.type), + actor: actor, + item: item, + reve: item.system.pr, + sorts: sorts, + nouveauxpr: nouveauxpr, + purification: purification != undefined, + permanence: permanence != undefined, + options: { isGM: game.user.isGM } + } + if (!item.isEnchantementPossible) { + ui.notifications.info("Seuls les liquides et les gemmes sont enchantables") + return + } + if (item.system.prpermanent) { + ui.notifications.info(`La ${enchanter.type} est permanente`) + return + } + if (!game.user.isGM) { + if (!(actor?.isPersonnage() || actor?.isHautRevant())) { + ui.notifications.info(`Seul un haut rêvant peut enchanter une ${enchanter.type}`) + return + } + if (item.system.quantite != 1) { + ui.notifications.info(`Impossible d'enchanter ${item.system.quantite} ${enchanter.type}s ${item.system.quantite > 1 ? 'en une seule fois' : ''}`) + return + } + if (!(nouveauxpr.length > 0 || purification || permanence)) { + ui.notifications.info("Le haut-rêvant n'a lancé de rituel d'enchantement") + return + } + if (item.system.magique && item.system.purifie && !purification && !permanence) { + ui.notifications.info(`La ${enchanter.type} est déjà enchantée et doit être purifiée`) + return + } + } + + const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/enchantement/dialog-enchanter.hbs`, enchanter) + const dialog = new DialogEnchanter(enchanter, html) + dialog.render(true) + } + + constructor(enchanter, html) { + let options = { classes: ["dialog-enchanter"], width: 400, height: 'fit-content', 'z-index': 99999 } + let conf = { + title: `Enchanter une ${enchanter.type}`, + content: html, + default: "enchanter", + buttons: { + "enchanter": { label: "Enchanter", callback: it => this.onEnchanter() } + } + }; + super(conf, options) + this.html = html + this.enchanter = enchanter + this.item = enchanter.item + } + + activateListeners(html) { + super.activateListeners(html) + this.html = html + this.html.find("input.enchantement").change(event => this.$onSelectEnchantement(event)) + this.html.find("input.reve").change(event => this.$onForceReve(event)) + } + + $onSelectEnchantement(event) { + const addReve = $(event.currentTarget).data('reve') + this.enchanter.idx = $(event.currentTarget).data('idx') + this.enchanter.reve = this.item.system.pr + Number(addReve) + this.html.find("input.reve").val(this.enchanter.reve) + for (let idx = 0; idx < this.enchanter.nouveauxpr.length; idx++) { + if (idx != this.enchanter.idx) { + this.html.find(`.enchantement[data-idx='${idx}']`).prop("checked", false) + } + } + } + + $onForceReve(event) { + const newReve = Number(event.currentTarget.value) + if (this.enchanter.reve != newReve) { + this.enchanter.idx = undefined + } + this.enchanter.reve = newReve + } + + async onEnchanter() { + foundry.utils.mergeObject(this.enchanter, + { + rendrepurifie: this.html.find("input.rendrepurifie").prop("checked"), + rendrepermanent: this.html.find("input.rendrepermanent").prop("checked"), + addreve: this.enchanter.reve != this.item.system.pr + }, + { inplace: true }) + const item = this.enchanter.item + const actor = this.enchanter.actor + + if (this.enchanter.reve == 0) { + await item.update({ + 'system.pr': 0, + 'system.magique': false, + 'system.purifie': false, + 'system.prpermanent': false, + 'system.prdate': 0 + }) + } + else { + const isPurifiee = this.enchanter.addreve + ? (this.enchanter.rendrepurifie && (item.item.system.pr == 0 ? true : item.system.purifie)) + : (this.enchanter.rendrepurifie || item.system.purifie) + await item.update({ + 'system.pr': this.enchanter.reve, + 'system.magique': true, + 'system.purifie': isPurifiee, + 'system.prpermanent': item.system.prpermanent || this.enchanter.rendrepermanent, + 'system.prdate': DialogEnchanter.dateEnchantement() + }) + if (actor) { + if (this.enchanter.rendrepurifie) { + await RdDItemSort.changeLancementsSort(this.enchanter.sorts.purification, it => it.slice(1)); + } + if (this.enchanter.rendrepermanent) { + await RdDItemSort.changeLancementsSort(this.enchanter.sorts.permanence, it => it.slice(1)); + } + if (this.enchanter.addreve && this.enchanter.idx != undefined) { + await RdDItemSort.changeLancementsSort(RdDItemSort.findEnchantement(actor), it => it.toSpliced(this.enchanter.idx, 1)) + } + } + } + } +} \ No newline at end of file diff --git a/module/item-sheet.js b/module/item-sheet.js index 4cfb3985..cedec032 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -2,7 +2,6 @@ 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"; -import { RdDGemme } from "./rdd-gemme.js"; import { HtmlUtility } from "./html-utility.js"; import { ReglesOptionnelles } from "./settings/regles-optionnelles.js"; import { SYSTEM_RDD } from "./constants.js"; @@ -15,6 +14,7 @@ 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"; +import { RdDItemGemme } from "./item/gemme.js"; /** * Extend the basic ItemSheet for RdD specific items @@ -133,10 +133,6 @@ export class RdDItemSheet extends ItemSheet { formData.enchantement = await RdDTextEditor.enrichHTML(this.item.system.enchantement, this.item) formData.sureffet = await RdDTextEditor.enrichHTML(this.item.system.sureffet, this.item) } - if (this.item.type == ITEM_TYPES.gemme) { - formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList(); - RdDGemme.calculDataDerivees(this.item) - } if (this.item.type == ITEM_TYPES.herbe) { if (formData.options.isOwned && ['Soin', 'Repos'].includes(formData.system.categorie)) { @@ -164,7 +160,7 @@ export class RdDItemSheet extends ItemSheet { HtmlUtility.showControlWhen(this.html.find(".item-cout"), ReglesOptionnelles.isUsing('afficher-prix-joueurs') || game.user.isGM || !this.item.isOwned); - HtmlUtility.showControlWhen(this.html.find(".item-magique"), this.item.isMagique()); + HtmlUtility.showControlWhen(this.html.find(".item-magique"), this.item.isMagique); // Everything below here is only needed if the sheet is editable if (!this.options.editable) return; @@ -193,30 +189,26 @@ export class RdDItemSheet extends ItemSheet { }) this.html.find('.creer-tache-livre').click((event) => this._getEventActor(event).creerTacheDepuisLivre(this.item)); - this.html.find('.creer-potion-base').click((event) => this._getEventActor(event).actionHerbe(this.item)); + this.html.find('.creer-potion-base').click((event) => this._getEventActor(event).fabriquerDecoctionHerbe(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 })); this.html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor)) this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event)) if (this.actor) { - // TODO this.html.find('.actionItem').click(event => ItemAction.onActionItem(event, this.actor, this.options)) - + + // TODO: utiliser un itemAction? 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 => this.itemActionDelete(event)); - this.html.find('.item-quantite-plus').click(async event => { await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), 1) - this.render(); - }); + this.render() + }) this.html.find('.item-quantite-moins').click(async event => { await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), -1) - this.render(); - }); + this.render() + }) } const updateItemTimestamp = (path, timestamp) => this.item.update({ [path]: foundry.utils.duplicate(timestamp) }) diff --git a/module/item-sort.js b/module/item-sort.js index e619583f..189f2fba 100644 --- a/module/item-sort.js +++ b/module/item-sort.js @@ -22,7 +22,21 @@ export class RdDItemSort extends Item { } static addSpaceToNonNumeric(value) { - return Number.isNumeric(value) || ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes( String(value).charAt[0]) ? value : ' ' + RdDItemSort.toVar(value) + return Number.isNumeric(value) || ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(String(value).charAt[0]) ? value : ' ' + RdDItemSort.toVar(value) + } + + static lancements(sort) { return sort?.system.lancements.length ?? 0 } + + static findEnchantement(actor) { return RdDItemSort.findSort(actor, 'Enchantement', ['Narcos', 'N']) } + static findPermanence(actor) { return RdDItemSort.findSort(actor, 'Permanence', ['Narcos', 'N']) } + static findPurification(actor) { return RdDItemSort.findSort(actor, 'Purification', ['Narcos', 'N']) } + + static findSort(actor, name, draconics) { + return actor.itemTypes[ITEM_TYPES.sort].find(it => Grammar.includesLowerCaseNoAccent(it.name, name) + && (draconics == undefined || draconics.includes(it.system.draconic))) + } + static async changeLancementsSort(sort, changement) { + await sort?.update({ 'system.lancements': changement(sort.system.lancements) }); } static toVar(value) { @@ -151,5 +165,4 @@ export class RdDItemSort extends Item { .map(it => it.split(':')) .map(it => { return { case: it[0], bonus: it[1] } }); } - } \ No newline at end of file diff --git a/module/item.js b/module/item.js index c51fffe8..3c1859ee 100644 --- a/module/item.js +++ b/module/item.js @@ -41,9 +41,6 @@ const typesObjetsTemporels = [ITEM_TYPES.blessure, ITEM_TYPES.poison, ITEM_TYPES const typesObjetsEquipable = [ITEM_TYPES.arme, ITEM_TYPES.armure, ITEM_TYPES.objet]; const typesEnvironnement = typesInventaireMateriel; const encBrin = 0.00005; // un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc -const encPepin = 0.0007; /* un pépin de gemme = 1/10 cm3 = 1/1000 l = 3.5/1000 kg = 7/2000 kg = 7/1000 enc -densité 3.5 (~2.3 à 4, parfois plus) -- https://www.juwelo.fr/guide-des-pierres/faits-et-chiffres/ - */ export const defaultItemImg = { arme: "systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_gnome.webp", @@ -85,7 +82,6 @@ export const defaultItemImg = { /* -------------------------------------------- */ export class RdDItem extends Item { - static get defaultIcon() { return undefined; } @@ -184,7 +180,6 @@ export class RdDItem extends Item { isCompetenceCreature() { return this.type == ITEM_TYPES.competencecreature } isConteneur() { return this.type == ITEM_TYPES.conteneur; } isMonnaie() { return this.type == ITEM_TYPES.monnaie; } - isPotion() { return this.type == ITEM_TYPES.potion; } isNourritureBoisson() { return this.type == ITEM_TYPES.nourritureboisson; } isService() { return this.type == ITEM_TYPES.service; } @@ -223,6 +218,12 @@ export class RdDItem extends Item { return this.getEnvironnements(milieux).length > 0 } + get nameDisplay() { + return this.isMagique ? (this.name + ' ') : this.name + } + + get isEnchantementPossible() { return false } + getEnvironnements(milieux = undefined) { const environnements = this.isInventaire() ? this.system.environnement : undefined; if (milieux == undefined || !environnements) { @@ -331,7 +332,7 @@ export class RdDItem extends Item { return this.type == ITEM_TYPES.objet && Grammar.includesLowerCaseNoAccent(this.name, 'cristal alchimique') && this.system.quantite > 0; } - isMagique() { + get isMagique() { return this.system.magique } @@ -342,6 +343,7 @@ export class RdDItem extends Item { isNomLike(texte) { return Grammar.includesLowerCaseNoAccent(this.name, texte) } + isNomTypeLike(texte) { return this.isNomLike(texte) || Grammar.includesLowerCaseNoAccent(Misc.typeName(this.type, 'Item'), texte) } @@ -360,8 +362,6 @@ export class RdDItem extends Item { return 0; case ITEM_TYPES.herbe: return this.getEncHerbe(); - case ITEM_TYPES.gemme: - return encPepin * this.system.taille; } return Math.max(this.system.encombrement ?? 0, 0); } @@ -427,10 +427,6 @@ export class RdDItem extends Item { itemSpecificActions() { const actions = ITEM_ACTIONS[this.type] ?? [] - // const actorTypes = actions.actorTypes ?? [ACTOR_TYPES.personnage] - // if (!actorTypes.includes(this.actor?.type)) { - // return [] - // } return actions } diff --git a/module/item/gemme.js b/module/item/gemme.js new file mode 100644 index 00000000..fdf82f44 --- /dev/null +++ b/module/item/gemme.js @@ -0,0 +1,112 @@ +import { RdDItem } from "../item.js"; +import { ACTION_ITEM_ENCHANTER } from "../enchantement/dialog-enchanter.js"; + +const tableGemmes = { + "almaze": { label: "Almaze", couleur: "Blanc" }, + "aquafane": { label: "Aquafane", couleur: "Vert Profond" }, + "asterite": { label: "Astérite", couleur: "Bleu, Violet ou Blanc" }, + "cyanolithe": { label: "Cyanolithe", couleur: "Bleu Intense" }, + "larmededragon": { label: "Larme de Dragon", couleur: "Rouge Intense" }, + "muska": { label: "Muska", couleur: "Violet Profond" }, + "nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense" }, + "nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense, Rose, Vert ou Bleu Pâle" }, + "oeildetigre": { label: "Oeil de Tigre", couleur: "Jaune" }, + "scarlatine": { label: "Scarlatine", couleur: "Rouge Clair ou Orangé" }, + "seliphane": { label: "Séliphane", couleur: "Vert Lumineux" }, + "tournelune": { label: "Tournelune", couleur: "Violet ou Bleu" }, + "zebraide": { label: "Zebraïde", couleur: "Bandes Bicolores, toutes couleurs" } +} + +/** + * un pépin de gemme = 1/10 cm3 = 1/1000 l = 3.5/1000 kg = 7/2000 kg = 7/1000 enc + * densité 3.5 (~2.3 à 4, parfois plus) -- https://www.juwelo.fr/guide-des-pierres/faits-et-chiffres/ + */ +const encPepin = 0.0007; + +/** + * Item pour gérer les gemmes + */ +export class RdDItemGemme extends RdDItem { + + static getGemmeTypeOptionList() { + // TODO: look how to map object key-value pairs + let options = "" + for (let gemmeKey in tableGemmes) { + options += `` + } + return options; + } + + static get defaultIcon() { + return "systems/foundryvtt-reve-de-dragon/icons/gemmes/almaze.webp" + } + + get isEnchantementPossible() { + return this.enchantabilite > 0 + } + + get inertie() { return 7 - Number(this.system.purete) } + get enchantabilite() { return this.system.taille - this.inertie } + + getEnc() { + return encPepin * this.system.taille; + } + + itemSpecificActions() { + return [ACTION_ITEM_ENCHANTER] + } + + prepareDerivedData() { + super.prepareDerivedData() + this.system.cout = (this.system.taille * this.system.purete) + this.system.qualite + this.system.inertie = this.inertie + this.system.enchantabilite = this.enchantabilite + } + + getUtilisation() { + switch (this.system.categorie) { + case 'Alchimie': case 'Autre': case 'AlchimieAutre': + // TODO: distinguer les remèdes alchimiques enchantables/non + return 'alchimie' + case 'Cuisine': + return 'cuisine' + case 'Remede': case 'Repos': case 'Soin': + return 'soins' + } + return '' + } + + getProprietes() { + const proprietes = [ + `Taille: ${this.system.taille}`, + `Pureté: ${this.system.purete}`, + `Inertie: ${this.system.inertie}`, + `Enchantabilité: ${this.system.enchantabilite}` + ] + const proprietesMagiques = this.system.magique ? [ + `Enchantée ${this.system.purifie ? ', purifiée' : ''} ${this.system.prpermanent ? 'permanente' : ''} `, + `Points de rêve: ${this.system.pr}`, + `Puissance: ${this.system.puissance}`, + ] : [] + return proprietes + .concat(proprietesMagiques) + .concat(this._inventaireTemplateChatData()) + .filter(it => it != undefined) + } + + perteReveChateauDormant() { + if (this.system.magique && !this.system.prpermanent && this.system.pr > 0) { + const nouveauReve = Math.max(this.system.pr - 1, 0) + return { + alias: this.parent.getAlias(), + item: this, + update: { + _id: this.id, + 'system.pr': nouveauReve, + 'system.magique': nouveauReve > 0 + } + } + } + return undefined + } +} \ No newline at end of file diff --git a/module/item/item-actions.js b/module/item/item-actions.js index 74e17268..f61d13fd 100644 --- a/module/item/item-actions.js +++ b/module/item/item-actions.js @@ -27,6 +27,12 @@ const _MONTRER = { code: 'item-montrer', label: 'Montrer', icon: it => 'fa-solid fa-comment', action: (item, actor) => item.postItemToChat() } +const _SPLIT = { + code: 'item-split', label: 'Séparer le goupe', icon: it => 'fa-solid fa-unlink', + filter: it => Misc.toInt(it.system.quantite) > 1, + action: (item, actor) => RdDSheetUtility.splitItem(item, actor) +} + const _EDIT = { code: 'item-edit', label: 'Editer', icon: it => 'fa-solid fa-edit', action: (item, actor) => item.sheet.render(true) @@ -69,7 +75,7 @@ const _BOIRE = { 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) + action: (item, actor) => actor.fabriquerDecoctionHerbe(item) } const _OUVRIR = { code: 'item-edit', label: 'Ouvrir', icon: it => 'fa-solid fa-eye', @@ -89,19 +95,6 @@ const _REFOULER = { 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, @@ -109,7 +102,7 @@ const _SORT_RESERVE = { } export const COMMON_ACTIONS = [_EQUIPER] -export const DEFAULT_ACTIONS = [_SPACEHOLDER, _VENDRE, _MONTRER, _EDIT, _DELETE] +export const DEFAULT_ACTIONS = [_SPACEHOLDER, _SPLIT, _VENDRE, _MONTRER, _EDIT, _DELETE] export const ITEM_ACTIONS = { faune: [_CUISINER, _MANGER_CRU], @@ -120,7 +113,6 @@ export const ITEM_ACTIONS = { nourritureboisson: [_MANGER, _BOIRE], ombre: [_REFOULER], plante: [_CUISINER, _MANGER_CRU], - potion: [_CONSOMMER_POTION, _ENCHANTER], queue: [_REFOULER], sort: [_SORT_RESERVE], service: [_ACHAT_SERVICE] @@ -130,7 +122,7 @@ export const ITEM_ACTIONS = { export class ItemAction { static applies(action, item, options) { - return action + return action && item && item.isActionAllowed(action.code) && (!action.filter || action.filter(item)) && (!action.optionsFilter || action.optionsFilter(options)) @@ -146,7 +138,7 @@ export class ItemAction { 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) + 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 f0af84d4..79d73f94 100644 --- a/module/item/potion.js +++ b/module/item/potion.js @@ -1,20 +1,18 @@ -import { ITEM_TYPES } from "../constants.js"; import { Grammar } from "../grammar.js"; import { RdDItem } from "../item.js"; import { SystemCompendiums } from "../settings/system-compendiums.js"; -import { ITEM_ACTIONS } from "./item-actions.js"; -import { DialogEnchanter } from "./potion/dialog-enchanter.js"; +import { ACTION_ITEM_ENCHANTER } from "../enchantement/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' }] +// --- Actions sur les "potions" +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) +} +/** + * Item pour gérer les potions + */ export class RdDItemPotion extends RdDItem { static async herbesSoins() { @@ -33,114 +31,67 @@ export class RdDItemPotion extends RdDItem { return "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp" } + get isEnchantementPossible() { + return this.system.etat == 'Liquide' + } + + itemSpecificActions() { + return [_CONSOMMER_POTION, ACTION_ITEM_ENCHANTER] + } + 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) } - - itemSpecificActions() { - return ITEM_ACTIONS[ITEM_TYPES.potion] - } - - getActions(options = { warnIfNot: true }) { - const actionConsommer = this.prepareAction('Consommer', options.warnIfNot); - if (this.isEnchantable()) { - return [ - actionConsommer, - this.prepareAction('Enchanter', options.warnIfNot) - ] - } - return [ - actionConsommer - ] - } - // TDOD: purifier? getUtilisation() { switch (this.system.categorie) { - case 'Alchimie': case 'AlchimieEnchante': - case 'AlchimieAutre': + case 'Alchimie': case 'Autre': case 'AlchimieAutre': + // TODO: distinguer les remèdes alchimiques enchantables/non return 'alchimie' - case 'Cuisine': return 'cuisine' - case 'Remede': case 'Repos': case 'ReposEnchante': case 'Soin': case 'SoinEnchante': + case 'Cuisine': + return 'cuisine' + case 'Remede': case 'Repos': case 'Soin': return 'soins' } return '' } - _potionChatData() { - return [ - `Rareté: ${this.system.rarete}`, + getProprietes() { + const proprietes = [ + `Rareté: ${this.system.rarete} `, `Catégorie: ${this.system.categorie}`, - ...this._inventaireTemplateChatData() + `Etat: ${this.system.etat}` ] + const proprietesMagiques = this.system.magique ? [ + `Enchantée ${this.system.purifie ? ', purifiée' : ''} ${this.system.prpermanent ? 'permanente' : ''} `, + `Points de rêve: ${this.system.pr}`, + ] : [] + return proprietes + .concat(proprietesMagiques) + .concat(this._inventaireTemplateChatData()) + .filter(it => it != undefined) } - 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() { + perteReveChateauDormant() { if (this.system.magique && !this.system.prpermanent && this.system.pr > 0) { - const nouveauReve = Math.max(this.system.pr - 1, 0) + const nouveaupr = Math.max(this.system.pr - 1, 0) return { - _id: this.id, - name: this.name, - img: this.img, - 'system.pr': nouveauReve, - 'system.quantite': nouveauReve > 0 ? this.system.quantite : 0, - 'system.magique': nouveauReve > 0 + alias: this.parent.getAlias(), + item: this, + nouveaupr: nouveaupr, + update: { + _id: this.id, + 'system.pr': nouveaupr, + 'system.magique': nouveaupr > 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 { - 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.sheet?.render(true) - } - 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().indexDate - } - static buildHerbesList(listeHerbes, max) { let list = {} for (let herbe of listeHerbes) { diff --git a/module/item/potion/dialog-enchanter.js b/module/item/potion/dialog-enchanter.js deleted file mode 100644 index 248f9485..00000000 --- a/module/item/potion/dialog-enchanter.js +++ /dev/null @@ -1,46 +0,0 @@ - -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-gemme.js b/module/item/sheet-gemme.js new file mode 100644 index 00000000..297a88bd --- /dev/null +++ b/module/item/sheet-gemme.js @@ -0,0 +1,38 @@ +import { ITEM_TYPES } from "../constants.js"; +import { DialogEnchanter } from "../enchantement/dialog-enchanter.js"; +import { RdDTimestamp } from "../time/rdd-timestamp.js"; +import { RdDItemGemme } from "./gemme.js"; +import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js"; + +export class RdDGemmeItemSheet extends RdDItemInventaireSheet { + + static get ITEM_TYPE() { return ITEM_TYPES.gemme }; + + async getData() { + const formData = foundry.utils.mergeObject(await super.getData(), + { + inertie: this.item.inertie, + enchantabilite: this.item.enchantabilite, + isEnchantementPossible: this.item.isEnchantementPossible, + gemmeTypeList: RdDItemGemme.getGemmeTypeOptionList(), + dateActuelle: game.system.rdd.calendrier.dateCourante(), + enchantement: RdDTimestamp.splitIndexDate(this.item.system.prdate) + }) + return formData + } + + activateListeners(html) { + super.activateListeners(html); + + this.html.find('.item-enchanter').click((event) => DialogEnchanter.enchanter(this.item)) + + 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}`) + }); + + } +} diff --git a/module/item/sheet-potion.js b/module/item/sheet-potion.js index d556c36e..e9f27e75 100644 --- a/module/item/sheet-potion.js +++ b/module/item/sheet-potion.js @@ -1,4 +1,5 @@ import { ITEM_TYPES } from "../constants.js"; +import { DialogEnchanter } from "../enchantement/dialog-enchanter.js"; import { RdDTimestamp } from "../time/rdd-timestamp.js"; import { RdDItemPotion } from "./potion.js"; import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js"; @@ -18,14 +19,12 @@ export class RdDPotionItemSheet extends RdDItemInventaireSheet { } } } - 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' + formData.isEnchantementPossible = this.item.isEnchantementPossible + formData.isSoins = this.item.categorie == 'Soin' + formData.isRepos = this.item.categorie == 'Repos' if (formData.isSoins) { const herbesSoins = await RdDItemPotion.herbesSoins() RdDPotionItemSheet.$calculBonusHerbe(formData, herbesSoins, 12); @@ -37,20 +36,20 @@ export class RdDPotionItemSheet extends RdDItemInventaireSheet { formData.herbesRepos = RdDItemPotion.buildHerbesList(herbesRepos, 7) } formData.dateActuelle = game.system.rdd.calendrier.dateCourante() - formData.enchantement = RdDTimestamp.splitIndexDate(this.potion.system.prdate) + formData.enchantement = RdDTimestamp.splitIndexDate(this.item.system.prdate) return formData } activateListeners(html) { super.activateListeners(html); - this.html.find('.item-enchanter').click((event) => this.potion.enchanterPotion()) + this.html.find('.item-enchanter').click((event) => DialogEnchanter.enchanter(this.item)) 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 }) + this.item.update({ 'system.prdate': indexDate }) console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`) }); diff --git a/module/migrations.js b/module/migrations.js index 612210b9..6ea83ac3 100644 --- a/module/migrations.js +++ b/module/migrations.js @@ -589,6 +589,42 @@ class _12_0_32_MigrationRaces extends Migration { } } +class _12_0_37_MigrationAlchimieEtat extends Migration { + get code() { return "migration-alchimie-etat" } + get version() { return "12.0.37" } + + async migrate() { + await this.applyItemsUpdates(items => items + .filter(it => [ITEM_TYPES.potion].includes(it.type)) + .map(it => this.migratePotion(it)) + ) + } + + mappingCategorie(categorie) { + switch (categorie) { + case 'AlchimieEnchante': return 'Alchimie' + case 'ReposEnchante': return 'Repos' + case 'SoinEnchante': return 'Soin' + case 'AutreEnchante': return 'Autre' + } + return categorie + } + + mappingEtat(categorie) { + return ['Alchimie', 'Repos', 'Soin', 'Autre'].includes(categorie) ? 'Liquide' : 'Autre' + } + + async migratePotion(potion) { + const newCategorie = this.mappingCategorie(potion.system.categorie) + return { + _id: potion.id, + 'system.etat': this.mappingEtat(potion.system.categorie), + 'system.magique': potion.system.pr > 0, + 'system.categorie': newCategorie + } + } +} + export class Migrations { static getMigrations() { return [ @@ -610,6 +646,7 @@ export class Migrations { new _11_2_20_MigrationAstrologie(), new _12_0_26_MigrationVoieSorts(), new _12_0_32_MigrationRaces(), + new _12_0_37_MigrationAlchimieEtat(), ]; } diff --git a/module/rdd-gemme.js b/module/rdd-gemme.js deleted file mode 100644 index 83981ecf..00000000 --- a/module/rdd-gemme.js +++ /dev/null @@ -1,36 +0,0 @@ - -const tableGemmes = { - "almaze": { label: "Almaze", couleur: "Blanc"}, - "aquafane": { label: "Aquafane", couleur: "Vert Profond"}, - "asterite": { label: "Astérite", couleur: "Bleu, Violet ou Blanc"}, - "cyanolithe": { label: "Cyanolithe", couleur: "Bleu Intense"}, - "larmededragon": { label: "Larme de Dragon", couleur: "Rouge Intense"}, - "muska": { label: "Muska", couleur: "Violet Profond"}, - "nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense"}, - "nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense, Rose, Vert ou Bleu Pâle"}, - "oeildetigre": { label: "Oeil de Tigre", couleur: "Jaune"}, - "scarlatine": { label: "Scarlatine", couleur: "Rouge Clair ou Orangé"}, - "seliphane": { label: "Séliphane", couleur: "Vert Lumineux"}, - "tournelune": { label: "Tournelune", couleur: "Violet ou Bleu"}, - "zebraide": { label: "Zebraïde", couleur: "Bandes Bicolores, toutes couleurs"} -} - -export class RdDGemme extends Item { - - static getGemmeTypeOptionList() { - // TODO: look how to map object key-value pairs - let options = "" - for (let gemmeKey in tableGemmes) { - options += `` - } - return options; - } - - - static calculDataDerivees(gemme) { - gemme.system.cout = (gemme.system.taille * gemme.system.purete) + gemme.system.qualite; - gemme.system.inertie = 7 - gemme.system.purete; - gemme.system.enchantabilite = gemme.system.taille - gemme.system.inertie; - } - -} diff --git a/module/rdd-main.js b/module/rdd-main.js index 907781c1..533385ac 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -77,6 +77,8 @@ import { RdDStatBlockParser } from "./apps/rdd-import-stats.js" import { RdDJournalSheet } from "./journal/journal-sheet.js" import { RdDPotionItemSheet } from "./item/sheet-potion.js" import { RdDItemPotion } from "./item/potion.js" +import { RdDItemGemme } from "./item/gemme.js" +import { RdDGemmeItemSheet } from "./item/sheet-gemme.js" /** * RdD system @@ -100,17 +102,18 @@ export class SystemReveDeDragon { this.itemClasses = { armure: RdDItemArmure, blessure: RdDItemBlessure, + gemme: RdDItemGemme, maladie: RdDItemMaladie, ombre: RdDItemOmbre, poison: RdDItemPoison, - queue: RdDItemQueue, - tete: RdDItemTete, potion: RdDItemPotion, + queue: RdDItemQueue, race: RdDItemRace, rencontre: RdDRencontre, service: RdDItemService, signedraconique: RdDItemSigneDraconique, souffle: RdDItemSouffle, + tete: RdDItemTete, } this.actorClasses = { commerce: RdDCommerce, @@ -190,22 +193,10 @@ export class SystemReveDeDragon { Items.unregisterSheet("core", ItemSheet) RdDActorExportSheet.init() - RdDItemSheet.register(RdDSigneDraconiqueItemSheet) - RdDItemSheet.register(RdDRencontreItemSheet) - RdDItemSheet.register(RdDConteneurItemSheet) - RdDItemSheet.register(RdDHerbeItemSheet) - RdDItemSheet.register(RdDFauneItemSheet) - RdDItemSheet.register(RdDPlanteItemSheet) - RdDItemSheet.register(RdDPotionItemSheet) - RdDItemSheet.register(RdDIngredientItemSheet) - RdDItemSheet.register(RdDServiceItemSheet) - RdDItemSheet.register(RdDBlessureItemSheet) - RdDJournalSheet.register() - Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, { types: [ "objet", "arme", "armure", "livre", "munition", - "monnaie", "nourritureboisson", "gemme", + "monnaie", "nourritureboisson", ], makeDefault: true }) @@ -220,6 +211,19 @@ export class SystemReveDeDragon { ], makeDefault: true }) + + RdDItemSheet.register(RdDBlessureItemSheet) + RdDItemSheet.register(RdDConteneurItemSheet) + RdDItemSheet.register(RdDFauneItemSheet) + RdDItemSheet.register(RdDGemmeItemSheet) + RdDItemSheet.register(RdDHerbeItemSheet) + RdDItemSheet.register(RdDIngredientItemSheet) + RdDItemSheet.register(RdDPlanteItemSheet) + RdDItemSheet.register(RdDPotionItemSheet) + RdDItemSheet.register(RdDRencontreItemSheet) + RdDItemSheet.register(RdDServiceItemSheet) + RdDItemSheet.register(RdDSigneDraconiqueItemSheet) + RdDJournalSheet.register() // préparation des différents modules console.log(`Initializing Reve de Dragon Hooks and handlers`) diff --git a/module/rdd-sheet-utility.js b/module/rdd-sheet-utility.js index 8dbbf217..79b08cb6 100644 --- a/module/rdd-sheet-utility.js +++ b/module/rdd-sheet-utility.js @@ -66,10 +66,12 @@ export class RdDSheetUtility { } static async splitItem(item, actor, onSplit = () => { }) { - const dialog = await DialogSplitItem.create(item, async (item, split) => { + const _onSplit = async (item, split) => { await RdDSheetUtility._onSplitItem(item, split, actor); onSplit(); - }); + await RdDSheetUtility.renderItemBranch(actor, item) + } + const dialog = await DialogSplitItem.create(item, _onSplit) dialog.render(true) } diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 8c22cb41..42c7f96b 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -192,7 +192,8 @@ 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/item/potion-enum-categorie.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/item/enum-categorie-alchimie.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/item/enum-etat-alchimie.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', @@ -206,6 +207,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-type.html', // Partials + 'systems/foundryvtt-reve-de-dragon/templates/enchantement/partial-enchantement.hbs', 'systems/foundryvtt-reve-de-dragon/templates/coeur/chat-effet-tendre-moment.hbs', 'systems/foundryvtt-reve-de-dragon/templates/coeur/afficher-coeur.hbs', 'systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats-recherche.hbs', @@ -262,7 +264,6 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-sante.hbs', 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html', - 'systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html' ]; @@ -339,6 +340,7 @@ export class RdDUtility { 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)) + Handlebars.registerHelper('item-name', (item) => item.nameDisplay) // TMRs Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord)); diff --git a/packs_src/archetypes/commerce_Liste_d__quipement_1Nng9d8r6lrPHCaJ.yml b/packs_src/archetypes/commerce_Liste_d__quipement_1Nng9d8r6lrPHCaJ.yml index 3e0932a2..84675208 100644 --- a/packs_src/archetypes/commerce_Liste_d__quipement_1Nng9d8r6lrPHCaJ.yml +++ b/packs_src/archetypes/commerce_Liste_d__quipement_1Nng9d8r6lrPHCaJ.yml @@ -2358,6 +2358,7 @@ items: indexMinute: 0 rarete: '' categorie: Remede + etat: Epais herbe: '' herbebrins: 0 herbebonus: 0 @@ -3897,7 +3898,8 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 @@ -4919,6 +4921,7 @@ items: indexMinute: 0 rarete: '' categorie: Remede + etat: Epais herbe: '' herbebrins: 0 herbebonus: 0 @@ -5349,7 +5352,8 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 @@ -5605,7 +5609,8 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 @@ -5765,7 +5770,8 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 @@ -6437,7 +6443,8 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 @@ -6672,6 +6679,7 @@ items: indexMinute: 0 rarete: '' categorie: Remede + etat: Solide herbe: '' herbebrins: 0 herbebonus: 0 @@ -7157,6 +7165,7 @@ items: indexMinute: 0 rarete: '' categorie: Remede + etat: Poudre herbe: '' herbebrins: 0 herbebonus: 0 @@ -7610,7 +7619,8 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 @@ -7690,6 +7700,7 @@ items: indexMinute: 0 rarete: '' categorie: Remede + etat: Solide herbe: '' herbebrins: 0 herbebonus: 0 @@ -7768,6 +7779,7 @@ items: indexMinute: 0 rarete: '' categorie: Remede + etat: Epais herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Bitume_de_Camphre_9cLkTDugz84gpHUB.yml b/packs_src/equipement/potion_Bitume_de_Camphre_9cLkTDugz84gpHUB.yml index 0f22da8c..46e94a46 100644 --- a/packs_src/equipement/potion_Bitume_de_Camphre_9cLkTDugz84gpHUB.yml +++ b/packs_src/equipement/potion_Bitume_de_Camphre_9cLkTDugz84gpHUB.yml @@ -29,6 +29,7 @@ system: indexMinute: 0 rarete: '' categorie: Remede + etat: Epais herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Elixir_des_gnomes_JXMef7FXVOG1XYWO.yml b/packs_src/equipement/potion_Elixir_des_gnomes_JXMef7FXVOG1XYWO.yml index 163bd09f..0a8452cf 100644 --- a/packs_src/equipement/potion_Elixir_des_gnomes_JXMef7FXVOG1XYWO.yml +++ b/packs_src/equipement/potion_Elixir_des_gnomes_JXMef7FXVOG1XYWO.yml @@ -30,7 +30,8 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Gel_e_royale_kFUh4027jnAdqbyK.yml b/packs_src/equipement/potion_Gel_e_royale_kFUh4027jnAdqbyK.yml index d5375987..e77c529a 100644 --- a/packs_src/equipement/potion_Gel_e_royale_kFUh4027jnAdqbyK.yml +++ b/packs_src/equipement/potion_Gel_e_royale_kFUh4027jnAdqbyK.yml @@ -29,6 +29,7 @@ system: indexMinute: 0 rarete: '' categorie: Remede + etat: Epais 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 86834b00..724959b8 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,8 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide 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 ad79816a..b17944c1 100644 --- a/packs_src/equipement/potion_Lait_de_lune_A3jx5dPkk5IeXSXn.yml +++ b/packs_src/equipement/potion_Lait_de_lune_A3jx5dPkk5IeXSXn.yml @@ -30,7 +30,8 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide 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 2b8c8a83..d2331d8c 100644 --- a/packs_src/equipement/potion_Liqueur_de_Bagdol_PrnJrG50u1UPdlJN.yml +++ b/packs_src/equipement/potion_Liqueur_de_Bagdol_PrnJrG50u1UPdlJN.yml @@ -28,7 +28,8 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Mirobolant_keLCmhsbxHK39UIy.yml b/packs_src/equipement/potion_Mirobolant_keLCmhsbxHK39UIy.yml index 6f164f04..0e180536 100644 --- a/packs_src/equipement/potion_Mirobolant_keLCmhsbxHK39UIy.yml +++ b/packs_src/equipement/potion_Mirobolant_keLCmhsbxHK39UIy.yml @@ -30,7 +30,8 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Perles_de_Bjwal_OYWzXiQUFsjU5AF2.yml b/packs_src/equipement/potion_Perles_de_Bjwal_OYWzXiQUFsjU5AF2.yml index 7b5cdec4..317314b8 100644 --- a/packs_src/equipement/potion_Perles_de_Bjwal_OYWzXiQUFsjU5AF2.yml +++ b/packs_src/equipement/potion_Perles_de_Bjwal_OYWzXiQUFsjU5AF2.yml @@ -29,6 +29,7 @@ system: indexMinute: 0 rarete: '' categorie: Remede + etat: Solide herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Sable_Poudre_ElweMV283IUpqaik.yml b/packs_src/equipement/potion_Sable_Poudre_ElweMV283IUpqaik.yml index 5a516f30..9aa473db 100644 --- a/packs_src/equipement/potion_Sable_Poudre_ElweMV283IUpqaik.yml +++ b/packs_src/equipement/potion_Sable_Poudre_ElweMV283IUpqaik.yml @@ -29,6 +29,7 @@ system: indexMinute: 0 rarete: '' categorie: Remede + etat: Poudre 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 baea12de..8d565ba7 100644 --- a/packs_src/equipement/potion_Teinture_d_Erozonne_bA0JDA7awoWhu0vO.yml +++ b/packs_src/equipement/potion_Teinture_d_Erozonne_bA0JDA7awoWhu0vO.yml @@ -30,7 +30,8 @@ system: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Topazo_ne_FH3mSvdebfhIL2Af.yml b/packs_src/equipement/potion_Topazo_ne_FH3mSvdebfhIL2Af.yml index e370e80c..60af0385 100644 --- a/packs_src/equipement/potion_Topazo_ne_FH3mSvdebfhIL2Af.yml +++ b/packs_src/equipement/potion_Topazo_ne_FH3mSvdebfhIL2Af.yml @@ -29,6 +29,7 @@ system: indexMinute: 0 rarete: '' categorie: Remede + etat: Solide herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/equipement/potion_Tournegraisse_4GeV81qoJrjHIgzR.yml b/packs_src/equipement/potion_Tournegraisse_4GeV81qoJrjHIgzR.yml index 198dc9fb..9e8b0349 100644 --- a/packs_src/equipement/potion_Tournegraisse_4GeV81qoJrjHIgzR.yml +++ b/packs_src/equipement/potion_Tournegraisse_4GeV81qoJrjHIgzR.yml @@ -29,6 +29,7 @@ system: indexMinute: 0 rarete: '' categorie: Remede + etat: Epais herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/packs_src/voyageurs/personnage_le_Haut_R_vant_Erudit_AZBxORb7IYgXaOfb.yml b/packs_src/voyageurs/personnage_le_Haut_R_vant_Erudit_AZBxORb7IYgXaOfb.yml index ef09c30c..410335b7 100644 --- a/packs_src/voyageurs/personnage_le_Haut_R_vant_Erudit_AZBxORb7IYgXaOfb.yml +++ b/packs_src/voyageurs/personnage_le_Haut_R_vant_Erudit_AZBxORb7IYgXaOfb.yml @@ -3344,7 +3344,8 @@ items: indexDate: -1 indexMinute: 0 rarete: '' - categorie: Alchimie + categorie: Remede + etat: Liquide herbe: '' herbebrins: 0 herbebonus: 0 diff --git a/styles/simple.css b/styles/simple.css index 38d4d89d..602cc813 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -467,7 +467,7 @@ table {border: 1px solid #7a7971;} text-align: left; } .equipement-nom { - flex-grow : 4; + flex-grow : 3; margin: 0; justify-content: center; text-align: left; diff --git a/template.json b/template.json index fec10313..74dbdf20 100644 --- a/template.json +++ b/template.json @@ -589,6 +589,13 @@ } } }, + "enchantable": { + "magique": false, + "pr": 0, + "purifie": false, + "prpermanent": false, + "prdate": 0 + }, "equipement": { "equipe": false }, @@ -739,7 +746,7 @@ "templates": ["description", "inventaire"] }, "gemme": { - "templates": ["description", "inventaire"], + "templates": ["description", "enchantable", "inventaire", "temporel"], "type": "", "taille": 0, "purete": 0, @@ -795,18 +802,14 @@ "niveau_maximum": 0 }, "potion": { - "templates": ["description", "inventaire", "temporel"], + "templates": ["description", "enchantable", "inventaire", "temporel"], "rarete": "", "categorie": "", + "etat": "", "herbe": "", "herbebrins": 0, "herbebonus": 0, - "reposalchimique": false, - "magique": false, - "pr": 0, - "purifie": false, - "prpermanent": false, - "prdate": 0 + "reposalchimique": false }, "service": { "templates": ["description", "inventaire"], @@ -903,7 +906,7 @@ "value": 0 } }, - "attributs":{ + "attributs": { "protection": { "value": 0 } @@ -950,7 +953,8 @@ "xp": 0, "bonuscase": "", "isrituel": false, - "coutseuil": 0 + "coutseuil": 0, + "lancements": [] }, "sortreserve": { "sortid": "", diff --git a/templates/actor/hr-rencontres.hbs b/templates/actor/hr-rencontres.hbs index fc649a33..5e37a491 100644 --- a/templates/actor/hr-rencontres.hbs +++ b/templates/actor/hr-rencontres.hbs @@ -4,7 +4,7 @@ {{#each rencontres as |rencontre key|}}
  • - + {{rencontre.name}} r{{rencontre.system.force}} ({{rencontre.system.coord}} - {{caseTmr-label rencontre.system.coord}}) {{#if rencontre.system.date}} diff --git a/templates/actor/hr-signes-draconiques.hbs b/templates/actor/hr-signes-draconiques.hbs index 1a190bd6..4e5e428a 100644 --- a/templates/actor/hr-signes-draconiques.hbs +++ b/templates/actor/hr-signes-draconiques.hbs @@ -4,8 +4,8 @@ {{#each signedraconiques as |signe key|}}
  • - {{signe.name}} - {{signe.system.difficulte}} + {{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/inventaire-item.hbs b/templates/actor/inventaire-item.hbs index 26137e2d..11106e22 100644 --- a/templates/actor/inventaire-item.hbs +++ b/templates/actor/inventaire-item.hbs @@ -9,11 +9,11 @@ {{else}}far fa-plus-square {{/if~}}"> - {{item.name}} + {{item.name}}{{#if item.system.magique}} {{/if}} {{else}} - {{item.name}} + {{item.name}}{{#if item.system.magique}} {{/if}} {{#if (eq item.type 'arme')}} {{>"systems/foundryvtt-reve-de-dragon/templates/item/icon-arme-broken.hbs" item}} {{/if}} @@ -25,8 +25,8 @@ {{/if}} {{item.system.quantite}} - {{#if (gt item.system.quantite 1)}} - + {{#if @root.options.isGM}} + {{/if}} {{numberFormat item.system.encTotal decimals=2}} diff --git a/templates/actor/inventaire.html b/templates/actor/inventaire.html index feacdd3b..938738e6 100644 --- a/templates/actor/inventaire.html +++ b/templates/actor/inventaire.html @@ -18,7 +18,7 @@