foundryvtt-frostgrave/module/frostgrave.js
2021-05-29 23:20:50 +02:00

58 lines
1.5 KiB
JavaScript

// Import Modules
import { frostgraveActor } from "./actor/actor.js";
import { frostgraveActorSheet } from "./actor/actor-sheet.js";
import { frostgraveItem } from "./item/item.js";
import { frostgraveItemSheet } from "./item/item-sheet.js";
import { preloadHandlebarsTemplates } from "./templates.js";
Hooks.once("init", async function () {
game.frostgrave = {
frostgraveActor,
frostgraveItem,
};
/**
* Set an initiative formula for the system
* @type {String}
*/
CONFIG.Combat.initiative = {
formula: "1d20",
decimals: 2,
};
// Define custom Entity classes
CONFIG.Actor.documentClas = frostgraveActor;
CONFIG.Item.documentClas = frostgraveItem;
// Register sheet application classes
Actors.unregisterSheet("core", ActorSheet);
Actors.registerSheet("foundryvtt-frostgrave", frostgraveActorSheet, {
makeDefault: true,
});
Items.unregisterSheet("core", ItemSheet);
Items.registerSheet("foundryvtt-frostgrave", frostgraveItemSheet, {
types: ["item", "feature", "spell"],
makeDefault: true,
});
// If you need to add Handlebars helpers, here are a few useful examples:
Handlebars.registerHelper("concat", function () {
var outStr = "";
for (var arg in arguments) {
if (typeof arguments[arg] != "object") {
outStr += arguments[arg];
}
}
return outStr;
});
Handlebars.registerHelper("toLowerCase", function (str) {
return str.toLowerCase();
});
// Preload Handlebars Templates
preloadHandlebarsTemplates();
});