update warriors gift to use compendium
This commit is contained in:
parent
03787ee314
commit
c670bd5dc6
@ -1,17 +1,21 @@
|
||||
import { moduleHelpers, moduleName } from '../globals.js';
|
||||
import { moduleHelpers, moduleName, settingKeys } from '../globals.js';
|
||||
import { addItemsToToken } from '../helpers.js';
|
||||
import { PowerEffect } from './basePowers.js';
|
||||
|
||||
export class WarriorsGiftEffect extends PowerEffect {
|
||||
constructor(token, targets) {
|
||||
super(token, targets);
|
||||
const template = game.actors.getName('warriors-edge_template');
|
||||
async init() {
|
||||
await super.init();
|
||||
this.edges = [];
|
||||
const pack = game.packs.get(moduleHelpers.getSetting(settingKeys.powerActorsCompendium));
|
||||
const templateUUID = pack?.index?.find((a) => a.name === 'warriors-edge_template').uuid;
|
||||
if (!templateUUID) {
|
||||
return;
|
||||
}
|
||||
const template = await foundry.utils.fromUuid(templateUUID);
|
||||
if (template) {
|
||||
this.edges = template.items
|
||||
.filter((i) => i.type === 'edge')
|
||||
.map((i) => template.getEmbeddedDocument('Item', i.id));
|
||||
} else {
|
||||
this.edges = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user