2023-01-04 21:24:56 +01:00
|
|
|
/**
|
2023-01-04 22:09:09 +01:00
|
|
|
* Warhero system
|
2023-01-04 21:24:56 +01:00
|
|
|
* Author: Uberwald
|
|
|
|
* Software License: Prop
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
// Import Modules
|
2023-01-04 22:09:09 +01:00
|
|
|
import { WarheroActor } from "./warhero-actor.js";
|
|
|
|
import { WarheroItemSheet } from "./warhero-item-sheet.js";
|
|
|
|
import { WarheroActorSheet } from "./warhero-actor-sheet.js";
|
2023-03-10 18:32:13 +01:00
|
|
|
import { WarheroPartySheet } from "./warhero-party-sheet.js";
|
2023-01-04 22:09:09 +01:00
|
|
|
import { WarheroNPCSheet } from "./warhero-npc-sheet.js";
|
2023-02-08 21:19:53 +01:00
|
|
|
import { WarheroMonsterSheet } from "./warhero-monster-sheet.js";
|
2023-01-04 22:09:09 +01:00
|
|
|
import { WarheroUtility } from "./warhero-utility.js";
|
|
|
|
import { WarheroCombat } from "./warhero-combat.js";
|
|
|
|
import { WarheroItem } from "./warhero-item.js";
|
|
|
|
import { WarheroHotbar } from "./warhero-hotbar.js"
|
|
|
|
import { WarheroCommands } from "./warhero-commands.js"
|
2023-01-04 22:21:49 +01:00
|
|
|
import { WARHERO_CONFIG } from "./warhero-config.js"
|
2023-01-04 21:24:56 +01:00
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/* Foundry VTT Initialization */
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
|
|
|
/************************************************************************************/
|
|
|
|
Hooks.once("init", async function () {
|
|
|
|
|
2023-01-04 22:09:09 +01:00
|
|
|
console.log(`Initializing Warhero RPG`);
|
2023-01-04 21:24:56 +01:00
|
|
|
|
2023-01-04 22:21:49 +01:00
|
|
|
game.system.warhero = {
|
2023-01-04 22:09:09 +01:00
|
|
|
WarheroHotbar,
|
2023-01-04 22:21:49 +01:00
|
|
|
WarheroCommands,
|
|
|
|
config: WARHERO_CONFIG
|
2023-01-04 21:24:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
// preload handlebars templates
|
2023-01-04 22:09:09 +01:00
|
|
|
WarheroUtility.preloadHandlebarsTemplates();
|
2023-01-04 21:24:56 +01:00
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
// Set an initiative formula for the system
|
|
|
|
CONFIG.Combat.initiative = {
|
|
|
|
formula: "1d6",
|
|
|
|
decimals: 1
|
|
|
|
};
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
2023-01-04 22:09:09 +01:00
|
|
|
game.socket.on("system.fvtt-warhero", data => {
|
|
|
|
WarheroUtility.onSocketMesssage(data)
|
2023-01-04 21:24:56 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
// Define custom Entity classes
|
2023-01-04 22:09:09 +01:00
|
|
|
CONFIG.Combat.documentClass = WarheroCombat
|
|
|
|
CONFIG.Actor.documentClass = WarheroActor
|
|
|
|
CONFIG.Item.documentClass = WarheroItem
|
2023-01-04 21:24:56 +01:00
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
// Register sheet application classes
|
|
|
|
Actors.unregisterSheet("core", ActorSheet);
|
2023-02-08 21:19:53 +01:00
|
|
|
Actors.registerSheet("fvtt-warhero", WarheroActorSheet, { types: ["character"], makeDefault: true });
|
|
|
|
Actors.registerSheet("fvtt-warhero", WarheroNPCSheet, { types: ["npc"], makeDefault: false });
|
|
|
|
Actors.registerSheet("fvtt-warhero", WarheroMonsterSheet, { types: ["monster"], makeDefault: false });
|
2023-03-10 18:32:13 +01:00
|
|
|
Actors.registerSheet("fvtt-warhero", WarheroPartySheet, { types: ["party"], makeDefault: false });
|
2023-01-04 21:24:56 +01:00
|
|
|
|
|
|
|
Items.unregisterSheet("core", ItemSheet);
|
2023-02-08 21:19:53 +01:00
|
|
|
Items.registerSheet("fvtt-warhero", WarheroItemSheet, { makeDefault: true });
|
2023-01-04 21:24:56 +01:00
|
|
|
|
2023-01-04 22:09:09 +01:00
|
|
|
WarheroUtility.init()
|
2023-01-04 21:24:56 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/* Foundry VTT Initialization */
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
Hooks.once("ready", function () {
|
|
|
|
|
|
|
|
// User warning
|
|
|
|
if (!game.user.isGM && game.user.character == undefined) {
|
|
|
|
ui.notifications.info("Warning ! No character linked to your user !");
|
|
|
|
}
|
|
|
|
|
2023-01-04 22:09:09 +01:00
|
|
|
WarheroUtility.ready()
|
2023-01-04 21:24:56 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/* Foundry VTT Initialization */
|
|
|
|
/* -------------------------------------------- */
|
2023-03-04 17:34:18 +01:00
|
|
|
/*Hooks.on("chatMessage", (html, content, msg) => {
|
2023-01-04 21:24:56 +01:00
|
|
|
if (content[0] == '/') {
|
|
|
|
let regExp = /(\S+)/g;
|
|
|
|
let commands = content.match(regExp);
|
|
|
|
if (game.system.cruciblerpg.commands.processChatCommand(commands, content, msg)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
2023-03-04 17:34:18 +01:00
|
|
|
});*/
|
2023-01-04 21:24:56 +01:00
|
|
|
|