Ajout de l'Item "faune" pour tables environnement

This commit is contained in:
Vincent Vandemeulebrouck 2022-12-03 18:31:05 +01:00
parent db8fd6dbf8
commit ab704c46d2
20 changed files with 139 additions and 4 deletions

BIN
icons/faune/cerf.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
icons/faune/chevre.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
icons/faune/crabe.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
icons/faune/lapin.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
icons/faune/oie.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
icons/faune/oiseau.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
icons/faune/poisson.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
icons/faune/rongeur.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
icons/faune/saumon.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
icons/faune/singe-vert.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -20,6 +20,7 @@
"TypeMonnaie": "Monnaie", "TypeMonnaie": "Monnaie",
"TypeHerbe": "Herbe ou plante", "TypeHerbe": "Herbe ou plante",
"TypeIngredient": "Ingrédient", "TypeIngredient": "Ingrédient",
"TypeFaune": "Faune",
"TypeLivre": "Livre", "TypeLivre": "Livre",
"TypePotion": "Potion", "TypePotion": "Potion",
"TypeArme": "Arme", "TypeArme": "Arme",

View File

@ -23,7 +23,7 @@ const MILIEUX = [
"Sous-sols" "Sous-sols"
] ]
const ITEM_ENVIRONNEMENT_TYPES = [ const ITEM_ENVIRONNEMENT_TYPES = [
'herbe', 'ingredient' 'herbe', 'ingredient', 'faune'
] ]
export class Environnement { export class Environnement {

View File

@ -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.
<br>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': ''
});
}
}

View File

