/** * imperium5 system * Author: Uberwald * Software License: Prop */ /* -------------------------------------------- */ /* -------------------------------------------- */ // Import Modules import { Imperium5Actor } from "./imperium5-actor.js"; import { Imperium5ItemSheet } from "./imperium5-item-sheet.js"; import { Imperium5ActorSheet } from "./imperium5-actor-sheet.js"; import { Imperium5ActorPMSheet } from "./imperium5-actor-pm-sheet.js"; import { Imperium5Utility } from "./imperium5-utility.js"; import { Imperium5Combat } from "./imperium5-combat.js"; import { Imperium5Item } from "./imperium5-item.js"; /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ /************************************************************************************/ Hooks.once("init", async function () { console.log(`Initializing Imperium5 RPG`); /* -------------------------------------------- */ // preload handlebars templates Imperium5Utility.preloadHandlebarsTemplates(); /* -------------------------------------------- */ // Set an initiative formula for the system CONFIG.Combat.initiative = { formula: "1d6", decimals: 1 }; /* -------------------------------------------- */ game.socket.on("system.fvtt-imperium5", data => { Imperium5Utility.onSocketMesssage(data) }); /* -------------------------------------------- */ // Define custom Entity classes CONFIG.Combat.documentClass = Imperium5Combat CONFIG.Actor.documentClass = Imperium5Actor CONFIG.Item.documentClass = Imperium5Item game.system.imperium5 = { } /* -------------------------------------------- */ // Register sheet application classes Actors.unregisterSheet("core", ActorSheet) Actors.registerSheet("fvtt-imperium5", Imperium5ActorSheet, { types: ["character"], makeDefault: true }) Actors.registerSheet("fvtt-imperium5", Imperium5ActorPMSheet, { types: ["pm"], makeDefault: true }) Items.unregisterSheet("core", ItemSheet) Items.registerSheet("fvtt-imperium5", Imperium5ItemSheet, { makeDefault: true } ) Imperium5Utility.init() }) /* -------------------------------------------- */ function welcomeMessage() { ChatMessage.create({ user: game.user.id, whisper: [game.user.id], content: `
Bienvenue dans Imperium5 ! ` }); } /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ Hooks.once("ready", function () { Imperium5Utility.ready() if (!game.user.isGM && game.user.character == undefined) { ui.notifications.info("Attention ! Aucun personnage n'est relié !") ChatMessage.create({ content: "WARNING Le joueur " + game.user.name + " n'est pas connecté à un personnage !", user: game.user._id }); } // CSS patch for v9 if (game.version) { let sidebar = document.getElementById("sidebar") sidebar.style.width = "min-content" } welcomeMessage() }) /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ Hooks.on("chatMessage", (html, content, msg) => { if (content[0] == '/') { let regExp = /(\S+)/g let commands = content.match(regExp) if (game.system.imperium5.commands.processChatCommand(commands, content, msg)) { return false } } return true });