/** * RdD system * Author: Uberwald * Software License: Prop */ /* -------------------------------------------- */ /* -------------------------------------------- */ // Import Modules import { VadentisActor } from "./vadentis-actor.js"; import { VadentisItemSheet } from "./vadentis-item-sheet.js"; import { VadentisActorSheet } from "./vadentis-actor-sheet.js"; import { VadentisUtility } from "./vadentis-utility.js"; import { VadentisCombat } from "./vadentis-combat.js"; import { VadentisTokenHud } from "./vadentis-hud.js"; /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ /************************************************************************************/ Hooks.once("init", async function () { console.log(`Initializing Vadentis`); /* -------------------------------------------- */ // preload handlebars templates VadentisUtility.preloadHandlebarsTemplates(); /* -------------------------------------------- */ // Set an initiative formula for the system CONFIG.Combat.initiative = { formula: "1d20", decimals: 0 }; /* -------------------------------------------- */ game.socket.on("system.foundryvtt-vadentis", data => { VadentisUtility.onSocketMesssage(data); }); /* -------------------------------------------- */ // Define custom Entity classes CONFIG.Actor.documentClass = VadentisActor; CONFIG.Combat.documentClass = VadentisCombat; CONFIG.Vadentis = { } /* -------------------------------------------- */ // Register sheet application classes Actors.unregisterSheet("core", ActorSheet); Actors.registerSheet("foundryvtt-vadentis", VadentisActorSheet, { types: ["personnage"], makeDefault: true }); Items.unregisterSheet("core", ItemSheet); Items.registerSheet("foundryvtt-vadentis", VadentisItemSheet, { makeDefault: true }); // Init/registers Hooks.on('renderChatLog', (log, html, data) => { VadentisUtility.registerChatCallbacks(html); }); // Init/registers Hooks.on('updateCombat', (combat, round, diff, id) => { VadentisUtility.updateCombat(combat, round, diff, id); }); VadentisTokenHud.init(); }); /* -------------------------------------------- */ function welcomeMessage() { //ChatUtility.removeMyChatMessageContaining('
'); ChatMessage.create({ user: game.user._id, whisper: [game.user._id], content: `
Bienvenue !
` }); } /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ Hooks.once("ready", function () { // User warning if (!game.user.isGM && game.user.character == undefined) { ui.notifications.info("Attention ! Vous n'est connecté à aucun personnage"); ChatMessage.create({ content: "WARNING Le joueur " + game.user.name + " n'est pas connecté à un personnage !", user: game.user._id }); } welcomeMessage(); }); /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ Hooks.on("chatMessage", (html, content, msg) => { if (content[0] == '/') { let regExp = /(\S+)/g; let commands = content.toLowerCase().match(regExp); console.log(commands); //if ( commands[0] == '/gmdeck') { //game.system.sos.gmDeck.render( true ); //return false; //} } return true; });