Nouvelles corrections sur la fiche

This commit is contained in:
2026-03-06 11:31:04 +01:00
parent 65dc626380
commit b9db8eb2fc
4 changed files with 42 additions and 8 deletions
+22 -2
View File
@@ -18,7 +18,8 @@ export default class AwECharacterSheet extends AwEActorSheet {
createKit: AwECharacterSheet.#onCreateKit,
createEquipment: AwECharacterSheet.#onCreateEquipment,
flowPointsPlus: AwECharacterSheet.#onFlowPointsPlus,
flowPointsMinus: AwECharacterSheet.#onFlowPointsMinus
flowPointsMinus: AwECharacterSheet.#onFlowPointsMinus,
rollField: AwECharacterSheet.#onRollField
}
}
@@ -83,7 +84,13 @@ export default class AwECharacterSheet extends AwEActorSheet {
break
case "biography":
context.tab = context.tabs.biography
context.fields = doc.itemTypes.field
context.fields = doc.itemTypes.field.map(item => ({
...item,
keyAttrLabel: game.i18n.localize(SYSTEM.ATTRIBUTES[item.system.keyAttribute]?.label ?? item.system.keyAttribute),
keyAttr2Label: item.system.keyAttribute2
? game.i18n.localize(SYSTEM.ATTRIBUTES[item.system.keyAttribute2]?.label ?? item.system.keyAttribute2)
: null
}))
context.archetypes = doc.itemTypes.archetype
context.backgrounds = doc.itemTypes.background
context.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
@@ -187,4 +194,17 @@ export default class AwECharacterSheet extends AwEActorSheet {
const current = this.actor.system.flowPoints.value
this.actor.update({ "system.flowPoints.value": Math.max(0, current - 1) })
}
/**
* Roll the key attribute check from a Field item.
* @param {PointerEvent} event The triggering event.
* @param {HTMLElement} target The target element.
*/
static async #onRollField(event, target) {
const itemId = target.closest("[data-item-id]")?.dataset.itemId
const item = this.document.items.get(itemId)
if (!item) return
const attrId = target.dataset.attributeId ?? item.system.keyAttribute
await this.document.rollAttribute(attrId)
}
}