diff --git a/module/data/action/summonAction.mjs b/module/data/action/summonAction.mjs index 68f93510..d03c766b 100644 --- a/module/data/action/summonAction.mjs +++ b/module/data/action/summonAction.mjs @@ -1,50 +1,41 @@ -import DHSummonField from '../fields/action/summonField.mjs'; import DHBaseAction from './baseAction.mjs'; -import DHSummonDialog from '../../applications/dialogs/summonDialog.mjs'; export default class DHSummonAction extends DHBaseAction { - static defineSchema() { - return { - ...super.defineSchema(), - summon: new DHSummonField({ required: false, initial: [] }) - }; - } + static extraSchemas = [...super.extraSchemas, 'summon']; - static extraSchemas=[...super.extraSchemas,'summon']; + // get defaultValues() { + // return { + // summon: [] + // }; + // } - get defaultValues() { - return { - summon: [] - }; - } + // async trigger(event, ...args) { + // if (!this.canSummon || !canvas.scene){ + // ui.notifications.warn(game.i18n.localize("DAGGERHEART.ACTIONS.TYPES.summon.error")); + // return; + // } + // await this._performAction(); + // } - async trigger(event, ...args) { - if (!this.canSummon || !canvas.scene){ - ui.notifications.warn(game.i18n.localize("DAGGERHEART.ACTIONS.TYPES.summon.error")); - return; - } - await this._performAction(); - } + // get canSummon() { + // return game.user.can('TOKEN_CREATE'); + // } - get canSummon() { - return game.user.can('TOKEN_CREATE'); - } + // async _performAction(event, ...args) { + // const validSummons = this.summon.filter(entry => entry.actorUUID); + // if (validSummons.length === 0) { + // ui.notifications.warn("No actors configured for this Summon action."); + // return; + // } + // // FOR NOW: Just log the data to prove the schema working or not + // console.group("Summon Action Triggered"); - async _performAction(event, ...args) { - const validSummons = this.summon.filter(entry => entry.actorUUID); - if (validSummons.length === 0) { - ui.notifications.warn("No actors configured for this Summon action."); - return; - } - // FOR NOW: Just log the data to prove the schema working or not - console.group("Summon Action Triggered"); + // for (const entry of validSummons) { + // const actor = await fromUuid(entry.actorUUID); + // console.log(`- Ready to summon ${entry.count}x [${actor?.name || "Unknown Actor"}]`); + // } + // console.groupEnd(); - for (const entry of validSummons) { - const actor = await fromUuid(entry.actorUUID); - console.log(`- Ready to summon ${entry.count}x [${actor?.name || "Unknown Actor"}]`); - } - console.groupEnd(); - - //Todo: Open Summon Dialog - } -} \ No newline at end of file + // //Todo: Open Summon Dialog + // } +} diff --git a/module/data/fields/action/summonField.mjs b/module/data/fields/action/summonField.mjs index 1abb31f4..038cae09 100644 --- a/module/data/fields/action/summonField.mjs +++ b/module/data/fields/action/summonField.mjs @@ -7,32 +7,22 @@ export default class DHSummonField extends fields.ArrayField { static order = 120; constructor(options = {}, context = {}) { - const summonFields = new fields.SchemaField({ - actorUUID: new fields.DocumentUUIDField({ - type: 'Actor', - required: true - }), - count: new fields.NumberField({ - required: true, - default: 1, - min: 1, - integer: true - }) + const summonFields = new fields.SchemaField({ + actorUUID: new fields.DocumentUUIDField({ + type: 'Actor', + required: true + }), + count: new fields.NumberField({ + required: true, + default: 1, + min: 1, + integer: true }) + }); super(summonFields, options, context); - - // summon: new fields.ArrayField(new fields.SchemaField({ - // actorUUID: new fields.DocumentUUIDField({ - // type: 'Actor', - // required: true }), - // count: new fields.NumberField({ - // required: true, - // default: 1, - // min: 1, - // integer: true }) - // }), { required: false, initial: [] }) - // }; - // super(summonFields, options, context); } -} \ No newline at end of file + static async execute(config) { + console.log('something'); + } +}