diff --git a/module/actor.js b/module/actor.js
index 5ad7ce8e..59a3402f 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -18,7 +18,7 @@ import { RdDItemArme } from "./item-arme.js";
import { RdDAlchimie } from "./rdd-alchimie.js";
import { STATUSES, StatusEffects } from "./settings/status-effects.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
-import { RdDItemSigneDraconique } from "./item/item-signedraconique.js";
+import { RdDItemSigneDraconique } from "./item/signedraconique.js";
import { ReglesOptionelles } from "./settings/regles-optionelles.js";
import { EffetsDraconiques } from "./tmr/effets-draconiques.js";
import { Draconique } from "./tmr/draconique.js";
@@ -30,7 +30,7 @@ import { RdDPossession } from "./rdd-possession.js";
import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { RdDConfirm } from "./rdd-confirm.js";
import { DialogValidationEncaissement } from "./dialog-validation-encaissement.js";
-import { RdDRencontre } from "./item/item-rencontre.js";
+import { RdDRencontre } from "./item/rencontre.js";
import { Targets } from "./targets.js";
import { DialogRepos } from "./dialog-repos.js";
import { RdDBaseActor } from "./actor/base-actor.js";
diff --git a/module/dialog-create-signedraconique.js b/module/dialog-create-signedraconique.js
index 7f5820be..d59e60df 100644
--- a/module/dialog-create-signedraconique.js
+++ b/module/dialog-create-signedraconique.js
@@ -1,6 +1,6 @@
import { ChatUtility } from "./chat-utility.js";
import { HtmlUtility } from "./html-utility.js";
-import { RdDItemSigneDraconique } from "./item/item-signedraconique.js";
+import { RdDItemSigneDraconique } from "./item/signedraconique.js";
import { TMRUtility } from "./tmr-utility.js";
export class DialogCreateSigneDraconique extends Dialog {
diff --git a/module/environnement.js b/module/environnement.js
index 891126d4..4c9e58ba 100644
--- a/module/environnement.js
+++ b/module/environnement.js
@@ -1,13 +1,10 @@
import { SYSTEM_RDD } from "./constants.js";
import { Grammar } from "./grammar.js";
-import { HtmlUtility } from "./html-utility.js";
import { Misc } from "./misc.js";
import { CompendiumTableHelpers, CompendiumTable, SystemCompendiums } from "./settings/system-compendiums.js";
-import { RdDRaretes } from "./tirage/raretes.js";
const COMPENDIUMS_RECHERCHE = 'compendiums-recherche';
-const TYPE_ITEMS_NATURELS = ["faune", "herbe", "plante", "ingredient"];
export class Environnement {
static init() {
@@ -46,7 +43,8 @@ export class Environnement {
}
async $prepareCompendiums() {
- this.compendiums = game.settings.get(SYSTEM_RDD, COMPENDIUMS_RECHERCHE);
+ this.compendiums = game.settings.get(SYSTEM_RDD, COMPENDIUMS_RECHERCHE).filter(c => SystemCompendiums.getPack(c));
+
this.compendiumTables = this.compendiums.map(it => new CompendiumTable(it, 'Item'));
const compendiumItems = await this.getElements(it => 1, it => it.isInventaire());
const fromCompendiums = Misc.concat(compendiumItems.map(it => it.getMilieux().filter(m => m)));
@@ -75,99 +73,3 @@ export class Environnement {
return CompendiumTableHelpers.buildTable(elements, itemFrequence);
}
}
-
-export class EnvironmentSheetHelper {
- static defaultOptions(defaultOptions) {
- return mergeObject(defaultOptions, {
- tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }]
- });
- }
-
- static setPosition(sheet, superPosition) {
- const position = superPosition;
- const sheetHeader = sheet.element.find(".sheet-header");
- const sheetBody = sheet.element.find(".sheet-body");
- sheetBody.css("height", position.height - sheetHeader[0].clientHeight)
- return position;
- }
-
- /* -------------------------------------------- */
- static async getData(sheet, formData) {
- return mergeObject(formData, {
- milieux: await game.system.rdd.environnement.autresMilieux(sheet.item)
- });
- }
-
- static activateListeners(sheet) {
- HtmlUtility.showControlWhen(sheet.html.find("div.description-milieu"), TYPE_ITEMS_NATURELS.includes(sheet.item.type));
-
- if (!sheet.options.editable) return;
-
- sheet.html.find("input.input-selection-milieu").keypress(event => {
- if (event.keyCode == '13') {
- EnvironmentSheetHelper.onAddMilieu(sheet, event);
- }
- event.stopPropagation();
- })
- sheet.html.find("a.milieu-add").click(event => EnvironmentSheetHelper.onAddMilieu(sheet, event));
- sheet.html.find("div.environnement-milieu a.milieu-delete").click(event => EnvironmentSheetHelper.onDeleteMilieu(sheet, event));
- sheet.html.find("div.environnement-milieu select.environnement-rarete").change(event => EnvironmentSheetHelper.onChange(sheet, event,
- updated => EnvironmentSheetHelper.$changeRarete(sheet, event, updated)));
- sheet.html.find("div.environnement-milieu input[name='environnement-frequence']").change(event => EnvironmentSheetHelper.onChange(sheet, event,
- updated => EnvironmentSheetHelper.$changeFrequence(sheet, event, updated)));
- }
-
- static $changeFrequence(sheet, event, updated) {
- updated.frequence = Number(sheet.html.find(event.currentTarget).val());
- }
-
- static $changeRarete(sheet, event, updated) {
- const name = sheet.html.find(event.currentTarget).val();
- const rarete = RdDRaretes.getRarete(name);
- updated.rarete = rarete.code;
- updated.frequence = rarete.frequence;
- }
-
- static async onAddMilieu(sheet, event) {
- const milieu = sheet.html.find('input.input-selection-milieu').val();
- if (!milieu) {
- ui.notifications.warn(`Choisissez le milieu dans lequel se trouve le/la ${sheet.item.name}`);
- return
- }
- const list = sheet.item.system.environnement;
- const exists = list.find(it => it.milieu == milieu);
- if (exists) {
- ui.notifications.warn(`${sheet.item.name} a déjà une rareté ${exists.rarete} en ${milieu} (fréquence: ${exists.frequence})`);
- return
- }
- const rarete = RdDRaretes.getRarete();
- const newList = [...list, { milieu, rarete: rarete.code, frequence: rarete.frequence }].sort(Misc.ascending(it => it.milieu))
- await sheet.item.update({ 'system.environnement': newList })
- }
-
- static async onDeleteMilieu(sheet, event) {
- const milieu = EnvironmentSheetHelper.$getEventMilieu(sheet, event);
- if (milieu != undefined) {
- const newList = sheet.item.system.environnement.filter(it => it.milieu != milieu)
- .sort(Misc.ascending(it => it.milieu));
- await sheet.item.update({ 'system.environnement': newList });
- }
- }
-
- static async onChange(sheet, event, doMutation) {
- const list = sheet.item.system.environnement;
- const milieu = EnvironmentSheetHelper.$getEventMilieu(sheet, event);
- const updated = list.find(it => it.milieu == milieu);
- if (updated) {
- doMutation(updated);
- const newList = [...list.filter(it => it.milieu != milieu), updated]
- .sort(Misc.ascending(it => it.milieu));
- await sheet.item.update({ 'system.environnement': newList });
- }
- }
-
- static $getEventMilieu(sheet, event) {
- return sheet.html.find(event.currentTarget)?.parents("div.environnement-milieu").data("milieu");
- }
-
-}
\ No newline at end of file
diff --git a/module/item-arme.js b/module/item-arme.js
index 22118f78..4f78a8e4 100644
--- a/module/item-arme.js
+++ b/module/item-arme.js
@@ -1,5 +1,4 @@
import { RdDItemCompetenceCreature } from "./item-competencecreature.js"
-import { Misc } from "./misc.js";
import { RdDCombatManager } from "./rdd-combat.js";
const nomCategorieParade = {
diff --git a/module/item-faune-sheet.js b/module/item-faune-sheet.js
deleted file mode 100644
index f49d2317..00000000
--- a/module/item-faune-sheet.js
+++ /dev/null
@@ -1,67 +0,0 @@
-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.find("a.linked-actor-delete").click(event => this.onDeleteLinkedActor());
- html.find("a.preparer-nourriture").click(event => this.preparerNourriture(event));
- html.find("a.manger-nourriture").click(event => this.mangerNourriture(event));
- }
-
- async _onDropActor(event, dragData) {
- console.log('faune:dropActor', event, dragData)
- const linkedActor = fromUuidSync(dragData.uuid);
- if (linkedActor?.pack) {
- this.item.update({
- 'system.actor.pack': linkedActor.pack,
- 'system.actor.id': linkedActor._id,
- 'system.actor.name': linkedActor.name
- });
- }
- else {
- ui.notifications.warn(`${linkedActor.name} ne provient pas d'un 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': ''
- });
- }
-
- async preparerNourriture(event) {
- if (this.actor) {
- await this.actor.preparerNourriture(this.item);
- }
- }
- async mangerNourriture(event) {
- if (this.actor) {
- await this.actor.mangerNourriture(this.item);
- }
- }
-
-}
diff --git a/module/item-herbe-sheet.js b/module/item-herbe-sheet.js
deleted file mode 100644
index 0cc0c36b..00000000
--- a/module/item-herbe-sheet.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import { EnvironmentSheetHelper } from "./environnement.js";
-import { RdDItemSheet } from "./item-sheet.js";
-
-export class RdDHerbeItemSheet extends RdDItemSheet {
-
- static get ITEM_TYPE() { return "herbe" };
-
- 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);
- EnvironmentSheetHelper.activateListeners(this);
- }
-}
diff --git a/module/item-ingredient-sheet.js b/module/item-ingredient-sheet.js
deleted file mode 100644
index fdfc66ae..00000000
--- a/module/item-ingredient-sheet.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import { EnvironmentSheetHelper } from "./environnement.js";
-import { RdDItemSheet } from "./item-sheet.js";
-
-export class RdDIngredientItemSheet extends RdDItemSheet {
-
- static get ITEM_TYPE() { return "ingredient" };
-
- 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);
- EnvironmentSheetHelper.activateListeners(this);
- }
-}
diff --git a/module/item-plante-sheet.js b/module/item-plante-sheet.js
deleted file mode 100644
index f4401270..00000000
--- a/module/item-plante-sheet.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import { EnvironmentSheetHelper } from "./environnement.js";
-import { RdDItemSheet } from "./item-sheet.js";
-
-export class RdDPlanteItemSheet extends RdDItemSheet {
-
- static get ITEM_TYPE() { return "plante" };
-
- 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);
- EnvironmentSheetHelper.activateListeners(this);
- }
-}
diff --git a/module/item.js b/module/item.js
index 8669ce38..b526521e 100644
--- a/module/item.js
+++ b/module/item.js
@@ -1,12 +1,11 @@
import { DialogItemVente } from "./dialog-item-vente.js";
-import { Environnement } from "./environnement.js";
import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js";
import { RdDHerbes } from "./rdd-herbes.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDUtility } from "./rdd-utility.js";
import { SystemCompendiums } from "./settings/system-compendiums.js";
-import { RdDRaretes } from "./tirage/raretes.js";
+import { RdDRaretes } from "./item/raretes.js";
const typesInventaireMateriel = [
"arme",
@@ -493,7 +492,7 @@ export class RdDItem extends Item {
return [false, `Impossible de regrouper ${this.name} avec ${other.name}`];
}
else {
- const excludedProperties = ['quantite', 'cout', 'encTotal', 'environnement'];
+ const excludedProperties = ['quantite', 'cout', 'encTotal', 'environnement', 'contenu'];
if (this.getUtilisationCuisine()) {
excludedProperties.push('sust', 'encombrement');
}
diff --git a/module/tirage/raretes.js b/module/item/raretes.js
similarity index 91%
rename from module/tirage/raretes.js
rename to module/item/raretes.js
index ffffb25d..22398ed3 100644
--- a/module/tirage/raretes.js
+++ b/module/item/raretes.js
@@ -15,12 +15,12 @@ const RARETES = [
export class RdDRaretes {
- static getRarete(code = undefined) {
+ static getRareteByCode(code = undefined) {
return RARETES.find(it => it.code == code) ?? RARETE_FREQUENTE;
}
static getChamp(rarete, field = undefined) {
- const selected = this.getRarete(rarete);
+ const selected = this.getRareteByCode(rarete);
return field ? selected[field] : selected[frequence];
}
@@ -37,7 +37,7 @@ export class RdDRaretes {
const freqMax = Math.max(0, ...list.map(env => env.frequence));
const env = list.find(env => env.frequence == freqMax);
if (env) {
- return RdDRaretes.getRarete(env.rarete)
+ return RdDRaretes.getRareteByCode(env.rarete)
}
if (milieux == undefined) {
return RdDRaretes.selonQualite(item)
diff --git a/module/item/item-rencontre.js b/module/item/rencontre.js
similarity index 100%
rename from module/item/item-rencontre.js
rename to module/item/rencontre.js
diff --git a/module/item/item-service.js b/module/item/service.js
similarity index 100%
rename from module/item/item-service.js
rename to module/item/service.js
diff --git a/module/item/sheet-base-inventaire.js b/module/item/sheet-base-inventaire.js
new file mode 100644
index 00000000..1c7a8996
--- /dev/null
+++ b/module/item/sheet-base-inventaire.js
@@ -0,0 +1,119 @@
+import { HtmlUtility } from "../html-utility.js";
+import { RdDItemSheet } from "../item-sheet.js";
+import { Misc } from "../misc.js";
+import { RdDRaretes } from "./raretes.js";
+
+const TYPE_ITEMS_NATURELS = ["faune", "herbe", "plante", "ingredient"];
+
+export class RdDItemInventaireSheet extends RdDItemSheet {
+
+ static get defaultOptions() {
+ return mergeObject(RdDItemSheet.defaultOptions, {
+ tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }]
+ });
+ }
+
+ setPosition(options = {}) {
+ const position = super.setPosition(options);
+ const sheetHeader = this.element.find(".sheet-header");
+ const sheetBody = this.element.find(".sheet-body");
+ sheetBody.css("height", position.height - sheetHeader[0].clientHeight)
+ return position;
+ }
+
+ async getData() {
+ const formData = await super.getData();
+ return mergeObject(formData, {
+ milieux: await game.system.rdd.environnement.autresMilieux(this.item)
+ });
+ }
+
+ activateListeners(html) {
+ super.activateListeners(html);
+ HtmlUtility.showControlWhen(this.html.find("div.description-milieu"), TYPE_ITEMS_NATURELS.includes(this.item.type));
+
+ if (!this.options.editable) return;
+ this.html.find("a.preparer-nourriture").click(event => this.preparerNourriture(event));
+ this.html.find("a.manger-nourriture").click(event => this.mangerNourriture(event));
+
+ this.html.find("input.input-selection-milieu").keypress(event => {
+ if (event.keyCode == '13') {
+ this.onAddMilieu(event);
+ }
+ event.stopPropagation();
+ })
+ this.html.find("a.milieu-add").click(event => this.onAddMilieu(event));
+ this.html.find("div.environnement-milieu a.milieu-delete").click(event => this.onDeleteMilieu(event));
+ this.html.find("div.environnement-milieu select.environnement-rarete").change(event => this.onChange(event,
+ updated => this.$changeRarete(event, updated)));
+ this.html.find("div.environnement-milieu input[name='environnement-frequence']").change(event => this.onChange(event,
+ updated => this.$changeFrequence(event, updated)));
+
+
+ }
+
+ async preparerNourriture(event) {
+ if (this.actor && this.item.getUtilisationCuisine() == 'brut') {
+ await this.actor.preparerNourriture(this.item);
+ }
+ }
+
+ async mangerNourriture(event) {
+ if (this.actor && this.item.getUtilisation() == 'cuisine') {
+ await this.actor.mangerNourriture(this.item);
+ }
+ }
+
+ $changeFrequence(event, updated) {
+ updated.frequence = Number(this.html.find(event.currentTarget).val());
+ }
+
+ $changeRarete(event, updated) {
+ const code = this.html.find(event.currentTarget).val();
+ const rarete = RdDRaretes.getRareteByCode(code);
+ updated.rarete = rarete.code;
+ updated.frequence = rarete.frequence;
+ }
+
+ async onAddMilieu(event) {
+ const milieu = this.html.find('input.input-selection-milieu').val();
+ if (!milieu) {
+ ui.notifications.warn(`Choisissez le milieu dans lequel se trouve le/la ${this.item.name}`);
+ return
+ }
+ const list = this.item.getEnvironnement();
+ const exists = list.find(it => it.milieu == milieu);
+ if (exists) {
+ ui.notifications.warn(`${this.item.name} a déjà une rareté ${exists.rarete} en ${milieu} (fréquence: ${exists.frequence})`);
+ return
+ }
+ const rarete = RdDRaretes.rareteFrequente();
+ const newList = [...list, { milieu, rarete: rarete.code, frequence: rarete.frequence }].sort(Misc.ascending(it => it.milieu))
+ await this.item.update({ 'system.environnement': newList })
+ }
+
+ async onDeleteMilieu(event) {
+ const milieu = this.$getEventMilieu(event);
+ if (milieu != undefined) {
+ const newList = this.item.getEnvironnement().filter(it => it.milieu != milieu)
+ .sort(Misc.ascending(it => it.milieu));
+ await this.item.update({ 'system.environnement': newList });
+ }
+ }
+
+ async onChange(event, doMutation) {
+ const list = this.item.system.environnement;
+ const milieu = this.$getEventMilieu(event);
+ const updated = list.find(it => it.milieu == milieu);
+ if (updated) {
+ doMutation(updated);
+ const newList = [...list.filter(it => it.milieu != milieu), updated]
+ .sort(Misc.ascending(it => it.milieu));
+ await this.item.update({ 'system.environnement': newList });
+ }
+ }
+
+ $getEventMilieu(event) {
+ return this.html.find(event.currentTarget)?.parents("div.environnement-milieu").data("milieu");
+ }
+}
diff --git a/module/item-conteneur-sheet.js b/module/item/sheet-conteneur.js
similarity index 83%
rename from module/item-conteneur-sheet.js
rename to module/item/sheet-conteneur.js
index 744ba751..b5ff7855 100644
--- a/module/item-conteneur-sheet.js
+++ b/module/item/sheet-conteneur.js
@@ -1,9 +1,9 @@
-import { RdDBaseActorSheet } from "./actor/base-actor-sheet.js";
-import { RdDItemSheet } from "./item-sheet.js";
-import { RdDSheetUtility } from "./rdd-sheet-utility.js";
-import { RdDUtility } from "./rdd-utility.js";
+import { RdDBaseActorSheet } from "../actor/base-actor-sheet.js";
+import { RdDSheetUtility } from "../rdd-sheet-utility.js";
+import { RdDUtility } from "../rdd-utility.js";
+import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
-export class RdDConteneurItemSheet extends RdDItemSheet {
+export class RdDConteneurItemSheet extends RdDItemInventaireSheet {
static get ITEM_TYPE() { return "conteneur" };
diff --git a/module/item/sheet-faune.js b/module/item/sheet-faune.js
new file mode 100644
index 00000000..de22340c
--- /dev/null
+++ b/module/item/sheet-faune.js
@@ -0,0 +1,38 @@
+import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
+
+export class RdDFauneItemSheet extends RdDItemInventaireSheet {
+
+ static get ITEM_TYPE() { return "faune" };
+
+ activateListeners(html) {
+ super.activateListeners(html);
+
+ if (!this.options.editable) return;
+
+ html.find("a.linked-actor-delete").click(event => this.onDeleteLinkedActor());
+ }
+
+ async _onDropActor(event, dragData) {
+ console.log('faune:dropActor', event, dragData)
+ const linkedActor = fromUuidSync(dragData.uuid);
+ if (linkedActor?.pack) {
+ this.item.update({
+ 'system.actor.pack': linkedActor.pack,
+ 'system.actor.id': linkedActor._id,
+ 'system.actor.name': linkedActor.name
+ });
+ }
+ else {
+ ui.notifications.warn(`${linkedActor.name} ne provient pas d'un 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/sheet-herbe.js b/module/item/sheet-herbe.js
new file mode 100644
index 00000000..d4c412bb
--- /dev/null
+++ b/module/item/sheet-herbe.js
@@ -0,0 +1,6 @@
+import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
+
+export class RdDHerbeItemSheet extends RdDItemInventaireSheet {
+
+ static get ITEM_TYPE() { return "herbe" };
+}
diff --git a/module/item/sheet-ingredient.js b/module/item/sheet-ingredient.js
new file mode 100644
index 00000000..0c39caac
--- /dev/null
+++ b/module/item/sheet-ingredient.js
@@ -0,0 +1,5 @@
+import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
+
+export class RdDIngredientItemSheet extends RdDItemInventaireSheet {
+ static get ITEM_TYPE() { return "ingredient" };
+}
diff --git a/module/item/sheet-plante.js b/module/item/sheet-plante.js
new file mode 100644
index 00000000..2a6f10fa
--- /dev/null
+++ b/module/item/sheet-plante.js
@@ -0,0 +1,7 @@
+import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
+
+export class RdDPlanteItemSheet extends RdDItemInventaireSheet {
+
+ static get ITEM_TYPE() { return "plante" };
+
+}
diff --git a/module/item-rencontre-sheet.js b/module/item/sheet-rencontre.js
similarity index 95%
rename from module/item-rencontre-sheet.js
rename to module/item/sheet-rencontre.js
index c134300d..79e7a663 100644
--- a/module/item-rencontre-sheet.js
+++ b/module/item/sheet-rencontre.js
@@ -1,5 +1,5 @@
-import { RdDRencontre } from "./item/item-rencontre.js";
-import { RdDItemSheet } from "./item-sheet.js";
+import { RdDRencontre } from "./rencontre.js";
+import { RdDItemSheet } from "../item-sheet.js";
export class RdDRencontreItemSheet extends RdDItemSheet {
diff --git a/module/item-service-sheet.js b/module/item/sheet-service.js
similarity index 87%
rename from module/item-service-sheet.js
rename to module/item/sheet-service.js
index cd61de7e..a819247d 100644
--- a/module/item-service-sheet.js
+++ b/module/item/sheet-service.js
@@ -1,4 +1,4 @@
-import { RdDItemSheet } from "./item-sheet.js";
+import { RdDItemSheet } from "../item-sheet.js";
export class RdDServiceItemSheet extends RdDItemSheet {
diff --git a/module/item-signedraconique-sheet.js b/module/item/sheet-signedraconique.js
similarity index 92%
rename from module/item-signedraconique-sheet.js
rename to module/item/sheet-signedraconique.js
index 6052079a..894c1227 100644
--- a/module/item-signedraconique-sheet.js
+++ b/module/item/sheet-signedraconique.js
@@ -1,6 +1,6 @@
-import { RdDItemSheet } from "./item-sheet.js";
-import { RdDItemSigneDraconique } from "./item/item-signedraconique.js";
-import { TMRUtility } from "./tmr-utility.js";
+import { RdDItemSheet } from "../item-sheet.js";
+import { RdDItemSigneDraconique } from "./signedraconique.js";
+import { TMRUtility } from "../tmr-utility.js";
/**
* Item sheet pour signes draconiques
diff --git a/module/item/item-signedraconique.js b/module/item/signedraconique.js
similarity index 100%
rename from module/item/item-signedraconique.js
rename to module/item/signedraconique.js
diff --git a/module/migrations.js b/module/migrations.js
index 45d9f84e..c5544ded 100644
--- a/module/migrations.js
+++ b/module/migrations.js
@@ -1,11 +1,10 @@
import { RdDBaseActor } from "./actor/base-actor.js";
import { LOG_HEAD, SYSTEM_RDD } from "./constants.js";
-import { Environnement } from "./environnement.js";
import { Grammar } from "./grammar.js";
import { Monnaie } from "./item-monnaie.js";
import { RdDItem } from "./item.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
-import { RdDRaretes } from "./tirage/raretes.js";
+import { RdDRaretes } from "./item/raretes.js";
class Migration {
get code() { return "sample"; }
@@ -289,7 +288,7 @@ class _10_3_0_FrequenceEnvironnement extends Migration {
}
_updatesFrequences(it) {
- const rarete = RdDRaretes.getRarete(it.system.rarete);
+ const rarete = RdDRaretes.getRareteByCode(it.system.rarete);
return {
_id: it.id,
'system.rarete': undefined,
diff --git a/module/rdd-compendium-organiser.js b/module/rdd-compendium-organiser.js
index e8b11b4e..b0ddfa3d 100644
--- a/module/rdd-compendium-organiser.js
+++ b/module/rdd-compendium-organiser.js
@@ -1,8 +1,8 @@
import { SYSTEM_RDD } from "./constants.js";
-export class RddCompendiumOrganiser {
+export class RdDCompendiumOrganiser {
static init() {
- Hooks.on('renderCompendium', async (pack, html, compendiumData) => RddCompendiumOrganiser.onRenderCompendium(pack, html, compendiumData))
+ Hooks.on('renderCompendium', async (pack, html, compendiumData) => RdDCompendiumOrganiser.onRenderCompendium(pack, html, compendiumData))
}
static async onRenderCompendium(compendium, html, compendiumData) {
@@ -10,14 +10,14 @@ export class RddCompendiumOrganiser {
const pack = compendium.collection
if (pack.metadata.system === SYSTEM_RDD) {
html.find('.directory-item').each((i, element) => {
- RddCompendiumOrganiser.setEntityTypeName(pack, element);
+ RdDCompendiumOrganiser.setEntityTypeName(pack, element);
});
}
}
static async setEntityTypeName(pack, element) {
- const label = RddCompendiumOrganiser.getEntityTypeLabel(await pack.getDocument(element.dataset.documentId));
- RddCompendiumOrganiser.insertEntityType(element, label);
+ const label = RdDCompendiumOrganiser.getEntityTypeLabel(await pack.getDocument(element.dataset.documentId));
+ RdDCompendiumOrganiser.insertEntityType(element, label);
}
static insertEntityType(element, label) {
diff --git a/module/rdd-main.js b/module/rdd-main.js
index 1a921ae5..1ca85977 100644
--- a/module/rdd-main.js
+++ b/module/rdd-main.js
@@ -1,16 +1,20 @@
import { SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
-import { RdDActor } from "./actor.js";
-import { RdDItem } from "./item.js";
+import { Migrations } from './migrations.js';
+
import { RdDUtility } from "./rdd-utility.js";
import { TMRUtility } from "./tmr-utility.js";
+import { TMRRencontres } from "./tmr-rencontres.js";
import { RdDCalendrier } from "./rdd-calendrier.js";
+import { RdDTimestamp } from "./rdd-timestamp.js";
+import { DialogChronologie } from "./dialog-chronologie.js";
+
import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDTokenHud } from "./rdd-token-hud.js";
import { RdDCommands } from "./rdd-commands.js";
import { RdDCombatManager, RdDCombat } from "./rdd-combat.js";
import { ChatUtility } from "./chat-utility.js";
import { StatusEffects } from "./settings/status-effects.js";
-import { RddCompendiumOrganiser } from "./rdd-compendium-organiser.js";
+import { RdDCompendiumOrganiser } from "./rdd-compendium-organiser.js";
import { ReglesOptionelles } from "./settings/regles-optionelles.js";
import { RdDHotbar } from "./rdd-hotbar-drop.js"
import { EffetsDraconiques } from "./tmr/effets-draconiques.js";
@@ -18,39 +22,39 @@ import { RdDHerbes } from "./rdd-herbes.js";
import { RdDDice } from "./rdd-dice.js";
import { RdDPossession } from "./rdd-possession.js";
import { Misc } from "./misc.js";
-import { Migrations } from './migrations.js';
-import { DialogChronologie } from "./dialog-chronologie.js";
+
import { SystemCompendiums } from "./settings/system-compendiums.js";
import { Environnement } from "./environnement.js";
-import { RdDItemService } from "./item/item-service.js";
-import { RdDBaseActor } from "./actor/base-actor.js";
-import { RdDCommerceSheet } from "./actor/commerce-sheet.js";
-import { RdDCommerce } from "./actor/commerce.js";
-import { RdDTimestamp } from "./rdd-timestamp.js";
-import { RdDItemMaladie } from "./item/maladie.js";
-import { RdDItemPoison } from "./item/poison.js";
-import { RdDItemSigneDraconique } from "./item/item-signedraconique.js";
-import { RdDItemQueue } from "./item/queue.js";
-import { RdDItemOmbre } from "./item/ombre.js";
-import { RdDItemSouffle } from "./item/souffle.js";
-import { RdDRencontre } from "./item/item-rencontre.js";
+import { RdDActor } from "./actor.js";
+import { RdDBaseActor } from "./actor/base-actor.js";
+import { RdDCommerce } from "./actor/commerce.js";
import { RdDActorSheet } from "./actor-sheet.js";
+import { RdDCommerceSheet } from "./actor/commerce-sheet.js";
import { RdDActorCreatureSheet } from "./actor-creature-sheet.js";
import { RdDActorVehiculeSheet } from "./actor-vehicule-sheet.js";
import { RdDActorEntiteSheet } from "./actor-entite-sheet.js";
-import { RdDItemSheet } from "./item-sheet.js";
-import { RdDServiceItemSheet } from "./item-service-sheet.js";
-import { RdDHerbeItemSheet } from "./item-herbe-sheet.js";
-import { RdDRencontreItemSheet } from "./item-rencontre-sheet.js";
-import { RdDPlanteItemSheet } from "./item-plante-sheet.js";
-import { RdDIngredientItemSheet } from "./item-ingredient-sheet.js";
-import { RdDFauneItemSheet } from "./item-faune-sheet.js";
-import { RdDConteneurItemSheet } from "./item-conteneur-sheet.js";
-import { RdDSigneDraconiqueItemSheet } from "./item-signedraconique-sheet.js";
-import { TMRRencontres } from "./tmr-rencontres.js";
-import { FenetreRechercheTirage } from "./tirage/fenetre-recherche-tirage.js";
+import { RdDItem } from "./item.js";
+import { RdDItemService } from "./item/service.js";
+import { RdDItemMaladie } from "./item/maladie.js";
+import { RdDItemPoison } from "./item/poison.js";
+import { RdDItemSigneDraconique } from "./item/signedraconique.js";
+import { RdDItemQueue } from "./item/queue.js";
+import { RdDItemOmbre } from "./item/ombre.js";
+import { RdDItemSouffle } from "./item/souffle.js";
+import { RdDRencontre } from "./item/rencontre.js";
+
+import { RdDItemSheet } from "./item-sheet.js";
+import { RdDServiceItemSheet } from "./item/sheet-service.js";
+import { RdDRencontreItemSheet } from "./item/sheet-rencontre.js";
+import { RdDHerbeItemSheet } from "./item/sheet-herbe.js";
+import { RdDPlanteItemSheet } from "./item/sheet-plante.js";
+import { RdDIngredientItemSheet } from "./item/sheet-ingredient.js";
+import { RdDFauneItemSheet } from "./item/sheet-faune.js";
+import { RdDConteneurItemSheet } from "./item/sheet-conteneur.js";
+import { RdDSigneDraconiqueItemSheet } from "./item/sheet-signedraconique.js";
+import { RdDItemInventaireSheet } from "./item/sheet-base-inventaire.js";
/**
* RdD system
@@ -151,12 +155,16 @@ export class SystemReveDeDragon {
RdDItemSheet.register(RdDIngredientItemSheet);
RdDItemSheet.register(RdDServiceItemSheet);
+ Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
+ types: [
+ "objet", "arme", "armure", "livre", "potion", "munition",
+ "monnaie", "nourritureboisson", "gemme",
+ ], makeDefault: true
+ });
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
types: [
"competence", "competencecreature",
"recettealchimique", "musique", "chant", "danse", "jeu", "recettecuisine", "oeuvre",
- "objet", "arme", "armure", "livre", "potion", "munition",
- "monnaie", "nourritureboisson", "gemme",
"meditation", "queue", "ombre", "souffle", "tete", "casetmr", "sort", "sortreserve",
"nombreastral", "tache", "maladie", "poison", "possession",
"tarot", "extraitpoetique"
@@ -176,7 +184,7 @@ export class SystemReveDeDragon {
RdDCombatManager.init();
RdDTokenHud.init();
RdDBaseActor.init();
- RddCompendiumOrganiser.init();
+ RdDCompendiumOrganiser.init();
EffetsDraconiques.init()
TMRUtility.init();
RdDHotbar.initDropbar();
diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js
index 51120319..ac450e98 100644
--- a/module/rdd-tmr-dialog.js
+++ b/module/rdd-tmr-dialog.js
@@ -15,7 +15,7 @@ import { HtmlUtility } from "./html-utility.js";
import { ReglesOptionelles } from "./settings/regles-optionelles.js";
import { RdDDice } from "./rdd-dice.js";
import { STATUSES } from "./settings/status-effects.js";
-import { RdDRencontre } from "./item/item-rencontre.js";
+import { RdDRencontre } from "./item/rencontre.js";
import { RdDCalendrier } from "./rdd-calendrier.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
diff --git a/module/rdd-utility.js b/module/rdd-utility.js
index 97ae50fd..b62961df 100644
--- a/module/rdd-utility.js
+++ b/module/rdd-utility.js
@@ -8,15 +8,13 @@ import { DialogItemAchat } from "./dialog-item-achat.js";
import { ReglesOptionelles } from "./settings/regles-optionelles.js";
import { RdDDice } from "./rdd-dice.js";
import { RdDItem } from "./item.js";
-import { Monnaie } from "./item-monnaie.js";
import { RdDPossession } from "./rdd-possession.js";
import { RdDNameGen } from "./rdd-namegen.js";
import { RdDConfirm } from "./rdd-confirm.js";
-import { Environnement } from "./environnement.js";
import { RdDItemCompetence } from "./item-competence.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
-import { RdDRaretes } from "./tirage/raretes.js";
+import { RdDRaretes } from "./item/raretes.js";
/* -------------------------------------------- */
// This table starts at 0 -> niveau -10
diff --git a/module/settings/system-compendiums.js b/module/settings/system-compendiums.js
index b9bc9a80..7a1dc033 100644
--- a/module/settings/system-compendiums.js
+++ b/module/settings/system-compendiums.js
@@ -61,7 +61,7 @@ export class SystemCompendiums extends FormApplication {
static async getPackContent(compendium, docType) {
const pack = SystemCompendiums.getPack(compendium);
- if (pack.metadata.type == docType) {
+ if (pack?.metadata.type == docType) {
return await pack.getDocuments();
}
return [];
diff --git a/module/tirage/fenetre-recherche-tirage.js b/module/tirage/fenetre-recherche-tirage.js
index a614afe3..f3c6eeb7 100644
--- a/module/tirage/fenetre-recherche-tirage.js
+++ b/module/tirage/fenetre-recherche-tirage.js
@@ -2,7 +2,7 @@ import { RdDItem } from '../item.js';
import { HtmlUtility } from '../html-utility.js';
import { Misc } from "../misc.js";
import { CompendiumTableHelpers } from '../settings/system-compendiums.js';
-import { RdDRaretes } from './raretes.js';
+import { RdDRaretes } from '../item/raretes.js';
const FILTER_GROUPS = [
{ group: 'type', label: "Type d'objet" },
diff --git a/template.json b/template.json
index 681a54e3..2a49c793 100644
--- a/template.json
+++ b/template.json
@@ -584,9 +584,7 @@
"encombrement": 0,
"quantite": 1,
"qualite": 0,
- "cout": 0.0
- },
- "environnement": {
+ "cout": 0.0,
"milieu": "",
"environnement": []
},
@@ -713,25 +711,25 @@
"force": 0
},
"herbe": {
- "templates": ["description", "inventaire", "environnement", "comestible"],
+ "templates": ["description", "inventaire", "comestible"],
"niveau": 0,
"base": 0,
"categorie": ""
},
"plante": {
- "templates": ["description", "inventaire", "environnement", "comestible"],
+ "templates": ["description", "inventaire", "comestible"],
"niveau": 0,
"base": 0,
"categorie": ""
},
"ingredient": {
- "templates": ["description", "inventaire", "environnement", "comestible"],
+ "templates": ["description", "inventaire", "comestible"],
"niveau": 0,
"base": 0,
"categorie": ""
},
"faune": {
- "templates": ["description", "inventaire", "environnement", "comestible"],
+ "templates": ["description", "inventaire", "comestible"],
"categorie": "",
"actor": {
"id": "",
diff --git a/templates/item-arme-sheet.html b/templates/item-arme-sheet.html
index 8a52c2cd..2964af13 100644
--- a/templates/item-arme-sheet.html
+++ b/templates/item-arme-sheet.html
@@ -1,8 +1,11 @@