diff --git a/lang/en.json b/lang/en.json index fc121341d5..9eb97c66d8 100644 --- a/lang/en.json +++ b/lang/en.json @@ -994,6 +994,7 @@ "DND5E.SubclassDuplicateError": "A subclass with the identifier {identifier} already exists on this actor.", "DND5E.SubclassMismatchWarn": "{name} subclass has no matching class with identifier '{class}'.", "DND5E.SubclassName": "Subclass Name", +"DND5E.Subtype": "Subtype", "DND5E.Supply": "Supply", "DND5E.Target": "Target", "DND5E.TargetAlly": "Ally", diff --git a/module/applications/advancement/item-choice-config.mjs b/module/applications/advancement/item-choice-config.mjs index 03f8b4f81f..1ee1fa7970 100644 --- a/module/applications/advancement/item-choice-config.mjs +++ b/module/applications/advancement/item-choice-config.mjs @@ -41,7 +41,7 @@ export default class ItemChoiceConfig extends AdvancementConfig { configuration.pool = await configuration.pool.reduce(async (pool, uuid) => { const item = await fromUuid(uuid); if ( this.advancement._validateItemType(item, { - restriction: configuration.type, spellLevel: configuration.spellLevel ?? false, error: false + restriction: configuration.type, spellLevel: configuration.restriction.level ?? false, error: false }) ) return [...await pool, uuid]; return pool; }, []); diff --git a/module/applications/advancement/item-choice-flow.mjs b/module/applications/advancement/item-choice-flow.mjs index 4fca364ef9..33c903c304 100644 --- a/module/applications/advancement/item-choice-flow.mjs +++ b/module/applications/advancement/item-choice-flow.mjs @@ -125,7 +125,7 @@ export default class ItemChoiceFlow extends ItemGrantFlow { const item = await Item.implementation.fromDropData(data); try { - this.advancement._verifyItemType(item); + this.advancement._validateItemType(item); } catch(err) { return ui.notifications.error(err.message); } @@ -140,7 +140,7 @@ export default class ItemChoiceFlow extends ItemGrantFlow { } // If spell level is restricted to available level, ensure the spell is of the appropriate level - const spellLevel = this.advancement.configuration.spellLevel; + const spellLevel = this.advancement.configuration.restriction.level; if ( (this.advancement.configuration.type === "spell") && spellLevel === "available" ) { const maxSlot = this._maxSpellSlotLevel(); if ( item.system.level > maxSlot ) return ui.notifications.error(game.i18n.format( diff --git a/module/data/advancement/item-choice.mjs b/module/data/advancement/item-choice.mjs index 637a269c83..3718a2c118 100644 --- a/module/data/advancement/item-choice.mjs +++ b/module/data/advancement/item-choice.mjs @@ -18,7 +18,11 @@ export default class ItemChoiceConfigurationData extends foundry.abstract.DataMo }), pool: new foundry.data.fields.ArrayField(new foundry.data.fields.StringField(), {label: "DOCUMENT.Items"}), spell: new foundry.data.fields.EmbeddedDataField(SpellConfigurationData, {nullable: true, initial: null}), - spellLevel: new foundry.data.fields.StringField({label: "DND5E.SpellLevel"}) + restriction: new foundry.data.fields.SchemaField({ + type: new foundry.data.fields.StringField({label: "DND5E.Type"}), + subtype: new foundry.data.fields.StringField({label: "DND5E.Subtype"}), + level: new foundry.data.fields.StringField({label: "DND5E.SpellLevel"}) + }, {label: ""}) }; } } diff --git a/module/data/item/feat.mjs b/module/data/item/feat.mjs index d3b7cd8be7..17253dea36 100644 --- a/module/data/item/feat.mjs +++ b/module/data/item/feat.mjs @@ -24,8 +24,8 @@ export default class FeatData extends SystemDataModel.mixin( static defineSchema() { return this.mergeSchema(super.defineSchema(), { type: new foundry.data.fields.SchemaField({ - value: new foundry.data.fields.StringField({required: true}), - subtype: new foundry.data.fields.StringField({required: true}) + value: new foundry.data.fields.StringField({required: true, label: "DND5E.Type"}), + subtype: new foundry.data.fields.StringField({required: true, label: "DND5E.Subtype"}) }, {label: "DND5E.ItemFeatureType"}), requirements: new foundry.data.fields.StringField({required: true, label: "DND5E.Requirements"}), recharge: new foundry.data.fields.SchemaField({ diff --git a/module/documents/advancement/item-choice.mjs b/module/documents/advancement/item-choice.mjs index 0ba93fce60..8c69c598ea 100644 --- a/module/documents/advancement/item-choice.mjs +++ b/module/documents/advancement/item-choice.mjs @@ -85,7 +85,7 @@ export default class ItemChoiceAdvancement extends ItemGrantAdvancement { _validateItemType(item, { restriction, spellLevel, error=true }={}) { super._validateItemType(item, { error }); restriction ??= this.configuration.type; - spellLevel ??= this.configuration.spellLevel; + spellLevel ??= this.configuration.restriction.level; // Type restriction is set and the item type does not match the selected type if ( restriction && (restriction !== item.type) ) { diff --git a/templates/advancement/item-choice-config.hbs b/templates/advancement/item-choice-config.hbs index 3634c762a2..ef2950cfb2 100644 --- a/templates/advancement/item-choice-config.hbs +++ b/templates/advancement/item-choice-config.hbs @@ -29,8 +29,8 @@
- + {{#select configuration.restriction.level}} {{#each CONFIG.spellLevels as |label key|}}