[Fix] Itemlink Redux Revengeance (#399)

* Small random fixes

* Added use of ItemLinkFields

* Multiclass levelup fixes

* Fixed our onCreate methods unintentionally being run on all clients

* Remade apps handling

* Added for all class items and subclass

* Restored foreignDocumentUuidField

* Improved

* PR fxies

* Fixed tooltip enrichment

* .

* Reverted silly change
This commit is contained in:
WBHarry 2025-07-26 00:37:30 +02:00 committed by GitHub
parent fcba5041e9
commit 2a4777f1a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
61 changed files with 648 additions and 489 deletions

View file

@ -1,7 +1,7 @@
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
export default class ActionSelectionDialog extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(item, event, options={}) {
constructor(item, event, options = {}) {
super(options);
this.#item = item;
this.#event = event;
@ -24,7 +24,7 @@ export default class ActionSelectionDialog extends HandlebarsApplicationMixin(Ap
static PARTS = {
actions: {
template: "systems/daggerheart/templates/dialogs/actionSelect.hbs"
template: 'systems/daggerheart/templates/dialogs/actionSelect.hbs'
}
};
@ -60,10 +60,10 @@ export default class ActionSelectionDialog extends HandlebarsApplicationMixin(Ap
const actions = this.#item.system.actionsList,
itemName = this.#item.name;
return {
...await super._prepareContext(options),
...(await super._prepareContext(options)),
actions,
itemName
}
};
}
static async #onChooseAction(event, button) {
@ -80,8 +80,8 @@ export default class ActionSelectionDialog extends HandlebarsApplicationMixin(Ap
static create(item, event, options) {
return new Promise(resolve => {
const dialog = new this(item, event, options);
dialog.addEventListener("close", () => resolve(dialog.action), { once: true });
dialog.addEventListener('close', () => resolve(dialog.action), { once: true });
dialog.render({ force: true });
});
}
}
}

View file

@ -68,7 +68,10 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
}));
if (this.config.costs?.length) {
const updatedCosts = game.system.api.fields.ActionFields.CostField.calcCosts.call(this.action, this.config.costs);
const updatedCosts = game.system.api.fields.ActionFields.CostField.calcCosts.call(
this.action,
this.config.costs
);
context.costs = updatedCosts.map(x => ({
...x,
label: x.keyIsID
@ -80,7 +83,9 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
}
if (this.config.uses?.max) {
context.uses = game.system.api.fields.ActionFields.UsesField.calcUses.call(this.action, this.config.uses);
context.canRoll = context.canRoll && game.system.api.fields.ActionFields.UsesField.hasUses.call(this.action, context.uses);
context.canRoll =
context.canRoll &&
game.system.api.fields.ActionFields.UsesField.hasUses.call(this.action, context.uses);
}
if (this.roll) {
context.roll = this.roll;