-
Notifications
You must be signed in to change notification settings - Fork 0
/
swSaga.mjs
55 lines (43 loc) · 1.78 KB
/
swSaga.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Import sheet classes.
import swSagaActorSheet from "./module/sheets/actor-sheet.mjs";
import swSagaActor from "./module/documents/actor.mjs";
import swSagaItem from "./module/documents/item.mjs";
import swSagaItemSheet from "./module/sheets/item-sheet.mjs";
// Import helper/utility classes and constants.
import { swSaga } from "./module/config.mjs";
async function preloadHandlebarsTemplates(){
const templatePaths = [
"systems/swSaga/templates/item/partials/components/armor-card.hbs",
"systems/swSaga/templates/item/partials/components/weapon-card.hbs",
"systems/swSaga/templates/item/partials/components/force-card.hbs"
];
return loadTemplates(templatePaths);
}
/* -------------------------------------------- */
/* Init Hook */
/* -------------------------------------------- */
Hooks.once('init', async function() {
console.log('Loading swsaga system')
CONFIG.swSaga = swSaga;
CONFIG.Actor.documentClass = swSagaActor;
CONFIG.Item.documentClass = swSagaItem;
// Register sheet application classes
Actors.unregisterSheet("core", ActorSheet);
Actors.registerSheet("swSaga", swSagaActorSheet, { makeDefault: true });
Items.unregisterSheet("core", ItemSheet);
Items.registerSheet("swSaga", swSagaItemSheet, { makeDefault: true });
preloadHandlebarsTemplates();
Handlebars.registerHelper('setBonus', (actorObject, skillObject, x, y) =>{
let armor = 0;
let talent = 0;
let feat = 0;
let equipment = 0;
if (x === y){
return actorObject.abilities[x].mod + (skillObject.trained ? 5 : 0) + (Math.floor(actorObject.characterLevel / 2));
}
return null;
})
Handlebars.registerHelper('hasProperty', (objectToSpy, propertyToFind) =>{
return objectToSpy.hasOwnProperty(propertyToFind);
})
});