diff --git a/module/rdd-herbes.js b/module/rdd-herbes.js index edcd3513..4d650e27 100644 --- a/module/rdd-herbes.js +++ b/module/rdd-herbes.js @@ -6,7 +6,7 @@ import { RdDTimestamp } from "./time/rdd-timestamp.js"; export class RdDHerbes extends Item { /* -------------------------------------------- */ - static async initializeHerbes() { + static async onReady() { this.herbesSoins = await RdDHerbes.listCategorieHerbes('Soin'); this.herbesRepos = await RdDHerbes.listCategorieHerbes('Repos'); } diff --git a/module/rdd-main.js b/module/rdd-main.js index d51f3351..e16e7948 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -1,69 +1,70 @@ -import { SYSTEM_RDD, SYSTEM_SOCKET_ID, RDD_CONFIG } from "./constants.js"; -import { Migrations } from './migrations.js'; +import { SYSTEM_RDD, SYSTEM_SOCKET_ID, RDD_CONFIG } from "./constants.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 "./time/rdd-calendrier.js"; -import { RdDTimestamp } from "./time/rdd-timestamp.js"; -import { DialogChronologie } from "./dialog-chronologie.js"; +import { RdDUtility } from "./rdd-utility.js" +import { TMRUtility } from "./tmr-utility.js" +import { TMRRencontres } from "./tmr-rencontres.js" +import { RdDCalendrier } from "./time/rdd-calendrier.js" +import { RdDTimestamp } from "./time/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 { ReglesOptionnelles } from "./settings/regles-optionnelles.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 { ReglesOptionnelles } from "./settings/regles-optionnelles.js" import { RdDHotbar } from "./rdd-hotbar-drop.js" -import { EffetsDraconiques } from "./tmr/effets-draconiques.js"; -import { RdDHerbes } from "./rdd-herbes.js"; -import { RdDDice } from "./rdd-dice.js"; -import { RdDPossession } from "./rdd-possession.js"; -import { Misc } from "./misc.js"; +import { EffetsDraconiques } from "./tmr/effets-draconiques.js" +import { RdDHerbes } from "./rdd-herbes.js" +import { RdDDice } from "./rdd-dice.js" +import { RdDPossession } from "./rdd-possession.js" +import { Misc } from "./misc.js" -import { SystemCompendiums } from "./settings/system-compendiums.js"; -import { Environnement } from "./environnement.js"; +import { SystemCompendiums } from "./settings/system-compendiums.js" +import { Environnement } from "./environnement.js" -import { RdDActor } from "./actor.js"; -import { RdDBaseActor } from "./actor/base-actor.js"; -import { RdDCommerce } from "./actor/commerce.js"; -import { RdDEntite } from "./actor/entite.js"; -import { RdDVehicule } from "./actor/vehicule.js"; -import { RdDActorSheet } from "./actor-sheet.js"; -import { RdDCommerceSheet } from "./actor/commerce-sheet.js"; -import { RdDCreatureSheet } from "./actor/creature-sheet.js"; -import { RdDActorEntiteSheet } from "./actor/entite-sheet.js"; -import { RdDActorVehiculeSheet } from "./actor/vehicule-sheet.js"; +import { RdDActor } from "./actor.js" +import { RdDBaseActor } from "./actor/base-actor.js" +import { RdDCommerce } from "./actor/commerce.js" +import { RdDEntite } from "./actor/entite.js" +import { RdDVehicule } from "./actor/vehicule.js" +import { RdDActorSheet } from "./actor-sheet.js" +import { RdDCommerceSheet } from "./actor/commerce-sheet.js" +import { RdDCreatureSheet } from "./actor/creature-sheet.js" +import { RdDActorEntiteSheet } from "./actor/entite-sheet.js" +import { RdDActorVehiculeSheet } from "./actor/vehicule-sheet.js" -import { RdDItem } from "./item.js"; -import { RdDItemBlessure } from "./item/blessure.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 { RdDItem } from "./item.js" +import { RdDItemBlessure } from "./item/blessure.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 { RdDBlessureItemSheet } from "./item/sheet-blessure.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"; -import { AppAstrologie } from "./sommeil/app-astrologie.js"; -import { RdDItemArmure } from "./item/armure.js"; -import { AutoAdjustDarkness as AutoAdjustDarkness } from "./time/auto-adjust-darkness.js"; -import { RdDCreature } from "./actor/creature.js"; -import { RdDTMRDialog } from "./rdd-tmr-dialog.js"; +import { RdDItemSheet } from "./item-sheet.js" +import { RdDBlessureItemSheet } from "./item/sheet-blessure.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" +import { AppAstrologie } from "./sommeil/app-astrologie.js" +import { RdDItemArmure } from "./item/armure.js" +import { AutoAdjustDarkness as AutoAdjustDarkness } from "./time/auto-adjust-darkness.js" +import { RdDCreature } from "./actor/creature.js" +import { RdDTMRDialog } from "./rdd-tmr-dialog.js" +import { RdDActorExportSheet } from "./actor/actor-export-sheet.js" /** * RdD system @@ -71,18 +72,18 @@ import { RdDTMRDialog } from "./rdd-tmr-dialog.js"; * Software License: GNU GPLv3 */ export class SystemReveDeDragon { - + static start() { const system = new SystemReveDeDragon() Hooks.once('init', async () => await system.onInit()) Hooks.once('diceSoNiceReady', (dice3d) => RdDDice.diceSoNiceReady(dice3d)) Hooks.once('ready', () => system.onReady()) } - + constructor() { - this.config = RDD_CONFIG; - this.RdDUtility = RdDUtility; - this.RdDHotbar = RdDHotbar; + this.config = RDD_CONFIG + this.RdDUtility = RdDUtility + this.RdDHotbar = RdDHotbar this.itemClasses = { armure: RdDItemArmure, blessure: RdDItemBlessure, @@ -108,42 +109,42 @@ export class SystemReveDeDragon { /* Foundry VTT Initialization */ /* -------------------------------------------- */ async onInit() { - game.system.rdd = this; - this.AppAstrologie = AppAstrologie; + game.system.rdd = this + this.AppAstrologie = AppAstrologie - console.log(`Initializing Reve de Dragon System`); + console.log(`Initializing Reve de Dragon System`) // preload handlebars templates - RdDUtility.preloadHandlebarsTemplates(); + RdDUtility.preloadHandlebarsTemplates() /* -------------------------------------------- */ - this.initSystemSettings(); + this.initSystemSettings() /* -------------------------------------------- */ // Set an initiative formula for the system CONFIG.Combat.initiative = { formula: "1+(1d6/10)", decimals: 2 - }; + } /* -------------------------------------------- */ game.socket.on(SYSTEM_SOCKET_ID, async (sockmsg) => { - console.log(">>>>> MSG RECV", sockmsg); + console.log(">>>>> MSG RECV", sockmsg) try { - RdDUtility.onSocketMessage(sockmsg); - RdDCombat.onSocketMessage(sockmsg); - ChatUtility.onSocketMessage(sockmsg); - RdDBaseActor.onSocketMessage(sockmsg); + RdDUtility.onSocketMessage(sockmsg) + RdDCombat.onSocketMessage(sockmsg) + ChatUtility.onSocketMessage(sockmsg) + RdDBaseActor.onSocketMessage(sockmsg) } catch (e) { console.error('game.socket.on(SYSTEM_SOCKET_ID) Exception: ', sockmsg, ' => ', e) } - }); + }) /* -------------------------------------------- */ // Define custom Entity classes - CONFIG.Actor.documentClass = RdDBaseActor; - CONFIG.Item.documentClass = RdDItem; + CONFIG.Actor.documentClass = RdDBaseActor + CONFIG.Item.documentClass = RdDItem CONFIG.RDD = { resolutionTable: RdDResolutionTable.resolutionTable, carac_array: RdDUtility.getCaracArray(), @@ -153,30 +154,31 @@ export class SystemReveDeDragon { /* -------------------------------------------- */ // Register sheet application classes - Actors.unregisterSheet("core", ActorSheet); - Actors.registerSheet(SYSTEM_RDD, RdDCommerceSheet, { types: ["commerce"], makeDefault: true }); - Actors.registerSheet(SYSTEM_RDD, RdDActorSheet, { types: ["personnage"], makeDefault: true }); - Actors.registerSheet(SYSTEM_RDD, RdDCreatureSheet, { types: ["creature"], makeDefault: true }); - Actors.registerSheet(SYSTEM_RDD, RdDActorVehiculeSheet, { types: ["vehicule"], makeDefault: true }); - Actors.registerSheet(SYSTEM_RDD, RdDActorEntiteSheet, { types: ["entite"], makeDefault: true }); - Items.unregisterSheet("core", ItemSheet); + Actors.unregisterSheet("core", ActorSheet) + Actors.registerSheet(SYSTEM_RDD, RdDCommerceSheet, { types: ["commerce"], makeDefault: true }) + Actors.registerSheet(SYSTEM_RDD, RdDActorExportSheet, { types: ["personnage"], makeDefault: false }) + Actors.registerSheet(SYSTEM_RDD, RdDActorSheet, { types: ["personnage"], makeDefault: true }) + Actors.registerSheet(SYSTEM_RDD, RdDCreatureSheet, { types: ["creature"], makeDefault: true }) + Actors.registerSheet(SYSTEM_RDD, RdDActorVehiculeSheet, { types: ["vehicule"], makeDefault: true }) + Actors.registerSheet(SYSTEM_RDD, RdDActorEntiteSheet, { types: ["entite"], makeDefault: true }) + Items.unregisterSheet("core", ItemSheet) - RdDItemSheet.register(RdDSigneDraconiqueItemSheet); - RdDItemSheet.register(RdDRencontreItemSheet); - RdDItemSheet.register(RdDConteneurItemSheet); - RdDItemSheet.register(RdDHerbeItemSheet); - RdDItemSheet.register(RdDFauneItemSheet); - RdDItemSheet.register(RdDPlanteItemSheet); - RdDItemSheet.register(RdDIngredientItemSheet); - RdDItemSheet.register(RdDServiceItemSheet); - RdDItemSheet.register(RdDBlessureItemSheet); + RdDItemSheet.register(RdDSigneDraconiqueItemSheet) + RdDItemSheet.register(RdDRencontreItemSheet) + RdDItemSheet.register(RdDConteneurItemSheet) + RdDItemSheet.register(RdDHerbeItemSheet) + RdDItemSheet.register(RdDFauneItemSheet) + RdDItemSheet.register(RdDPlanteItemSheet) + RdDItemSheet.register(RdDIngredientItemSheet) + RdDItemSheet.register(RdDServiceItemSheet) + RdDItemSheet.register(RdDBlessureItemSheet) 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", @@ -185,31 +187,30 @@ export class SystemReveDeDragon { "nombreastral", "tache", "maladie", "poison", "possession", "tarot", "extraitpoetique", "empoignade" ], makeDefault: true - }); - CONFIG.Combat.documentClass = RdDCombatManager; + }) + CONFIG.Combat.documentClass = RdDCombatManager // préparation des différents modules - AutoAdjustDarkness.init(); - RdDTimestamp.init(); - RdDCalendrier.init(); - SystemCompendiums.init(); - DialogChronologie.init(); - ReglesOptionnelles.init(); - RdDUtility.init(); - RdDDice.init(); - RdDCommands.init(); - RdDCombatManager.init(); - RdDTokenHud.init(); - RdDBaseActor.init(); - RdDCompendiumOrganiser.init(); + AutoAdjustDarkness.init() + RdDTimestamp.init() + RdDCalendrier.init() + SystemCompendiums.init() + DialogChronologie.init() + ReglesOptionnelles.init() + RdDUtility.init() + RdDDice.init() + RdDCommands.init() + RdDCombatManager.init() + RdDTokenHud.init() + RdDBaseActor.init() + RdDCompendiumOrganiser.init() EffetsDraconiques.init() - TMRUtility.init(); + TMRUtility.init() await RdDTMRDialog.init() - RdDHotbar.initDropbar(); - RdDPossession.init(); - TMRRencontres.init(); - Environnement.init(); - + RdDHotbar.init() + RdDPossession.init() + TMRRencontres.init() + Environnement.init() } initSystemSettings() { @@ -225,7 +226,7 @@ export class SystemReveDeDragon { "avant-encaissement": "Avant l'encaissement", }, default: "avant-encaissement" - }); + }) /* -------------------------------------------- */ game.settings.register(SYSTEM_RDD, "supprimer-dialogues-combat-chat", { @@ -235,7 +236,7 @@ export class SystemReveDeDragon { config: true, default: true, type: Boolean - }); + }) /* -------------------------------------------- */ game.settings.register(SYSTEM_RDD, "activer-sons-audio", { @@ -245,7 +246,8 @@ export class SystemReveDeDragon { config: true, default: true, type: Boolean - }); + }) + /* -------------------------------------------- */ game.settings.register(SYSTEM_RDD, "appliquer-famine-soif", { name: "Notifier de la famine et la soif pour", @@ -259,7 +261,7 @@ export class SystemReveDeDragon { "famine-soif": "la famine et la soif", }, default: "aucun" - }); + }) } async onReady() { @@ -267,47 +269,47 @@ export class SystemReveDeDragon { /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ - game.system.rdd.calendrier = new RdDCalendrier(); + game.system.rdd.calendrier = new RdDCalendrier() if (Misc.isUniqueConnectedGM()) { - new Migrations().migrate(); - this.messageDeBienvenue(); - import("https://www.uberwald.me/fvtt_appcount/count-class-ready.js").then(moduleCounter=>{ + new Migrations().migrate() + this.messageDeBienvenue() + import("https://www.uberwald.me/fvtt_appcount/count-class-ready.js").then(moduleCounter => { console.log("ClassCounter loaded", moduleCounter) moduleCounter.ClassCounter.registerUsageCount() - }).catch(err=> + }).catch(err => console.log("No stats available, giving up.") - ) + ) } - StatusEffects.onReady(); - RdDHerbes.initializeHerbes(); - RdDDice.onReady(); + StatusEffects.onReady() + RdDHerbes.onReady() + RdDDice.onReady() /* -------------------------------------------- */ /* Affiche/Init le calendrier */ - game.system.rdd.calendrier.display(); + game.system.rdd.calendrier.display() // Avertissement si joueur sans personnage if (!game.user.isGM && game.user.character == undefined) { - ui.notifications.info("Attention ! Vous n'êtes connecté à aucun personnage !"); + ui.notifications.info("Attention ! Vous n'êtes connecté à aucun personnage !") ChatMessage.create({ content: "ATTENTION Le joueur " + game.user.name + " n'est connecté à aucun personnage !", user: game.user.id - }); + }) } } /* -------------------------------------------- */ messageDeBienvenue() { if (game.user.isGM) { - ChatUtility.removeChatMessageContaining('
'); + ChatUtility.removeChatMessageContaining('
') ChatMessage.create({ user: game.user.id, content: `
Bienvenue dans le Rêve des Dragons !
Vous trouverez quelques informations pour démarrer dans ce document : @Compendium[foundryvtt-reve-de-dragon.rappel-des-regles.7uGrUHGdPu0EmIu2]{Documentation MJ/Joueurs}
La commande /aide dans le chat permet de voir les commandes spécifiques à Rêve de Dragon.
- ` }); + ` }) } } } -SystemReveDeDragon.start(); +SystemReveDeDragon.start() diff --git a/module/time/rdd-calendrier.js b/module/time/rdd-calendrier.js index 5e7e88a5..a56df1ce 100644 --- a/module/time/rdd-calendrier.js +++ b/module/time/rdd-calendrier.js @@ -1,7 +1,6 @@ import { MAX_NOMBRE_ASTRAL, RdDTimestamp, WORLD_TIMESTAMP_SETTING } from "./rdd-timestamp.js"; import { RdDCalendrierEditor } from "./rdd-calendrier-editor.js"; import { RdDResolutionTable } from "../rdd-resolution-table.js"; -import { RdDUtility } from "../rdd-utility.js"; import { RdDDice } from "../rdd-dice.js"; import { Misc } from "../misc.js"; import { DialogChronologie } from "../dialog-chronologie.js";