64 lines
2.0 KiB
JavaScript
64 lines
2.0 KiB
JavaScript
/* -------------------------------------------- */
|
|
import { VadentisCombat } from "./vadentis-combat.js";
|
|
|
|
/* -------------------------------------------- */
|
|
export class VadentisUtility extends Entity {
|
|
|
|
/* -------------------------------------------- */
|
|
static async preloadHandlebarsTemplates() {
|
|
|
|
const templatePaths = [
|
|
'systems/foundryvtt-vadentis/templates/actor-sheet.html',
|
|
'systems/foundryvtt-vadentis/templates/item-sheet.html',
|
|
'systems/foundryvtt-vadentis/templates/score-option-list.html',
|
|
'systems/foundryvtt-vadentis/templates/malus-option-list.html',
|
|
'systems/foundryvtt-vadentis/templates/bonus-option-list.html',
|
|
'systems/foundryvtt-vadentis/templates/editor-notes-gm.html'
|
|
]
|
|
return loadTemplates(templatePaths);
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static registerChatCallbacks( ) {
|
|
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static fillRange (start, end) {
|
|
return Array(end - start + 1).fill().map((item, index) => start + index);
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static onSocketMesssage( msg ) {
|
|
if( !game.user.isGM ) return; // Only GM
|
|
|
|
if (msg.name == 'msg_declare_actions' ) {
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static async loadCompendiumNames(compendium) {
|
|
const pack = game.packs.get(compendium);
|
|
let competences;
|
|
await pack.getIndex().then(index => competences = index);
|
|
return competences;
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static async loadCompendium(compendium, filter = item => true) {
|
|
let compendiumItems = await SoSUtility.loadCompendiumNames(compendium);
|
|
|
|
const pack = game.packs.get(compendium);
|
|
let list = [];
|
|
for (let compendiumItem of compendiumItems) {
|
|
await pack.getEntity(compendiumItem._id).then(it => {
|
|
const item = it.data;
|
|
if (filter(item)) {
|
|
list.push(item);
|
|
}
|
|
});
|
|
};
|
|
return list;
|
|
}
|
|
|
|
} |