Enhance actor sheet
This commit is contained in:
@ -8,3 +8,4 @@ export { default as CthulhuEternalArmorSheet } from "./sheets/armor-sheet.mjs"
|
||||
export { default as CthulhuEternalMentalDisorderSheet } from "./sheets/mentaldisorder-sheet.mjs"
|
||||
export { default as CthulhuEternalGearSheet } from "./sheets/gear-sheet.mjs"
|
||||
export { default as CthulhuEternalMotivationSheet } from "./sheets/motivation-sheet.mjs"
|
||||
export { default as CthulhuEternalArchetypeSheet } from "./sheets/archetype-sheet.mjs"
|
||||
|
28
module/applications/sheets/archetype-sheet.mjs
Normal file
28
module/applications/sheets/archetype-sheet.mjs
Normal file
@ -0,0 +1,28 @@
|
||||
import CthulhuEternalItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class CthulhuEternalArchetypeSheet extends CthulhuEternalItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["archetype"],
|
||||
position: {
|
||||
width: 600,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["archetype-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-cthulhu-eternal/templates/archetype.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
|
||||
return context
|
||||
}
|
||||
}
|
@ -32,7 +32,8 @@ export default class CthulhuEternalActorSheet extends HandlebarsApplicationMixin
|
||||
editImage: CthulhuEternalActorSheet.#onEditImage,
|
||||
toggleSheet: CthulhuEternalActorSheet.#onToggleSheet,
|
||||
edit: CthulhuEternalActorSheet.#onItemEdit,
|
||||
delete: CthulhuEternalActorSheet.#onItemDelete
|
||||
delete: CthulhuEternalActorSheet.#onItemDelete,
|
||||
updateCheckboxArray: CthulhuEternalActorSheet.#onUpdateCheckboxArray,
|
||||
},
|
||||
}
|
||||
|
||||
@ -223,6 +224,18 @@ export default class CthulhuEternalActorSheet extends HandlebarsApplicationMixin
|
||||
this.render()
|
||||
}
|
||||
|
||||
static #onUpdateCheckboxArray(event, target) {
|
||||
console.log("Update checkbox array", event, target)
|
||||
let arrayName = target.dataset.name
|
||||
let arrayIdx = Number(target.dataset.index)
|
||||
let dataPath = `system.san.${arrayName}`
|
||||
let tab = foundry.utils.duplicate(this.document.system.san[arrayName])
|
||||
tab[arrayIdx] = target.checked
|
||||
this.actor.update( { [dataPath]: tab } )
|
||||
// Dump
|
||||
console.log("Array name", arrayName, arrayIdx, target.checked, dataPath)
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle changing a Document's image.
|
||||
*
|
||||
|
Reference in New Issue
Block a user