Lint fixes

This commit is contained in:
WBHarry 2026-04-22 15:35:55 +02:00
parent 4e555dd314
commit 6147201117
10 changed files with 53 additions and 48 deletions

View file

@ -1,4 +1,4 @@
import { LevelOptionType } from "../../data/levelTier.mjs"; import { LevelOptionType } from '../../data/levelTier.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
@ -21,7 +21,7 @@ export default class LevelupOptionsDialog extends HandlebarsApplicationMixin(App
window: { icon: 'fa-solid fa-angles-up fa-fw' }, window: { icon: 'fa-solid fa-angles-up fa-fw' },
actions: { actions: {
addTierOption: LevelupOptionsDialog.#addTierOption, addTierOption: LevelupOptionsDialog.#addTierOption,
removeTierOption: LevelupOptionsDialog.#removeTierOption, removeTierOption: LevelupOptionsDialog.#removeTierOption
}, },
form: { handler: this.updateData, submitOnChange: true, closeOnSubmit: false } form: { handler: this.updateData, submitOnChange: true, closeOnSubmit: false }
}; };
@ -29,7 +29,7 @@ export default class LevelupOptionsDialog extends HandlebarsApplicationMixin(App
static PARTS = { static PARTS = {
header: { template: 'systems/daggerheart/templates/dialogs/levelupOptionsDialog/header.hbs' }, header: { template: 'systems/daggerheart/templates/dialogs/levelupOptionsDialog/header.hbs' },
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' }, tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
tiers: { template: 'systems/daggerheart/templates/dialogs/levelupOptionsDialog/tiers.hbs' }, tiers: { template: 'systems/daggerheart/templates/dialogs/levelupOptionsDialog/tiers.hbs' }
}; };
/** @inheritdoc */ /** @inheritdoc */
@ -40,14 +40,14 @@ export default class LevelupOptionsDialog extends HandlebarsApplicationMixin(App
{ id: 'tier3', label: 'DAGGERHEART.GENERAL.Tiers.3', tier: 3 }, { id: 'tier3', label: 'DAGGERHEART.GENERAL.Tiers.3', tier: 3 },
{ id: 'tier4', label: 'DAGGERHEART.GENERAL.Tiers.4', tier: 4 } { id: 'tier4', label: 'DAGGERHEART.GENERAL.Tiers.4', tier: 4 }
], ],
initial: 'tier2', initial: 'tier2'
} }
}; };
_attachPartListeners(partId, htmlElement, options) { _attachPartListeners(partId, htmlElement, options) {
super._attachPartListeners(partId, htmlElement, options); super._attachPartListeners(partId, htmlElement, options);
for(const element of htmlElement.querySelectorAll('.option-type-select')) for (const element of htmlElement.querySelectorAll('.option-type-select'))
element.addEventListener('change', this.updateSelectedOption.bind(this)); element.addEventListener('change', this.updateSelectedOption.bind(this));
} }
@ -68,7 +68,7 @@ export default class LevelupOptionsDialog extends HandlebarsApplicationMixin(App
}, {}); }, {});
return acc; return acc;
}, {}) }, {});
context.optionTypes = LevelOptionType; context.optionTypes = LevelOptionType;
context.selectedOption = this.selectedOption; context.selectedOption = this.selectedOption;
@ -78,7 +78,7 @@ export default class LevelupOptionsDialog extends HandlebarsApplicationMixin(App
static async updateData(_event, _element, formData) { static async updateData(_event, _element, formData) {
const data = foundry.utils.expandObject(formData.object); const data = foundry.utils.expandObject(formData.object);
await this.item.update(data) await this.item.update(data);
this.render(); this.render();
} }
@ -90,10 +90,12 @@ export default class LevelupOptionsDialog extends HandlebarsApplicationMixin(App
static async #addTierOption(_event, button) { static async #addTierOption(_event, button) {
const { tier } = button.dataset; const { tier } = button.dataset;
await this.item.update({ [`system.levelupOptionTiers.${tier}.${foundry.utils.randomID()}`]: { await this.item.update({
label: LevelOptionType[this.selectedOption].label, [`system.levelupOptionTiers.${tier}.${foundry.utils.randomID()}`]: {
type: this.selectedOption label: LevelOptionType[this.selectedOption].label,
}}); type: this.selectedOption
}
});
this.selectedOption = null; this.selectedOption = null;
this.render(); this.render();

View file

@ -364,7 +364,7 @@ export default class DhCharacterLevelUp extends LevelUpBase {
advancement.experience?.flatMap(x => x.data.map(data => ({ name: data, modifier: x.value }))) ?? advancement.experience?.flatMap(x => x.data.map(data => ({ name: data, modifier: x.value }))) ??
[], [],
multiclass: advancement.multiclass, multiclass: advancement.multiclass,
subclass: advancement.subclass, subclass: advancement.subclass
}; };
context.advancements.statistics.proficiency.shown = context.advancements.statistics.proficiency.shown =

View file

@ -100,7 +100,7 @@ export default function DHApplicationMixin(Base) {
addNewItem: DHSheetV2.#addNewItem, addNewItem: DHSheetV2.#addNewItem,
browseItem: DHSheetV2.#browseItem, browseItem: DHSheetV2.#browseItem,
editAttribution: DHSheetV2.#editAttribution, editAttribution: DHSheetV2.#editAttribution,
configureLevelUpOptions: DHSheetV2.#configureLevelUpOptions, configureLevelUpOptions: DHSheetV2.#configureLevelUpOptions
}, },
contextMenus: [ contextMenus: [
{ {
@ -126,9 +126,9 @@ export default function DHApplicationMixin(Base) {
icon: 'fa-solid fa-angles-up fa-fw', icon: 'fa-solid fa-angles-up fa-fw',
label: 'DAGGERHEART.UI.Tooltip.configureLevelupOptions', label: 'DAGGERHEART.UI.Tooltip.configureLevelupOptions',
action: 'configureLevelUpOptions', action: 'configureLevelUpOptions',
visible: DHSheetV2.#hasLevelUpOptions, visible: DHSheetV2.#hasLevelUpOptions
} }
], ]
}, },
dragDrop: [{ dragSelector: '.inventory-item[data-type="effect"]', dropSelector: null }], dragDrop: [{ dragSelector: '.inventory-item[data-type="effect"]', dropSelector: null }],
tagifyConfigs: [] tagifyConfigs: []
@ -155,7 +155,7 @@ export default function DHApplicationMixin(Base) {
static #hasLevelUpOptions() { static #hasLevelUpOptions() {
return this.document.system.metadata.hasLevelUpOptions; return this.document.system.metadata.hasLevelUpOptions;
}; }
/** /**
* Refresh the custom parts of the application frame * Refresh the custom parts of the application frame

View file

@ -309,9 +309,9 @@ export default class DhCharacter extends DhCreature {
integer: true, integer: true,
min: 0, min: 0,
max: 5, max: 5,
initial: 0, initial: 0
}) })
}), })
}) })
}; };
} }

View file

@ -80,7 +80,7 @@ export default class DhCompanion extends DhCreature {
initial: 1, initial: 1,
label: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.label', label: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.label',
hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.hint' hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.hint'
}), })
}) })
}), }),
attack: new ActionField({ attack: new ActionField({

View file

@ -12,7 +12,7 @@ export default class DHClass extends BaseDataItem {
label: 'TYPES.Item.class', label: 'TYPES.Item.class',
type: 'class', type: 'class',
hasDescription: true, hasDescription: true,
hasLevelUpOptions: true, hasLevelUpOptions: true
}); });
} }
@ -54,9 +54,12 @@ export default class DHClass extends BaseDataItem {
backgroundQuestions: new fields.ArrayField(new fields.StringField(), { initial: ['', '', ''] }), backgroundQuestions: new fields.ArrayField(new fields.StringField(), { initial: ['', '', ''] }),
connections: new fields.ArrayField(new fields.StringField(), { initial: ['', '', ''] }), connections: new fields.ArrayField(new fields.StringField(), { initial: ['', '', ''] }),
isMulticlass: new fields.BooleanField({ initial: false }), isMulticlass: new fields.BooleanField({ initial: false }),
levelupOptionTiers: new fields.TypedObjectField(new fields.TypedObjectField(new fields.EmbeddedDataField(DhLevelOption)), { levelupOptionTiers: new fields.TypedObjectField(
initial: { 2: {}, 3: {}, 4: {} } new fields.TypedObjectField(new fields.EmbeddedDataField(DhLevelOption)),
}), {
initial: { 2: {}, 3: {}, 4: {} }
}
)
}; };
} }

View file

@ -71,7 +71,7 @@ export class DhLevelOption extends foundry.abstract.DataModel {
}), }),
subType: new fields.StringField({ subType: new fields.StringField({
nullable: true, nullable: true,
label: 'DAGGERHEART.GENERAL.subType', label: 'DAGGERHEART.GENERAL.subType'
}), }),
value: new fields.NumberField({ value: new fields.NumberField({
integer: true, integer: true,
@ -196,8 +196,8 @@ export const LevelOptionType = {
hopeIndex: { key: 'hopeIndex', label: 'DAGGERHEART.GENERAL.hope' }, hopeIndex: { key: 'hopeIndex', label: 'DAGGERHEART.GENERAL.hope' },
fearIndex: { key: 'fearIndex', label: 'DAGGERHEART.GENERAL.fear' }, fearIndex: { key: 'fearIndex', label: 'DAGGERHEART.GENERAL.fear' },
advantageIndex: { key: 'advantageIndex', label: 'DAGGERHEART.GENERAL.Advantage.full' }, advantageIndex: { key: 'advantageIndex', label: 'DAGGERHEART.GENERAL.Advantage.full' },
comboDieIndex:{ key: 'comboDieIndex', label: 'Combo Die' } // Translation pending actual useage comboDieIndex: { key: 'comboDieIndex', label: 'Combo Die' } // Translation pending actual useage
}, }
}, },
...CompanionLevelOptionType ...CompanionLevelOptionType
}; };

View file

@ -345,7 +345,7 @@ export class DhLevelupLevel extends foundry.abstract.DataModel {
data: new fields.ArrayField(new fields.StringField()), data: new fields.ArrayField(new fields.StringField()),
secondaryData: new fields.TypedObjectField(new fields.StringField()), secondaryData: new fields.TypedObjectField(new fields.StringField()),
type: new fields.StringField({ required: true }), type: new fields.StringField({ required: true }),
subType: new fields.StringField({ nullable: true }), subType: new fields.StringField({ nullable: true })
}) })
) )
) )

View file

@ -11,7 +11,7 @@ export default class DualityRoll extends D20Roll {
this.rallyChoices = this.setRallyChoices(); this.rallyChoices = this.setRallyChoices();
this.guaranteedCritical = options.guaranteedCritical; this.guaranteedCritical = options.guaranteedCritical;
const advantageFaces = data.rules?.roll?.advantageFaces ? Number.parseInt(data.rules.roll.advantageFaces) : 6 const advantageFaces = data.rules?.roll?.advantageFaces ? Number.parseInt(data.rules.roll.advantageFaces) : 6;
this.advantageFaces = Number.isNaN(advantageFaces) ? 6 : advantageFaces; this.advantageFaces = Number.isNaN(advantageFaces) ? 6 : advantageFaces;
} }