138 lines
4.4 KiB
JavaScript
138 lines
4.4 KiB
JavaScript
/**
|
|
* Te Deum system
|
|
* Author: Uberwald
|
|
* Software License: Prop
|
|
*/
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/* -------------------------------------------- */
|
|
// Import Modules
|
|
import { TeDeumActor } from "./actors/tedeum-actor.js";
|
|
import { TeDeumActorPJSheet } from "./actors/tedeum-actor-sheet.js";
|
|
|
|
import { TeDeumPJSchema } from "./data/tedeum-schema-pj.js";
|
|
import { TeDeumArmeSchema } from "./data/tedeum-schema-arme.js";
|
|
import { TeDeumArmureSchema } from "./data/tedeum-schema-armure.js";
|
|
import { TeDeumCompetenceSchema } from "./data/tedeum-schema-competence.js";
|
|
import { TeDeumEquipementSchema } from "./data/tedeum-schema-equipement.js";
|
|
import { TeDeumOrigineSchema } from "./data/tedeum-schema-origine.js";
|
|
import { TeDeumEducationSchema } from "./data/tedeum-schema-education.js";
|
|
import { TeDeumDeboucheSchema } from "./data/tedeum-schema-debouche.js";
|
|
|
|
import { TeDeumItem } from "./items/tedeum-item.js";
|
|
import { TeDeumItemSheet } from "./items/tedeum-item-sheet.js";
|
|
|
|
import { TeDeumHotbar } from "./app/tedeum-hotbar.js"
|
|
import { TeDeumCombat } from "./app/tedeum-combat.js";
|
|
|
|
import { TeDeumUtility } from "./common/tedeum-utility.js";
|
|
import { TEDEUM_CONFIG, LOCALISATION, ARME_SPECIFICITE} from "./common/tedeum-config.js";
|
|
import { ClassCounter} from "https://www.uberwald.me/fvtt_appcount/count-class-ready.js";
|
|
/* -------------------------------------------- */
|
|
/* Foundry VTT Initialization */
|
|
/* -------------------------------------------- */
|
|
|
|
/************************************************************************************/
|
|
Hooks.once("init", async function () {
|
|
|
|
console.log(`Initializing TeDeum RPG`);
|
|
|
|
game.system.tedeum = {
|
|
config: TEDEUM_CONFIG,
|
|
LOCALISATION: LOCALISATION,
|
|
ARME_SPECIFICITE: ARME_SPECIFICITE,
|
|
TeDeumHotbar
|
|
}
|
|
console.log(`Initializing TeDeum RPG 2`);
|
|
|
|
// preload handlebars templates
|
|
TeDeumUtility.preloadHandlebarsTemplates();
|
|
|
|
// Set an initiative formula for the system
|
|
CONFIG.Combat.initiative = {
|
|
formula: "1d6",
|
|
decimals: 1
|
|
};
|
|
|
|
game.socket.on("system.fvtt-te-deum", data => {
|
|
TeDeumUtility.onSocketMesssage(data)
|
|
});
|
|
|
|
//CONFIG.Combat.documentClass = TeDeumCombat
|
|
CONFIG.Actor.documentClass = TeDeumActor;
|
|
CONFIG.Item.documentClass = TeDeumItem
|
|
CONFIG.Actor.dataModels = {
|
|
pj: TeDeumPJSchema,
|
|
pnj: TeDeumPJSchema,
|
|
};
|
|
CONFIG.Item.dataModels = {
|
|
arme: TeDeumArmeSchema,
|
|
competence: TeDeumCompetenceSchema,
|
|
equipement: TeDeumEquipementSchema,
|
|
armure: TeDeumArmureSchema,
|
|
origine: TeDeumOrigineSchema,
|
|
education: TeDeumEducationSchema,
|
|
debouche: TeDeumDeboucheSchema,
|
|
};
|
|
|
|
console.log("TeDeum RPG | Ready");
|
|
|
|
Actors.unregisterSheet("core", ActorSheet);
|
|
Actors.registerSheet("fvtt-te-deum", TeDeumActorPJSheet, { types: ["pj"], makeDefault: true });
|
|
Actors.registerSheet("fvtt-te-deum", TeDeumActorPJSheet, { types: ["pnj"], makeDefault: true });
|
|
|
|
Items.unregisterSheet("core", ItemSheet);
|
|
Items.registerSheet("fvtt-te-deum", TeDeumItemSheet, { types: ["arme"], makeDefault: true });
|
|
|
|
TeDeumUtility.init()
|
|
});
|
|
|
|
/* -------------------------------------------- */
|
|
function welcomeMessage() {
|
|
if (game.user.isGM) {
|
|
ChatMessage.create({
|
|
user: game.user.id,
|
|
whisper: [game.user.id],
|
|
content: `<div id="welcome-message-tedeum"><span class="rdd-roll-part">
|
|
<strong>Bienvenu dans Te Deum Pour Un Massacre !</strong>` });
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
/* Foundry VTT Initialization */
|
|
/* -------------------------------------------- */
|
|
Hooks.once("ready", function () {
|
|
|
|
// User warning
|
|
if (!game.user.isGM && game.user.character == undefined) {
|
|
ui.notifications.info("Attention ! Aucun personnage relié au joueur !");
|
|
ChatMessage.create({
|
|
content: "<b>WARNING</b> Le joueur " + game.user.name + " n'est pas relié à un personnage !",
|
|
user: game.user._id
|
|
});
|
|
}
|
|
|
|
console.log("YEADEAE");
|
|
ClassCounter.registerUsageCount();
|
|
welcomeMessage();
|
|
TeDeumUtility.ready();
|
|
|
|
})
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
/* Foundry VTT Initialization */
|
|
/* -------------------------------------------- */
|
|
Hooks.on("chatMessage", (html, content, msg) => {
|
|
if (content[0] == '/') {
|
|
let regExp = /(\S+)/g;
|
|
let commands = content.match(regExp);
|
|
if (game.system.tedeum.commands.processChatCommand(commands, content, msg)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
});
|
|
|