Merge branch 'main' into iss4-attach-items

This commit is contained in:
psitacus 2025-07-12 03:31:26 -06:00
commit f61cc23daa
93 changed files with 3803 additions and 2390 deletions

View file

@ -10,6 +10,7 @@ export default class AdversarySheet extends DHBaseActorSheet {
actions: {
reactionRoll: AdversarySheet.#reactionRoll,
useItem: this.useItem,
useAction: this.useItem,
toChat: this.toChat
},
window: {

View file

@ -24,6 +24,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
levelManagement: CharacterSheet.#levelManagement,
toggleEquipItem: CharacterSheet.#toggleEquipItem,
useItem: this.useItem, //TODO Fix this
useAction: this.useAction,
toChat: this.toChat
},
window: {
@ -625,6 +626,20 @@ export default class CharacterSheet extends DHBaseActorSheet {
}
}
/**
* Use an action
* @type {ApplicationClickAction}
*/
static async useAction(event, button) {
const item = this.getItem(button);
if (!item) return;
const action = item.system.actions.find(x => x.id === button.dataset.actionId);
if (!action) return;
action.use(event);
}
/**
* Send item to Chat
* @type {ApplicationClickAction}

View file

@ -11,6 +11,7 @@ export default class DhpEnvironment extends DHBaseActorSheet {
},
actions: {
useItem: this.useItem,
useAction: this.useItem,
toChat: this.toChat
},
dragDrop: [{ dragSelector: '.action-section .inventory-item', dropSelector: null }]

View file

@ -36,7 +36,7 @@ export default class ArmorSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
switch (partId) {
case 'settings':
context.features = this.document.system.features.map(x => x.value);
context.features = this.document.system.armorFeatures.map(x => x.value);
break;
}
@ -48,6 +48,6 @@ export default class ArmorSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
* @param {Array<Object>} selectedOptions - The currently selected tag objects.
*/
static async #onFeatureSelect(selectedOptions) {
await this.document.update({ 'system.features': selectedOptions.map(x => ({ value: x.value })) });
await this.document.update({ 'system.armorFeatures': selectedOptions.map(x => ({ value: x.value })) });
}
}

View file

@ -35,7 +35,7 @@ export default class WeaponSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
await super._preparePartContext(partId, context);
switch (partId) {
case 'settings':
context.features = this.document.system.features.map(x => x.value);
context.features = this.document.system.weaponFeatures.map(x => x.value);
context.systemFields.attack.fields = this.document.system.attack.schema.fields;
break;
}
@ -47,6 +47,6 @@ export default class WeaponSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
* @param {Array<Object>} selectedOptions - The currently selected tag objects.
*/
static async #onFeatureSelect(selectedOptions) {
await this.document.update({ 'system.features': selectedOptions.map(x => ({ value: x.value })) });
await this.document.update({ 'system.weaponFeatures': selectedOptions.map(x => ({ value: x.value })) });
}
}