foundryvtt-frostgrave/module/frostgrave.js
2021-05-31 00:06:05 +02:00

59 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.documentClass = frostgraveActor;
CONFIG.Item.documentClass = frostgraveItem;
// Register sheet application classes
Actors.unregisterSheet("core", ActorSheet);
Actors.registerSheet("foundryvtt-frostgrave", frostgraveActorSheet, {
types: ["character"],
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();
});