129 lines
3.9 KiB
JavaScript
129 lines
3.9 KiB
JavaScript
/* -------------------------------------------- */
|
|
// Import Modules
|
|
import { BoLActor } from "./actor/actor.js"
|
|
import { BoLActorSheet } from "./actor/actor-sheet.js"
|
|
import { BoLVehicleSheet } from "./actor/vehicle-sheet.js"
|
|
import { BoLHordeSheet } from "./actor/horde-sheet.js"
|
|
import { BoLItem } from "./item/item.js"
|
|
import { BoLItemSheet } from "./item/item-sheet.js"
|
|
import { System, BOL } from "./system/config.js"
|
|
import { preloadHandlebarsTemplates } from "./system/templates.js"
|
|
import { registerHandlebarsHelpers } from "./system/helpers.js"
|
|
import registerHooks from "./system/hooks.js"
|
|
import { Macros } from "./system/macros.js"
|
|
import { BoLUtility } from "./system/bol-utility.js"
|
|
import { BoLCombatManager } from "./system/bol-combat.js"
|
|
import { BoLTokenHud } from "./system/bol-action-hud.js"
|
|
import { BoLHotbar } from "./system/bol-hotbar.js"
|
|
import { BoLCommands } from "./system/bol-commands.js"
|
|
import { BoLRoll } from "./controllers/bol-rolls.js"
|
|
|
|
/* -------------------------------------------- */
|
|
Hooks.once('init', async function () {
|
|
|
|
game.bol = {
|
|
BoLActor,
|
|
BoLItem,
|
|
BoLHotbar,
|
|
BoLRoll,
|
|
BoLUtility,
|
|
macros: Macros,
|
|
config: BOL
|
|
};
|
|
|
|
// Game socket
|
|
game.socket.on("system.bol", sockmsg => {
|
|
BoLUtility.onSocketMessage(sockmsg);
|
|
})
|
|
|
|
|
|
/**
|
|
* Set an initiative formula for the system
|
|
* @type {String}
|
|
*/
|
|
CONFIG.Combat.initiative = {
|
|
formula: "2d6+@attributes.mind.value+@aptitudes.init.value",
|
|
decimals: 2
|
|
};
|
|
|
|
// Define custom Entity classes
|
|
CONFIG.Actor.documentClass = BoLActor;
|
|
CONFIG.Item.documentClass = BoLItem;
|
|
CONFIG.Combat.documentClass = BoLCombatManager;
|
|
|
|
// Register sheet application classes
|
|
Actors.unregisterSheet("core", ActorSheet);
|
|
Actors.registerSheet("bol", BoLActorSheet, { types: ["character", "encounter"], makeDefault: true })
|
|
Actors.registerSheet("bol", BoLVehicleSheet, { types: ["vehicle"], makeDefault: true })
|
|
Actors.registerSheet("bol", BoLHordeSheet, { types: ["horde"], makeDefault: true })
|
|
|
|
Items.unregisterSheet("core", ItemSheet);
|
|
Items.registerSheet("bol", BoLItemSheet, { makeDefault: true });
|
|
|
|
// Inot useful stuff
|
|
BoLUtility.init()
|
|
BoLTokenHud.init()
|
|
BoLHotbar.init()
|
|
BoLCommands.init()
|
|
|
|
// Preload Handlebars Templates
|
|
await preloadHandlebarsTemplates();
|
|
|
|
// Register Handlebars helpers
|
|
registerHandlebarsHelpers();
|
|
|
|
// Register hooks
|
|
registerHooks()
|
|
|
|
});
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
function welcomeMessage() {
|
|
ChatMessage.create({
|
|
user: game.user.id,
|
|
whisper: [game.user.id],
|
|
content: `<div id="welcome-message-bol"><span class="rdd-roll-part">
|
|
<strong>` + game.i18n.localize("BOL.chat.welcome1") + `</strong><p>` +
|
|
game.i18n.localize("BOL.chat.welcome2") + "<p>" +
|
|
game.i18n.localize("BOL.chat.welcome3") + "<p>" +
|
|
game.i18n.localize("BOL.chat.welcome4") + "</p>" +
|
|
game.i18n.localize("BOL.chat.welcome5") + "<br>" +
|
|
game.i18n.localize("BOL.chat.welcome6")
|
|
})
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
Hooks.once('ready', async function () {
|
|
|
|
BoLUtility.ready()
|
|
|
|
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()
|
|
|
|
// User warning
|
|
if (!game.user.isGM && game.user.character == undefined) {
|
|
ui.notifications.info(game.i18n.localize("BOL.chat.pcwarning"));
|
|
ChatMessage.create({
|
|
content: game.i18n.localize("BOL.chat.pcwarningmsg") + game.user.name,
|
|
user: game.user._id
|
|
});
|
|
}
|
|
if (!game.user.isGM && game.user.character && !game.user.character.prototypeToken.actorLink) {
|
|
ui.notifications.info(game.i18n.localize("BOL.chat.pcnotlinked"));
|
|
ChatMessage.create({
|
|
content: game.i18n.localize("BOL.chat.pcnotlinkedmsg") + game.user.name,
|
|
user: game.user._id
|
|
});
|
|
}
|
|
|
|
})
|
|
|
|
|