mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
Added createDialog
This commit is contained in:
parent
a76479e9b7
commit
94262ba6ec
4 changed files with 9 additions and 1 deletions
|
|
@ -712,17 +712,23 @@ export default function DHApplicationMixin(Base) {
|
||||||
|
|
||||||
const cls =
|
const cls =
|
||||||
type === 'action' ? game.system.api.models.actions.actionsTypes.base : getDocumentClass(documentClass);
|
type === 'action' ? game.system.api.models.actions.actionsTypes.base : getDocumentClass(documentClass);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
name: cls.defaultName({ type, parent }),
|
name: cls.defaultName({ type, parent }),
|
||||||
type,
|
type,
|
||||||
system: systemData
|
system: systemData
|
||||||
};
|
};
|
||||||
|
|
||||||
if (inVault) data['system.inVault'] = true;
|
if (inVault) data['system.inVault'] = true;
|
||||||
if (disabled) data.disabled = true;
|
if (disabled) data.disabled = true;
|
||||||
if (type === 'domainCard' && parent?.system.domains?.length) {
|
if (type === 'domainCard' && parent?.system.domains?.length) {
|
||||||
data.system.domain = parent.system.domains[0];
|
data.system.domain = parent.system.domains[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (documentClass === 'ActiveEffect') {
|
||||||
|
return cls.createDialog(data, { parent: this.document });
|
||||||
|
}
|
||||||
|
|
||||||
const doc = await cls.create(data, { parent, renderSheet: !event.shiftKey });
|
const doc = await cls.create(data, { parent, renderSheet: !event.shiftKey });
|
||||||
if (parentIsItem && type === 'feature') {
|
if (parentIsItem && type === 'feature') {
|
||||||
await this.document.update({
|
await this.document.update({
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
||||||
throw new Error('The array of sub-types to restrict to must not be empty.');
|
throw new Error('The array of sub-types to restrict to must not be empty.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const creatableEffects = ['base', 'armor'];
|
const creatableEffects = types || ['base', 'armor'];
|
||||||
const documentTypes = this.TYPES.filter(type => creatableEffects.includes(type)).map(type => {
|
const documentTypes = this.TYPES.filter(type => creatableEffects.includes(type)).map(type => {
|
||||||
const labelKey = `TYPES.ActiveEffect.${type}`;
|
const labelKey = `TYPES.ActiveEffect.${type}`;
|
||||||
const label = game.i18n.has(labelKey) ? game.i18n.localize(labelKey) : type;
|
const label = game.i18n.has(labelKey) ? game.i18n.localize(labelKey) : type;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
collection=effects.inactives
|
collection=effects.inactives
|
||||||
canCreate=true
|
canCreate=true
|
||||||
hideResources=true
|
hideResources=true
|
||||||
|
disabled=true
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -17,5 +17,6 @@
|
||||||
collection=effects.inactives
|
collection=effects.inactives
|
||||||
canCreate=true
|
canCreate=true
|
||||||
hideResources=true
|
hideResources=true
|
||||||
|
disabled=true
|
||||||
}}
|
}}
|
||||||
</section>
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue