10.6.2 #611

Merged
uberwald merged 7 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2023-01-18 08:40:41 +01:00
42 changed files with 517 additions and 518 deletions
Showing only changes of commit 851a208aee - Show all commits

View File

@ -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";

View File

@ -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 {

View File

@ -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");
}
}

View File

@ -1,5 +1,4 @@
import { RdDItemCompetenceCreature } from "./item-competencecreature.js"
import { Misc } from "./misc.js";
import { RdDCombatManager } from "./rdd-combat.js";
const nomCategorieParade = {

View File

@ -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.
<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': ''
});
}
async preparerNourriture(event) {
if (this.actor) {
await this.actor.preparerNourriture(this.item);
}
}
async mangerNourriture(event) {
if (this.actor) {
await this.actor.mangerNourriture(this.item);
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

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

View File

@ -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)

View File

@ -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");
}
}

View File

@ -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" };

View File

@ -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.
<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

@ -0,0 +1,6 @@
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
export class RdDHerbeItemSheet extends RdDItemInventaireSheet {
static get ITEM_TYPE() { return "herbe" };
}

View File

@ -0,0 +1,5 @@
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
export class RdDIngredientItemSheet extends RdDItemInventaireSheet {
static get ITEM_TYPE() { return "ingredient" };
}

View File

@ -0,0 +1,7 @@
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
export class RdDPlanteItemSheet extends RdDItemInventaireSheet {
static get ITEM_TYPE() { return "plante" };
}

View File

@ -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 {

View File

@ -1,4 +1,4 @@
import { RdDItemSheet } from "./item-sheet.js";
import { RdDItemSheet } from "../item-sheet.js";
export class RdDServiceItemSheet extends RdDItemSheet {

View File

@ -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

View File

@ -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,

View File

@ -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) {

View File

@ -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();

View File

@ -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";

View File

@ -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

View File

@ -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 [];

View File

@ -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" },

View File

@ -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": "",

View File

@ -1,8 +1,11 @@
<form class="{{cssClass}}" autocomplete="off">
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
{{!-- Sheet Body --}}
<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 flexcol" data-group="primary" data-tab="informations">
<div class="form-group">
<label for="system.competence">Compétence de mêlée</label>
<select name="system.competence" id="competence" data-dtype="String">
@ -46,7 +49,6 @@
{{/select}}
</select>
</div>
<div class="form-group">
<label for="system.force">Force min. </label>
<input class="attribute-value" type="text" name="system.force" value="{{system.force}}" data-dtype="String"/>
@ -99,8 +101,9 @@
{{/select}}
</select>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -1,8 +1,12 @@
<form class="{{cssClass}}" autocomplete="off">
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
{{!-- Sheet Body --}}
<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 flexcol" data-group="primary" data-tab="informations">
<div class="form-group">
<label for="system.protection">Protection</label>
<input class="attribute-value" type="text" name="system.protection" value="{{system.protection}}" data-dtype="String"/>
@ -17,5 +21,7 @@
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -1,7 +1,13 @@
<form class="{{cssClass}}" autocomplete="off">
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
{{!-- Sheet Body --}}
<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 flexcol" data-group="primary" data-tab="informations">
<div class="form-group">
<label for="xp">Capacite (points d'Enc.)</label>
<input class="attribute-value" type="text" name="system.capacite" value="{{system.capacite}}" data-dtype="Number"/>
@ -22,7 +28,8 @@
</ul>
</div>
{{/if}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -1,7 +1,11 @@
<form class="{{cssClass}}" autocomplete="off">
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
{{!-- Sheet Body --}}
<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 flexcol" data-group="primary" data-tab="informations">
<div class="form-group">
<label>Type</label>
<select name="system.type" id="type" data-dtype="String">
@ -28,5 +32,7 @@
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -10,9 +10,13 @@
{{/if}}
</div>
</header>
{{!-- Sheet Body --}}
<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 flexcol" data-group="primary" data-tab="informations">
<div class="form-group">
<label for="xp">Auteur</label>
<input class="attribute-value" type="text" name="system.auteur" value="{{system.auteur}}" data-dtype="String"/>
@ -48,5 +52,7 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -1,7 +1,14 @@
<form class="{{cssClass}}" autocomplete="off">
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
<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 flexcol" data-group="primary" data-tab="informations">
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -1,8 +1,14 @@
<form class="{{cssClass}}" autocomplete="off">
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
{{!-- Sheet Body --}}
<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 flexcol" data-group="primary" data-tab="informations">
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -1,7 +1,11 @@
<form class="{{cssClass}}" autocomplete="off">
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
{{!-- Sheet Body --}}
<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 flexcol" data-group="primary" data-tab="informations">
<div class="form-group">
<label for="system.sust">Sustentation</label>
<input class="attribute-value" type="text" name="system.sust" value="{{system.sust}}" data-dtype="Number" />
@ -32,5 +36,7 @@
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -1,8 +1,14 @@
<form class="{{cssClass}}" autocomplete="off">
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
{{!-- Sheet Body --}}
<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 flexcol" data-group="primary" data-tab="informations">
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -11,8 +11,12 @@
</div>
</header>
{{!-- Sheet Body --}}
<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 flexcol" data-group="primary" data-tab="informations">
<div class="form-group">
<label>Fréquence</label>
<select name="system.rarete" class="rarete" data-dtype="String">
@ -96,6 +100,8 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -1,3 +1,4 @@
{{#unless isOwned}}
{{>'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete-script.hbs'}}
<div class="tab items" data-group="primary" data-tab="environnement">
<div class="form-group description-milieu">
@ -35,3 +36,4 @@
</div>
{{/each}}
</div>
{{/unless}}

View File

@ -1 +1,3 @@
{{#unless isOwned}}
<a class="item" data-tab="environnement">Environnement</a>
{{/unless}}