mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[PR] [Feature] Beastform Wildcards (#1247)
* Added support for wildcard paths in beastform token paths * Fixed browse dataSource
This commit is contained in:
parent
2d6390248f
commit
7055591a76
11 changed files with 176 additions and 2 deletions
|
|
@ -33,11 +33,13 @@ export default class DHBeastform extends BaseDataItem {
|
|||
tokenImg: new fields.FilePathField({
|
||||
initial: 'icons/svg/mystery-man.svg',
|
||||
categories: ['IMAGE'],
|
||||
wildcard: true,
|
||||
base64: false
|
||||
}),
|
||||
tokenRingImg: new fields.FilePathField({
|
||||
initial: 'icons/svg/mystery-man.svg',
|
||||
categories: ['IMAGE'],
|
||||
wildcard: true,
|
||||
base64: false
|
||||
}),
|
||||
tokenSize: new fields.SchemaField({
|
||||
|
|
@ -108,6 +110,30 @@ export default class DHBeastform extends BaseDataItem {
|
|||
};
|
||||
}
|
||||
|
||||
static async getWildcardImage(actor, beastform) {
|
||||
const usesDynamicToken = actor.prototypeToken.ring.enabled && beastform.system.tokenRingImg;
|
||||
const tokenPath = usesDynamicToken ? beastform.system.tokenRingImg : beastform.system.tokenImg;
|
||||
const usesWildcard = tokenPath.includes('*');
|
||||
if (usesWildcard) {
|
||||
const filePicker = new foundry.applications.apps.FilePicker.implementation(tokenPath);
|
||||
const { files } = await foundry.applications.apps.FilePicker.implementation.browse(
|
||||
filePicker.activeSource,
|
||||
tokenPath,
|
||||
{
|
||||
wildcard: true,
|
||||
type: 'image'
|
||||
}
|
||||
);
|
||||
const selectedImage = await game.system.api.applications.dialogs.ImageSelectDialog.configure(
|
||||
game.i18n.localize('DAGGERHEART.APPLICATIONS.ImageSelect.title'),
|
||||
files
|
||||
);
|
||||
return { usesDynamicToken, selectedImage };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async _preCreate() {
|
||||
if (!this.actor) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue