/** * Pegasus system * Author: Uberwald * Software License: Prop */ /* -------------------------------------------- */ /* -------------------------------------------- */ // Import Modules import { PegasusActor } from "./pegasus-actor.js"; import { PegasusItemSheet } from "./pegasus-item-sheet.js"; import { PegasusActorSheet } from "./pegasus-actor-sheet.js"; import { PegasusVehicleSheet } from "./pegasus-vehicle-sheet.js"; import { PegasusUtility } from "./pegasus-utility.js"; import { PegasusCombatTracker,PegasusCombat } from "./pegasus-combat.js"; import { PegasusItem } from "./pegasus-item.js"; import { PEGASUS_CONFIG } from "./pegasus-config.js" /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ /************************************************************************************/ Hooks.once("init", async function () { console.log(`Initializing Pegasus RPG`); /* -------------------------------------------- */ // preload handlebars templates PegasusUtility.preloadHandlebarsTemplates(); /* -------------------------------------------- */ game.settings.register("fvtt-pegasus-rpg", "dice-max-level", { name: "Maximum level value for dices lists", hint: "Set the maximum level value for dices lists", scope: "world", config: true, default: 20, type: Number }) /* -------------------------------------------- */ // Set an initiative formula for the system CONFIG.Combat.initiative = { formula: "1d6", decimals: 1 }; /* -------------------------------------------- */ game.socket.on("system.fvtt-pegasus-rpg", data => { PegasusUtility.onSocketMesssage(data) }); /* -------------------------------------------- */ // Define custom Entity classes CONFIG.Combat.documentClass = PegasusCombat CONFIG.Actor.documentClass = PegasusActor CONFIG.Item.documentClass = PegasusItem CONFIG.ui.combat = PegasusCombatTracker game.system.pegasus = { utility: PegasusUtility, config: PEGASUS_CONFIG } /* -------------------------------------------- */ // Register sheet application classes Actors.unregisterSheet("core", ActorSheet); Actors.registerSheet("fvtt-pegasus", PegasusActorSheet, { types: ["character"], makeDefault: true }) Actors.registerSheet("fvtt-pegasus", PegasusActorSheet, { types: ["npc"], makeDefault: true }) Actors.registerSheet("fvtt-pegasus", PegasusVehicleSheet, { types: ["vehicle"], makeDefault: false }) Items.unregisterSheet("core", ItemSheet); Items.registerSheet("fvtt-pegasus", PegasusItemSheet, { makeDefault: true }); PegasusUtility.init() }); /* -------------------------------------------- */ function welcomeMessage() { ChatMessage.create({ user: game.user.id, whisper: [game.user.id], content: `
Welcome to the Pegasus Engine CORE RPG.
Created by GMD Online

The Pegasus Engine is a available for free on our website. It is also available as a PDF and in Print format at an affordable price.

This project has been made possible thanks to all the Official GMD Members and Patreon Members that have supported me and as a result made it possible to supply this interface for free.

In return I have made available a fully detailed Compendium for FREE for all members, which can be obtained from the Members page on my website.

You too can become a supporter for future projects and enjoy amazing rewards.
Sign up Here : https://www.gmdonline.co.uk/gmdmemberspage/

GMD Online, GMD CORE RPG logo are © 2018 CORE Worlds and Game Rules © 2001. Interface © 2021 All rights reserved.

Enjoy and become the hero you were born to be!

` }); } /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ Hooks.once("ready", function () { PegasusUtility.ready(); // User warning if (!game.user.isGM && game.user.character == undefined) { ui.notifications.info("Warning ! No character linked to your user !"); ChatMessage.create({ content: "WARNING The player " + game.user.name + " is not linked to a character !", 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.pegasus.commands.processChatCommand(commands, content, msg)) { return false; } } return true; });