diff --git a/icons/faune/cerf.webp b/icons/faune/cerf.webp new file mode 100644 index 00000000..c18c8505 Binary files /dev/null and b/icons/faune/cerf.webp differ diff --git a/icons/faune/chevre.webp b/icons/faune/chevre.webp new file mode 100644 index 00000000..f604aa6c Binary files /dev/null and b/icons/faune/chevre.webp differ diff --git a/icons/faune/crabe.webp b/icons/faune/crabe.webp new file mode 100644 index 00000000..6e797ec4 Binary files /dev/null and b/icons/faune/crabe.webp differ diff --git a/icons/faune/lapin.webp b/icons/faune/lapin.webp new file mode 100644 index 00000000..dc37f4a4 Binary files /dev/null and b/icons/faune/lapin.webp differ diff --git a/icons/faune/oie.webp b/icons/faune/oie.webp new file mode 100644 index 00000000..58687f01 Binary files /dev/null and b/icons/faune/oie.webp differ diff --git a/icons/faune/oiseau.webp b/icons/faune/oiseau.webp new file mode 100644 index 00000000..f5ef4a2d Binary files /dev/null and b/icons/faune/oiseau.webp differ diff --git a/icons/faune/poisson.webp b/icons/faune/poisson.webp new file mode 100644 index 00000000..b4e68d2a Binary files /dev/null and b/icons/faune/poisson.webp differ diff --git a/icons/faune/raton-laveur.webp b/icons/faune/raton-laveur.webp new file mode 100644 index 00000000..9022c695 Binary files /dev/null and b/icons/faune/raton-laveur.webp differ diff --git a/icons/faune/rongeur.webp b/icons/faune/rongeur.webp new file mode 100644 index 00000000..9fb51a92 Binary files /dev/null and b/icons/faune/rongeur.webp differ diff --git a/icons/faune/saumon.webp b/icons/faune/saumon.webp new file mode 100644 index 00000000..5b8faf39 Binary files /dev/null and b/icons/faune/saumon.webp differ diff --git a/icons/faune/singe-vert.webp b/icons/faune/singe-vert.webp new file mode 100644 index 00000000..36cecb0a Binary files /dev/null and b/icons/faune/singe-vert.webp differ diff --git a/lang/fr.json b/lang/fr.json index 76a10929..3cc1bf86 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -20,6 +20,7 @@ "TypeMonnaie": "Monnaie", "TypeHerbe": "Herbe ou plante", "TypeIngredient": "Ingrédient", + "TypeFaune": "Faune", "TypeLivre": "Livre", "TypePotion": "Potion", "TypeArme": "Arme", diff --git a/module/environnement.js b/module/environnement.js index 3b5e3221..eebc6834 100644 --- a/module/environnement.js +++ b/module/environnement.js @@ -23,7 +23,7 @@ const MILIEUX = [ "Sous-sols" ] const ITEM_ENVIRONNEMENT_TYPES = [ - 'herbe', 'ingredient' + 'herbe', 'ingredient', 'faune' ] export class Environnement { diff --git a/module/item-faune-sheet.js b/module/item-faune-sheet.js new file mode 100644 index 00000000..274142b2 --- /dev/null +++ b/module/item-faune-sheet.js @@ -0,0 +1,54 @@ +import { EnvironmentSheetHelper } from "./environnement.js"; +import { RdDItemSheet } from "./item-sheet.js"; +import { RdDUtility } from "./rdd-utility.js"; + +export class RdDFauneItemSheet extends RdDItemSheet { + + static get ITEM_TYPE() { return "faune" }; + + static get defaultOptions() { + return EnvironmentSheetHelper.defaultOptions(super.defaultOptions); + } + + setPosition(options = {}) { + return EnvironmentSheetHelper.setPosition(this, super.setPosition(options)); + } + + async getData() { + const formData = await super.getData(); + return await EnvironmentSheetHelper.getData(this, formData); + } + + activateListeners(html) { + super.activateListeners(html); + if (!this.options.editable) return; + + EnvironmentSheetHelper.activateListeners(this, html); + + html.find("a.linked-actor-delete").click(event => this.onDeleteLinkedActor()); + + } + + async _onDropActor(event, dragData) { + console.log('faune:dropActor', event, dragData) + const actor = fromUuidSync(dragData.uuid); + if (actor?.pack) { + this.item.update({ + 'system.actor.pack': actor.pack, + 'system.actor.id': actor._id, + 'system.actor.name': actor.name + }); + } + else { + ui.notifications.warn(`${actor.name} ne provient pas d'eun compendium. +
Choisissez une créature du compendium pour représenter un élément de faune générique`) + } + } + async onDeleteLinkedActor() { + this.item.update({ + 'system.actor.pack': '', + 'system.actor.id': '', + 'system.actor.name': '' + }); + } +} diff --git a/module/item.js b/module/item.js index 060151bc..6182bd0f 100644 --- a/module/item.js +++ b/module/item.js @@ -10,6 +10,7 @@ const typesObjetsInventaire = [ "gemme", "herbe", "ingredient", + "faune", "livre", "monnaie", "munition", @@ -35,6 +36,7 @@ export const defaultItemImg = { conteneur: "systems/foundryvtt-reve-de-dragon/icons/objets/sac_a_dos.webp", sort: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp", herbe: "systems/foundryvtt-reve-de-dragon/icons/botanique/Endorlotte.webp", + faune: "systems/foundryvtt-reve-de-dragon/icons/faune/rongeur.webp", ingredient: "systems/foundryvtt-reve-de-dragon/icons/objets/sable_poudre.webp", livre: "systems/foundryvtt-reve-de-dragon/icons/objets/livre.webp", potion: "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp", @@ -457,6 +459,14 @@ export class RdDItem extends Item { ] } /* -------------------------------------------- */ + _fauneChatData() { + return [ + `Sustentation: ${this.system.sust}`, + `Milieu: ${this.system.milieu}`, + ...this._inventaireTemplateChatData() + ] + } + /* -------------------------------------------- */ _tacheChatData() { return [ `Caractéristique: ${this.system.carac}`, diff --git a/module/rdd-main.js b/module/rdd-main.js index 23acc016..912d6209 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -42,6 +42,7 @@ import { TMRRencontres } from "./tmr-rencontres.js"; import { RdDHerbeItemSheet } from "./item-herbe-sheet.js"; import { Environnement } from "./environnement.js"; import { RdDIngredientItemSheet } from "./item-ingredient-sheet.js"; +import { RdDFauneItemSheet } from "./item-faune-sheet.js"; import { RdDConteneurItemSheet } from "./item-conteneur-sheet.js"; /* -------------------------------------------- */ @@ -193,6 +194,7 @@ Hooks.once("init", async function () { RdDItemSheet.register(RdDRencontreItemSheet); RdDItemSheet.register(RdDConteneurItemSheet); RdDItemSheet.register(RdDHerbeItemSheet); + RdDItemSheet.register(RdDFauneItemSheet); RdDItemSheet.register(RdDIngredientItemSheet); Items.registerSheet(SYSTEM_RDD, RdDItemSheet, { diff --git a/module/rdd-utility.js b/module/rdd-utility.js index fe173ac9..0b7f21d3 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -183,6 +183,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/item-sort-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-herbe-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-ingredient-sheet.html', + 'systems/foundryvtt-reve-de-dragon/templates/item-faune-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-livre-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-tache-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-potion-sheet.html', @@ -218,6 +219,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-type.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html', // Partials + 'systems/foundryvtt-reve-de-dragon/templates/common/compendium-link.hbs', 'systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html', @@ -326,7 +328,7 @@ export class RdDUtility { return a.name.localeCompare(b.name); }) ); - Handlebars.registerHelper('linkCompendium', (compendium, id, name) => `@Compendium[${compendium}.${id}]{${name}}`); + Handlebars.registerHelper('linkCompendium', (pack, id, name)=> RdDUtility.linkCompendium(pack, id, name)); Handlebars.registerHelper('uniteQuantite', (type) => RdDItem.getUniteQuantite(type)); Handlebars.registerHelper('isFieldInventaireModifiable', (type, field) => RdDItem.isFieldInventaireModifiable(type, field)); Handlebars.registerHelper('getFrequenceRarete', (rarete, field) => Environnement.getFrequenceRarete(rarete, field)); @@ -334,6 +336,10 @@ export class RdDUtility { return loadTemplates(templatePaths); } + static linkCompendium(pack, id, name) { + return `@Compendium[${pack}.${id}]{${name}}`; + } + /* -------------------------------------------- */ static async creerObjet(actorSheet) { let itemType = $(".item-type").val(); @@ -464,6 +470,7 @@ export class RdDUtility { formData.livres = this.arrayOrEmpty(itemTypes['livre']); formData.potions = this.arrayOrEmpty(itemTypes['potion']); formData.ingredients = this.arrayOrEmpty(itemTypes['ingredient']); + formData.faunes = this.arrayOrEmpty(itemTypes['faune']); formData.herbes = this.arrayOrEmpty(itemTypes['herbe']); formData.monnaie = this.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere()); formData.nourritureboissons = this.arrayOrEmpty(itemTypes['nourritureboisson']); @@ -478,6 +485,7 @@ export class RdDUtility { .concat(formData.potions) .concat(formData.ingredients) .concat(formData.herbes) + .concat(formData.faunes) .concat(formData.monnaie) .concat(formData.nourritureboissons) .concat(formData.gemmes); diff --git a/template.json b/template.json index 27c37132..c9950acf 100644 --- a/template.json +++ b/template.json @@ -572,7 +572,7 @@ "types": [ "competence", "competencecreature", "recettealchimique", "musique", "chant", "danse", "jeu", "recettecuisine", "oeuvre", - "objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", + "objet", "arme", "armure", "conteneur", "herbe", "ingredient", "faune", "livre", "potion", "munition", "monnaie", "nourritureboisson", "gemme", "meditation", "rencontre", "queue", "ombre", "souffle", "tete", "casetmr", "signedraconique", "sort", "sortreserve", "nombreastral", "tache", "maladie", "poison", "possession", @@ -700,11 +700,11 @@ }, "nourritureboisson": { "templates": [ "description", "inventaire" ], - "sust": 0, "boisson": false, "desaltere": 0, "alcoolise": false, "force": 0, + "sust": 0, "exotisme": 0 }, "herbe": { @@ -717,8 +717,20 @@ "templates": [ "description", "inventaire", "environnement" ], "niveau": 0, "base": 0, + "sust": 0, + "exotisme": 0, "categorie": "" }, + "faune": { + "templates": [ "description", "inventaire", "environnement"], + "sust": 0, + "exotisme": 0, + "actor": { + "id": "", + "pack": "", + "name": "" + } + }, "livre": { "templates": [ "description", "inventaire" ], "competence": "", diff --git a/templates/common/compendium-link.hbs b/templates/common/compendium-link.hbs new file mode 100644 index 00000000..3efebb63 --- /dev/null +++ b/templates/common/compendium-link.hbs @@ -0,0 +1 @@ +{{name}} \ No newline at end of file diff --git a/templates/item-faune-sheet.html b/templates/item-faune-sheet.html new file mode 100644 index 00000000..145b7a0c --- /dev/null +++ b/templates/item-faune-sheet.html @@ -0,0 +1,47 @@ +
+
+ +
+

+
+
+ + + +
+
+
+
+ + +
+ {{#if (gt system.sust 0)}} +
+ + +
+ {{/if}} +
+ +
+ {{#if system.actor.id}} + + + {{else}} + + {{/if}} +
+
+ {{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} +
+
+ {{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}} +
+
\ No newline at end of file