@ -10,6 +10,7 @@ const typesObjetsInventaire = [
"gemme", "gemme",
"herbe", "herbe",
"ingredient", "ingredient",
"faune",
"livre", "livre",
"monnaie", "monnaie",
"munition", "munition",
@ -35,6 +36,7 @@ export const defaultItemImg = {
conteneur: "systems/foundryvtt-reve-de-dragon/icons/objets/sac_a_dos.webp", conteneur: "systems/foundryvtt-reve-de-dragon/icons/objets/sac_a_dos.webp",
sort: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp", sort: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp",
herbe: "systems/foundryvtt-reve-de-dragon/icons/botanique/Endorlotte.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", ingredient: "systems/foundryvtt-reve-de-dragon/icons/objets/sable_poudre.webp",
livre: "systems/foundryvtt-reve-de-dragon/icons/objets/livre.webp", livre: "systems/foundryvtt-reve-de-dragon/icons/objets/livre.webp",
potion: "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp", potion: "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp",
@ -457,6 +459,14 @@ export class RdDItem extends Item {
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_fauneChatData() {
return [
`<b>Sustentation</b>: ${this.system.sust}`,
`<b>Milieu</b>: ${this.system.milieu}`,
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
_tacheChatData() { _tacheChatData() {
return [ return [
`<b>Caractéristique</b>: ${this.system.carac}`, `<b>Caractéristique</b>: ${this.system.carac}`,

View File

@ -42,6 +42,7 @@ import { TMRRencontres } from "./tmr-rencontres.js";
import { RdDHerbeItemSheet } from "./item-herbe-sheet.js"; import { RdDHerbeItemSheet } from "./item-herbe-sheet.js";
import { Environnement } from "./environnement.js"; import { Environnement } from "./environnement.js";
import { RdDIngredientItemSheet } from "./item-ingredient-sheet.js"; import { RdDIngredientItemSheet } from "./item-ingredient-sheet.js";
import { RdDFauneItemSheet } from "./item-faune-sheet.js";
import { RdDConteneurItemSheet } from "./item-conteneur-sheet.js"; import { RdDConteneurItemSheet } from "./item-conteneur-sheet.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -193,6 +194,7 @@ Hooks.once("init", async function () {
RdDItemSheet.register(RdDRencontreItemSheet); RdDItemSheet.register(RdDRencontreItemSheet);
RdDItemSheet.register(RdDConteneurItemSheet); RdDItemSheet.register(RdDConteneurItemSheet);
RdDItemSheet.register(RdDHerbeItemSheet); RdDItemSheet.register(RdDHerbeItemSheet);
RdDItemSheet.register(RdDFauneItemSheet);
RdDItemSheet.register(RdDIngredientItemSheet); RdDItemSheet.register(RdDIngredientItemSheet);
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, { Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {

View File

@ -183,6 +183,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/item-sort-sheet.html', '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-herbe-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-ingredient-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-livre-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-tache-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-tache-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-potion-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-type.html',
'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html',
// Partials // 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-overflow.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html',
@ -326,7 +328,7 @@ export class RdDUtility {
return a.name.localeCompare(b.name); 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('uniteQuantite', (type) => RdDItem.getUniteQuantite(type));
Handlebars.registerHelper('isFieldInventaireModifiable', (type, field) => RdDItem.isFieldInventaireModifiable(type, field)); Handlebars.registerHelper('isFieldInventaireModifiable', (type, field) => RdDItem.isFieldInventaireModifiable(type, field));
Handlebars.registerHelper('getFrequenceRarete', (rarete, field) => Environnement.getFrequenceRarete(rarete, field)); Handlebars.registerHelper('getFrequenceRarete', (rarete, field) => Environnement.getFrequenceRarete(rarete, field));
@ -334,6 +336,10 @@ export class RdDUtility {
return loadTemplates(templatePaths); return loadTemplates(templatePaths);
} }
static linkCompendium(pack, id, name) {
return `@Compendium[${pack}.${id}]{${name}}`;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static async creerObjet(actorSheet) { static async creerObjet(actorSheet) {
let itemType = $(".item-type").val(); let itemType = $(".item-type").val();
@ -464,6 +470,7 @@ export class RdDUtility {
formData.livres = this.arrayOrEmpty(itemTypes['livre']); formData.livres = this.arrayOrEmpty(itemTypes['livre']);
formData.potions = this.arrayOrEmpty(itemTypes['potion']); formData.potions = this.arrayOrEmpty(itemTypes['potion']);
formData.ingredients = this.arrayOrEmpty(itemTypes['ingredient']); formData.ingredients = this.arrayOrEmpty(itemTypes['ingredient']);
formData.faunes = this.arrayOrEmpty(itemTypes['faune']);
formData.herbes = this.arrayOrEmpty(itemTypes['herbe']); formData.herbes = this.arrayOrEmpty(itemTypes['herbe']);
formData.monnaie = this.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere()); formData.monnaie = this.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere());
formData.nourritureboissons = this.arrayOrEmpty(itemTypes['nourritureboisson']); formData.nourritureboissons = this.arrayOrEmpty(itemTypes['nourritureboisson']);
@ -478,6 +485,7 @@ export class RdDUtility {
.concat(formData.potions) .concat(formData.potions)
.concat(formData.ingredients) .concat(formData.ingredients)
.concat(formData.herbes) .concat(formData.herbes)
.concat(formData.faunes)
.concat(formData.monnaie) .concat(formData.monnaie)
.concat(formData.nourritureboissons) .concat(formData.nourritureboissons)
.concat(formData.gemmes); .concat(formData.gemmes);

View File

@ -572,7 +572,7 @@
"types": [ "types": [
"competence", "competencecreature", "competence", "competencecreature",
"recettealchimique", "musique", "chant", "danse", "jeu", "recettecuisine", "oeuvre", "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", "monnaie", "nourritureboisson", "gemme",
"meditation", "rencontre", "queue", "ombre", "souffle", "tete", "casetmr", "signedraconique", "sort", "sortreserve", "meditation", "rencontre", "queue", "ombre", "souffle", "tete", "casetmr", "signedraconique", "sort", "sortreserve",
"nombreastral", "tache", "maladie", "poison", "possession", "nombreastral", "tache", "maladie", "poison", "possession",
@ -700,11 +700,11 @@
}, },
"nourritureboisson": { "nourritureboisson": {
"templates": [ "description", "inventaire" ], "templates": [ "description", "inventaire" ],
"sust": 0,
"boisson": false, "boisson": false,
"desaltere": 0, "desaltere": 0,
"alcoolise": false, "alcoolise": false,
"force": 0, "force": 0,
"sust": 0,
"exotisme": 0 "exotisme": 0
}, },
"herbe": { "herbe": {
@ -717,8 +717,20 @@
"templates": [ "description", "inventaire", "environnement" ], "templates": [ "description", "inventaire", "environnement" ],
"niveau": 0, "niveau": 0,
"base": 0, "base": 0,
"sust": 0,
"exotisme": 0,
"categorie": "" "categorie": ""
}, },
"faune": {
"templates": [ "description", "inventaire", "environnement"],
"sust": 0,
"exotisme": 0,
"actor": {
"id": "",
"pack": "",
"name": ""
}
},
"livre": { "livre": {
"templates": [ "description", "inventaire" ], "templates": [ "description", "inventaire" ],
"competence": "", "competence": "",

View File

@ -0,0 +1 @@
<a class="content-link" draggable="true" data-pack="{{pack}}" data-uuid="Compendium.{{pack}}.{{id}}" data-id="{{id}}"><i class="fas fa-suitcase"></i>{{name}}</a>

View File

@ -0,0 +1,47 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}" />
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
</div>
</header>
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="informations">Informations</a>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.html"}}
</nav>
<section class="sheet-body">
<div class="tab items" data-group="primary" data-tab="informations">
<div class="flexcol">
<div class="form-group">
<label for="system.sust">Sustentation (si applicable)</label>
<input class="attribute-value" type="number" name="system.sust" value="{{system.sust}}" data-dtype="Number" min="0"/>
</div>
{{#if (gt system.sust 0)}}
<div class="form-group">
<label for="system.exotisme">Exotisme</label>
<input class="attribute-value" type="number" name="system.exotisme" value="{{system.exotisme}}" data-dtype="Number" min="-10" max="0"/>
</div>
{{/if}}
<div class="form-group">
<label>Créature correspondante</label>
<div>
{{#if system.actor.id}}
<label>
{{>'systems/foundryvtt-reve-de-dragon/templates/common/compendium-link.hbs'
pack=system.actor.pack id=system.actor.id name=system.actor.name}}
</label>
<a class="linked-actor-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
{{else}}
<label>Pas de fiche de créature</label>
{{/if}}
</div>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>