/** * Heritiers system * Author: Uberwald * Software License: Prop */ /* -------------------------------------------- */ /* -------------------------------------------- */ // Import Modules import { HeritiersActor } from "./heritiers-actor.js"; import { HeritiersItemSheet } from "./heritiers-item-sheet.js"; import { HeritiersActorSheet } from "./heritiers-actor-sheet.js"; import { HeritiersActorPNJSheet } from "./heritiers-actor-pnj-sheet.js"; import { HeritiersCreatureSheet } from "./heritiers-creature-sheet.js"; import { HeritiersUtility } from "./heritiers-utility.js"; import { HeritiersCombat } from "./heritiers-combat.js"; import { HeritiersItem } from "./heritiers-item.js"; import { HERITIERS_CONFIG } from "./heritiers-config.js"; /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ /************************************************************************************/ Hooks.once("init", async function () { console.log(`Initializing Heritiers RPG`); /* -------------------------------------------- */ // preload handlebars templates HeritiersUtility.preloadHandlebarsTemplates() /* -------------------------------------------- */ // Set an initiative formula for the system CONFIG.Combat.initiative = { formula: "1d10", decimals: 1 }; /* -------------------------------------------- */ game.socket.on("system.fvtt-les-heritiers", data => { HeritiersUtility.onSocketMesssage(data) }); /* -------------------------------------------- */ // Define custom Entity classes CONFIG.Combat.documentClass = HeritiersCombat CONFIG.Actor.documentClass = HeritiersActor CONFIG.Item.documentClass = HeritiersItem game.system.lesheritiers = { HeritiersUtility, config: HERITIERS_CONFIG } /* -------------------------------------------- */ // Register sheet application classes Actors.unregisterSheet("core", ActorSheet); Actors.registerSheet("fvtt-les-heritiers", HeritiersActorSheet, { types: ["personnage"], makeDefault: true }) Actors.registerSheet("fvtt-les-heritiers", HeritiersActorPNJSheet, { types: ["pnj"], makeDefault: true }) Items.unregisterSheet("core", ItemSheet); Items.registerSheet("fvtt-les-heritiers", HeritiersItemSheet, { makeDefault: true }) HeritiersUtility.init() }); /* -------------------------------------------- */ function welcomeMessage() { ChatMessage.create({ user: game.user.id, whisper: [game.user.id], content: `
Bienvenue dans Les Heritiers et la Belle Epoque !

Les livres du JDR Les Heritiers sont nécessaires pour jouer : https://www.titam-france.fr

Les Heritiers est jeu de rôle publié par Titam France/Sombres projets, tout les droits leur appartiennent.

Système développé par LeRatierBretonnien, support sur le Discord FR de Foundry.

` }); } /* -------------------------------------------- */ async function importDefaultScene() { let exists = game.scenes.find(j => j.name == "Accueil"); if (!exists) { const scenes = await HeritiersUtility.loadCompendium("fvtt-les-heritiers.scenes") let newDocuments = scenes.filter(i => i.name == "Accueil"); await game.scenes.documentClass.create(newDocuments); game.scenes.find(i => i.name == "Accueil").activate(); } } /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ Hooks.once("ready", function () { HeritiersUtility.ready() // User warning if (!game.user.isGM && game.user.character == undefined) { ui.notifications.info("Attention ! Aucun personnage n'est relié au joueur !"); ChatMessage.create({ content: "ATTENTION Le joueur " + game.user.name + " n'est relié à aucun personnage !", user: game.user._id }); } import("https://www.uberwald.me/fvtt_appcount/count-class-ready.js").then(moduleCounter=>{ console.log("ClassCounter loaded", moduleCounter) moduleCounter.ClassCounter.registerUsageCount() }).catch(err=> console.log("No stats available, giving up.") ) welcomeMessage(); importDefaultScene(); }); /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ Hooks.on("chatMessage", (html, content, msg) => { if (content[0] == '/') { let regExp = /(\S+)/g; let commands = content.match(regExp); if (game.system.lesheritiers.commands.processChatCommand(commands, content, msg)) { return false; } } return true; });