diff --git a/module/applications/sheets/_module.mjs b/module/applications/sheets/_module.mjs index f45bf73d..9b7a35b4 100644 --- a/module/applications/sheets/_module.mjs +++ b/module/applications/sheets/_module.mjs @@ -1,2 +1,4 @@ export { default as RdDItemBaseSheet} from "./common-item-sheet.mjs" export { default as RdDMonnaieSheet } from "./monnaie-sheet.mjs" +export { default as RdDMunitionSheet } from "./munition-sheet.mjs" + diff --git a/module/applications/sheets/munition-sheet.mjs b/module/applications/sheets/munition-sheet.mjs new file mode 100644 index 00000000..828f1fec --- /dev/null +++ b/module/applications/sheets/munition-sheet.mjs @@ -0,0 +1,34 @@ +import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs"; +import { ITEM_TYPES } from "../../constants.js"; +import RdDItemBaseSheet from "./common-item-sheet.mjs"; + +export default class RdDMunitionSheet extends RdDItemBaseSheet { + /** @override */ + static get ITEM_TYPE() { return ITEM_TYPES.munition } + static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE] } + + /** @override */ + static DEFAULT_OPTIONS = Object.assign({}, + RdDItemBaseSheet.DEFAULT_OPTIONS, + { + classes: ["fvtt-rdd", "item", "munition"], + position: { width: 400 }, + window: { contentClasses: ["munition-content"] } + }) + + /** @override */ + static PARTS = { + main: { + template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/munition.hbs", + }, + } + + /** @override */ + async _prepareContext() { + return Object.assign( + await super._prepareContext(), + await TEMPLATE_DESCRIPTION.prepareContext(this.document), + await TEMPLATE_INVENTAIRE.prepareContext(this.document) + ) + } +} \ No newline at end of file diff --git a/module/documents/munition.mjs b/module/documents/munition.mjs new file mode 100644 index 00000000..19ade5fd --- /dev/null +++ b/module/documents/munition.mjs @@ -0,0 +1,7 @@ +import { RdDItem } from "../item.js"; + +export default class RdDItemMunition extends RdDItem { + static get defaultIcon() { + return 'systems/foundryvtt-reve-de-dragon/icons/objets/fleche.webp' + } +} diff --git a/module/models/_module.mjs b/module/models/_module.mjs index f636920a..588f6fd9 100644 --- a/module/models/_module.mjs +++ b/module/models/_module.mjs @@ -1 +1,2 @@ export { default as RdDModelMonnaie } from "./monnaie.mjs" +export { default as RdDModelMunition } from "./munition.mjs" diff --git a/module/models/munition.mjs b/module/models/munition.mjs new file mode 100644 index 00000000..2d5d7d61 --- /dev/null +++ b/module/models/munition.mjs @@ -0,0 +1,10 @@ +import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../common/_module.mjs"; + +export default class RdDModelMunition extends foundry.abstract.TypeDataModel { + static defineSchema() { + return Object.assign({}, + TEMPLATE_DESCRIPTION.fields(), + TEMPLATE_INVENTAIRE.fields() + ) + } +} diff --git a/module/rdd-main.js b/module/rdd-main.js index 730f19eb..b6759d9b 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -105,6 +105,7 @@ export class SystemReveDeDragon { this.RdDStatBlockParser = RdDStatBlockParser this.itemClasses = { monnaie: items.RdDModelMonnaie, + munition: items.RdDModelMunition, armure: RdDItemArmure, blessure: RdDItemBlessure, gemme: RdDItemGemme, @@ -185,6 +186,7 @@ export class SystemReveDeDragon { CONFIG.Item.documentClass = RdDItem CONFIG.Item.dataModels = { monnaie: models.RdDModelMonnaie, + munition: models.RdDModelMunition, } CONFIG.RDD = { resolutionTable: RdDResolutionTable.resolutionTable, @@ -206,17 +208,16 @@ export class SystemReveDeDragon { Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, { types: [ - "objet", "arme", "armure", "livre", "munition", "nourritureboisson", + "objet", "arme", "armure", "livre", "nourritureboisson", ], makeDefault: true }) sheets.RdDItemBaseSheet.registerAll( - sheets.RdDMonnaieSheet + sheets.RdDMonnaieSheet, + sheets.RdDMunitionSheet ) - // , - // sheets.RdDMunitionSheet Items.registerSheet(SYSTEM_RDD, RdDItemSheetV1, { types: [ "competence", "competencecreature", diff --git a/template.json b/template.json index 3bc25e74..869ba16b 100644 --- a/template.json +++ b/template.json @@ -750,9 +750,6 @@ "inertie": 0, "enchantabilite": 0 }, - "munition": { - "templates": ["description", "inventaire"] - }, "nourritureboisson": { "templates": ["description", "inventaire", "comestible"], "cuisinier": "", diff --git a/templates/item/munition.hbs b/templates/item/munition.hbs new file mode 100644 index 00000000..f83fd7f3 --- /dev/null +++ b/templates/item/munition.hbs @@ -0,0 +1,14 @@ +
+ {{>"systems/foundryvtt-reve-de-dragon/templates/header-item.hbs"}} + +
+
+ {{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.hbs"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.hbs"}} +
+ {{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.hbs"}} +
+
\ No newline at end of file diff --git a/templates/sheets/item/munition.hbs b/templates/sheets/item/munition.hbs new file mode 100644 index 00000000..ac7de3a4 --- /dev/null +++ b/templates/sheets/item/munition.hbs @@ -0,0 +1,5 @@ +
+ {{> "systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/header.hbs"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-inventaire.hbs"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-description.hbs"}} +