From e848406ccb5ad58519a496025f1aff9baeaa0915 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Sun, 7 Jun 2020 23:16:50 +0200 Subject: [PATCH] Preliminary verssion for fight --- module/hook-renderChatLog.js | 9 +++++++ module/rdd-main.js | 52 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 module/hook-renderChatLog.js create mode 100644 module/rdd-main.js diff --git a/module/hook-renderChatLog.js b/module/hook-renderChatLog.js new file mode 100644 index 00000000..c34d03d8 --- /dev/null +++ b/module/hook-renderChatLog.js @@ -0,0 +1,9 @@ +/* -------------------------------------------- */ +import { RdDUtility } from "./rdd-utility.js"; + +/* -------------------------------------------- */ +// Activate chat listeners defined +Hooks.on('renderChatLog', (log, html, data) => { + RdDUtility.chatListeners(html); +}); + diff --git a/module/rdd-main.js b/module/rdd-main.js new file mode 100644 index 00000000..ad48fba6 --- /dev/null +++ b/module/rdd-main.js @@ -0,0 +1,52 @@ +/** + * RdD system + * Author: LeRatierBretonnien + * Software License: GNU GPLv3 + */ + +/* -------------------------------------------- */ + +/* -------------------------------------------- */ +// Import Modules +import { RdDActor } from "./actor.js"; +import { RdDItemSheet } from "./item-sheet.js"; +import { RdDActorSheet } from "./actor-sheet.js"; +import { RdDUtility } from "./rdd-utility.js"; + +/* -------------------------------------------- */ +/* Foundry VTT Initialization */ +/* -------------------------------------------- */ + +Hooks.once("init", async function() { + console.log(`Initializing Reve de Dragon System`); + + // preload handlebars templates + RdDUtility.preloadHandlebarsTemplates(); + + /** + * Set an initiative formula for the system + * @type {String} + */ + CONFIG.Combat.initiative = { + formula: "1d20", + decimals: 2 + }; + + // Define custom Entity classes + CONFIG.Actor.entityClass = RdDActor; + CONFIG.RDD = {} + CONFIG.RDD.resolutionTable = RdDUtility.buildResolutionTable(); + CONFIG.RDD.level_category = RdDUtility.getLevelCategory(); + CONFIG.RDD.carac_array = RdDUtility.getCaracArray(); + CONFIG.RDD.bonusmalus = RdDUtility.getBonusMalus(); + game.data.RdDUtility = RdDUtility; + + // Register sheet application classes + Actors.unregisterSheet("core", ActorSheet); + Actors.registerSheet("foundryvtt-reve-de-dragon", RdDActorSheet, { makeDefault: true }); + Items.unregisterSheet("core", ItemSheet); + Items.registerSheet("foundryvtt-reve-de-dragon", RdDItemSheet, {makeDefault: true}); + + +}); +