Fixed so that weaponfeatures and armorFeatures are tolerant of features having been removed

This commit is contained in:
WBHarry 2026-02-28 13:32:47 +01:00
parent c48842dd2d
commit 2ee0db2afe
5 changed files with 7 additions and 13 deletions

View file

@ -1404,9 +1404,7 @@ export const allWeaponFeatures = () => {
};
export const orderedWeaponFeatures = () => {
const homebrewFeatures = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).itemFeatures
.weaponFeatures;
const allFeatures = { ...weaponFeatures, ...homebrewFeatures };
const allFeatures = allWeaponFeatures();
const all = Object.keys(allFeatures).map(key => {
const feature = allFeatures[key];
return {

View file

@ -23,9 +23,7 @@ export default class DHArmor extends AttachableItem {
armorFeatures: new fields.ArrayField(
new fields.SchemaField({
value: new fields.StringField({
required: true,
choices: CONFIG.DH.ITEM.allArmorFeatures,
blank: true
required: true
}),
effectIds: new fields.ArrayField(new fields.StringField({ required: true })),
actionIds: new fields.ArrayField(new fields.StringField({ required: true }))
@ -58,7 +56,7 @@ export default class DHArmor extends AttachableItem {
async getDescriptionData() {
const baseDescription = this.description;
const allFeatures = CONFIG.DH.ITEM.allArmorFeatures();
const features = this.armorFeatures.map(x => allFeatures[x.value]);
const features = this.armorFeatures.map(x => allFeatures[x.value]).filter(x => x);
const prefix = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/sheets/items/armor/description.hbs',

View file

@ -38,9 +38,7 @@ export default class DHWeapon extends AttachableItem {
weaponFeatures: new fields.ArrayField(
new fields.SchemaField({
value: new fields.StringField({
required: true,
choices: CONFIG.DH.ITEM.allWeaponFeatures,
blank: true
required: true
}),
effectIds: new fields.ArrayField(new fields.StringField({ required: true })),
actionIds: new fields.ArrayField(new fields.StringField({ required: true }))
@ -121,7 +119,7 @@ export default class DHWeapon extends AttachableItem {
const burden = game.i18n.localize(CONFIG.DH.GENERAL.burden[this.burden].label);
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
const features = this.weaponFeatures.map(x => allFeatures[x.value]);
const features = this.weaponFeatures.map(x => allFeatures[x.value]).filter(x => x);
const prefix = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',

View file

@ -119,8 +119,8 @@ export const tagifyElement = (element, baseOptions, onChange, tagifyOptions = {}
}),
maxTags: typeof maxTags === 'function' ? maxTags() : maxTags,
dropdown: {
searchKeys: ['value', 'name'],
mapValueTo: 'name',
searchKeys: ['value'],
enabled: 0,
maxItems: 100,
closeOnSelect: true,

View file

@ -2,7 +2,7 @@
"id": "daggerheart",
"title": "Daggerheart",
"description": "An unofficial implementation of the Daggerheart system",
"version": "1.7.2",
"version": "1.7.3",
"compatibility": {
"minimum": "13.346",
"verified": "13.351",